ninja.js 622 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040
  1. (function(a, f) {
  2. function h(b) {
  3. return m.isWindow(b) ? b: 9 === b.nodeType ? b.defaultView || b.parentWindow: !1
  4. }
  5. function n(b) {
  6. if (!ea[b]) {
  7. var a = w.body,
  8. d = m("<" + b + ">").appendTo(a),
  9. c = d.css("display");
  10. d.remove();
  11. if ("none" === c || "" === c) N || (N = w.createElement("iframe"), N.frameBorder = N.width = N.height = 0),
  12. a.appendChild(N),
  13. Q && N.createElement || (Q = (N.contentWindow || N.contentDocument).document, Q.write(("CSS1Compat" === w.compatMode ? "<!doctype html>": "") + "<html><body>"), Q.close()),
  14. d = Q.createElement(b),
  15. Q.body.appendChild(d),
  16. c = m.css(d, "display"),
  17. a.removeChild(N);
  18. ea[b] = c
  19. }
  20. return ea[b]
  21. }
  22. function p(b, a) {
  23. var d = {};
  24. m.each(pa.concat.apply([], pa.slice(0, a)),
  25. function() {
  26. d[this] = b
  27. });
  28. return d
  29. }
  30. function b() {
  31. Y = f
  32. }
  33. function d() {
  34. setTimeout(b, 0);
  35. return Y = m.now()
  36. }
  37. function c() {
  38. try {
  39. return new a.XMLHttpRequest
  40. } catch(b) {}
  41. }
  42. function e(b, a, d, c) {
  43. if (m.isArray(a)) m.each(a,
  44. function(a, H) {
  45. d || Ta.test(b) ? c(b, H) : e(b + "[" + ("object" == typeof H || m.isArray(H) ? a: "") + "]", H, d, c)
  46. });
  47. else if (d || null == a || "object" != typeof a) c(b, a);
  48. else for (var g in a) e(b + "[" + g + "]", a[g], d, c)
  49. }
  50. function g(b, a) {
  51. var d, c, e = m.ajaxSettings.flatOptions || {};
  52. for (d in a) a[d] !== f && ((e[d] ? b: c || (c = {}))[d] = a[d]);
  53. c && m.extend(!0, b, c)
  54. }
  55. function r(b, a, d, c, e, g) {
  56. e = e || a.dataTypes[0];
  57. g = g || {};
  58. g[e] = !0;
  59. e = b[e];
  60. for (var l = 0,
  61. m = e ? e.length: 0, k = b === ga, q; l < m && (k || !q); l++) q = e[l](a, d, c),
  62. "string" == typeof q && (!k || g[q] ? q = f: (a.dataTypes.unshift(q), q = r(b, a, d, c, q, g))); ! k && q || g["*"] || (q = r(b, a, d, c, "*", g));
  63. return q
  64. }
  65. function k(b) {
  66. return function(a, d) {
  67. "string" != typeof a && (d = a, a = "*");
  68. if (m.isFunction(d)) for (var c = a.toLowerCase().split(qa), e = 0, g = c.length, f, l; e < g; e++) f = c[e],
  69. (l = /^\+/.test(f)) && (f = f.substr(1) || "*"),
  70. f = b[f] = b[f] || [],
  71. f[l ? "unshift": "push"](d)
  72. }
  73. }
  74. function l(b, a, d) {
  75. var c = "width" === a ? b.offsetWidth: b.offsetHeight,
  76. e = "width" === a ? Ua: Va,
  77. g = 0,
  78. f = e.length;
  79. if (0 < c) {
  80. if ("border" !== d) for (; g < f; g++) d || (c -= parseFloat(m.css(b, "padding" + e[g])) || 0),
  81. "margin" === d ? c += parseFloat(m.css(b, d + e[g])) || 0 : c -= parseFloat(m.css(b, "border" + e[g] + "Width")) || 0;
  82. return c + "px"
  83. }
  84. c = S(b, a, a);
  85. if (0 > c || null == c) c = b.style[a] || 0;
  86. c = parseFloat(c) || 0;
  87. if (d) for (; g < f; g++) c += parseFloat(m.css(b, "padding" + e[g])) || 0,
  88. "padding" !== d && (c += parseFloat(m.css(b, "border" + e[g] + "Width")) || 0),
  89. "margin" === d && (c += parseFloat(m.css(b, d + e[g])) || 0);
  90. return c + "px"
  91. }
  92. function t(b, a) {
  93. a.src ? m.ajax({
  94. url: a.src,
  95. async: !1,
  96. dataType: "script"
  97. }) : m.globalEval((a.text || a.textContent || a.innerHTML || "").replace(Wa, "/*$0*/"));
  98. a.parentNode && a.parentNode.removeChild(a)
  99. }
  100. function v(b) {
  101. var a = (b.nodeName || "").toLowerCase();
  102. "input" === a ? q(b) : "script" !== a && "undefined" != typeof b.getElementsByTagName && m.grep(b.getElementsByTagName("input"), q)
  103. }
  104. function q(b) {
  105. if ("checkbox" === b.type || "radio" === b.type) b.defaultChecked = b.checked
  106. }
  107. function y(b) {
  108. return "undefined" != typeof b.getElementsByTagName ? b.getElementsByTagName("*") : "undefined" != typeof b.querySelectorAll ? b.querySelectorAll("*") : []
  109. }
  110. function s(b, a) {
  111. var d;
  112. if (1 === a.nodeType) {
  113. a.clearAttributes && a.clearAttributes();
  114. a.mergeAttributes && a.mergeAttributes(b);
  115. d = a.nodeName.toLowerCase();
  116. if ("object" === d) a.outerHTML = b.outerHTML;
  117. else if ("input" !== d || "checkbox" !== b.type && "radio" !== b.type) if ("option" === d) a.selected = b.defaultSelected;
  118. else {
  119. if ("input" === d || "textarea" === d) a.defaultValue = b.defaultValue
  120. } else b.checked && (a.defaultChecked = a.checked = b.checked),
  121. a.value !== b.value && (a.value = b.value);
  122. a.removeAttribute(m.expando)
  123. }
  124. }
  125. function u(b, a) {
  126. if (1 === a.nodeType && m.hasData(b)) {
  127. var d, c, e;
  128. c = m._data(b);
  129. var g = m._data(a, c),
  130. f = c.events;
  131. if (f) for (d in delete g.handle, g.events = {},
  132. f) for (c = 0, e = f[d].length; c < e; c++) m.event.add(a, d + (f[d][c].namespace ? ".": "") + f[d][c].namespace, f[d][c], f[d][c].data);
  133. g.data && (g.data = m.extend({},
  134. g.data))
  135. }
  136. }
  137. function z(b, a) {
  138. return m.nodeName(b, "table") ? b.getElementsByTagName("tbody")[0] || b.appendChild(b.ownerDocument.createElement("tbody")) : b
  139. }
  140. function A(b) {
  141. var a = ra.split("|");
  142. b = b.createDocumentFragment();
  143. if (b.createElement) for (; a.length;) b.createElement(a.pop());
  144. return b
  145. }
  146. function x(b, a, d) {
  147. a = a || 0;
  148. if (m.isFunction(a)) return m.grep(b,
  149. function(b, c) {
  150. return !! a.call(b, c, b) === d
  151. });
  152. if (a.nodeType) return m.grep(b,
  153. function(b, c) {
  154. return b === a === d
  155. });
  156. if ("string" == typeof a) {
  157. var c = m.grep(b,
  158. function(b) {
  159. return 1 === b.nodeType
  160. });
  161. if (Xa.test(a)) return m.filter(a, c, !d);
  162. a = m.filter(a, c)
  163. }
  164. return m.grep(b,
  165. function(b, c) {
  166. return 0 <= m.inArray(b, a) === d
  167. })
  168. }
  169. function D(b) {
  170. return ! b || !b.parentNode || 11 === b.parentNode.nodeType
  171. }
  172. function B() {
  173. return ! 0
  174. }
  175. function F() {
  176. return ! 1
  177. }
  178. function L(b, a, d) {
  179. var c = a + "defer",
  180. e = a + "queue",
  181. g = a + "mark",
  182. f = m._data(b, c); ! f || "queue" !== d && m._data(b, e) || "mark" !== d && m._data(b, g) || setTimeout(function() {
  183. m._data(b, e) || m._data(b, g) || (m.removeData(b, c, !0), f.fire())
  184. },
  185. 0)
  186. }
  187. function O(b) {
  188. for (var a in b) if (("data" !== a || !m.isEmptyObject(b[a])) && "toJSON" !== a) return ! 1;
  189. return ! 0
  190. }
  191. function C(b, a, d) {
  192. if (d === f && 1 === b.nodeType) if (d = "data-" + a.replace(Ya, "-$1").toLowerCase(), d = b.getAttribute(d), "string" == typeof d) {
  193. try {
  194. d = "true" === d ? !0 : "false" === d ? !1 : "null" === d ? null: m.isNumeric(d) ? parseFloat(d) : Za.test(d) ? m.parseJSON(d) : d
  195. } catch(c) {}
  196. m.data(b, a, d)
  197. } else d = f;
  198. return d
  199. }
  200. function G(b) {
  201. var a = sa[b] = {},
  202. d,
  203. c;
  204. b = b.split(/\s+/);
  205. d = 0;
  206. for (c = b.length; d < c; d++) a[b[d]] = !0;
  207. return a
  208. }
  209. var w = a.document,
  210. J = a.navigator,
  211. V = a.location,
  212. m = function() {
  213. function b() {
  214. if (!d.isReady) {
  215. try {
  216. w.documentElement.doScroll("left")
  217. } catch(a) {
  218. setTimeout(b, 1);
  219. return
  220. }
  221. d.ready()
  222. }
  223. }
  224. var d = function(b, a) {
  225. return new d.fn.init(b, a, g)
  226. },
  227. c = a.jQuery,
  228. e = a.$,
  229. g,
  230. l = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
  231. r = /\S/,
  232. m = /^\s+/,
  233. k = /\s+$/,
  234. q = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
  235. h = /^[\],:{}\s]*$/,
  236. t = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
  237. v = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
  238. n = /(?:^|:|,)(?:\s*\[)+/g,
  239. y = /(webkit)[ \/]([\w.]+)/,
  240. s = /(opera)(?:.*version)?[ \/]([\w.]+)/,
  241. p = /(msie) ([\w.]+)/,
  242. u = /(mozilla)(?:.*? rv:([\w.]+))?/,
  243. z = /-([a-z]|[0-9])/ig,
  244. A = /^-ms-/,
  245. x = function(b, a) {
  246. return (a + "").toUpperCase()
  247. },
  248. D = J.userAgent,
  249. aa,
  250. T,
  251. $a = Object.prototype.toString,
  252. ha = Object.prototype.hasOwnProperty,
  253. ia = Array.prototype.push,
  254. X = Array.prototype.slice,
  255. ta = String.prototype.trim,
  256. ua = Array.prototype.indexOf,
  257. B = {};
  258. d.fn = d.prototype = {
  259. constructor: d,
  260. init: function(b, a, c) {
  261. var e, E;
  262. if (!b) return this;
  263. if (b.nodeType) return this.context = this[0] = b,
  264. this.length = 1,
  265. this;
  266. if ("body" === b && !a && w.body) return this.context = w,
  267. this[0] = w.body,
  268. this.selector = b,
  269. this.length = 1,
  270. this;
  271. if ("string" == typeof b) {
  272. "<" !== b.charAt(0) || ">" !== b.charAt(b.length - 1) || 3 > b.length ? e = l.exec(b) : e = [null, b, null];
  273. if (e && (e[1] || !a)) {
  274. if (e[1]) return E = (a = a instanceof d ? a[0] : a) ? a.ownerDocument || a: w,
  275. (c = q.exec(b)) ? d.isPlainObject(a) ? (b = [w.createElement(c[1])], d.fn.attr.call(b, a, !0)) : b = [E.createElement(c[1])] : (c = d.buildFragment([e[1]], [E]), b = (c.cacheable ? d.clone(c.fragment) : c.fragment).childNodes),
  276. d.merge(this, b);
  277. if ((a = w.getElementById(e[2])) && a.parentNode) {
  278. if (a.id !== e[2]) return c.find(b);
  279. this.length = 1;
  280. this[0] = a
  281. }
  282. this.context = w;
  283. this.selector = b;
  284. return this
  285. }
  286. return ! a || a.jquery ? (a || c).find(b) : this.constructor(a).find(b)
  287. }
  288. if (d.isFunction(b)) return c.ready(b);
  289. b.selector !== f && (this.selector = b.selector, this.context = b.context);
  290. return d.makeArray(b, this)
  291. },
  292. selector: "",
  293. jquery: "1.7.1",
  294. length: 0,
  295. size: function() {
  296. return this.length
  297. },
  298. toArray: function() {
  299. return X.call(this, 0)
  300. },
  301. get: function(b) {
  302. return null == b ? this.toArray() : 0 > b ? this[this.length + b] : this[b]
  303. },
  304. pushStack: function(b, a, c) {
  305. var e = this.constructor();
  306. d.isArray(b) ? ia.apply(e, b) : d.merge(e, b);
  307. e.prevObject = this;
  308. e.context = this.context;
  309. "find" === a ? e.selector = this.selector + (this.selector ? " ": "") + c: a && (e.selector = this.selector + "." + a + "(" + c + ")");
  310. return e
  311. },
  312. each: function(b, a) {
  313. return d.each(this, b, a)
  314. },
  315. ready: function(b) {
  316. d.bindReady();
  317. aa.add(b);
  318. return this
  319. },
  320. eq: function(b) {
  321. b = +b;
  322. return - 1 === b ? this.slice(b) : this.slice(b, b + 1)
  323. },
  324. first: function() {
  325. return this.eq(0)
  326. },
  327. last: function() {
  328. return this.eq( - 1)
  329. },
  330. slice: function() {
  331. return this.pushStack(X.apply(this, arguments), "slice", X.call(arguments).join(","))
  332. },
  333. map: function(b) {
  334. return this.pushStack(d.map(this,
  335. function(a, d) {
  336. return b.call(a, d, a)
  337. }))
  338. },
  339. end: function() {
  340. return this.prevObject || this.constructor(null)
  341. },
  342. push: ia,
  343. sort: [].sort,
  344. splice: [].splice
  345. };
  346. d.fn.init.prototype = d.fn;
  347. d.extend = d.fn.extend = function() {
  348. var b, a, c, e, E, g, l = arguments[0] || {},
  349. r = 1,
  350. m = arguments.length,
  351. k = !1;
  352. "boolean" == typeof l && (k = l, l = arguments[1] || {},
  353. r = 2);
  354. "object" != typeof l && !d.isFunction(l) && (l = {});
  355. for (m === r && (l = this, --r); r < m; r++) if (null != (b = arguments[r])) for (a in b) c = l[a],
  356. e = b[a],
  357. l !== e && (k && e && (d.isPlainObject(e) || (E = d.isArray(e))) ? (E ? (E = !1, g = c && d.isArray(c) ? c: []) : g = c && d.isPlainObject(c) ? c: {},
  358. l[a] = d.extend(k, g, e)) : e !== f && (l[a] = e));
  359. return l
  360. };
  361. d.extend({
  362. noConflict: function(b) {
  363. a.$ === d && (a.$ = e);
  364. b && a.jQuery === d && (a.jQuery = c);
  365. return d
  366. },
  367. isReady: !1,
  368. readyWait: 1,
  369. holdReady: function(b) {
  370. b ? d.readyWait++:d.ready(!0)
  371. },
  372. ready: function(b) {
  373. if (!0 === b && !--d.readyWait || !0 !== b && !d.isReady) {
  374. if (!w.body) return setTimeout(d.ready, 1);
  375. d.isReady = !0; ! 0 !== b && 0 < --d.readyWait || (aa.fireWith(w, [d]), d.fn.trigger && d(w).trigger("ready").off("ready"))
  376. }
  377. },
  378. bindReady: function() {
  379. if (!aa) {
  380. aa = d.Callbacks("once memory");
  381. if ("complete" === w.readyState) return setTimeout(d.ready, 1);
  382. if (w.addEventListener) w.addEventListener("DOMContentLoaded", T, !1),
  383. a.addEventListener("load", d.ready, !1);
  384. else if (w.attachEvent) {
  385. w.attachEvent("onreadystatechange", T);
  386. a.attachEvent("onload", d.ready);
  387. var c = !1;
  388. try {
  389. c = null == a.frameElement
  390. } catch(e) {}
  391. w.documentElement.doScroll && c && b()
  392. }
  393. }
  394. },
  395. isFunction: function(b) {
  396. return "function" === d.type(b)
  397. },
  398. isArray: Array.isArray ||
  399. function(b) {
  400. return "array" === d.type(b)
  401. },
  402. isWindow: function(b) {
  403. return b && "object" == typeof b && "setInterval" in b
  404. },
  405. isNumeric: function(b) {
  406. return ! isNaN(parseFloat(b)) && isFinite(b)
  407. },
  408. type: function(b) {
  409. return null == b ? String(b) : B[$a.call(b)] || "object"
  410. },
  411. isPlainObject: function(b) {
  412. if (!b || "object" !== d.type(b) || b.nodeType || d.isWindow(b)) return ! 1;
  413. try {
  414. if (b.constructor && !ha.call(b, "constructor") && !ha.call(b.constructor.prototype, "isPrototypeOf")) return ! 1
  415. } catch(a) {
  416. return ! 1
  417. }
  418. for (var c in b);
  419. return c === f || ha.call(b, c)
  420. },
  421. isEmptyObject: function(b) {
  422. for (var a in b) return ! 1;
  423. return ! 0
  424. },
  425. error: function(b) {
  426. throw Error(b);
  427. },
  428. parseJSON: function(b) {
  429. if ("string" != typeof b || !b) return null;
  430. b = d.trim(b);
  431. if (a.JSON && a.JSON.parse) return a.JSON.parse(b);
  432. if (h.test(b.replace(t, "@").replace(v, "]").replace(n, ""))) return (new Function("return " + b))();
  433. d.error("Invalid JSON: " + b)
  434. },
  435. parseXML: function(b) {
  436. var c, e;
  437. try {
  438. a.DOMParser ? (e = new DOMParser, c = e.parseFromString(b, "text/xml")) : (c = new ActiveXObject("Microsoft.XMLDOM"), c.async = "false", c.loadXML(b))
  439. } catch(E) {
  440. c = f
  441. }
  442. c && c.documentElement && !c.getElementsByTagName("parsererror").length || d.error("Invalid XML: " + b);
  443. return c
  444. },
  445. noop: function() {},
  446. globalEval: function(b) {
  447. b && r.test(b) && (a.execScript ||
  448. function(b) {
  449. a.eval.call(a, b)
  450. })(b)
  451. },
  452. camelCase: function(b) {
  453. return b.replace(A, "ms-").replace(z, x)
  454. },
  455. nodeName: function(b, a) {
  456. return b.nodeName && b.nodeName.toUpperCase() === a.toUpperCase()
  457. },
  458. each: function(b, a, c) {
  459. var e, E = 0,
  460. g = b.length,
  461. l = g === f || d.isFunction(b);
  462. if (c) if (l) for (e in b) {
  463. if (!1 === a.apply(b[e], c)) break
  464. } else for (; E < g && !1 !== a.apply(b[E++], c););
  465. else if (l) for (e in b) {
  466. if (!1 === a.call(b[e], e, b[e])) break
  467. } else for (; E < g && !1 !== a.call(b[E], E, b[E++]););
  468. return b
  469. },
  470. trim: ta ?
  471. function(b) {
  472. return null == b ? "": ta.call(b)
  473. }: function(b) {
  474. return null == b ? "": (b + "").replace(m, "").replace(k, "")
  475. },
  476. makeArray: function(b, a) {
  477. var c = a || [];
  478. if (null != b) {
  479. var e = d.type(b);
  480. null == b.length || "string" === e || "function" === e || "regexp" === e || d.isWindow(b) ? ia.call(c, b) : d.merge(c, b)
  481. }
  482. return c
  483. },
  484. inArray: function(b, a, d) {
  485. var c;
  486. if (a) {
  487. if (ua) return ua.call(a, b, d);
  488. c = a.length;
  489. for (d = d ? 0 > d ? Math.max(0, c + d) : d: 0; d < c; d++) if (d in a && a[d] === b) return d
  490. }
  491. return - 1
  492. },
  493. merge: function(b, a) {
  494. var d = b.length,
  495. c = 0;
  496. if ("number" == typeof a.length) for (var e = a.length; c < e; c++) b[d++] = a[c];
  497. else for (; a[c] !== f;) b[d++] = a[c++];
  498. b.length = d;
  499. return b
  500. },
  501. grep: function(b, a, d) {
  502. var c = [],
  503. e;
  504. d = !!d;
  505. for (var E = 0,
  506. g = b.length; E < g; E++) e = !!a(b[E], E),
  507. d !== e && c.push(b[E]);
  508. return c
  509. },
  510. map: function(b, a, c) {
  511. var e, E, g = [],
  512. l = 0,
  513. r = b.length;
  514. if (b instanceof d || r !== f && "number" == typeof r && (0 < r && b[0] && b[r - 1] || 0 === r || d.isArray(b))) for (; l < r; l++) e = a(b[l], l, c),
  515. null != e && (g[g.length] = e);
  516. else for (E in b) e = a(b[E], E, c),
  517. null != e && (g[g.length] = e);
  518. return g.concat.apply([], g)
  519. },
  520. guid: 1,
  521. proxy: function(b, a) {
  522. if ("string" == typeof a) {
  523. var c = b[a];
  524. a = b;
  525. b = c
  526. }
  527. if (!d.isFunction(b)) return f;
  528. var e = X.call(arguments, 2),
  529. c = function() {
  530. return b.apply(a, e.concat(X.call(arguments)))
  531. };
  532. c.guid = b.guid = b.guid || c.guid || d.guid++;
  533. return c
  534. },
  535. access: function(b, a, c, e, E, g) {
  536. var l = b.length;
  537. if ("object" == typeof a) {
  538. for (var r in a) d.access(b, r, a[r], e, E, c);
  539. return b
  540. }
  541. if (c !== f) {
  542. e = !g && e && d.isFunction(c);
  543. for (r = 0; r < l; r++) E(b[r], a, e ? c.call(b[r], r, E(b[r], a)) : c, g);
  544. return b
  545. }
  546. return l ? E(b[0], a) : f
  547. },
  548. now: function() {
  549. return (new Date).getTime()
  550. },
  551. uaMatch: function(b) {
  552. b = b.toLowerCase();
  553. b = y.exec(b) || s.exec(b) || p.exec(b) || 0 > b.indexOf("compatible") && u.exec(b) || [];
  554. return {
  555. browser: b[1] || "",
  556. version: b[2] || "0"
  557. }
  558. },
  559. sub: function() {
  560. function b(a, d) {
  561. return new b.fn.init(a, d)
  562. }
  563. d.extend(!0, b, this);
  564. b.superclass = this;
  565. b.fn = b.prototype = this();
  566. b.fn.constructor = b;
  567. b.sub = this.sub;
  568. b.fn.init = function(c, e) {
  569. e && e instanceof d && !(e instanceof b) && (e = b(e));
  570. return d.fn.init.call(this, c, e, a)
  571. };
  572. b.fn.init.prototype = b.fn;
  573. var a = b(w);
  574. return b
  575. },
  576. browser: {}
  577. });
  578. d.each("Boolean Number String Function Array Date RegExp Object".split(" "),
  579. function(b, a) {
  580. B["[object " + a + "]"] = a.toLowerCase()
  581. });
  582. D = d.uaMatch(D);
  583. D.browser && (d.browser[D.browser] = !0, d.browser.version = D.version);
  584. d.browser.webkit && (d.browser.safari = !0);
  585. r.test("\u00a0") && (m = /^[\s\xA0]+/, k = /[\s\xA0]+$/);
  586. g = d(w);
  587. w.addEventListener ? T = function() {
  588. w.removeEventListener("DOMContentLoaded", T, !1);
  589. d.ready()
  590. }: w.attachEvent && (T = function() {
  591. "complete" === w.readyState && (w.detachEvent("onreadystatechange", T), d.ready())
  592. });
  593. return d
  594. } (),
  595. sa = {};
  596. m.Callbacks = function(b) {
  597. b = b ? sa[b] || G(b) : {};
  598. var a = [],
  599. d = [],
  600. c,
  601. e,
  602. g,
  603. l,
  604. r,
  605. k = function(d) {
  606. var c, e, g, f;
  607. c = 0;
  608. for (e = d.length; c < e; c++) g = d[c],
  609. f = m.type(g),
  610. "array" === f ? k(g) : "function" !== f || b.unique && h.has(g) || a.push(g)
  611. },
  612. q = function(f, m) {
  613. m = m || [];
  614. c = !b.memory || [f, m];
  615. e = !0;
  616. r = g || 0;
  617. g = 0;
  618. for (l = a.length; a && r < l; r++) if (!1 === a[r].apply(f, m) && b.stopOnFalse) {
  619. c = !0;
  620. break
  621. }
  622. e = !1;
  623. a && (b.once ? !0 === c ? h.disable() : a = [] : d && d.length && (c = d.shift(), h.fireWith(c[0], c[1])))
  624. },
  625. h = {
  626. add: function() {
  627. if (a) {
  628. var b = a.length;
  629. k(arguments);
  630. e ? l = a.length: c && !0 !== c && (g = b, q(c[0], c[1]))
  631. }
  632. return this
  633. },
  634. remove: function() {
  635. if (a) for (var d = arguments,
  636. c = 0,
  637. g = d.length; c < g; c++) for (var f = 0; f < a.length && (d[c] !== a[f] || (e && f <= l && (l--, f <= r && r--), a.splice(f--, 1), !b.unique)); f++);
  638. return this
  639. },
  640. has: function(b) {
  641. if (a) for (var d = 0,
  642. c = a.length; d < c; d++) if (b === a[d]) return ! 0;
  643. return ! 1
  644. },
  645. empty: function() {
  646. a = [];
  647. return this
  648. },
  649. disable: function() {
  650. a = d = c = f;
  651. return this
  652. },
  653. disabled: function() {
  654. return ! a
  655. },
  656. lock: function() {
  657. d = f;
  658. c && !0 !== c || h.disable();
  659. return this
  660. },
  661. locked: function() {
  662. return ! d
  663. },
  664. fireWith: function(a, g) {
  665. d && (e ? b.once || d.push([a, g]) : (!b.once || !c) && q(a, g));
  666. return this
  667. },
  668. fire: function() {
  669. h.fireWith(this, arguments);
  670. return this
  671. },
  672. fired: function() {
  673. return !! c
  674. }
  675. };
  676. return h
  677. };
  678. var ja = [].slice;
  679. m.extend({
  680. Deferred: function(b) {
  681. var a = m.Callbacks("once memory"),
  682. d = m.Callbacks("once memory"),
  683. c = m.Callbacks("memory"),
  684. e = "pending",
  685. g = {
  686. resolve: a,
  687. reject: d,
  688. notify: c
  689. },
  690. f = {
  691. done: a.add,
  692. fail: d.add,
  693. progress: c.add,
  694. state: function() {
  695. return e
  696. },
  697. isResolved: a.fired,
  698. isRejected: d.fired,
  699. then: function(b, a, d) {
  700. l.done(b).fail(a).progress(d);
  701. return this
  702. },
  703. always: function() {
  704. l.done.apply(l, arguments).fail.apply(l, arguments);
  705. return this
  706. },
  707. pipe: function(b, a, d) {
  708. return m.Deferred(function(c) {
  709. m.each({
  710. done: [b, "resolve"],
  711. fail: [a, "reject"],
  712. progress: [d, "notify"]
  713. },
  714. function(b, a) {
  715. var d = a[0],
  716. e = a[1],
  717. E;
  718. m.isFunction(d) ? l[b](function() { (E = d.apply(this, arguments)) && m.isFunction(E.promise) ? E.promise().then(c.resolve, c.reject, c.notify) : c[e + "With"](this === l ? c: this, [E])
  719. }) : l[b](c[e])
  720. })
  721. }).promise()
  722. },
  723. promise: function(b) {
  724. if (null == b) b = f;
  725. else for (var a in f) b[a] = f[a];
  726. return b
  727. }
  728. },
  729. l = f.promise({}),
  730. r;
  731. for (r in g) l[r] = g[r].fire,
  732. l[r + "With"] = g[r].fireWith;
  733. l.done(function() {
  734. e = "resolved"
  735. },
  736. d.disable, c.lock).fail(function() {
  737. e = "rejected"
  738. },
  739. a.disable, c.lock);
  740. b && b.call(l, l);
  741. return l
  742. },
  743. when: function(b) {
  744. function a(b) {
  745. return function(a) {
  746. f[b] = 1 < arguments.length ? ja.call(arguments, 0) : a;
  747. r.notifyWith(k, f)
  748. }
  749. }
  750. function d(b) {
  751. return function(a) {
  752. c[b] = 1 < arguments.length ? ja.call(arguments, 0) : a; --l || r.resolveWith(r, c)
  753. }
  754. }
  755. var c = ja.call(arguments, 0),
  756. e = 0,
  757. g = c.length,
  758. f = Array(g),
  759. l = g,
  760. r = 1 >= g && b && m.isFunction(b.promise) ? b: m.Deferred(),
  761. k = r.promise();
  762. if (1 < g) {
  763. for (; e < g; e++) c[e] && c[e].promise && m.isFunction(c[e].promise) ? c[e].promise().then(d(e), r.reject, a(e)) : --l;
  764. l || r.resolveWith(r, c)
  765. } else r !== b && r.resolveWith(r, g ? [b] : []);
  766. return k
  767. }
  768. });
  769. m.support = function() {
  770. var b, d, c, e, g, f, l, r, k, q = w.createElement("div");
  771. q.setAttribute("className", "t");
  772. q.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
  773. d = q.getElementsByTagName("*");
  774. c = q.getElementsByTagName("a")[0];
  775. if (!d || !d.length || !c) return {};
  776. e = w.createElement("select");
  777. g = e.appendChild(w.createElement("option"));
  778. d = q.getElementsByTagName("input")[0];
  779. b = {
  780. leadingWhitespace: 3 === q.firstChild.nodeType,
  781. tbody: !q.getElementsByTagName("tbody").length,
  782. htmlSerialize: !!q.getElementsByTagName("link").length,
  783. style: /top/.test(c.getAttribute("style")),
  784. hrefNormalized: "/a" === c.getAttribute("href"),
  785. opacity: /^0.55/.test(c.style.opacity),
  786. cssFloat: !!c.style.cssFloat,
  787. checkOn: "on" === d.value,
  788. optSelected: g.selected,
  789. getSetAttribute: "t" !== q.className,
  790. enctype: !!w.createElement("form").enctype,
  791. html5Clone: "<:nav></:nav>" !== w.createElement("nav").cloneNode(!0).outerHTML,
  792. submitBubbles: !0,
  793. changeBubbles: !0,
  794. focusinBubbles: !1,
  795. deleteExpando: !0,
  796. noCloneEvent: !0,
  797. inlineBlockNeedsLayout: !1,
  798. shrinkWrapBlocks: !1,
  799. reliableMarginRight: !0
  800. };
  801. d.checked = !0;
  802. b.noCloneChecked = d.cloneNode(!0).checked;
  803. e.disabled = !0;
  804. b.optDisabled = !g.disabled;
  805. try {
  806. delete q.test
  807. } catch(h) {
  808. b.deleteExpando = !1
  809. } ! q.addEventListener && q.attachEvent && q.fireEvent && (q.attachEvent("onclick",
  810. function() {
  811. b.noCloneEvent = !1
  812. }), q.cloneNode(!0).fireEvent("onclick"));
  813. d = w.createElement("input");
  814. d.value = "t";
  815. d.setAttribute("type", "radio");
  816. b.radioValue = "t" === d.value;
  817. d.setAttribute("checked", "checked");
  818. q.appendChild(d);
  819. c = w.createDocumentFragment();
  820. c.appendChild(q.lastChild);
  821. b.checkClone = c.cloneNode(!0).cloneNode(!0).lastChild.checked;
  822. b.appendChecked = d.checked;
  823. c.removeChild(d);
  824. c.appendChild(q);
  825. q.innerHTML = "";
  826. a.getComputedStyle && (f = w.createElement("div"), f.style.width = "0", f.style.marginRight = "0", q.style.width = "2px", q.appendChild(f), b.reliableMarginRight = 0 === (parseInt((a.getComputedStyle(f, null) || {
  827. marginRight: 0
  828. }).marginRight, 10) || 0));
  829. if (q.attachEvent) for (r in {
  830. submit: 1,
  831. change: 1,
  832. focusin: 1
  833. }) f = "on" + r,
  834. (k = f in q) || (q.setAttribute(f, "return;"), k = "function" == typeof q[f]),
  835. b[r + "Bubbles"] = k;
  836. c.removeChild(q);
  837. c = e = g = f = q = d = null;
  838. m(function() {
  839. var a, d, c, e, g, f = w.getElementsByTagName("body")[0]; ! f || (a = w.createElement("div"), a.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px", f.insertBefore(a, f.firstChild), q = w.createElement("div"), a.appendChild(q), q.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>", l = q.getElementsByTagName("td"), k = 0 === l[0].offsetHeight, l[0].style.display = "", l[1].style.display = "none", b.reliableHiddenOffsets = k && 0 === l[0].offsetHeight, q.innerHTML = "", q.style.width = q.style.paddingLeft = "1px", m.boxModel = b.boxModel = 2 === q.offsetWidth, "undefined" != typeof q.style.zoom && (q.style.display = "inline", q.style.zoom = 1, b.inlineBlockNeedsLayout = 2 === q.offsetWidth, q.style.display = "", q.innerHTML = "<div style='width:4px;'></div>", b.shrinkWrapBlocks = 2 !== q.offsetWidth), q.style.cssText = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;visibility:hidden;border:0;", q.innerHTML = "<div style='position:absolute;top:0;left:0;width:1px;height:1px;margin:0;border:5px solid #000;padding:0;'><div></div></div><table style='position:absolute;top:0;left:0;width:1px;height:1px;margin:0;border:5px solid #000;padding:0;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>", d = q.firstChild, c = d.firstChild, e = d.nextSibling.firstChild.firstChild, g = {
  840. doesNotAddBorder: 5 !== c.offsetTop,
  841. doesAddBorderForTableAndCells: 5 === e.offsetTop
  842. },
  843. c.style.position = "fixed", c.style.top = "20px", g.fixedPosition = 20 === c.offsetTop || 15 === c.offsetTop, c.style.position = c.style.top = "", d.style.overflow = "hidden", d.style.position = "relative", g.subtractsBorderForOverflowNotVisible = -5 === c.offsetTop, g.doesNotIncludeMarginInBodyOffset = 1 !== f.offsetTop, f.removeChild(a), q = null, m.extend(b, g))
  844. });
  845. return b
  846. } ();
  847. var Za = /^(?:\{.*\}|\[.*\])$/,
  848. Ya = /([A-Z])/g;
  849. m.extend({
  850. cache: {},
  851. uuid: 0,
  852. expando: "jQuery" + (m.fn.jquery + Math.random()).replace(/\D/g, ""),
  853. noData: {
  854. embed: !0,
  855. object: "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
  856. applet: !0
  857. },
  858. hasData: function(b) {
  859. b = b.nodeType ? m.cache[b[m.expando]] : b[m.expando];
  860. return !! b && !O(b)
  861. },
  862. data: function(b, a, d, c) {
  863. if (m.acceptData(b)) {
  864. var e, g;
  865. e = m.expando;
  866. var l = "string" == typeof a,
  867. r = b.nodeType,
  868. k = r ? m.cache: b,
  869. q = r ? b[e] : b[e] && e,
  870. h = "events" === a;
  871. if (q && k[q] && (h || c || k[q].data) || !l || d !== f) {
  872. q || (r ? b[e] = q = ++m.uuid: q = e);
  873. k[q] || (k[q] = {},
  874. r || (k[q].toJSON = m.noop));
  875. if ("object" == typeof a || "function" == typeof a) c ? k[q] = m.extend(k[q], a) : k[q].data = m.extend(k[q].data, a);
  876. b = e = k[q];
  877. c || (e.data || (e.data = {}), e = e.data);
  878. d !== f && (e[m.camelCase(a)] = d);
  879. if (h && !e[a]) return b.events;
  880. l ? (g = e[a], null == g && (g = e[m.camelCase(a)])) : g = e;
  881. return g
  882. }
  883. }
  884. },
  885. removeData: function(b, a, d) {
  886. if (m.acceptData(b)) {
  887. var c, e, g, f = m.expando,
  888. l = b.nodeType,
  889. r = l ? m.cache: b,
  890. k = l ? b[f] : f;
  891. if (r[k]) {
  892. if (a && (c = d ? r[k] : r[k].data)) {
  893. m.isArray(a) || (a in c ? a = [a] : (a = m.camelCase(a), a in c ? a = [a] : a = a.split(" ")));
  894. e = 0;
  895. for (g = a.length; e < g; e++) delete c[a[e]];
  896. if (! (d ? O: m.isEmptyObject)(c)) return
  897. }
  898. if (!d && (delete r[k].data, !O(r[k]))) return;
  899. m.support.deleteExpando || !r.setInterval ? delete r[k] : r[k] = null;
  900. l && (m.support.deleteExpando ? delete b[f] : b.removeAttribute ? b.removeAttribute(f) : b[f] = null)
  901. }
  902. }
  903. },
  904. _data: function(b, a, d) {
  905. return m.data(b, a, d, !0)
  906. },
  907. acceptData: function(b) {
  908. if (b.nodeName) {
  909. var a = m.noData[b.nodeName.toLowerCase()];
  910. if (a) return ! 0 !== a && b.getAttribute("classid") === a
  911. }
  912. return ! 0
  913. }
  914. });
  915. m.fn.extend({
  916. data: function(b, a) {
  917. var d, c, e, g = null;
  918. if ("undefined" == typeof b) {
  919. if (this.length && (g = m.data(this[0]), 1 === this[0].nodeType && !m._data(this[0], "parsedAttrs"))) {
  920. c = this[0].attributes;
  921. for (var l = 0,
  922. r = c.length; l < r; l++) e = c[l].name,
  923. 0 === e.indexOf("data-") && (e = m.camelCase(e.substring(5)), C(this[0], e, g[e]));
  924. m._data(this[0], "parsedAttrs", !0)
  925. }
  926. return g
  927. }
  928. if ("object" == typeof b) return this.each(function() {
  929. m.data(this, b)
  930. });
  931. d = b.split(".");
  932. d[1] = d[1] ? "." + d[1] : "";
  933. return a === f ? (g = this.triggerHandler("getData" + d[1] + "!", [d[0]]), g === f && this.length && (g = m.data(this[0], b), g = C(this[0], b, g)), g === f && d[1] ? this.data(d[0]) : g) : this.each(function() {
  934. var c = m(this),
  935. e = [d[0], a];
  936. c.triggerHandler("setData" + d[1] + "!", e);
  937. m.data(this, b, a);
  938. c.triggerHandler("changeData" + d[1] + "!", e)
  939. })
  940. },
  941. removeData: function(b) {
  942. return this.each(function() {
  943. m.removeData(this, b)
  944. })
  945. }
  946. });
  947. m.extend({
  948. _mark: function(b, a) {
  949. b && (a = (a || "fx") + "mark", m._data(b, a, (m._data(b, a) || 0) + 1))
  950. },
  951. _unmark: function(b, a, d) { ! 0 !== b && (d = a, a = b, b = !1);
  952. if (a) {
  953. d = d || "fx";
  954. var c = d + "mark"; (b = b ? 0 : (m._data(a, c) || 1) - 1) ? m._data(a, c, b) : (m.removeData(a, c, !0), L(a, d, "mark"))
  955. }
  956. },
  957. queue: function(b, a, d) {
  958. var c;
  959. if (b) return a = (a || "fx") + "queue",
  960. c = m._data(b, a),
  961. d && (!c || m.isArray(d) ? c = m._data(b, a, m.makeArray(d)) : c.push(d)),
  962. c || []
  963. },
  964. dequeue: function(b, a) {
  965. a = a || "fx";
  966. var d = m.queue(b, a),
  967. c = d.shift(),
  968. e = {};
  969. "inprogress" === c && (c = d.shift());
  970. c && ("fx" === a && d.unshift("inprogress"), m._data(b, a + ".run", e), c.call(b,
  971. function() {
  972. m.dequeue(b, a)
  973. },
  974. e));
  975. d.length || (m.removeData(b, a + "queue " + a + ".run", !0), L(b, a, "queue"))
  976. }
  977. });
  978. m.fn.extend({
  979. queue: function(b, a) {
  980. "string" != typeof b && (a = b, b = "fx");
  981. return a === f ? m.queue(this[0], b) : this.each(function() {
  982. var d = m.queue(this, b, a);
  983. "fx" === b && "inprogress" !== d[0] && m.dequeue(this, b)
  984. })
  985. },
  986. dequeue: function(b) {
  987. return this.each(function() {
  988. m.dequeue(this, b)
  989. })
  990. },
  991. delay: function(b, a) {
  992. b = m.fx ? m.fx.speeds[b] || b: b;
  993. return this.queue(a || "fx",
  994. function(a, d) {
  995. var c = setTimeout(a, b);
  996. d.stop = function() {
  997. clearTimeout(c)
  998. }
  999. })
  1000. },
  1001. clearQueue: function(b) {
  1002. return this.queue(b || "fx", [])
  1003. },
  1004. promise: function(b, a) {
  1005. function d() {--l || c.resolveWith(e, [e])
  1006. }
  1007. "string" != typeof b && (b = f);
  1008. b = b || "fx";
  1009. for (var c = m.Deferred(), e = this, g = e.length, l = 1, r = b + "defer", k = b + "queue", q = b + "mark", h; g--;) if (h = m.data(e[g], r, f, !0) || (m.data(e[g], k, f, !0) || m.data(e[g], q, f, !0)) && m.data(e[g], r, m.Callbacks("once memory"), !0)) l++,
  1010. h.add(d);
  1011. d();
  1012. return c.promise()
  1013. }
  1014. });
  1015. var va = /[\n\t\r]/g,
  1016. ba = /\s+/,
  1017. ab = /\r/g,
  1018. bb = /^(?:button|input)$/i,
  1019. cb = /^(?:button|input|object|select|textarea)$/i,
  1020. db = /^a(?:rea)?$/i,
  1021. wa = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
  1022. xa = m.support.getSetAttribute,
  1023. K, ya, za;
  1024. m.fn.extend({
  1025. attr: function(b, a) {
  1026. return m.access(this, b, a, !0, m.attr)
  1027. },
  1028. removeAttr: function(b) {
  1029. return this.each(function() {
  1030. m.removeAttr(this, b)
  1031. })
  1032. },
  1033. prop: function(b, a) {
  1034. return m.access(this, b, a, !0, m.prop)
  1035. },
  1036. removeProp: function(b) {
  1037. b = m.propFix[b] || b;
  1038. return this.each(function() {
  1039. try {
  1040. this[b] = f,
  1041. delete this[b]
  1042. } catch(a) {}
  1043. })
  1044. },
  1045. addClass: function(b) {
  1046. var a, d, c, e, g, f, l;
  1047. if (m.isFunction(b)) return this.each(function(a) {
  1048. m(this).addClass(b.call(this, a, this.className))
  1049. });
  1050. if (b && "string" == typeof b) for (a = b.split(ba), d = 0, c = this.length; d < c; d++) if (e = this[d], 1 === e.nodeType) if (e.className || 1 !== a.length) {
  1051. g = " " + e.className + " ";
  1052. f = 0;
  1053. for (l = a.length; f < l; f++)~g.indexOf(" " + a[f] + " ") || (g += a[f] + " ");
  1054. e.className = m.trim(g)
  1055. } else e.className = b;
  1056. return this
  1057. },
  1058. removeClass: function(b) {
  1059. var a, d, c, e, g, l, r;
  1060. if (m.isFunction(b)) return this.each(function(a) {
  1061. m(this).removeClass(b.call(this, a, this.className))
  1062. });
  1063. if (b && "string" == typeof b || b === f) for (a = (b || "").split(ba), d = 0, c = this.length; d < c; d++) if (e = this[d], 1 === e.nodeType && e.className) if (b) {
  1064. g = (" " + e.className + " ").replace(va, " ");
  1065. l = 0;
  1066. for (r = a.length; l < r; l++) g = g.replace(" " + a[l] + " ", " ");
  1067. e.className = m.trim(g)
  1068. } else e.className = "";
  1069. return this
  1070. },
  1071. toggleClass: function(b, a) {
  1072. var d = typeof b,
  1073. c = "boolean" == typeof a;
  1074. return m.isFunction(b) ? this.each(function(d) {
  1075. m(this).toggleClass(b.call(this, d, this.className, a), a)
  1076. }) : this.each(function() {
  1077. if ("string" === d) for (var e, g = 0,
  1078. f = m(this), l = a, r = b.split(ba); e = r[g++];) l = c ? l: !f.hasClass(e),
  1079. f[l ? "addClass": "removeClass"](e);
  1080. else if ("undefined" === d || "boolean" === d) this.className && m._data(this, "__className__", this.className),
  1081. this.className = this.className || !1 === b ? "": m._data(this, "__className__") || ""
  1082. })
  1083. },
  1084. hasClass: function(b) {
  1085. b = " " + b + " ";
  1086. for (var a = 0,
  1087. d = this.length; a < d; a++) if (1 === this[a].nodeType && -1 < (" " + this[a].className + " ").replace(va, " ").indexOf(b)) return ! 0;
  1088. return ! 1
  1089. },
  1090. val: function(b) {
  1091. var a, d, c, e = this[0];
  1092. if (arguments.length) return c = m.isFunction(b),
  1093. this.each(function(d) {
  1094. var e = m(this),
  1095. g;
  1096. 1 === this.nodeType && (c ? g = b.call(this, d, e.val()) : g = b, null == g ? g = "": "number" == typeof g ? g += "": m.isArray(g) && (g = m.map(g,
  1097. function(b) {
  1098. return null == b ? "": b + ""
  1099. })), a = m.valHooks[this.nodeName.toLowerCase()] || m.valHooks[this.type], a && "set" in a && a.set(this, g, "value") !== f || (this.value = g))
  1100. });
  1101. if (e) {
  1102. if ((a = m.valHooks[e.nodeName.toLowerCase()] || m.valHooks[e.type]) && "get" in a && (d = a.get(e, "value")) !== f) return d;
  1103. d = e.value;
  1104. return "string" == typeof d ? d.replace(ab, "") : null == d ? "": d
  1105. }
  1106. }
  1107. });
  1108. m.extend({
  1109. valHooks: {
  1110. option: {
  1111. get: function(b) {
  1112. var a = b.attributes.value;
  1113. return ! a || a.specified ? b.value: b.text
  1114. }
  1115. },
  1116. select: {
  1117. get: function(b) {
  1118. var a, d, c = b.selectedIndex,
  1119. e = [],
  1120. g = b.options,
  1121. f = "select-one" === b.type;
  1122. if (0 > c) return null;
  1123. b = f ? c: 0;
  1124. for (d = f ? c + 1 : g.length; b < d; b++) if (a = g[b], a.selected && !((m.support.optDisabled ? a.disabled: null !== a.getAttribute("disabled")) || a.parentNode.disabled && m.nodeName(a.parentNode, "optgroup"))) {
  1125. a = m(a).val();
  1126. if (f) return a;
  1127. e.push(a)
  1128. }
  1129. return f && !e.length && g.length ? m(g[c]).val() : e
  1130. },
  1131. set: function(b, a) {
  1132. var d = m.makeArray(a);
  1133. m(b).find("option").each(function() {
  1134. this.selected = 0 <= m.inArray(m(this).val(), d)
  1135. });
  1136. d.length || (b.selectedIndex = -1);
  1137. return d
  1138. }
  1139. }
  1140. },
  1141. attrFn: {
  1142. val: !0,
  1143. css: !0,
  1144. html: !0,
  1145. text: !0,
  1146. data: !0,
  1147. width: !0,
  1148. height: !0,
  1149. offset: !0
  1150. },
  1151. attr: function(b, a, d, c) {
  1152. var e, g, l = b.nodeType;
  1153. if (b && 3 !== l && 8 !== l && 2 !== l) {
  1154. if (c && a in m.attrFn) return m(b)[a](d);
  1155. if ("undefined" == typeof b.getAttribute) return m.prop(b, a, d); (c = 1 !== l || !m.isXMLDoc(b)) && (a = a.toLowerCase(), g = m.attrHooks[a] || (wa.test(a) ? ya: K));
  1156. if (d !== f) {
  1157. if (null === d) {
  1158. m.removeAttr(b, a);
  1159. return
  1160. }
  1161. if (g && "set" in g && c && (e = g.set(b, d, a)) !== f) return e;
  1162. b.setAttribute(a, "" + d);
  1163. return d
  1164. }
  1165. if (g && "get" in g && c && null !== (e = g.get(b, a))) return e;
  1166. e = b.getAttribute(a);
  1167. return null === e ? f: e
  1168. }
  1169. },
  1170. removeAttr: function(b, a) {
  1171. var d, c, e, g, f = 0;
  1172. if (a && 1 === b.nodeType) for (c = a.toLowerCase().split(ba), g = c.length; f < g; f++)(e = c[f]) && (d = m.propFix[e] || e, m.attr(b, e, ""), b.removeAttribute(xa ? e: d), wa.test(e) && d in b && (b[d] = !1))
  1173. },
  1174. attrHooks: {
  1175. type: {
  1176. set: function(b, a) {
  1177. if (bb.test(b.nodeName) && b.parentNode) m.error("type property can't be changed");
  1178. else if (!m.support.radioValue && "radio" === a && m.nodeName(b, "input")) {
  1179. var d = b.value;
  1180. b.setAttribute("type", a);
  1181. d && (b.value = d);
  1182. return a
  1183. }
  1184. }
  1185. },
  1186. value: {
  1187. get: function(b, a) {
  1188. return K && m.nodeName(b, "button") ? K.get(b, a) : a in b ? b.value: null
  1189. },
  1190. set: function(b, a, d) {
  1191. if (K && m.nodeName(b, "button")) return K.set(b, a, d);
  1192. b.value = a
  1193. }
  1194. }
  1195. },
  1196. propFix: {
  1197. tabindex: "tabIndex",
  1198. readonly: "readOnly",
  1199. "for": "htmlFor",
  1200. "class": "className",
  1201. maxlength: "maxLength",
  1202. cellspacing: "cellSpacing",
  1203. cellpadding: "cellPadding",
  1204. rowspan: "rowSpan",
  1205. colspan: "colSpan",
  1206. usemap: "useMap",
  1207. frameborder: "frameBorder",
  1208. contenteditable: "contentEditable"
  1209. },
  1210. prop: function(b, a, d) {
  1211. var c, e, g;
  1212. g = b.nodeType;
  1213. if (b && 3 !== g && 8 !== g && 2 !== g) return (g = 1 !== g || !m.isXMLDoc(b)) && (a = m.propFix[a] || a, e = m.propHooks[a]),
  1214. d !== f ? e && "set" in e && (c = e.set(b, d, a)) !== f ? c: b[a] = d: e && "get" in e && null !== (c = e.get(b, a)) ? c: b[a]
  1215. },
  1216. propHooks: {
  1217. tabIndex: {
  1218. get: function(b) {
  1219. var a = b.getAttributeNode("tabindex");
  1220. return a && a.specified ? parseInt(a.value, 10) : cb.test(b.nodeName) || db.test(b.nodeName) && b.href ? 0 : f
  1221. }
  1222. }
  1223. }
  1224. });
  1225. m.attrHooks.tabindex = m.propHooks.tabIndex;
  1226. ya = {
  1227. get: function(b, a) {
  1228. var d, c = m.prop(b, a);
  1229. return ! 0 === c || "boolean" != typeof c && (d = b.getAttributeNode(a)) && !1 !== d.nodeValue ? a.toLowerCase() : f
  1230. },
  1231. set: function(b, a, d) {
  1232. var c; ! 1 === a ? m.removeAttr(b, d) : (c = m.propFix[d] || d, c in b && (b[c] = !0), b.setAttribute(d, d.toLowerCase()));
  1233. return d
  1234. }
  1235. };
  1236. xa || (za = {
  1237. name: !0,
  1238. id: !0
  1239. },
  1240. K = m.valHooks.button = {
  1241. get: function(b, a) {
  1242. var d;
  1243. return (d = b.getAttributeNode(a)) && (za[a] ? "" !== d.nodeValue: d.specified) ? d.nodeValue: f
  1244. },
  1245. set: function(b, a, d) {
  1246. var c = b.getAttributeNode(d);
  1247. c || (c = w.createAttribute(d), b.setAttributeNode(c));
  1248. return c.nodeValue = a + ""
  1249. }
  1250. },
  1251. m.attrHooks.tabindex.set = K.set, m.each(["width", "height"],
  1252. function(b, a) {
  1253. m.attrHooks[a] = m.extend(m.attrHooks[a], {
  1254. set: function(b, d) {
  1255. if ("" === d) return b.setAttribute(a, "auto"),
  1256. d
  1257. }
  1258. })
  1259. }), m.attrHooks.contenteditable = {
  1260. get: K.get,
  1261. set: function(b, a, d) {
  1262. "" === a && (a = "false");
  1263. K.set(b, a, d)
  1264. }
  1265. });
  1266. m.support.hrefNormalized || m.each(["href", "src", "width", "height"],
  1267. function(b, a) {
  1268. m.attrHooks[a] = m.extend(m.attrHooks[a], {
  1269. get: function(b) {
  1270. b = b.getAttribute(a, 2);
  1271. return null === b ? f: b
  1272. }
  1273. })
  1274. });
  1275. m.support.style || (m.attrHooks.style = {
  1276. get: function(b) {
  1277. return b.style.cssText.toLowerCase() || f
  1278. },
  1279. set: function(b, a) {
  1280. return b.style.cssText = "" + a
  1281. }
  1282. });
  1283. m.support.optSelected || (m.propHooks.selected = m.extend(m.propHooks.selected, {
  1284. get: function(b) {
  1285. b = b.parentNode;
  1286. b && (b.selectedIndex, b.parentNode && b.parentNode.selectedIndex);
  1287. return null
  1288. }
  1289. }));
  1290. m.support.enctype || (m.propFix.enctype = "encoding");
  1291. m.support.checkOn || m.each(["radio", "checkbox"],
  1292. function() {
  1293. m.valHooks[this] = {
  1294. get: function(b) {
  1295. return null === b.getAttribute("value") ? "on": b.value
  1296. }
  1297. }
  1298. });
  1299. m.each(["radio", "checkbox"],
  1300. function() {
  1301. m.valHooks[this] = m.extend(m.valHooks[this], {
  1302. set: function(b, a) {
  1303. if (m.isArray(a)) return b.checked = 0 <= m.inArray(m(b).val(), a)
  1304. }
  1305. })
  1306. });
  1307. var ka = /^(?:textarea|input|select)$/i,
  1308. Aa = /^([^\.]*)?(?:\.(.+))?$/,
  1309. eb = /\bhover(\.\S+)?\b/,
  1310. fb = /^key/,
  1311. gb = /^(?:mouse|contextmenu)|click/,
  1312. Ba = /^(?:focusinfocus|focusoutblur)$/,
  1313. hb = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
  1314. ib = function(b) { (b = hb.exec(b)) && (b[1] = (b[1] || "").toLowerCase(), b[3] = b[3] && new RegExp("(?:^|\\s)" + b[3] + "(?:\\s|$)"));
  1315. return b
  1316. },
  1317. Ca = function(b) {
  1318. return m.event.special.hover ? b: b.replace(eb, "mouseenter$1 mouseleave$1")
  1319. };
  1320. m.event = {
  1321. add: function(b, a, d, c, e) {
  1322. var g, l, r, k, q, h, t, v, n;
  1323. if (3 !== b.nodeType && 8 !== b.nodeType && a && d && (g = m._data(b))) {
  1324. d.handler && (t = d, d = t.handler);
  1325. d.guid || (d.guid = m.guid++); (r = g.events) || (g.events = r = {}); (l = g.handle) || (g.handle = l = function(b) {
  1326. return "undefined" == typeof m || b && m.event.triggered === b.type ? f: m.event.dispatch.apply(l.elem, arguments)
  1327. },
  1328. l.elem = b);
  1329. a = m.trim(Ca(a)).split(" ");
  1330. for (g = 0; g < a.length; g++) k = Aa.exec(a[g]) || [],
  1331. q = k[1],
  1332. h = (k[2] || "").split(".").sort(),
  1333. n = m.event.special[q] || {},
  1334. q = (e ? n.delegateType: n.bindType) || q,
  1335. n = m.event.special[q] || {},
  1336. k = m.extend({
  1337. type: q,
  1338. origType: k[1],
  1339. data: c,
  1340. handler: d,
  1341. guid: d.guid,
  1342. selector: e,
  1343. quick: ib(e),
  1344. namespace: h.join(".")
  1345. },
  1346. t),
  1347. v = r[q],
  1348. v || (v = r[q] = [], v.delegateCount = 0, n.setup && !1 !== n.setup.call(b, c, h, l) || (b.addEventListener ? b.addEventListener(q, l, !1) : b.attachEvent && b.attachEvent("on" + q, l))),
  1349. n.add && (n.add.call(b, k), k.handler.guid || (k.handler.guid = d.guid)),
  1350. e ? v.splice(v.delegateCount++, 0, k) : v.push(k),
  1351. m.event.global[q] = !0;
  1352. b = null
  1353. }
  1354. },
  1355. global: {},
  1356. remove: function(b, a, d, c, e) {
  1357. var g = m.hasData(b) && m._data(b),
  1358. f,
  1359. l,
  1360. r,
  1361. k,
  1362. q,
  1363. h,
  1364. t,
  1365. v,
  1366. n,
  1367. y,
  1368. s;
  1369. if (g && (t = g.events)) {
  1370. a = m.trim(Ca(a || "")).split(" ");
  1371. for (f = 0; f < a.length; f++) if (l = Aa.exec(a[f]) || [], r = k = l[1], l = l[2], r) {
  1372. v = m.event.special[r] || {};
  1373. r = (c ? v.delegateType: v.bindType) || r;
  1374. y = t[r] || [];
  1375. q = y.length;
  1376. l = l ? new RegExp("(^|\\.)" + l.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
  1377. for (h = 0; h < y.length; h++) s = y[h],
  1378. !e && k !== s.origType || d && d.guid !== s.guid || l && !l.test(s.namespace) || c && !(c === s.selector || "**" === c && s.selector) || (y.splice(h--, 1), s.selector && y.delegateCount--, !v.remove || v.remove.call(b, s));
  1379. 0 === y.length && q !== y.length && ((!v.teardown || !1 === v.teardown.call(b, l)) && m.removeEvent(b, r, g.handle), delete t[r])
  1380. } else for (r in t) m.event.remove(b, r + a[f], d, c, !0);
  1381. m.isEmptyObject(t) && (n = g.handle, n && (n.elem = null), m.removeData(b, ["events", "handle"], !0))
  1382. }
  1383. },
  1384. customEvent: {
  1385. getData: !0,
  1386. setData: !0,
  1387. changeData: !0
  1388. },
  1389. trigger: function(b, d, c, e) {
  1390. if (!c || 3 !== c.nodeType && 8 !== c.nodeType) {
  1391. var g = b.type || b,
  1392. l = [],
  1393. r,
  1394. k,
  1395. q,
  1396. h,
  1397. t,
  1398. v;
  1399. if (!Ba.test(g + m.event.triggered) && (0 <= g.indexOf("!") && (g = g.slice(0, -1), r = !0), 0 <= g.indexOf(".") && (l = g.split("."), g = l.shift(), l.sort()), c && !m.event.customEvent[g] || m.event.global[g])) if (b = "object" == typeof b ? b[m.expando] ? b: new m.Event(g, b) : new m.Event(g), b.type = g, b.isTrigger = !0, b.exclusive = r, b.namespace = l.join("."), b.namespace_re = b.namespace ? new RegExp("(^|\\.)" + l.join("\\.(?:.*\\.)?") + "(\\.|$)") : null, r = 0 > g.indexOf(":") ? "on" + g: "", c) {
  1400. if (b.result = f, b.target || (b.target = c), d = null != d ? m.makeArray(d) : [], d.unshift(b), h = m.event.special[g] || {},
  1401. !h.trigger || !1 !== h.trigger.apply(c, d)) {
  1402. v = [[c, h.bindType || g]];
  1403. if (!e && !h.noBubble && !m.isWindow(c)) {
  1404. k = h.delegateType || g;
  1405. l = Ba.test(k + g) ? c: c.parentNode;
  1406. for (q = null; l; l = l.parentNode) v.push([l, k]),
  1407. q = l;
  1408. q && q === c.ownerDocument && v.push([q.defaultView || q.parentWindow || a, k])
  1409. }
  1410. for (k = 0; k < v.length && !b.isPropagationStopped(); k++) l = v[k][0],
  1411. b.type = v[k][1],
  1412. (t = (m._data(l, "events") || {})[b.type] && m._data(l, "handle")) && t.apply(l, d),
  1413. (t = r && l[r]) && m.acceptData(l) && !1 === t.apply(l, d) && b.preventDefault();
  1414. b.type = g;
  1415. e || b.isDefaultPrevented() || h._default && !1 !== h._default.apply(c.ownerDocument, d) || "click" === g && m.nodeName(c, "a") || m.acceptData(c) && r && c[g] && ("focus" !== g && "blur" !== g || 0 !== b.target.offsetWidth) && !m.isWindow(c) && (q = c[r], q && (c[r] = null), m.event.triggered = g, c[g](), m.event.triggered = f, q && (c[r] = q));
  1416. return b.result
  1417. }
  1418. } else for (k in c = m.cache, c) c[k].events && c[k].events[g] && m.event.trigger(b, d, c[k].handle.elem, !0)
  1419. }
  1420. },
  1421. dispatch: function(b) {
  1422. b = m.event.fix(b || a.event);
  1423. var d = (m._data(this, "events") || {})[b.type] || [],
  1424. c = d.delegateCount,
  1425. e = [].slice.call(arguments, 0),
  1426. g = !b.exclusive && !b.namespace,
  1427. l = [],
  1428. r,
  1429. k,
  1430. q,
  1431. h,
  1432. t,
  1433. v,
  1434. n;
  1435. e[0] = b;
  1436. b.delegateTarget = this;
  1437. if (c && !(b.target.disabled || b.button && "click" === b.type)) for (q = m(this), q.context = this.ownerDocument || this, k = b.target; k != this; k = k.parentNode || this) {
  1438. t = {};
  1439. v = [];
  1440. q[0] = k;
  1441. for (r = 0; r < c; r++) {
  1442. h = d[r];
  1443. n = h.selector;
  1444. if (t[n] === f) {
  1445. var y = t,
  1446. s = n,
  1447. p;
  1448. if (h.quick) {
  1449. p = h.quick;
  1450. var u = k.attributes || {};
  1451. p = (!p[1] || k.nodeName.toLowerCase() === p[1]) && (!p[2] || (u.id || {}).value === p[2]) && (!p[3] || p[3].test((u["class"] || {}).value))
  1452. } else p = q.is(n);
  1453. y[s] = p
  1454. }
  1455. t[n] && v.push(h)
  1456. }
  1457. v.length && l.push({
  1458. elem: k,
  1459. matches: v
  1460. })
  1461. }
  1462. d.length > c && l.push({
  1463. elem: this,
  1464. matches: d.slice(c)
  1465. });
  1466. for (r = 0; r < l.length && !b.isPropagationStopped(); r++) for (c = l[r], b.currentTarget = c.elem, d = 0; d < c.matches.length && !b.isImmediatePropagationStopped(); d++) if (h = c.matches[d], g || !b.namespace && !h.namespace || b.namespace_re && b.namespace_re.test(h.namespace)) b.data = h.data,
  1467. b.handleObj = h,
  1468. h = ((m.event.special[h.origType] || {}).handle || h.handler).apply(c.elem, e),
  1469. h !== f && (b.result = h, !1 === h && (b.preventDefault(), b.stopPropagation()));
  1470. return b.result
  1471. },
  1472. props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
  1473. fixHooks: {},
  1474. keyHooks: {
  1475. props: ["char", "charCode", "key", "keyCode"],
  1476. filter: function(b, a) {
  1477. null == b.which && (b.which = null != a.charCode ? a.charCode: a.keyCode);
  1478. return b
  1479. }
  1480. },
  1481. mouseHooks: {
  1482. props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
  1483. filter: function(b, a) {
  1484. var d, c, e, g = a.button,
  1485. l = a.fromElement;
  1486. null == b.pageX && null != a.clientX && (d = b.target.ownerDocument || w, c = d.documentElement, e = d.body, b.pageX = a.clientX + (c && c.scrollLeft || e && e.scrollLeft || 0) - (c && c.clientLeft || e && e.clientLeft || 0), b.pageY = a.clientY + (c && c.scrollTop || e && e.scrollTop || 0) - (c && c.clientTop || e && e.clientTop || 0)); ! b.relatedTarget && l && (b.relatedTarget = l === b.target ? a.toElement: l); ! b.which && g !== f && (b.which = g & 1 ? 1 : g & 2 ? 3 : g & 4 ? 2 : 0);
  1487. return b
  1488. }
  1489. },
  1490. fix: function(b) {
  1491. if (b[m.expando]) return b;
  1492. var a, d, c = b,
  1493. e = m.event.fixHooks[b.type] || {},
  1494. g = e.props ? this.props.concat(e.props) : this.props;
  1495. b = m.Event(c);
  1496. for (a = g.length; a;) d = g[--a],
  1497. b[d] = c[d];
  1498. b.target || (b.target = c.srcElement || w);
  1499. 3 === b.target.nodeType && (b.target = b.target.parentNode);
  1500. b.metaKey === f && (b.metaKey = b.ctrlKey);
  1501. return e.filter ? e.filter(b, c) : b
  1502. },
  1503. special: {
  1504. ready: {
  1505. setup: m.bindReady
  1506. },
  1507. load: {
  1508. noBubble: !0
  1509. },
  1510. focus: {
  1511. delegateType: "focusin"
  1512. },
  1513. blur: {
  1514. delegateType: "focusout"
  1515. },
  1516. beforeunload: {
  1517. setup: function(b, a, d) {
  1518. m.isWindow(this) && (this.onbeforeunload = d)
  1519. },
  1520. teardown: function(b, a) {
  1521. this.onbeforeunload === a && (this.onbeforeunload = null)
  1522. }
  1523. }
  1524. },
  1525. simulate: function(b, a, d, c) {
  1526. b = m.extend(new m.Event, d, {
  1527. type: b,
  1528. isSimulated: !0,
  1529. originalEvent: {}
  1530. });
  1531. c ? m.event.trigger(b, null, a) : m.event.dispatch.call(a, b);
  1532. b.isDefaultPrevented() && d.preventDefault()
  1533. }
  1534. };
  1535. m.event.handle = m.event.dispatch;
  1536. m.removeEvent = w.removeEventListener ?
  1537. function(b, a, d) {
  1538. b.removeEventListener && b.removeEventListener(a, d, !1)
  1539. }: function(b, a, d) {
  1540. b.detachEvent && b.detachEvent("on" + a, d)
  1541. };
  1542. m.Event = function(b, a) {
  1543. if (! (this instanceof m.Event)) return new m.Event(b, a);
  1544. b && b.type ? (this.originalEvent = b, this.type = b.type, this.isDefaultPrevented = b.defaultPrevented || !1 === b.returnValue || b.getPreventDefault && b.getPreventDefault() ? B: F) : this.type = b;
  1545. a && m.extend(this, a);
  1546. this.timeStamp = b && b.timeStamp || m.now();
  1547. this[m.expando] = !0
  1548. };
  1549. m.Event.prototype = {
  1550. preventDefault: function() {
  1551. this.isDefaultPrevented = B;
  1552. var b = this.originalEvent; ! b || (b.preventDefault ? b.preventDefault() : b.returnValue = !1)
  1553. },
  1554. stopPropagation: function() {
  1555. this.isPropagationStopped = B;
  1556. var b = this.originalEvent; ! b || (b.stopPropagation && b.stopPropagation(), b.cancelBubble = !0)
  1557. },
  1558. stopImmediatePropagation: function() {
  1559. this.isImmediatePropagationStopped = B;
  1560. this.stopPropagation()
  1561. },
  1562. isDefaultPrevented: F,
  1563. isPropagationStopped: F,
  1564. isImmediatePropagationStopped: F
  1565. };
  1566. m.each({
  1567. mouseenter: "mouseover",
  1568. mouseleave: "mouseout"
  1569. },
  1570. function(b, a) {
  1571. m.event.special[b] = {
  1572. delegateType: a,
  1573. bindType: a,
  1574. handle: function(b) {
  1575. var d = b.relatedTarget,
  1576. c = b.handleObj,
  1577. e;
  1578. if (!d || d !== this && !m.contains(this, d)) b.type = c.origType,
  1579. e = c.handler.apply(this, arguments),
  1580. b.type = a;
  1581. return e
  1582. }
  1583. }
  1584. });
  1585. m.support.submitBubbles || (m.event.special.submit = {
  1586. setup: function() {
  1587. if (m.nodeName(this, "form")) return ! 1;
  1588. m.event.add(this, "click._submit keypress._submit",
  1589. function(b) {
  1590. b = b.target; (b = m.nodeName(b, "input") || m.nodeName(b, "button") ? b.form: f) && !b._submit_attached && (m.event.add(b, "submit._submit",
  1591. function(b) {
  1592. this.parentNode && !b.isTrigger && m.event.simulate("submit", this.parentNode, b, !0)
  1593. }), b._submit_attached = !0)
  1594. })
  1595. },
  1596. teardown: function() {
  1597. if (m.nodeName(this, "form")) return ! 1;
  1598. m.event.remove(this, "._submit")
  1599. }
  1600. });
  1601. m.support.changeBubbles || (m.event.special.change = {
  1602. setup: function() {
  1603. if (ka.test(this.nodeName)) {
  1604. if ("checkbox" === this.type || "radio" === this.type) m.event.add(this, "propertychange._change",
  1605. function(b) {
  1606. "checked" === b.originalEvent.propertyName && (this._just_changed = !0)
  1607. }),
  1608. m.event.add(this, "click._change",
  1609. function(b) {
  1610. this._just_changed && !b.isTrigger && (this._just_changed = !1, m.event.simulate("change", this, b, !0))
  1611. });
  1612. return ! 1
  1613. }
  1614. m.event.add(this, "beforeactivate._change",
  1615. function(b) {
  1616. b = b.target;
  1617. ka.test(b.nodeName) && !b._change_attached && (m.event.add(b, "change._change",
  1618. function(b) {
  1619. this.parentNode && !b.isSimulated && !b.isTrigger && m.event.simulate("change", this.parentNode, b, !0)
  1620. }), b._change_attached = !0)
  1621. })
  1622. },
  1623. handle: function(b) {
  1624. var a = b.target;
  1625. if (this !== a || b.isSimulated || b.isTrigger || "radio" !== a.type && "checkbox" !== a.type) return b.handleObj.handler.apply(this, arguments)
  1626. },
  1627. teardown: function() {
  1628. m.event.remove(this, "._change");
  1629. return ka.test(this.nodeName)
  1630. }
  1631. });
  1632. m.support.focusinBubbles || m.each({
  1633. focus: "focusin",
  1634. blur: "focusout"
  1635. },
  1636. function(b, a) {
  1637. var d = 0,
  1638. c = function(b) {
  1639. m.event.simulate(a, b.target, m.event.fix(b), !0)
  1640. };
  1641. m.event.special[a] = {
  1642. setup: function() {
  1643. 0 === d++&&w.addEventListener(b, c, !0)
  1644. },
  1645. teardown: function() {
  1646. 0 === --d && w.removeEventListener(b, c, !0)
  1647. }
  1648. }
  1649. });
  1650. m.fn.extend({
  1651. on: function(b, a, d, c, e) {
  1652. var g, l;
  1653. if ("object" == typeof b) {
  1654. "string" != typeof a && (d = a, a = f);
  1655. for (l in b) this.on(l, a, d, b[l], e);
  1656. return this
  1657. }
  1658. null == d && null == c ? (c = a, d = a = f) : null == c && ("string" == typeof a ? (c = d, d = f) : (c = d, d = a, a = f));
  1659. if (!1 === c) c = F;
  1660. else if (!c) return this;
  1661. 1 === e && (g = c, c = function(b) {
  1662. m().off(b);
  1663. return g.apply(this, arguments)
  1664. },
  1665. c.guid = g.guid || (g.guid = m.guid++));
  1666. return this.each(function() {
  1667. m.event.add(this, b, c, d, a)
  1668. })
  1669. },
  1670. one: function(b, a, d, c) {
  1671. return this.on.call(this, b, a, d, c, 1)
  1672. },
  1673. off: function(b, a, d) {
  1674. if (b && b.preventDefault && b.handleObj) {
  1675. var c = b.handleObj;
  1676. m(b.delegateTarget).off(c.namespace ? c.type + "." + c.namespace: c.type, c.selector, c.handler);
  1677. return this
  1678. }
  1679. if ("object" == typeof b) {
  1680. for (c in b) this.off(c, a, b[c]);
  1681. return this
  1682. }
  1683. if (!1 === a || "function" == typeof a) d = a,
  1684. a = f; ! 1 === d && (d = F);
  1685. return this.each(function() {
  1686. m.event.remove(this, b, d, a)
  1687. })
  1688. },
  1689. bind: function(b, a, d) {
  1690. return this.on(b, null, a, d)
  1691. },
  1692. unbind: function(b, a) {
  1693. return this.off(b, null, a)
  1694. },
  1695. live: function(b, a, d) {
  1696. m(this.context).on(b, this.selector, a, d);
  1697. return this
  1698. },
  1699. die: function(b, a) {
  1700. m(this.context).off(b, this.selector || "**", a);
  1701. return this
  1702. },
  1703. delegate: function(b, a, d, c) {
  1704. return this.on(a, b, d, c)
  1705. },
  1706. undelegate: function(b, a, d) {
  1707. return 1 == arguments.length ? this.off(b, "**") : this.off(a, b, d)
  1708. },
  1709. trigger: function(b, a) {
  1710. return this.each(function() {
  1711. m.event.trigger(b, a, this)
  1712. })
  1713. },
  1714. triggerHandler: function(b, a) {
  1715. if (this[0]) return m.event.trigger(b, a, this[0], !0)
  1716. },
  1717. toggle: function(b) {
  1718. var a = arguments,
  1719. d = b.guid || m.guid++,
  1720. c = 0,
  1721. e = function(d) {
  1722. var e = (m._data(this, "lastToggle" + b.guid) || 0) % c;
  1723. m._data(this, "lastToggle" + b.guid, e + 1);
  1724. d.preventDefault();
  1725. return a[e].apply(this, arguments) || !1
  1726. };
  1727. for (e.guid = d; c < a.length;) a[c++].guid = d;
  1728. return this.click(e)
  1729. },
  1730. hover: function(b, a) {
  1731. return this.mouseenter(b).mouseleave(a || b)
  1732. }
  1733. });
  1734. m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),
  1735. function(b, a) {
  1736. m.fn[a] = function(b, d) {
  1737. null == d && (d = b, b = null);
  1738. return 0 < arguments.length ? this.on(a, null, b, d) : this.trigger(a)
  1739. };
  1740. m.attrFn && (m.attrFn[a] = !0);
  1741. fb.test(a) && (m.event.fixHooks[a] = m.event.keyHooks);
  1742. gb.test(a) && (m.event.fixHooks[a] = m.event.mouseHooks)
  1743. }); (function() {
  1744. function b(a, d, e, g, f, l) {
  1745. f = 0;
  1746. for (var r = g.length; f < r; f++) {
  1747. var k = g[f];
  1748. if (k) {
  1749. for (var m = !1,
  1750. k = k[a]; k;) {
  1751. if (k[c] === e) {
  1752. m = g[k.sizset];
  1753. break
  1754. }
  1755. if (1 === k.nodeType) if (l || (k[c] = e, k.sizset = f), "string" != typeof d) {
  1756. if (k === d) {
  1757. m = !0;
  1758. break
  1759. }
  1760. } else if (0 < t.filter(d, [k]).length) {
  1761. m = k;
  1762. break
  1763. }
  1764. k = k[a]
  1765. }
  1766. g[f] = m
  1767. }
  1768. }
  1769. }
  1770. function a(b, d, e, g, f, l) {
  1771. f = 0;
  1772. for (var r = g.length; f < r; f++) {
  1773. var k = g[f];
  1774. if (k) {
  1775. for (var m = !1,
  1776. k = k[b]; k;) {
  1777. if (k[c] === e) {
  1778. m = g[k.sizset];
  1779. break
  1780. }
  1781. 1 === k.nodeType && !l && (k[c] = e, k.sizset = f);
  1782. if (k.nodeName.toLowerCase() === d) {
  1783. m = k;
  1784. break
  1785. }
  1786. k = k[b]
  1787. }
  1788. g[f] = m
  1789. }
  1790. }
  1791. }
  1792. var d = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
  1793. c = "sizcache" + (Math.random() + "").replace(".", ""),
  1794. e = 0,
  1795. g = Object.prototype.toString,
  1796. l = !1,
  1797. r = !0,
  1798. k = /\\/g,
  1799. q = /\r\n/g,
  1800. h = /\W/; [0, 0].sort(function() {
  1801. r = !1;
  1802. return 0
  1803. });
  1804. var t = function(b, a, c, e) {
  1805. c = c || [];
  1806. var f = a = a || w;
  1807. if (1 !== a.nodeType && 9 !== a.nodeType) return [];
  1808. if (!b || "string" != typeof b) return c;
  1809. var l, r, k, m, q, E, h = !0,
  1810. v = t.isXML(a),
  1811. H = [],
  1812. oa = b;
  1813. do
  1814. if (d.exec(""), l = d.exec(oa)) if (oa = l[3], H.push(l[1]), l[2]) {
  1815. m = l[3];
  1816. break
  1817. }
  1818. while (l);
  1819. if (1 < H.length && y.exec(b)) if (2 === H.length && n.relative[H[0]]) r = D(H[0] + H[1], a, e);
  1820. else for (r = n.relative[H[0]] ? [a] : t(H.shift(), a); H.length;) b = H.shift(),
  1821. n.relative[b] && (b += H.shift()),
  1822. r = D(b, r, e);
  1823. else if (!e && 1 < H.length && 9 === a.nodeType && !v && n.match.ID.test(H[0]) && !n.match.ID.test(H[H.length - 1]) && (q = t.find(H.shift(), a, v), a = q.expr ? t.filter(q.expr, q.set)[0] : q.set[0]), a) for (q = e ? {
  1824. expr: H.pop(),
  1825. set: u(e)
  1826. }: t.find(H.pop(), 1 !== H.length || "~" !== H[0] && "+" !== H[0] || !a.parentNode ? a: a.parentNode, v), r = q.expr ? t.filter(q.expr, q.set) : q.set, 0 < H.length ? k = u(r) : h = !1; H.length;) l = E = H.pop(),
  1827. n.relative[E] ? l = H.pop() : E = "",
  1828. null == l && (l = a),
  1829. n.relative[E](k, l, v);
  1830. else k = [];
  1831. k || (k = r);
  1832. k || t.error(E || b);
  1833. if ("[object Array]" === g.call(k)) if (h) if (a && 1 === a.nodeType) for (b = 0; null != k[b]; b++) k[b] && (!0 === k[b] || 1 === k[b].nodeType && t.contains(a, k[b])) && c.push(r[b]);
  1834. else for (b = 0; null != k[b]; b++) k[b] && 1 === k[b].nodeType && c.push(r[b]);
  1835. else c.push.apply(c, k);
  1836. else u(k, c);
  1837. m && (t(m, f, c, e), t.uniqueSort(c));
  1838. return c
  1839. };
  1840. t.uniqueSort = function(b) {
  1841. if (A && (l = r, b.sort(A), l)) for (var a = 1; a < b.length; a++) b[a] === b[a - 1] && b.splice(a--, 1);
  1842. return b
  1843. };
  1844. t.matches = function(b, a) {
  1845. return t(b, null, null, a)
  1846. };
  1847. t.matchesSelector = function(b, a) {
  1848. return 0 < t(a, null, null, [b]).length
  1849. };
  1850. t.find = function(b, a, d) {
  1851. var c, e, g, f, l, r;
  1852. if (!b) return [];
  1853. e = 0;
  1854. for (g = n.order.length; e < g; e++) if (l = n.order[e], f = n.leftMatch[l].exec(b)) if (r = f[1], f.splice(1, 1), "\\" !== r.substr(r.length - 1) && (f[1] = (f[1] || "").replace(k, ""), c = n.find[l](f, a, d), null != c)) {
  1855. b = b.replace(n.match[l], "");
  1856. break
  1857. }
  1858. c || (c = "undefined" != typeof a.getElementsByTagName ? a.getElementsByTagName("*") : []);
  1859. return {
  1860. set: c,
  1861. expr: b
  1862. }
  1863. };
  1864. t.filter = function(b, a, d, c) {
  1865. for (var e, g, l, r, k, m, q, E, h = b,
  1866. H = [], v = a, y = a && a[0] && t.isXML(a[0]); b && a.length;) {
  1867. for (l in n.filter) if (null != (e = n.leftMatch[l].exec(b)) && e[2] && (m = n.filter[l], k = e[1], g = !1, e.splice(1, 1), "\\" !== k.substr(k.length - 1))) {
  1868. v === H && (H = []);
  1869. if (n.preFilter[l]) if (e = n.preFilter[l](e, v, d, H, c, y), !e) g = r = !0;
  1870. else if (!0 === e) continue;
  1871. if (e) for (q = 0; null != (k = v[q]); q++) k && (r = m(k, e, q, v), E = c ^ r, d && null != r ? E ? g = !0 : v[q] = !1 : E && (H.push(k), g = !0));
  1872. if (r !== f) {
  1873. d || (v = H);
  1874. b = b.replace(n.match[l], "");
  1875. if (!g) return [];
  1876. break
  1877. }
  1878. }
  1879. if (b === h) if (null == g) t.error(b);
  1880. else break;
  1881. h = b
  1882. }
  1883. return v
  1884. };
  1885. t.error = function(b) {
  1886. throw Error("Syntax error, unrecognized expression: " + b);
  1887. };
  1888. var v = t.getText = function(b) {
  1889. var a, d;
  1890. a = b.nodeType;
  1891. var c = "";
  1892. if (a) if (1 === a || 9 === a) {
  1893. if ("string" == typeof b.textContent) return b.textContent;
  1894. if ("string" == typeof b.innerText) return b.innerText.replace(q, "");
  1895. for (b = b.firstChild; b; b = b.nextSibling) c += v(b)
  1896. } else {
  1897. if (3 === a || 4 === a) return b.nodeValue
  1898. } else for (a = 0; d = b[a]; a++) 8 !== d.nodeType && (c += v(d));
  1899. return c
  1900. },
  1901. n = t.selectors = {
  1902. order: ["ID", "NAME", "TAG"],
  1903. match: {
  1904. ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
  1905. CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
  1906. NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
  1907. ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
  1908. TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
  1909. CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
  1910. POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
  1911. PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
  1912. },
  1913. leftMatch: {},
  1914. attrMap: {
  1915. "class": "className",
  1916. "for": "htmlFor"
  1917. },
  1918. attrHandle: {
  1919. href: function(b) {
  1920. return b.getAttribute("href")
  1921. },
  1922. type: function(b) {
  1923. return b.getAttribute("type")
  1924. }
  1925. },
  1926. relative: {
  1927. "+": function(b, a) {
  1928. var d = "string" == typeof a,
  1929. c = d && !h.test(a),
  1930. d = d && !c;
  1931. c && (a = a.toLowerCase());
  1932. for (var c = 0,
  1933. e = b.length,
  1934. g; c < e; c++) if (g = b[c]) {
  1935. for (; (g = g.previousSibling) && 1 !== g.nodeType;);
  1936. b[c] = d || g && g.nodeName.toLowerCase() === a ? g || !1 : g === a
  1937. }
  1938. d && t.filter(a, b, !0)
  1939. },
  1940. ">": function(b, a) {
  1941. var d, c = "string" == typeof a,
  1942. e = 0,
  1943. g = b.length;
  1944. if (c && !h.test(a)) for (a = a.toLowerCase(); e < g; e++) {
  1945. if (d = b[e]) d = d.parentNode,
  1946. b[e] = d.nodeName.toLowerCase() === a ? d: !1
  1947. } else {
  1948. for (; e < g; e++)(d = b[e]) && (b[e] = c ? d.parentNode: d.parentNode === a);
  1949. c && t.filter(a, b, !0)
  1950. }
  1951. },
  1952. "": function(d, c, g) {
  1953. var f, l = e++,
  1954. r = b;
  1955. "string" == typeof c && !h.test(c) && (c = c.toLowerCase(), f = c, r = a);
  1956. r("parentNode", c, l, d, f, g)
  1957. },
  1958. "~": function(d, c, g) {
  1959. var f, l = e++,
  1960. r = b;
  1961. "string" == typeof c && !h.test(c) && (c = c.toLowerCase(), f = c, r = a);
  1962. r("previousSibling", c, l, d, f, g)
  1963. }
  1964. },
  1965. find: {
  1966. ID: function(b, a, d) {
  1967. if ("undefined" != typeof a.getElementById && !d) return (b = a.getElementById(b[1])) && b.parentNode ? [b] : []
  1968. },
  1969. NAME: function(b, a) {
  1970. if ("undefined" != typeof a.getElementsByName) {
  1971. for (var d = [], c = a.getElementsByName(b[1]), e = 0, g = c.length; e < g; e++) c[e].getAttribute("name") === b[1] && d.push(c[e]);
  1972. return 0 === d.length ? null: d
  1973. }
  1974. },
  1975. TAG: function(b, a) {
  1976. if ("undefined" != typeof a.getElementsByTagName) return a.getElementsByTagName(b[1])
  1977. }
  1978. },
  1979. preFilter: {
  1980. CLASS: function(b, a, d, c, e, g) {
  1981. b = " " + b[1].replace(k, "") + " ";
  1982. if (g) return b;
  1983. g = 0;
  1984. for (var f; null != (f = a[g]); g++) f && (e ^ (f.className && 0 <= (" " + f.className + " ").replace(/[\t\n\r]/g, " ").indexOf(b)) ? d || c.push(f) : d && (a[g] = !1));
  1985. return ! 1
  1986. },
  1987. ID: function(b) {
  1988. return b[1].replace(k, "")
  1989. },
  1990. TAG: function(b, a) {
  1991. return b[1].replace(k, "").toLowerCase()
  1992. },
  1993. CHILD: function(b) {
  1994. if ("nth" === b[1]) {
  1995. b[2] || t.error(b[0]);
  1996. b[2] = b[2].replace(/^\+|\s*/g, "");
  1997. var a = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec("even" === b[2] && "2n" || "odd" === b[2] && "2n+1" || !/\D/.test(b[2]) && "0n+" + b[2] || b[2]);
  1998. b[2] = a[1] + (a[2] || 1) - 0;
  1999. b[3] = a[3] - 0
  2000. } else b[2] && t.error(b[0]);
  2001. b[0] = e++;
  2002. return b
  2003. },
  2004. ATTR: function(b, a, d, c, e, g) {
  2005. a = b[1] = b[1].replace(k, ""); ! g && n.attrMap[a] && (b[1] = n.attrMap[a]);
  2006. b[4] = (b[4] || b[5] || "").replace(k, "");
  2007. "~=" === b[2] && (b[4] = " " + b[4] + " ");
  2008. return b
  2009. },
  2010. PSEUDO: function(b, a, c, e, g) {
  2011. if ("not" === b[1]) if (1 < (d.exec(b[3]) || "").length || /^\w/.test(b[3])) b[3] = t(b[3], null, null, a);
  2012. else return b = t.filter(b[3], a, c, 1 ^ g),
  2013. c || e.push.apply(e, b),
  2014. !1;
  2015. else if (n.match.POS.test(b[0]) || n.match.CHILD.test(b[0])) return ! 0;
  2016. return b
  2017. },
  2018. POS: function(b) {
  2019. b.unshift(!0);
  2020. return b
  2021. }
  2022. },
  2023. filters: {
  2024. enabled: function(b) {
  2025. return ! 1 === b.disabled && "hidden" !== b.type
  2026. },
  2027. disabled: function(b) {
  2028. return ! 0 === b.disabled
  2029. },
  2030. checked: function(b) {
  2031. return ! 0 === b.checked
  2032. },
  2033. selected: function(b) {
  2034. b.parentNode && b.parentNode.selectedIndex;
  2035. return ! 0 === b.selected
  2036. },
  2037. parent: function(b) {
  2038. return !! b.firstChild
  2039. },
  2040. empty: function(b) {
  2041. return ! b.firstChild
  2042. },
  2043. has: function(b, a, d) {
  2044. return !! t(d[3], b).length
  2045. },
  2046. header: function(b) {
  2047. return /h\d/i.test(b.nodeName)
  2048. },
  2049. text: function(b) {
  2050. var a = b.getAttribute("type"),
  2051. d = b.type;
  2052. return "input" === b.nodeName.toLowerCase() && "text" === d && (a === d || null === a)
  2053. },
  2054. radio: function(b) {
  2055. return "input" === b.nodeName.toLowerCase() && "radio" === b.type
  2056. },
  2057. checkbox: function(b) {
  2058. return "input" === b.nodeName.toLowerCase() && "checkbox" === b.type
  2059. },
  2060. file: function(b) {
  2061. return "input" === b.nodeName.toLowerCase() && "file" === b.type
  2062. },
  2063. password: function(b) {
  2064. return "input" === b.nodeName.toLowerCase() && "password" === b.type
  2065. },
  2066. submit: function(b) {
  2067. var a = b.nodeName.toLowerCase();
  2068. return ("input" === a || "button" === a) && "submit" === b.type
  2069. },
  2070. image: function(b) {
  2071. return "input" === b.nodeName.toLowerCase() && "image" === b.type
  2072. },
  2073. reset: function(b) {
  2074. var a = b.nodeName.toLowerCase();
  2075. return ("input" === a || "button" === a) && "reset" === b.type
  2076. },
  2077. button: function(b) {
  2078. var a = b.nodeName.toLowerCase();
  2079. return "input" === a && "button" === b.type || "button" === a
  2080. },
  2081. input: function(b) {
  2082. return /input|select|textarea|button/i.test(b.nodeName)
  2083. },
  2084. focus: function(b) {
  2085. return b === b.ownerDocument.activeElement
  2086. }
  2087. },
  2088. setFilters: {
  2089. first: function(b, a) {
  2090. return 0 === a
  2091. },
  2092. last: function(b, a, d, c) {
  2093. return a === c.length - 1
  2094. },
  2095. even: function(b, a) {
  2096. return 0 === a % 2
  2097. },
  2098. odd: function(b, a) {
  2099. return 1 === a % 2
  2100. },
  2101. lt: function(b, a, d) {
  2102. return a < d[3] - 0
  2103. },
  2104. gt: function(b, a, d) {
  2105. return a > d[3] - 0
  2106. },
  2107. nth: function(b, a, d) {
  2108. return d[3] - 0 === a
  2109. },
  2110. eq: function(b, a, d) {
  2111. return d[3] - 0 === a
  2112. }
  2113. },
  2114. filter: {
  2115. PSEUDO: function(b, a, d, c) {
  2116. var e = a[1],
  2117. g = n.filters[e];
  2118. if (g) return g(b, d, a, c);
  2119. if ("contains" === e) return 0 <= (b.textContent || b.innerText || v([b]) || "").indexOf(a[3]);
  2120. if ("not" === e) {
  2121. a = a[3];
  2122. d = 0;
  2123. for (c = a.length; d < c; d++) if (a[d] === b) return ! 1;
  2124. return ! 0
  2125. }
  2126. t.error(e)
  2127. },
  2128. CHILD: function(b, a) {
  2129. var d, e, g, f, l, r;
  2130. d = a[1];
  2131. r = b;
  2132. switch (d) {
  2133. case "only":
  2134. case "first":
  2135. for (; r = r.previousSibling;) if (1 === r.nodeType) return ! 1;
  2136. if ("first" === d) return ! 0;
  2137. r = b;
  2138. case "last":
  2139. for (; r = r.nextSibling;) if (1 === r.nodeType) return ! 1;
  2140. return ! 0;
  2141. case "nth":
  2142. d = a[2];
  2143. e = a[3];
  2144. if (1 === d && 0 === e) return ! 0;
  2145. g = a[0];
  2146. if ((f = b.parentNode) && (f[c] !== g || !b.nodeIndex)) {
  2147. l = 0;
  2148. for (r = f.firstChild; r; r = r.nextSibling) 1 === r.nodeType && (r.nodeIndex = ++l);
  2149. f[c] = g
  2150. }
  2151. r = b.nodeIndex - e;
  2152. return 0 === d ? 0 === r: 0 === r % d && 0 <= r / d
  2153. }
  2154. },
  2155. ID: function(b, a) {
  2156. return 1 === b.nodeType && b.getAttribute("id") === a
  2157. },
  2158. TAG: function(b, a) {
  2159. return "*" === a && 1 === b.nodeType || !!b.nodeName && b.nodeName.toLowerCase() === a
  2160. },
  2161. CLASS: function(b, a) {
  2162. return - 1 < (" " + (b.className || b.getAttribute("class")) + " ").indexOf(a)
  2163. },
  2164. ATTR: function(b, a) {
  2165. var d = a[1],
  2166. d = t.attr ? t.attr(b, d) : n.attrHandle[d] ? n.attrHandle[d](b) : null != b[d] ? b[d] : b.getAttribute(d),
  2167. c = d + "",
  2168. e = a[2],
  2169. g = a[4];
  2170. return null == d ? "!=" === e: !e && t.attr ? null != d: "=" === e ? c === g: "*=" === e ? 0 <= c.indexOf(g) : "~=" === e ? 0 <= (" " + c + " ").indexOf(g) : g ? "!=" === e ? c !== g: "^=" === e ? 0 === c.indexOf(g) : "$=" === e ? c.substr(c.length - g.length) === g: "|=" === e ? c === g || c.substr(0, g.length + 1) === g + "-": !1 : c && !1 !== d
  2171. },
  2172. POS: function(b, a, d, c) {
  2173. var e = n.setFilters[a[2]];
  2174. if (e) return e(b, d, a, c)
  2175. }
  2176. }
  2177. },
  2178. y = n.match.POS,
  2179. s = function(b, a) {
  2180. return "\\" + (a - 0 + 1)
  2181. },
  2182. p;
  2183. for (p in n.match) n.match[p] = new RegExp(n.match[p].source + /(?![^\[]*\])(?![^\(]*\))/.source),
  2184. n.leftMatch[p] = new RegExp(/(^(?:.|\r|\n)*?)/.source + n.match[p].source.replace(/\\(\d+)/g, s));
  2185. var u = function(b, a) {
  2186. b = Array.prototype.slice.call(b, 0);
  2187. return a ? (a.push.apply(a, b), a) : b
  2188. };
  2189. try {
  2190. Array.prototype.slice.call(w.documentElement.childNodes, 0)[0].nodeType
  2191. } catch(z) {
  2192. u = function(b, a) {
  2193. var d = 0,
  2194. c = a || [];
  2195. if ("[object Array]" === g.call(b)) Array.prototype.push.apply(c, b);
  2196. else if ("number" == typeof b.length) for (var e = b.length; d < e; d++) c.push(b[d]);
  2197. else for (; b[d]; d++) c.push(b[d]);
  2198. return c
  2199. }
  2200. }
  2201. var A, x;
  2202. w.documentElement.compareDocumentPosition ? A = function(b, a) {
  2203. return b === a ? (l = !0, 0) : b.compareDocumentPosition && a.compareDocumentPosition ? b.compareDocumentPosition(a) & 4 ? -1 : 1 : b.compareDocumentPosition ? -1 : 1
  2204. }: (A = function(b, a) {
  2205. if (b === a) return l = !0,
  2206. 0;
  2207. if (b.sourceIndex && a.sourceIndex) return b.sourceIndex - a.sourceIndex;
  2208. var d, c, e = [],
  2209. g = [];
  2210. d = b.parentNode;
  2211. c = a.parentNode;
  2212. var f = d;
  2213. if (d === c) return x(b, a);
  2214. if (!d) return - 1;
  2215. if (!c) return 1;
  2216. for (; f;) e.unshift(f),
  2217. f = f.parentNode;
  2218. for (f = c; f;) g.unshift(f),
  2219. f = f.parentNode;
  2220. d = e.length;
  2221. c = g.length;
  2222. for (f = 0; f < d && f < c; f++) if (e[f] !== g[f]) return x(e[f], g[f]);
  2223. return f === d ? x(b, g[f], -1) : x(e[f], a, 1)
  2224. },
  2225. x = function(b, a, d) {
  2226. if (b === a) return d;
  2227. for (b = b.nextSibling; b;) {
  2228. if (b === a) return - 1;
  2229. b = b.nextSibling
  2230. }
  2231. return 1
  2232. }); (function() {
  2233. var b = w.createElement("div"),
  2234. a = "script" + (new Date).getTime(),
  2235. d = w.documentElement;
  2236. b.innerHTML = "<a name='" + a + "'/>";
  2237. d.insertBefore(b, d.firstChild);
  2238. w.getElementById(a) && (n.find.ID = function(b, a, d) {
  2239. if ("undefined" != typeof a.getElementById && !d) return (a = a.getElementById(b[1])) ? a.id === b[1] || "undefined" != typeof a.getAttributeNode && a.getAttributeNode("id").nodeValue === b[1] ? [a] : f: []
  2240. },
  2241. n.filter.ID = function(b, a) {
  2242. var d = "undefined" != typeof b.getAttributeNode && b.getAttributeNode("id");
  2243. return 1 === b.nodeType && d && d.nodeValue === a
  2244. });
  2245. d.removeChild(b);
  2246. d = b = null
  2247. })(); (function() {
  2248. var b = w.createElement("div");
  2249. b.appendChild(w.createComment(""));
  2250. 0 < b.getElementsByTagName("*").length && (n.find.TAG = function(b, a) {
  2251. var d = a.getElementsByTagName(b[1]);
  2252. if ("*" === b[1]) {
  2253. for (var c = [], e = 0; d[e]; e++) 1 === d[e].nodeType && c.push(d[e]);
  2254. d = c
  2255. }
  2256. return d
  2257. });
  2258. b.innerHTML = "<a href='#'></a>";
  2259. b.firstChild && "undefined" != typeof b.firstChild.getAttribute && "#" !== b.firstChild.getAttribute("href") && (n.attrHandle.href = function(b) {
  2260. return b.getAttribute("href", 2)
  2261. });
  2262. b = null
  2263. })();
  2264. w.querySelectorAll &&
  2265. function() {
  2266. var b = t,
  2267. a = w.createElement("div");
  2268. a.innerHTML = "<p class='TEST'></p>";
  2269. if (!a.querySelectorAll || 0 !== a.querySelectorAll(".TEST").length) {
  2270. t = function(a, d, c, e) {
  2271. d = d || w;
  2272. if (!e && !t.isXML(d)) {
  2273. var g = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(a);
  2274. if (g && (1 === d.nodeType || 9 === d.nodeType)) {
  2275. if (g[1]) return u(d.getElementsByTagName(a), c);
  2276. if (g[2] && n.find.CLASS && d.getElementsByClassName) return u(d.getElementsByClassName(g[2]), c)
  2277. }
  2278. if (9 === d.nodeType) {
  2279. if ("body" === a && d.body) return u([d.body], c);
  2280. if (g && g[3]) {
  2281. var f = d.getElementById(g[3]);
  2282. if (!f || !f.parentNode) return u([], c);
  2283. if (f.id === g[3]) return u([f], c)
  2284. }
  2285. try {
  2286. return u(d.querySelectorAll(a), c)
  2287. } catch(l) {}
  2288. } else if (1 === d.nodeType && "object" !== d.nodeName.toLowerCase()) {
  2289. var g = d,
  2290. r = (f = d.getAttribute("id")) || "__sizzle__",
  2291. k = d.parentNode,
  2292. m = /^\s*[+~]/.test(a);
  2293. f ? r = r.replace(/'/g, "\\$&") : d.setAttribute("id", r);
  2294. m && k && (d = d.parentNode);
  2295. try {
  2296. if (!m || k) return u(d.querySelectorAll("[id='" + r + "'] " + a), c)
  2297. } catch(q) {} finally {
  2298. f || g.removeAttribute("id")
  2299. }
  2300. }
  2301. }
  2302. return b(a, d, c, e)
  2303. };
  2304. for (var d in b) t[d] = b[d];
  2305. a = null
  2306. }
  2307. } (); (function() {
  2308. var b = w.documentElement,
  2309. a = b.matchesSelector || b.mozMatchesSelector || b.webkitMatchesSelector || b.msMatchesSelector;
  2310. if (a) {
  2311. var d = !a.call(w.createElement("div"), "div"),
  2312. c = !1;
  2313. try {
  2314. a.call(w.documentElement, "[test!='']:sizzle")
  2315. } catch(e) {
  2316. c = !0
  2317. }
  2318. t.matchesSelector = function(b, e) {
  2319. e = e.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
  2320. if (!t.isXML(b)) try {
  2321. if (c || !n.match.PSEUDO.test(e) && !/!=/.test(e)) {
  2322. var g = a.call(b, e);
  2323. if (g || !d || b.document && 11 !== b.document.nodeType) return g
  2324. }
  2325. } catch(f) {}
  2326. return 0 < t(e, null, null, [b]).length
  2327. }
  2328. }
  2329. })(); (function() {
  2330. var b = w.createElement("div");
  2331. b.innerHTML = "<div class='test e'></div><div class='test'></div>";
  2332. b.getElementsByClassName && 0 !== b.getElementsByClassName("e").length && (b.lastChild.className = "e", 1 !== b.getElementsByClassName("e").length && (n.order.splice(1, 0, "CLASS"), n.find.CLASS = function(b, a, d) {
  2333. if ("undefined" != typeof a.getElementsByClassName && !d) return a.getElementsByClassName(b[1])
  2334. },
  2335. b = null))
  2336. })();
  2337. w.documentElement.contains ? t.contains = function(b, a) {
  2338. return b !== a && (b.contains ? b.contains(a) : !0)
  2339. }: w.documentElement.compareDocumentPosition ? t.contains = function(b, a) {
  2340. return !! (b.compareDocumentPosition(a) & 16)
  2341. }: t.contains = function() {
  2342. return ! 1
  2343. };
  2344. t.isXML = function(b) {
  2345. return (b = (b ? b.ownerDocument || b: 0).documentElement) ? "HTML" !== b.nodeName: !1
  2346. };
  2347. var D = function(b, a, d) {
  2348. var c, e = [],
  2349. g = "";
  2350. for (a = a.nodeType ? [a] : a; c = n.match.PSEUDO.exec(b);) g += c[0],
  2351. b = b.replace(n.match.PSEUDO, "");
  2352. b = n.relative[b] ? b + "*": b;
  2353. c = 0;
  2354. for (var f = a.length; c < f; c++) t(b, a[c], e, d);
  2355. return t.filter(g, e)
  2356. };
  2357. t.attr = m.attr;
  2358. t.selectors.attrMap = {};
  2359. m.find = t;
  2360. m.expr = t.selectors;
  2361. m.expr[":"] = m.expr.filters;
  2362. m.unique = t.uniqueSort;
  2363. m.text = t.getText;
  2364. m.isXMLDoc = t.isXML;
  2365. m.contains = t.contains
  2366. })();
  2367. var jb = /Until$/,
  2368. kb = /^(?:parents|prevUntil|prevAll)/,
  2369. lb = /,/,
  2370. Xa = /^.[^:#\[\.,]*$/,
  2371. mb = Array.prototype.slice,
  2372. Da = m.expr.match.POS,
  2373. nb = {
  2374. children: !0,
  2375. contents: !0,
  2376. next: !0,
  2377. prev: !0
  2378. };
  2379. m.fn.extend({
  2380. find: function(b) {
  2381. var a = this,
  2382. d, c;
  2383. if ("string" != typeof b) return m(b).filter(function() {
  2384. d = 0;
  2385. for (c = a.length; d < c; d++) if (m.contains(a[d], this)) return ! 0
  2386. });
  2387. var e = this.pushStack("", "find", b),
  2388. g,
  2389. f,
  2390. l;
  2391. d = 0;
  2392. for (c = this.length; d < c; d++) if (g = e.length, m.find(b, this[d], e), 0 < d) for (f = g; f < e.length; f++) for (l = 0; l < g; l++) if (e[l] === e[f]) {
  2393. e.splice(f--, 1);
  2394. break
  2395. }
  2396. return e
  2397. },
  2398. has: function(b) {
  2399. var a = m(b);
  2400. return this.filter(function() {
  2401. for (var b = 0,
  2402. d = a.length; b < d; b++) if (m.contains(this, a[b])) return ! 0
  2403. })
  2404. },
  2405. not: function(b) {
  2406. return this.pushStack(x(this, b, !1), "not", b)
  2407. },
  2408. filter: function(b) {
  2409. return this.pushStack(x(this, b, !0), "filter", b)
  2410. },
  2411. is: function(b) {
  2412. return !! b && ("string" == typeof b ? Da.test(b) ? 0 <= m(b, this.context).index(this[0]) : 0 < m.filter(b, this).length: 0 < this.filter(b).length)
  2413. },
  2414. closest: function(b, a) {
  2415. var d = [],
  2416. c,
  2417. e,
  2418. g = this[0];
  2419. if (m.isArray(b)) {
  2420. for (e = 1; g && g.ownerDocument && g !== a;) {
  2421. for (c = 0; c < b.length; c++) m(g).is(b[c]) && d.push({
  2422. selector: b[c],
  2423. elem: g,
  2424. level: e
  2425. });
  2426. g = g.parentNode;
  2427. e++
  2428. }
  2429. return d
  2430. }
  2431. var f = Da.test(b) || "string" != typeof b ? m(b, a || this.context) : 0;
  2432. c = 0;
  2433. for (e = this.length; c < e; c++) for (g = this[c]; g;) {
  2434. if (f ? -1 < f.index(g) : m.find.matchesSelector(g, b)) {
  2435. d.push(g);
  2436. break
  2437. }
  2438. g = g.parentNode;
  2439. if (!g || !g.ownerDocument || g === a || 11 === g.nodeType) break
  2440. }
  2441. d = 1 < d.length ? m.unique(d) : d;
  2442. return this.pushStack(d, "closest", b)
  2443. },
  2444. index: function(b) {
  2445. return b ? "string" == typeof b ? m.inArray(this[0], m(b)) : m.inArray(b.jquery ? b[0] : b, this) : this[0] && this[0].parentNode ? this.prevAll().length: -1
  2446. },
  2447. add: function(b, a) {
  2448. var d = "string" == typeof b ? m(b, a) : m.makeArray(b && b.nodeType ? [b] : b),
  2449. c = m.merge(this.get(), d);
  2450. return this.pushStack(D(d[0]) || D(c[0]) ? c: m.unique(c))
  2451. },
  2452. andSelf: function() {
  2453. return this.add(this.prevObject)
  2454. }
  2455. });
  2456. m.each({
  2457. parent: function(b) {
  2458. return (b = b.parentNode) && 11 !== b.nodeType ? b: null
  2459. },
  2460. parents: function(b) {
  2461. return m.dir(b, "parentNode")
  2462. },
  2463. parentsUntil: function(b, a, d) {
  2464. return m.dir(b, "parentNode", d)
  2465. },
  2466. next: function(b) {
  2467. return m.nth(b, 2, "nextSibling")
  2468. },
  2469. prev: function(b) {
  2470. return m.nth(b, 2, "previousSibling")
  2471. },
  2472. nextAll: function(b) {
  2473. return m.dir(b, "nextSibling")
  2474. },
  2475. prevAll: function(b) {
  2476. return m.dir(b, "previousSibling")
  2477. },
  2478. nextUntil: function(b, a, d) {
  2479. return m.dir(b, "nextSibling", d)
  2480. },
  2481. prevUntil: function(b, a, d) {
  2482. return m.dir(b, "previousSibling", d)
  2483. },
  2484. siblings: function(b) {
  2485. return m.sibling(b.parentNode.firstChild, b)
  2486. },
  2487. children: function(b) {
  2488. return m.sibling(b.firstChild)
  2489. },
  2490. contents: function(b) {
  2491. return m.nodeName(b, "iframe") ? b.contentDocument || b.contentWindow.document: m.makeArray(b.childNodes)
  2492. }
  2493. },
  2494. function(b, a) {
  2495. m.fn[b] = function(d, c) {
  2496. var e = m.map(this, a, d);
  2497. jb.test(b) || (c = d);
  2498. c && "string" == typeof c && (e = m.filter(c, e));
  2499. e = 1 < this.length && !nb[b] ? m.unique(e) : e; (1 < this.length || lb.test(c)) && kb.test(b) && (e = e.reverse());
  2500. return this.pushStack(e, b, mb.call(arguments).join(","))
  2501. }
  2502. });
  2503. m.extend({
  2504. filter: function(b, a, d) {
  2505. d && (b = ":not(" + b + ")");
  2506. return 1 === a.length ? m.find.matchesSelector(a[0], b) ? [a[0]] : [] : m.find.matches(b, a)
  2507. },
  2508. dir: function(b, a, d) {
  2509. var c = [];
  2510. for (b = b[a]; b && 9 !== b.nodeType && (d === f || 1 !== b.nodeType || !m(b).is(d));) 1 === b.nodeType && c.push(b),
  2511. b = b[a];
  2512. return c
  2513. },
  2514. nth: function(b, a, d, c) {
  2515. a = a || 1;
  2516. for (c = 0; b && (1 !== b.nodeType || ++c !== a); b = b[d]);
  2517. return b
  2518. },
  2519. sibling: function(b, a) {
  2520. for (var d = []; b; b = b.nextSibling) 1 === b.nodeType && b !== a && d.push(b);
  2521. return d
  2522. }
  2523. });
  2524. var ra = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
  2525. ob = / jQuery\d+="(?:\d+|null)"/g,
  2526. la = /^\s+/,
  2527. Ea = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
  2528. Fa = /<([\w:]+)/,
  2529. pb = /<tbody/i,
  2530. qb = /<|&#?\w+;/,
  2531. rb = /<(?:script|style)/i,
  2532. sb = /<(?:script|object|embed|option|style)/i,
  2533. Ga = new RegExp("<(?:" + ra + ")", "i"),
  2534. Ha = /checked\s*(?:[^=]|=\s*.checked.)/i,
  2535. tb = /\/(java|ecma)script/i,
  2536. Wa = /^\s*<!(?:\[CDATA\[|\-\-)/,
  2537. I = {
  2538. option: [1, "<select multiple='multiple'>", "</select>"],
  2539. legend: [1, "<fieldset>", "</fieldset>"],
  2540. thead: [1, "<table>", "</table>"],
  2541. tr: [2, "<table><tbody>", "</tbody></table>"],
  2542. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  2543. col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"],
  2544. area: [1, "<map>", "</map>"],
  2545. _default: [0, "", ""]
  2546. },
  2547. Ia = A(w);
  2548. I.optgroup = I.option;
  2549. I.tbody = I.tfoot = I.colgroup = I.caption = I.thead;
  2550. I.th = I.td;
  2551. m.support.htmlSerialize || (I._default = [1, "div<div>", "</div>"]);
  2552. m.fn.extend({
  2553. text: function(b) {
  2554. return m.isFunction(b) ? this.each(function(a) {
  2555. var d = m(this);
  2556. d.text(b.call(this, a, d.text()))
  2557. }) : "object" != typeof b && b !== f ? this.empty().append((this[0] && this[0].ownerDocument || w).createTextNode(b)) : m.text(this)
  2558. },
  2559. wrapAll: function(b) {
  2560. if (m.isFunction(b)) return this.each(function(a) {
  2561. m(this).wrapAll(b.call(this, a))
  2562. });
  2563. if (this[0]) {
  2564. var a = m(b, this[0].ownerDocument).eq(0).clone(!0);
  2565. this[0].parentNode && a.insertBefore(this[0]);
  2566. a.map(function() {
  2567. for (var b = this; b.firstChild && 1 === b.firstChild.nodeType;) b = b.firstChild;
  2568. return b
  2569. }).append(this)
  2570. }
  2571. return this
  2572. },
  2573. wrapInner: function(b) {
  2574. return m.isFunction(b) ? this.each(function(a) {
  2575. m(this).wrapInner(b.call(this, a))
  2576. }) : this.each(function() {
  2577. var a = m(this),
  2578. d = a.contents();
  2579. d.length ? d.wrapAll(b) : a.append(b)
  2580. })
  2581. },
  2582. wrap: function(b) {
  2583. var a = m.isFunction(b);
  2584. return this.each(function(d) {
  2585. m(this).wrapAll(a ? b.call(this, d) : b)
  2586. })
  2587. },
  2588. unwrap: function() {
  2589. return this.parent().each(function() {
  2590. m.nodeName(this, "body") || m(this).replaceWith(this.childNodes)
  2591. }).end()
  2592. },
  2593. append: function() {
  2594. return this.domManip(arguments, !0,
  2595. function(b) {
  2596. 1 === this.nodeType && this.appendChild(b)
  2597. })
  2598. },
  2599. prepend: function() {
  2600. return this.domManip(arguments, !0,
  2601. function(b) {
  2602. 1 === this.nodeType && this.insertBefore(b, this.firstChild)
  2603. })
  2604. },
  2605. before: function() {
  2606. if (this[0] && this[0].parentNode) return this.domManip(arguments, !1,
  2607. function(b) {
  2608. this.parentNode.insertBefore(b, this)
  2609. });
  2610. if (arguments.length) {
  2611. var b = m.clean(arguments);
  2612. b.push.apply(b, this.toArray());
  2613. return this.pushStack(b, "before", arguments)
  2614. }
  2615. },
  2616. after: function() {
  2617. if (this[0] && this[0].parentNode) return this.domManip(arguments, !1,
  2618. function(b) {
  2619. this.parentNode.insertBefore(b, this.nextSibling)
  2620. });
  2621. if (arguments.length) {
  2622. var b = this.pushStack(this, "after", arguments);
  2623. b.push.apply(b, m.clean(arguments));
  2624. return b
  2625. }
  2626. },
  2627. remove: function(b, a) {
  2628. for (var d = 0,
  2629. c; null != (c = this[d]); d++) if (!b || m.filter(b, [c]).length) ! a && 1 === c.nodeType && (m.cleanData(c.getElementsByTagName("*")), m.cleanData([c])),
  2630. c.parentNode && c.parentNode.removeChild(c);
  2631. return this
  2632. },
  2633. empty: function() {
  2634. for (var b = 0,
  2635. a; null != (a = this[b]); b++) for (1 === a.nodeType && m.cleanData(a.getElementsByTagName("*")); a.firstChild;) a.removeChild(a.firstChild);
  2636. return this
  2637. },
  2638. clone: function(b, a) {
  2639. b = null == b ? !1 : b;
  2640. a = null == a ? b: a;
  2641. return this.map(function() {
  2642. return m.clone(this, b, a)
  2643. })
  2644. },
  2645. html: function(b) {
  2646. if (b === f) return this[0] && 1 === this[0].nodeType ? this[0].innerHTML.replace(ob, "") : null;
  2647. if ("string" != typeof b || rb.test(b) || !m.support.leadingWhitespace && la.test(b) || I[(Fa.exec(b) || ["", ""])[1].toLowerCase()]) m.isFunction(b) ? this.each(function(a) {
  2648. var d = m(this);
  2649. d.html(b.call(this, a, d.html()))
  2650. }) : this.empty().append(b);
  2651. else {
  2652. b = b.replace(Ea, "<$1></$2>");
  2653. try {
  2654. for (var a = 0,
  2655. d = this.length; a < d; a++) 1 === this[a].nodeType && (m.cleanData(this[a].getElementsByTagName("*")), this[a].innerHTML = b)
  2656. } catch(c) {
  2657. this.empty().append(b)
  2658. }
  2659. }
  2660. return this
  2661. },
  2662. replaceWith: function(b) {
  2663. if (this[0] && this[0].parentNode) {
  2664. if (m.isFunction(b)) return this.each(function(a) {
  2665. var d = m(this),
  2666. c = d.html();
  2667. d.replaceWith(b.call(this, a, c))
  2668. });
  2669. "string" != typeof b && (b = m(b).detach());
  2670. return this.each(function() {
  2671. var a = this.nextSibling,
  2672. d = this.parentNode;
  2673. m(this).remove();
  2674. a ? m(a).before(b) : m(d).append(b)
  2675. })
  2676. }
  2677. return this.length ? this.pushStack(m(m.isFunction(b) ? b() : b), "replaceWith", b) : this
  2678. },
  2679. detach: function(b) {
  2680. return this.remove(b, !0)
  2681. },
  2682. domManip: function(b, a, d) {
  2683. var c, e, g, l = b[0],
  2684. r = [];
  2685. if (!m.support.checkClone && 3 === arguments.length && "string" == typeof l && Ha.test(l)) return this.each(function() {
  2686. m(this).domManip(b, a, d, !0)
  2687. });
  2688. if (m.isFunction(l)) return this.each(function(c) {
  2689. var e = m(this);
  2690. b[0] = l.call(this, c, a ? e.html() : f);
  2691. e.domManip(b, a, d)
  2692. });
  2693. if (this[0]) {
  2694. g = l && l.parentNode;
  2695. m.support.parentNode && g && 11 === g.nodeType && g.childNodes.length === this.length ? c = {
  2696. fragment: g
  2697. }: c = m.buildFragment(b, this, r);
  2698. g = c.fragment;
  2699. 1 === g.childNodes.length ? e = g = g.firstChild: e = g.firstChild;
  2700. if (e) {
  2701. a = a && m.nodeName(e, "tr");
  2702. for (var k = 0,
  2703. q = this.length,
  2704. h = q - 1; k < q; k++) d.call(a ? z(this[k], e) : this[k], c.cacheable || 1 < q && k < h ? m.clone(g, !0, !0) : g)
  2705. }
  2706. r.length && m.each(r, t)
  2707. }
  2708. return this
  2709. }
  2710. });
  2711. m.buildFragment = function(b, a, d) {
  2712. var c, e, g, f, l = b[0];
  2713. a && a[0] && (f = a[0].ownerDocument || a[0]);
  2714. f.createDocumentFragment || (f = w);
  2715. 1 === b.length && "string" == typeof l && 512 > l.length && f === w && "<" === l.charAt(0) && !(sb.test(l) || !m.support.checkClone && Ha.test(l) || !m.support.html5Clone && Ga.test(l)) && (e = !0, g = m.fragments[l], g && 1 !== g && (c = g));
  2716. c || (c = f.createDocumentFragment(), m.clean(b, f, c, d));
  2717. e && (m.fragments[l] = g ? c: 1);
  2718. return {
  2719. fragment: c,
  2720. cacheable: e
  2721. }
  2722. };
  2723. m.fragments = {};
  2724. m.each({
  2725. appendTo: "append",
  2726. prependTo: "prepend",
  2727. insertBefore: "before",
  2728. insertAfter: "after",
  2729. replaceAll: "replaceWith"
  2730. },
  2731. function(b, a) {
  2732. m.fn[b] = function(d) {
  2733. var c = [];
  2734. d = m(d);
  2735. var e = 1 === this.length && this[0].parentNode;
  2736. if (e && 11 === e.nodeType && 1 === e.childNodes.length && 1 === d.length) return d[a](this[0]),
  2737. this;
  2738. for (var e = 0,
  2739. g = d.length; e < g; e++) {
  2740. var f = (0 < e ? this.clone(!0) : this).get();
  2741. m(d[e])[a](f);
  2742. c = c.concat(f)
  2743. }
  2744. return this.pushStack(c, b, d.selector)
  2745. }
  2746. });
  2747. m.extend({
  2748. clone: function(b, a, d) {
  2749. var c, e, g;
  2750. m.support.html5Clone || !Ga.test("<" + b.nodeName) ? c = b.cloneNode(!0) : (c = w.createElement("div"), Ia.appendChild(c), c.innerHTML = b.outerHTML, c = c.firstChild);
  2751. var f = c;
  2752. if (! (m.support.noCloneEvent && m.support.noCloneChecked || 1 !== b.nodeType && 11 !== b.nodeType || m.isXMLDoc(b))) for (s(b, f), c = y(b), e = y(f), g = 0; c[g]; ++g) e[g] && s(c[g], e[g]);
  2753. if (a && (u(b, f), d)) for (c = y(b), e = y(f), g = 0; c[g]; ++g) u(c[g], e[g]);
  2754. return f
  2755. },
  2756. clean: function(b, a, d, c) {
  2757. a = a || w;
  2758. "undefined" == typeof a.createElement && (a = a.ownerDocument || a[0] && a[0].ownerDocument || w);
  2759. for (var e = [], g, f = 0, l; null != (l = b[f]); f++) if ("number" == typeof l && (l += ""), l) {
  2760. if ("string" == typeof l) if (qb.test(l)) {
  2761. l = l.replace(Ea, "<$1></$2>");
  2762. g = (Fa.exec(l) || ["", ""])[1].toLowerCase();
  2763. var r = I[g] || I._default,
  2764. k = r[0],
  2765. q = a.createElement("div");
  2766. a === w ? Ia.appendChild(q) : A(a).appendChild(q);
  2767. for (q.innerHTML = r[1] + l + r[2]; k--;) q = q.lastChild;
  2768. if (!m.support.tbody) for (k = pb.test(l), r = "table" !== g || k ? "<table>" !== r[1] || k ? [] : q.childNodes: q.firstChild && q.firstChild.childNodes, g = r.length - 1; 0 <= g; --g) m.nodeName(r[g], "tbody") && !r[g].childNodes.length && r[g].parentNode.removeChild(r[g]); ! m.support.leadingWhitespace && la.test(l) && q.insertBefore(a.createTextNode(la.exec(l)[0]), q.firstChild);
  2769. l = q.childNodes
  2770. } else l = a.createTextNode(l);
  2771. var h;
  2772. if (!m.support.appendChecked) if (l[0] && "number" == typeof(h = l.length)) for (g = 0; g < h; g++) v(l[g]);
  2773. else v(l);
  2774. l.nodeType ? e.push(l) : e = m.merge(e, l)
  2775. }
  2776. if (d) for (b = function(b) {
  2777. return ! b.type || tb.test(b.type)
  2778. },
  2779. f = 0; e[f]; f++) ! c || !m.nodeName(e[f], "script") || e[f].type && "text/javascript" !== e[f].type.toLowerCase() ? (1 === e[f].nodeType && (a = m.grep(e[f].getElementsByTagName("script"), b), e.splice.apply(e, [f + 1, 0].concat(a))), d.appendChild(e[f])) : c.push(e[f].parentNode ? e[f].parentNode.removeChild(e[f]) : e[f]);
  2780. return e
  2781. },
  2782. cleanData: function(b) {
  2783. for (var a, d, c = m.cache,
  2784. e = m.event.special,
  2785. g = m.support.deleteExpando,
  2786. f = 0,
  2787. l; null != (l = b[f]); f++) if (!l.nodeName || !m.noData[l.nodeName.toLowerCase()]) if (d = l[m.expando]) {
  2788. if ((a = c[d]) && a.events) {
  2789. for (var r in a.events) e[r] ? m.event.remove(l, r) : m.removeEvent(l, r, a.handle);
  2790. a.handle && (a.handle.elem = null)
  2791. }
  2792. g ? delete l[m.expando] : l.removeAttribute && l.removeAttribute(m.expando);
  2793. delete c[d]
  2794. }
  2795. }
  2796. });
  2797. var ma = /alpha\([^)]*\)/i,
  2798. ub = /opacity=([^)]*)/,
  2799. vb = /([A-Z]|^ms)/g,
  2800. Ja = /^-?\d+(?:px)?$/i,
  2801. wb = /^-?\d/,
  2802. xb = /^([\-+])=([\-+.\de]+)/,
  2803. yb = {
  2804. position: "absolute",
  2805. visibility: "hidden",
  2806. display: "block"
  2807. },
  2808. Ua = ["Left", "Right"],
  2809. Va = ["Top", "Bottom"],
  2810. S,
  2811. Ka,
  2812. La;
  2813. m.fn.css = function(b, a) {
  2814. return 2 === arguments.length && a === f ? this: m.access(this, b, a, !0,
  2815. function(b, a, d) {
  2816. return d !== f ? m.style(b, a, d) : m.css(b, a)
  2817. })
  2818. };
  2819. m.extend({
  2820. cssHooks: {
  2821. opacity: {
  2822. get: function(b, a) {
  2823. if (a) {
  2824. var d = S(b, "opacity", "opacity");
  2825. return "" === d ? "1": d
  2826. }
  2827. return b.style.opacity
  2828. }
  2829. }
  2830. },
  2831. cssNumber: {
  2832. fillOpacity: !0,
  2833. fontWeight: !0,
  2834. lineHeight: !0,
  2835. opacity: !0,
  2836. orphans: !0,
  2837. widows: !0,
  2838. zIndex: !0,
  2839. zoom: !0
  2840. },
  2841. cssProps: {
  2842. "float": m.support.cssFloat ? "cssFloat": "styleFloat"
  2843. },
  2844. style: function(b, a, d, c) {
  2845. if (b && 3 !== b.nodeType && 8 !== b.nodeType && b.style) {
  2846. var e, g = m.camelCase(a),
  2847. l = b.style,
  2848. r = m.cssHooks[g];
  2849. a = m.cssProps[g] || g;
  2850. if (d === f) return r && "get" in r && (e = r.get(b, !1, c)) !== f ? e: l[a];
  2851. c = typeof d;
  2852. "string" === c && (e = xb.exec(d)) && (d = +(e[1] + 1) * +e[2] + parseFloat(m.css(b, a)), c = "number");
  2853. if (! (null == d || "number" === c && isNaN(d) || ("number" === c && !m.cssNumber[g] && (d += "px"), r && "set" in r && (d = r.set(b, d)) === f))) try {
  2854. l[a] = d
  2855. } catch(k) {}
  2856. }
  2857. },
  2858. css: function(b, a, d) {
  2859. var c, e;
  2860. a = m.camelCase(a);
  2861. e = m.cssHooks[a];
  2862. a = m.cssProps[a] || a;
  2863. "cssFloat" === a && (a = "float");
  2864. if (e && "get" in e && (c = e.get(b, !0, d)) !== f) return c;
  2865. if (S) return S(b, a)
  2866. },
  2867. swap: function(b, a, d) {
  2868. var c = {},
  2869. e;
  2870. for (e in a) c[e] = b.style[e],
  2871. b.style[e] = a[e];
  2872. d.call(b);
  2873. for (e in a) b.style[e] = c[e]
  2874. }
  2875. });
  2876. m.curCSS = m.css;
  2877. m.each(["height", "width"],
  2878. function(b, a) {
  2879. m.cssHooks[a] = {
  2880. get: function(b, d, c) {
  2881. var e;
  2882. if (d) {
  2883. if (0 !== b.offsetWidth) return l(b, a, c);
  2884. m.swap(b, yb,
  2885. function() {
  2886. e = l(b, a, c)
  2887. });
  2888. return e
  2889. }
  2890. },
  2891. set: function(b, a) {
  2892. if (!Ja.test(a)) return a;
  2893. a = parseFloat(a);
  2894. if (0 <= a) return a + "px"
  2895. }
  2896. }
  2897. });
  2898. m.support.opacity || (m.cssHooks.opacity = {
  2899. get: function(b, a) {
  2900. return ub.test((a && b.currentStyle ? b.currentStyle.filter: b.style.filter) || "") ? parseFloat(RegExp.$1) / 100 + "": a ? "1": ""
  2901. },
  2902. set: function(b, a) {
  2903. var d = b.style,
  2904. c = b.currentStyle,
  2905. e = m.isNumeric(a) ? "alpha(opacity=" + 100 * a + ")": "",
  2906. g = c && c.filter || d.filter || "";
  2907. d.zoom = 1;
  2908. if (1 <= a && "" === m.trim(g.replace(ma, "")) && (d.removeAttribute("filter"), c && !c.filter)) return;
  2909. d.filter = ma.test(g) ? g.replace(ma, e) : g + " " + e
  2910. }
  2911. });
  2912. m(function() {
  2913. m.support.reliableMarginRight || (m.cssHooks.marginRight = {
  2914. get: function(b, a) {
  2915. var d;
  2916. m.swap(b, {
  2917. display: "inline-block"
  2918. },
  2919. function() {
  2920. a ? d = S(b, "margin-right", "marginRight") : d = b.style.marginRight
  2921. });
  2922. return d
  2923. }
  2924. })
  2925. });
  2926. w.defaultView && w.defaultView.getComputedStyle && (Ka = function(b, a) {
  2927. var d, c, e;
  2928. a = a.replace(vb, "-$1").toLowerCase(); (c = b.ownerDocument.defaultView) && (e = c.getComputedStyle(b, null)) && (d = e.getPropertyValue(a), "" === d && !m.contains(b.ownerDocument.documentElement, b) && (d = m.style(b, a)));
  2929. return d
  2930. });
  2931. w.documentElement.currentStyle && (La = function(b, a) {
  2932. var d, c, e, g = b.currentStyle && b.currentStyle[a],
  2933. f = b.style;
  2934. null === g && f && (e = f[a]) && (g = e); ! Ja.test(g) && wb.test(g) && (d = f.left, c = b.runtimeStyle && b.runtimeStyle.left, c && (b.runtimeStyle.left = b.currentStyle.left), f.left = "fontSize" === a ? "1em": g || 0, g = f.pixelLeft + "px", f.left = d, c && (b.runtimeStyle.left = c));
  2935. return "" === g ? "auto": g
  2936. });
  2937. S = Ka || La;
  2938. m.expr && m.expr.filters && (m.expr.filters.hidden = function(b) {
  2939. var a = b.offsetHeight;
  2940. return 0 === b.offsetWidth && 0 === a || !m.support.reliableHiddenOffsets && "none" === (b.style && b.style.display || m.css(b, "display"))
  2941. },
  2942. m.expr.filters.visible = function(b) {
  2943. return ! m.expr.filters.hidden(b)
  2944. });
  2945. var zb = /%20/g,
  2946. Ta = /\[\]$/,
  2947. Ma = /\r?\n/g,
  2948. Ab = /#.*$/,
  2949. Bb = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg,
  2950. Cb = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
  2951. Db = /^(?:GET|HEAD)$/,
  2952. Eb = /^\/\//,
  2953. Na = /\?/,
  2954. Fb = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
  2955. Gb = /^(?:select|textarea)/i,
  2956. qa = /\s+/,
  2957. Hb = /([?&])_=[^&]*/,
  2958. Oa = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
  2959. Pa = m.fn.load,
  2960. ga = {},
  2961. Qa = {},
  2962. M, P, Ra = ["*/"] + ["*"];
  2963. try {
  2964. M = V.href
  2965. } catch(Nb) {
  2966. M = w.createElement("a"),
  2967. M.href = "",
  2968. M = M.href
  2969. }
  2970. P = Oa.exec(M.toLowerCase()) || [];
  2971. m.fn.extend({
  2972. load: function(b, a, d) {
  2973. if ("string" != typeof b && Pa) return Pa.apply(this, arguments);
  2974. if (!this.length) return this;
  2975. var c = b.indexOf(" ");
  2976. if (0 <= c) {
  2977. var e = b.slice(c, b.length);
  2978. b = b.slice(0, c)
  2979. }
  2980. c = "GET";
  2981. a && (m.isFunction(a) ? (d = a, a = f) : "object" == typeof a && (a = m.param(a, m.ajaxSettings.traditional), c = "POST"));
  2982. var g = this;
  2983. m.ajax({
  2984. url: b,
  2985. type: c,
  2986. dataType: "html",
  2987. data: a,
  2988. complete: function(b, a, c) {
  2989. c = b.responseText;
  2990. b.isResolved() && (b.done(function(b) {
  2991. c = b
  2992. }), g.html(e ? m("<div>").append(c.replace(Fb, "")).find(e) : c));
  2993. d && g.each(d, [c, a, b])
  2994. }
  2995. });
  2996. return this
  2997. },
  2998. serialize: function() {
  2999. return m.param(this.serializeArray())
  3000. },
  3001. serializeArray: function() {
  3002. return this.map(function() {
  3003. return this.elements ? m.makeArray(this.elements) : this
  3004. }).filter(function() {
  3005. return this.name && !this.disabled && (this.checked || Gb.test(this.nodeName) || Cb.test(this.type))
  3006. }).map(function(b, a) {
  3007. var d = m(this).val();
  3008. return null == d ? null: m.isArray(d) ? m.map(d,
  3009. function(b, d) {
  3010. return {
  3011. name: a.name,
  3012. value: b.replace(Ma, "\r\n")
  3013. }
  3014. }) : {
  3015. name: a.name,
  3016. value: d.replace(Ma, "\r\n")
  3017. }
  3018. }).get()
  3019. }
  3020. });
  3021. m.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
  3022. function(b, a) {
  3023. m.fn[a] = function(b) {
  3024. return this.on(a, b)
  3025. }
  3026. });
  3027. m.each(["get", "post"],
  3028. function(b, a) {
  3029. m[a] = function(b, d, c, e) {
  3030. m.isFunction(d) && (e = e || c, c = d, d = f);
  3031. return m.ajax({
  3032. type: a,
  3033. url: b,
  3034. data: d,
  3035. success: c,
  3036. dataType: e
  3037. })
  3038. }
  3039. });
  3040. m.extend({
  3041. getScript: function(b, a) {
  3042. return m.get(b, f, a, "script")
  3043. },
  3044. getJSON: function(b, a, d) {
  3045. return m.get(b, a, d, "json")
  3046. },
  3047. ajaxSetup: function(b, a) {
  3048. a ? g(b, m.ajaxSettings) : (a = b, b = m.ajaxSettings);
  3049. g(b, a);
  3050. return b
  3051. },
  3052. ajaxSettings: {
  3053. url: M,
  3054. isLocal: /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/.test(P[1]),
  3055. global: !0,
  3056. type: "GET",
  3057. contentType: "application/x-www-form-urlencoded",
  3058. processData: !0,
  3059. async: !0,
  3060. accepts: {
  3061. xml: "application/xml, text/xml",
  3062. html: "text/html",
  3063. text: "text/plain",
  3064. json: "application/json, text/javascript",
  3065. "*": Ra
  3066. },
  3067. contents: {
  3068. xml: /xml/,
  3069. html: /html/,
  3070. json: /json/
  3071. },
  3072. responseFields: {
  3073. xml: "responseXML",
  3074. text: "responseText"
  3075. },
  3076. converters: {
  3077. "* text": a.String,
  3078. "text html": !0,
  3079. "text json": m.parseJSON,
  3080. "text xml": m.parseXML
  3081. },
  3082. flatOptions: {
  3083. context: !0,
  3084. url: !0
  3085. }
  3086. },
  3087. ajaxPrefilter: k(ga),
  3088. ajaxTransport: k(Qa),
  3089. ajax: function(b, a) {
  3090. function d(b, a, r, t) {
  3091. if (2 !== z) {
  3092. z = 2;
  3093. s && clearTimeout(s);
  3094. p = f;
  3095. v = t || "";
  3096. x.readyState = 0 < b ? 4 : 0;
  3097. var n, y, E;
  3098. t = a;
  3099. if (r) {
  3100. var u = c,
  3101. H = x,
  3102. fa = u.contents,
  3103. w = u.dataTypes,
  3104. D = u.responseFields,
  3105. B, C, F, G;
  3106. for (C in D) C in r && (H[D[C]] = r[C]);
  3107. for (;
  3108. "*" === w[0];) w.shift(),
  3109. B === f && (B = u.mimeType || H.getResponseHeader("content-type"));
  3110. if (B) for (C in fa) if (fa[C] && fa[C].test(B)) {
  3111. w.unshift(C);
  3112. break
  3113. }
  3114. if (w[0] in r) F = w[0];
  3115. else {
  3116. for (C in r) {
  3117. if (!w[0] || u.converters[C + " " + w[0]]) {
  3118. F = C;
  3119. break
  3120. }
  3121. G || (G = C)
  3122. }
  3123. F = F || G
  3124. }
  3125. F ? (F !== w[0] && w.unshift(F), r = r[F]) : r = void 0
  3126. } else r = f;
  3127. if (200 <= b && 300 > b || 304 === b) {
  3128. if (c.ifModified) {
  3129. if (B = x.getResponseHeader("Last-Modified")) m.lastModified[h] = B;
  3130. if (B = x.getResponseHeader("Etag")) m.etag[h] = B
  3131. }
  3132. if (304 === b) t = "notmodified",
  3133. n = !0;
  3134. else try {
  3135. B = c;
  3136. B.dataFilter && (r = B.dataFilter(r, B.dataType));
  3137. var L = B.dataTypes;
  3138. C = {};
  3139. var W, Z, O = L.length,
  3140. J, R = L[0],
  3141. I,
  3142. N,
  3143. K,
  3144. M,
  3145. P;
  3146. for (W = 1; W < O; W++) {
  3147. if (1 === W) for (Z in B.converters)"string" == typeof Z && (C[Z.toLowerCase()] = B.converters[Z]);
  3148. I = R;
  3149. R = L[W];
  3150. if ("*" === R) R = I;
  3151. else if ("*" !== I && I !== R) {
  3152. N = I + " " + R;
  3153. K = C[N] || C["* " + R];
  3154. if (!K) for (M in P = f, C) if (J = M.split(" "), J[0] === I || "*" === J[0]) if (P = C[J[1] + " " + R]) {
  3155. M = C[M]; ! 0 === M ? K = P: !0 === P && (K = M);
  3156. break
  3157. }
  3158. K || P || m.error("No conversion from " + N.replace(" ", " to ")); ! 0 !== K && (r = K ? K(r) : P(M(r)))
  3159. }
  3160. }
  3161. y = r;
  3162. t = "success";
  3163. n = !0
  3164. } catch(Q) {
  3165. t = "parsererror",
  3166. E = Q
  3167. }
  3168. } else if (E = t, !t || b) t = "error",
  3169. 0 > b && (b = 0);
  3170. x.status = b;
  3171. x.statusText = "" + (a || t);
  3172. n ? l.resolveWith(e, [y, t, x]) : l.rejectWith(e, [x, t, E]);
  3173. x.statusCode(q);
  3174. q = f;
  3175. A && g.trigger("ajax" + (n ? "Success": "Error"), [x, c, n ? y: E]);
  3176. k.fireWith(e, [x, t]);
  3177. A && (g.trigger("ajaxComplete", [x, c]), --m.active || m.event.trigger("ajaxStop"))
  3178. }
  3179. }
  3180. "object" == typeof b && (a = b, b = f);
  3181. a = a || {};
  3182. var c = m.ajaxSetup({},
  3183. a),
  3184. e = c.context || c,
  3185. g = e !== c && (e.nodeType || e instanceof m) ? m(e) : m.event,
  3186. l = m.Deferred(),
  3187. k = m.Callbacks("once memory"),
  3188. q = c.statusCode || {},
  3189. h,
  3190. t = {},
  3191. n = {},
  3192. v,
  3193. y,
  3194. p,
  3195. s,
  3196. u,
  3197. z = 0,
  3198. A,
  3199. w,
  3200. x = {
  3201. readyState: 0,
  3202. setRequestHeader: function(b, a) {
  3203. if (!z) {
  3204. var d = b.toLowerCase();
  3205. b = n[d] = n[d] || b;
  3206. t[b] = a
  3207. }
  3208. return this
  3209. },
  3210. getAllResponseHeaders: function() {
  3211. return 2 === z ? v: null
  3212. },
  3213. getResponseHeader: function(b) {
  3214. var a;
  3215. if (2 === z) {
  3216. if (!y) for (y = {}; a = Bb.exec(v);) y[a[1].toLowerCase()] = a[2];
  3217. a = y[b.toLowerCase()]
  3218. }
  3219. return a === f ? null: a
  3220. },
  3221. overrideMimeType: function(b) {
  3222. z || (c.mimeType = b);
  3223. return this
  3224. },
  3225. abort: function(b) {
  3226. b = b || "abort";
  3227. p && p.abort(b);
  3228. d(0, b);
  3229. return this
  3230. }
  3231. };
  3232. l.promise(x);
  3233. x.success = x.done;
  3234. x.error = x.fail;
  3235. x.complete = k.add;
  3236. x.statusCode = function(b) {
  3237. if (b) {
  3238. var a;
  3239. if (2 > z) for (a in b) q[a] = [q[a], b[a]];
  3240. else a = b[x.status],
  3241. x.then(a, a)
  3242. }
  3243. return this
  3244. };
  3245. c.url = ((b || c.url) + "").replace(Ab, "").replace(Eb, P[1] + "//");
  3246. c.dataTypes = m.trim(c.dataType || "*").toLowerCase().split(qa);
  3247. null == c.crossDomain && (u = Oa.exec(c.url.toLowerCase()), c.crossDomain = !(!u || u[1] == P[1] && u[2] == P[2] && (u[3] || ("http:" === u[1] ? 80 : 443)) == (P[3] || ("http:" === P[1] ? 80 : 443))));
  3248. c.data && c.processData && "string" != typeof c.data && (c.data = m.param(c.data, c.traditional));
  3249. r(ga, c, a, x);
  3250. if (2 === z) return ! 1;
  3251. A = c.global;
  3252. c.type = c.type.toUpperCase();
  3253. c.hasContent = !Db.test(c.type);
  3254. A && 0 === m.active++&&m.event.trigger("ajaxStart");
  3255. if (!c.hasContent && (c.data && (c.url += (Na.test(c.url) ? "&": "?") + c.data, delete c.data), h = c.url, !1 === c.cache)) {
  3256. u = m.now();
  3257. var D = c.url.replace(Hb, "$1_=" + u);
  3258. c.url = D + (D === c.url ? (Na.test(c.url) ? "&": "?") + "_=" + u: "")
  3259. } (c.data && c.hasContent && !1 !== c.contentType || a.contentType) && x.setRequestHeader("Content-Type", c.contentType);
  3260. c.ifModified && (h = h || c.url, m.lastModified[h] && x.setRequestHeader("If-Modified-Since", m.lastModified[h]), m.etag[h] && x.setRequestHeader("If-None-Match", m.etag[h]));
  3261. x.setRequestHeader("Accept", c.dataTypes[0] && c.accepts[c.dataTypes[0]] ? c.accepts[c.dataTypes[0]] + ("*" !== c.dataTypes[0] ? ", " + Ra + "; q=0.01": "") : c.accepts["*"]);
  3262. for (w in c.headers) x.setRequestHeader(w, c.headers[w]);
  3263. if (c.beforeSend && (!1 === c.beforeSend.call(e, x, c) || 2 === z)) return x.abort(),
  3264. !1;
  3265. for (w in {
  3266. success: 1,
  3267. error: 1,
  3268. complete: 1
  3269. }) x[w](c[w]);
  3270. if (p = r(Qa, c, a, x)) {
  3271. x.readyState = 1;
  3272. A && g.trigger("ajaxSend", [x, c]);
  3273. c.async && 0 < c.timeout && (s = setTimeout(function() {
  3274. x.abort("timeout")
  3275. },
  3276. c.timeout));
  3277. try {
  3278. z = 1,
  3279. p.send(t, d)
  3280. } catch(B) {
  3281. if (2 > z) d( - 1, B);
  3282. else throw B;
  3283. }
  3284. } else d( - 1, "No Transport");
  3285. return x
  3286. },
  3287. param: function(b, a) {
  3288. var d = [],
  3289. c = function(b, a) {
  3290. a = m.isFunction(a) ? a() : a;
  3291. d[d.length] = encodeURIComponent(b) + "=" + encodeURIComponent(a)
  3292. };
  3293. a === f && (a = m.ajaxSettings.traditional);
  3294. if (m.isArray(b) || b.jquery && !m.isPlainObject(b)) m.each(b,
  3295. function() {
  3296. c(this.name, this.value)
  3297. });
  3298. else for (var g in b) e(g, b[g], a, c);
  3299. return d.join("&").replace(zb, "+")
  3300. }
  3301. });
  3302. m.extend({
  3303. active: 0,
  3304. lastModified: {},
  3305. etag: {}
  3306. });
  3307. var Ib = m.now(),
  3308. ca = /(\=)\?(&|$)|\?\?/i;
  3309. m.ajaxSetup({
  3310. jsonp: "callback",
  3311. jsonpCallback: function() {
  3312. return m.expando + "_" + Ib++
  3313. }
  3314. });
  3315. m.ajaxPrefilter("json jsonp",
  3316. function(b, d, c) {
  3317. d = "application/x-www-form-urlencoded" === b.contentType && "string" == typeof b.data;
  3318. if ("jsonp" === b.dataTypes[0] || !1 !== b.jsonp && (ca.test(b.url) || d && ca.test(b.data))) {
  3319. var e, g = b.jsonpCallback = m.isFunction(b.jsonpCallback) ? b.jsonpCallback() : b.jsonpCallback,
  3320. f = a[g],
  3321. l = b.url,
  3322. r = b.data,
  3323. k = "$1" + g + "$2"; ! 1 !== b.jsonp && (l = l.replace(ca, k), b.url === l && (d && (r = r.replace(ca, k)), b.data === r && (l += (/\?/.test(l) ? "&": "?") + b.jsonp + "=" + g)));
  3324. b.url = l;
  3325. b.data = r;
  3326. a[g] = function(b) {
  3327. e = [b]
  3328. };
  3329. c.always(function() {
  3330. a[g] = f;
  3331. e && m.isFunction(f) && a[g](e[0])
  3332. });
  3333. b.converters["script json"] = function() {
  3334. e || m.error(g + " was not called");
  3335. return e[0]
  3336. };
  3337. b.dataTypes[0] = "json";
  3338. return "script"
  3339. }
  3340. });
  3341. m.ajaxSetup({
  3342. accepts: {
  3343. script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
  3344. },
  3345. contents: {
  3346. script: /javascript|ecmascript/
  3347. },
  3348. converters: {
  3349. "text script": function(b) {
  3350. m.globalEval(b);
  3351. return b
  3352. }
  3353. }
  3354. });
  3355. m.ajaxPrefilter("script",
  3356. function(b) {
  3357. b.cache === f && (b.cache = !1);
  3358. b.crossDomain && (b.type = "GET", b.global = !1)
  3359. });
  3360. m.ajaxTransport("script",
  3361. function(b) {
  3362. if (b.crossDomain) {
  3363. var a, d = w.head || w.getElementsByTagName("head")[0] || w.documentElement;
  3364. return {
  3365. send: function(c, e) {
  3366. a = w.createElement("script");
  3367. a.async = "async";
  3368. b.scriptCharset && (a.charset = b.scriptCharset);
  3369. a.src = b.url;
  3370. a.onload = a.onreadystatechange = function(b, c) {
  3371. if (c || !a.readyState || /loaded|complete/.test(a.readyState)) a.onload = a.onreadystatechange = null,
  3372. d && a.parentNode && d.removeChild(a),
  3373. a = f,
  3374. c || e(200, "success")
  3375. };
  3376. d.insertBefore(a, d.firstChild)
  3377. },
  3378. abort: function() {
  3379. a && a.onload(0, 1)
  3380. }
  3381. }
  3382. }
  3383. });
  3384. var na = a.ActiveXObject ?
  3385. function() {
  3386. for (var b in U) U[b](0, 1)
  3387. }: !1,
  3388. Jb = 0,
  3389. U;
  3390. m.ajaxSettings.xhr = a.ActiveXObject ?
  3391. function() {
  3392. var b;
  3393. if (! (b = !this.isLocal && c())) a: {
  3394. try {
  3395. b = new a.ActiveXObject("Microsoft.XMLHTTP");
  3396. break a
  3397. } catch(d) {}
  3398. b = void 0
  3399. }
  3400. return b
  3401. }: c; (function(b) {
  3402. m.extend(m.support, {
  3403. ajax: !!b,
  3404. cors: !!b && "withCredentials" in b
  3405. })
  3406. })(m.ajaxSettings.xhr());
  3407. m.support.ajax && m.ajaxTransport(function(b) {
  3408. if (!b.crossDomain || m.support.cors) {
  3409. var d;
  3410. return {
  3411. send: function(c, e) {
  3412. var g = b.xhr(),
  3413. l,
  3414. r;
  3415. b.username ? g.open(b.type, b.url, b.async, b.username, b.password) : g.open(b.type, b.url, b.async);
  3416. if (b.xhrFields) for (r in b.xhrFields) g[r] = b.xhrFields[r];
  3417. b.mimeType && g.overrideMimeType && g.overrideMimeType(b.mimeType);
  3418. b.crossDomain || c["X-Requested-With"] || (c["X-Requested-With"] = "XMLHttpRequest");
  3419. try {
  3420. for (r in c) g.setRequestHeader(r, c[r])
  3421. } catch(k) {}
  3422. g.send(b.hasContent && b.data || null);
  3423. d = function(a, c) {
  3424. var r, k, q, h, t;
  3425. try {
  3426. if (d && (c || 4 === g.readyState)) if (d = f, l && (g.onreadystatechange = m.noop, na && delete U[l]), c) 4 !== g.readyState && g.abort();
  3427. else {
  3428. r = g.status;
  3429. q = g.getAllResponseHeaders();
  3430. h = {}; (t = g.responseXML) && t.documentElement && (h.xml = t);
  3431. h.text = g.responseText;
  3432. try {
  3433. k = g.statusText
  3434. } catch(n) {
  3435. k = ""
  3436. }
  3437. r || !b.isLocal || b.crossDomain ? 1223 === r && (r = 204) : r = h.text ? 200 : 404
  3438. }
  3439. } catch(v) {
  3440. c || e( - 1, v)
  3441. }
  3442. h && e(r, k, h, q)
  3443. };
  3444. b.async && 4 !== g.readyState ? (l = ++Jb, na && (U || (U = {},
  3445. m(a).unload(na)), U[l] = d), g.onreadystatechange = d) : d()
  3446. },
  3447. abort: function() {
  3448. d && d(0, 1)
  3449. }
  3450. }
  3451. }
  3452. });
  3453. var ea = {},
  3454. N, Q, Kb = /^(?:toggle|show|hide)$/,
  3455. Lb = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
  3456. da, pa = [["height", "marginTop", "marginBottom", "paddingTop", "paddingBottom"], ["width", "marginLeft", "marginRight", "paddingLeft", "paddingRight"], ["opacity"]],
  3457. Y;
  3458. m.fn.extend({
  3459. show: function(b, a, d) {
  3460. var c;
  3461. if (b || 0 === b) return this.animate(p("show", 3), b, a, d);
  3462. a = 0;
  3463. for (d = this.length; a < d; a++) b = this[a],
  3464. b.style && (c = b.style.display, !m._data(b, "olddisplay") && "none" === c && (c = b.style.display = ""), "" === c && "none" === m.css(b, "display") && m._data(b, "olddisplay", n(b.nodeName)));
  3465. for (a = 0; a < d; a++) if (b = this[a], b.style && (c = b.style.display, "" === c || "none" === c)) b.style.display = m._data(b, "olddisplay") || "";
  3466. return this
  3467. },
  3468. hide: function(b, a, d) {
  3469. if (b || 0 === b) return this.animate(p("hide", 3), b, a, d);
  3470. var c;
  3471. a = 0;
  3472. for (d = this.length; a < d; a++) b = this[a],
  3473. b.style && (c = m.css(b, "display"), "none" !== c && !m._data(b, "olddisplay") && m._data(b, "olddisplay", c));
  3474. for (a = 0; a < d; a++) this[a].style && (this[a].style.display = "none");
  3475. return this
  3476. },
  3477. _toggle: m.fn.toggle,
  3478. toggle: function(b, a, d) {
  3479. var c = "boolean" == typeof b;
  3480. m.isFunction(b) && m.isFunction(a) ? this._toggle.apply(this, arguments) : null == b || c ? this.each(function() {
  3481. var a = c ? b: m(this).is(":hidden");
  3482. m(this)[a ? "show": "hide"]()
  3483. }) : this.animate(p("toggle", 3), b, a, d);
  3484. return this
  3485. },
  3486. fadeTo: function(b, a, d, c) {
  3487. return this.filter(":hidden").css("opacity", 0).show().end().animate({
  3488. opacity: a
  3489. },
  3490. b, d, c)
  3491. },
  3492. animate: function(b, a, d, c) {
  3493. function e() { ! 1 === g.queue && m._mark(this);
  3494. var a = m.extend({},
  3495. g),
  3496. d = 1 === this.nodeType,
  3497. c = d && m(this).is(":hidden"),
  3498. f,
  3499. l,
  3500. r,
  3501. k,
  3502. q,
  3503. h,
  3504. t,
  3505. v;
  3506. a.animatedProperties = {};
  3507. for (r in b) {
  3508. f = m.camelCase(r);
  3509. r !== f && (b[f] = b[r], delete b[r]);
  3510. l = b[f];
  3511. m.isArray(l) ? (a.animatedProperties[f] = l[1], l = b[f] = l[0]) : a.animatedProperties[f] = a.specialEasing && a.specialEasing[f] || a.easing || "swing";
  3512. if ("hide" === l && c || "show" === l && !c) return a.complete.call(this);
  3513. d && ("height" === f || "width" === f) && (a.overflow = [this.style.overflow, this.style.overflowX, this.style.overflowY], "inline" === m.css(this, "display") && "none" === m.css(this, "float") && (m.support.inlineBlockNeedsLayout && "inline" !== n(this.nodeName) ? this.style.zoom = 1 : this.style.display = "inline-block"))
  3514. }
  3515. null != a.overflow && (this.style.overflow = "hidden");
  3516. for (r in b) d = new m.fx(this, a, r),
  3517. l = b[r],
  3518. Kb.test(l) ? (v = m._data(this, "toggle" + r) || ("toggle" === l ? c ? "show": "hide": 0), v ? (m._data(this, "toggle" + r, "show" === v ? "hide": "show"), d[v]()) : d[l]()) : (k = Lb.exec(l), q = d.cur(), k ? (h = parseFloat(k[2]), t = k[3] || (m.cssNumber[r] ? "": "px"), "px" !== t && (m.style(this, r, (h || 1) + t), q *= (h || 1) / d.cur(), m.style(this, r, q + t)), k[1] && (h = ("-=" === k[1] ? -1 : 1) * h + q), d.custom(q, h, t)) : d.custom(q, l, ""));
  3519. return ! 0
  3520. }
  3521. var g = m.speed(a, d, c);
  3522. if (m.isEmptyObject(b)) return this.each(g.complete, [!1]);
  3523. b = m.extend({},
  3524. b);
  3525. return ! 1 === g.queue ? this.each(e) : this.queue(g.queue, e)
  3526. },
  3527. stop: function(b, a, d) {
  3528. "string" != typeof b && (d = a, a = b, b = f);
  3529. a && !1 !== b && this.queue(b || "fx", []);
  3530. return this.each(function() {
  3531. var a, c = !1,
  3532. e = m.timers,
  3533. g = m._data(this);
  3534. d || m._unmark(!0, this);
  3535. if (null == b) for (a in g) {
  3536. if (g[a] && g[a].stop && a.indexOf(".run") === a.length - 4) {
  3537. var f = g[a];
  3538. m.removeData(this, a, !0);
  3539. f.stop(d)
  3540. }
  3541. } else g[a = b + ".run"] && g[a].stop && (g = g[a], m.removeData(this, a, !0), g.stop(d));
  3542. for (a = e.length; a--;) e[a].elem !== this || null != b && e[a].queue !== b || (d ? e[a](!0) : e[a].saveState(), c = !0, e.splice(a, 1));
  3543. d && c || m.dequeue(this, b)
  3544. })
  3545. }
  3546. });
  3547. m.each({
  3548. slideDown: p("show", 1),
  3549. slideUp: p("hide", 1),
  3550. slideToggle: p("toggle", 1),
  3551. fadeIn: {
  3552. opacity: "show"
  3553. },
  3554. fadeOut: {
  3555. opacity: "hide"
  3556. },
  3557. fadeToggle: {
  3558. opacity: "toggle"
  3559. }
  3560. },
  3561. function(b, a) {
  3562. m.fn[b] = function(b, d, c) {
  3563. return this.animate(a, b, d, c)
  3564. }
  3565. });
  3566. m.extend({
  3567. speed: function(b, a, d) {
  3568. var c = b && "object" == typeof b ? m.extend({},
  3569. b) : {
  3570. complete: d || !d && a || m.isFunction(b) && b,
  3571. duration: b,
  3572. easing: d && a || a && !m.isFunction(a) && a
  3573. };
  3574. c.duration = m.fx.off ? 0 : "number" == typeof c.duration ? c.duration: c.duration in m.fx.speeds ? m.fx.speeds[c.duration] : m.fx.speeds._default;
  3575. if (null == c.queue || !0 === c.queue) c.queue = "fx";
  3576. c.old = c.complete;
  3577. c.complete = function(b) {
  3578. m.isFunction(c.old) && c.old.call(this);
  3579. c.queue ? m.dequeue(this, c.queue) : !1 !== b && m._unmark(this)
  3580. };
  3581. return c
  3582. },
  3583. easing: {
  3584. linear: function(b, a, d, c) {
  3585. return d + c * b
  3586. },
  3587. swing: function(b, a, d, c) {
  3588. return ( - Math.cos(b * Math.PI) / 2 + 0.5) * c + d
  3589. }
  3590. },
  3591. timers: [],
  3592. fx: function(b, a, d) {
  3593. this.options = a;
  3594. this.elem = b;
  3595. this.prop = d;
  3596. a.orig = a.orig || {}
  3597. }
  3598. });
  3599. m.fx.prototype = {
  3600. update: function() {
  3601. this.options.step && this.options.step.call(this.elem, this.now, this); (m.fx.step[this.prop] || m.fx.step._default)(this)
  3602. },
  3603. cur: function() {
  3604. if (null != this.elem[this.prop] && (!this.elem.style || null == this.elem.style[this.prop])) return this.elem[this.prop];
  3605. var b, a = m.css(this.elem, this.prop);
  3606. return isNaN(b = parseFloat(a)) ? a && "auto" !== a ? a: 0 : b
  3607. },
  3608. custom: function(b, a, c) {
  3609. function e(b) {
  3610. return g.step(b)
  3611. }
  3612. var g = this,
  3613. l = m.fx;
  3614. this.startTime = Y || d();
  3615. this.end = a;
  3616. this.now = this.start = b;
  3617. this.pos = this.state = 0;
  3618. this.unit = c || this.unit || (m.cssNumber[this.prop] ? "": "px");
  3619. e.queue = this.options.queue;
  3620. e.elem = this.elem;
  3621. e.saveState = function() {
  3622. g.options.hide && m._data(g.elem, "fxshow" + g.prop) === f && m._data(g.elem, "fxshow" + g.prop, g.start)
  3623. };
  3624. e() && m.timers.push(e) && !da && (da = setInterval(l.tick, l.interval))
  3625. },
  3626. show: function() {
  3627. var b = m._data(this.elem, "fxshow" + this.prop);
  3628. this.options.orig[this.prop] = b || m.style(this.elem, this.prop);
  3629. this.options.show = !0;
  3630. b !== f ? this.custom(this.cur(), b) : this.custom("width" === this.prop || "height" === this.prop ? 1 : 0, this.cur());
  3631. m(this.elem).show()
  3632. },
  3633. hide: function() {
  3634. this.options.orig[this.prop] = m._data(this.elem, "fxshow" + this.prop) || m.style(this.elem, this.prop);
  3635. this.options.hide = !0;
  3636. this.custom(this.cur(), 0)
  3637. },
  3638. step: function(b) {
  3639. var a, c, e = Y || d(),
  3640. g = !0,
  3641. f = this.elem,
  3642. l = this.options;
  3643. if (b || e >= l.duration + this.startTime) {
  3644. this.now = this.end;
  3645. this.pos = this.state = 1;
  3646. this.update();
  3647. l.animatedProperties[this.prop] = !0;
  3648. for (a in l.animatedProperties) ! 0 !== l.animatedProperties[a] && (g = !1);
  3649. if (g) {
  3650. null != l.overflow && !m.support.shrinkWrapBlocks && m.each(["", "X", "Y"],
  3651. function(b, a) {
  3652. f.style["overflow" + a] = l.overflow[b]
  3653. });
  3654. l.hide && m(f).hide();
  3655. if (l.hide || l.show) for (a in l.animatedProperties) m.style(f, a, l.orig[a]),
  3656. m.removeData(f, "fxshow" + a, !0),
  3657. m.removeData(f, "toggle" + a, !0); (b = l.complete) && (l.complete = !1, b.call(f))
  3658. }
  3659. return ! 1
  3660. }
  3661. Infinity == l.duration ? this.now = e: (c = e - this.startTime, this.state = c / l.duration, this.pos = m.easing[l.animatedProperties[this.prop]](this.state, c, 0, 1, l.duration), this.now = this.start + (this.end - this.start) * this.pos);
  3662. this.update();
  3663. return ! 0
  3664. }
  3665. };
  3666. m.extend(m.fx, {
  3667. tick: function() {
  3668. for (var b, a = m.timers,
  3669. d = 0; d < a.length; d++) b = a[d],
  3670. !b() && a[d] === b && a.splice(d--, 1);
  3671. a.length || m.fx.stop()
  3672. },
  3673. interval: 13,
  3674. stop: function() {
  3675. clearInterval(da);
  3676. da = null
  3677. },
  3678. speeds: {
  3679. slow: 600,
  3680. fast: 200,
  3681. _default: 400
  3682. },
  3683. step: {
  3684. opacity: function(b) {
  3685. m.style(b.elem, "opacity", b.now)
  3686. },
  3687. _default: function(b) {
  3688. b.elem.style && null != b.elem.style[b.prop] ? b.elem.style[b.prop] = b.now + b.unit: b.elem[b.prop] = b.now
  3689. }
  3690. }
  3691. });
  3692. m.each(["width", "height"],
  3693. function(b, a) {
  3694. m.fx.step[a] = function(b) {
  3695. m.style(b.elem, a, Math.max(0, b.now) + b.unit)
  3696. }
  3697. });
  3698. m.expr && m.expr.filters && (m.expr.filters.animated = function(b) {
  3699. return m.grep(m.timers,
  3700. function(a) {
  3701. return b === a.elem
  3702. }).length
  3703. });
  3704. var Mb = /^t(?:able|d|h)$/i,
  3705. Sa = /^(?:body|html)$/i;
  3706. "getBoundingClientRect" in w.documentElement ? m.fn.offset = function(b) {
  3707. var a = this[0],
  3708. d;
  3709. if (b) return this.each(function(a) {
  3710. m.offset.setOffset(this, b, a)
  3711. });
  3712. if (!a || !a.ownerDocument) return null;
  3713. if (a === a.ownerDocument.body) return m.offset.bodyOffset(a);
  3714. try {
  3715. d = a.getBoundingClientRect()
  3716. } catch(c) {}
  3717. var e = a.ownerDocument,
  3718. g = e.documentElement;
  3719. if (!d || !m.contains(g, a)) return d ? {
  3720. top: d.top,
  3721. left: d.left
  3722. }: {
  3723. top: 0,
  3724. left: 0
  3725. };
  3726. a = e.body;
  3727. e = h(e);
  3728. return {
  3729. top: d.top + (e.pageYOffset || m.support.boxModel && g.scrollTop || a.scrollTop) - (g.clientTop || a.clientTop || 0),
  3730. left: d.left + (e.pageXOffset || m.support.boxModel && g.scrollLeft || a.scrollLeft) - (g.clientLeft || a.clientLeft || 0)
  3731. }
  3732. }: m.fn.offset = function(b) {
  3733. var a = this[0];
  3734. if (b) return this.each(function(a) {
  3735. m.offset.setOffset(this, b, a)
  3736. });
  3737. if (!a || !a.ownerDocument) return null;
  3738. if (a === a.ownerDocument.body) return m.offset.bodyOffset(a);
  3739. var d, c = a.offsetParent,
  3740. e = a.ownerDocument,
  3741. g = e.documentElement,
  3742. f = e.body;
  3743. d = (e = e.defaultView) ? e.getComputedStyle(a, null) : a.currentStyle;
  3744. for (var l = a.offsetTop,
  3745. r = a.offsetLeft; (a = a.parentNode) && a !== f && a !== g && (!m.support.fixedPosition || "fixed" !== d.position);) d = e ? e.getComputedStyle(a, null) : a.currentStyle,
  3746. l -= a.scrollTop,
  3747. r -= a.scrollLeft,
  3748. a === c && (l += a.offsetTop, r += a.offsetLeft, m.support.doesNotAddBorder && (!m.support.doesAddBorderForTableAndCells || !Mb.test(a.nodeName)) && (l += parseFloat(d.borderTopWidth) || 0, r += parseFloat(d.borderLeftWidth) || 0), c = a.offsetParent),
  3749. m.support.subtractsBorderForOverflowNotVisible && "visible" !== d.overflow && (l += parseFloat(d.borderTopWidth) || 0, r += parseFloat(d.borderLeftWidth) || 0);
  3750. if ("relative" === d.position || "static" === d.position) l += f.offsetTop,
  3751. r += f.offsetLeft;
  3752. m.support.fixedPosition && "fixed" === d.position && (l += Math.max(g.scrollTop, f.scrollTop), r += Math.max(g.scrollLeft, f.scrollLeft));
  3753. return {
  3754. top: l,
  3755. left: r
  3756. }
  3757. };
  3758. m.offset = {
  3759. bodyOffset: function(b) {
  3760. var a = b.offsetTop,
  3761. d = b.offsetLeft;
  3762. m.support.doesNotIncludeMarginInBodyOffset && (a += parseFloat(m.css(b, "marginTop")) || 0, d += parseFloat(m.css(b, "marginLeft")) || 0);
  3763. return {
  3764. top: a,
  3765. left: d
  3766. }
  3767. },
  3768. setOffset: function(b, a, d) {
  3769. var c = m.css(b, "position");
  3770. "static" === c && (b.style.position = "relative");
  3771. var e = m(b),
  3772. g = e.offset(),
  3773. f = m.css(b, "top"),
  3774. l = m.css(b, "left"),
  3775. r = {},
  3776. k = {},
  3777. q,
  3778. h; ("absolute" === c || "fixed" === c) && -1 < m.inArray("auto", [f, l]) ? (k = e.position(), q = k.top, h = k.left) : (q = parseFloat(f) || 0, h = parseFloat(l) || 0);
  3779. m.isFunction(a) && (a = a.call(b, d, g));
  3780. null != a.top && (r.top = a.top - g.top + q);
  3781. null != a.left && (r.left = a.left - g.left + h);
  3782. "using" in a ? a.using.call(b, r) : e.css(r)
  3783. }
  3784. };
  3785. m.fn.extend({
  3786. position: function() {
  3787. if (!this[0]) return null;
  3788. var b = this[0],
  3789. a = this.offsetParent(),
  3790. d = this.offset(),
  3791. c = Sa.test(a[0].nodeName) ? {
  3792. top: 0,
  3793. left: 0
  3794. }: a.offset();
  3795. d.top -= parseFloat(m.css(b, "marginTop")) || 0;
  3796. d.left -= parseFloat(m.css(b, "marginLeft")) || 0;
  3797. c.top += parseFloat(m.css(a[0], "borderTopWidth")) || 0;
  3798. c.left += parseFloat(m.css(a[0], "borderLeftWidth")) || 0;
  3799. return {
  3800. top: d.top - c.top,
  3801. left: d.left - c.left
  3802. }
  3803. },
  3804. offsetParent: function() {
  3805. return this.map(function() {
  3806. for (var b = this.offsetParent || w.body; b && !Sa.test(b.nodeName) && "static" === m.css(b, "position");) b = b.offsetParent;
  3807. return b
  3808. })
  3809. }
  3810. });
  3811. m.each(["Left", "Top"],
  3812. function(b, a) {
  3813. var d = "scroll" + a;
  3814. m.fn[d] = function(a) {
  3815. var c, e;
  3816. return a === f ? (c = this[0], c ? (e = h(c)) ? "pageXOffset" in e ? e[b ? "pageYOffset": "pageXOffset"] : m.support.boxModel && e.document.documentElement[d] || e.document.body[d] : c[d] : null) : this.each(function() { (e = h(this)) ? e.scrollTo(b ? m(e).scrollLeft() : a, b ? a: m(e).scrollTop()) : this[d] = a
  3817. })
  3818. }
  3819. });
  3820. m.each(["Height", "Width"],
  3821. function(b, a) {
  3822. var d = a.toLowerCase();
  3823. m.fn["inner" + a] = function() {
  3824. var b = this[0];
  3825. return b ? b.style ? parseFloat(m.css(b, d, "padding")) : this[d]() : null
  3826. };
  3827. m.fn["outer" + a] = function(b) {
  3828. var a = this[0];
  3829. return a ? a.style ? parseFloat(m.css(a, d, b ? "margin": "border")) : this[d]() : null
  3830. };
  3831. m.fn[d] = function(b) {
  3832. var c = this[0];
  3833. if (!c) return null == b ? null: this;
  3834. if (m.isFunction(b)) return this.each(function(a) {
  3835. var c = m(this);
  3836. c[d](b.call(this, a, c[d]()))
  3837. });
  3838. if (m.isWindow(c)) {
  3839. var e = c.document.documentElement["client" + a],
  3840. g = c.document.body;
  3841. return "CSS1Compat" === c.document.compatMode && e || g && g["client" + a] || e
  3842. }
  3843. return 9 === c.nodeType ? Math.max(c.documentElement["client" + a], c.body["scroll" + a], c.documentElement["scroll" + a], c.body["offset" + a], c.documentElement["offset" + a]) : b === f ? (c = m.css(c, d), e = parseFloat(c), m.isNumeric(e) ? e: c) : this.css(d, "string" == typeof b ? b: b + "px")
  3844. }
  3845. });
  3846. a.jQuery = a.$ = m;
  3847. "function" == typeof define && define.amd && define.amd.jQuery && define("jquery", [],
  3848. function() {
  3849. return m
  3850. })
  3851. })(window);
  3852. ADS = function() {};
  3853. ADS.displayCount = 0;
  3854. ADS.modulo = 2;
  3855. ADS.showAd = function() {}; !
  3856. function() {
  3857. var a = null,
  3858. f = !0,
  3859. h = !1;
  3860. try {
  3861. "undefined" != typeof AudioContext ? a = new AudioContext: "undefined" != typeof webkitAudioContext ? a = new webkitAudioContext: f = !1
  3862. } catch(n) {
  3863. f = !1
  3864. }
  3865. if (!f) if ("undefined" != typeof Audio) try {
  3866. new Audio
  3867. } catch(p) {
  3868. h = !0
  3869. } else h = !0;
  3870. if (f) {
  3871. var b = void 0 === a.createGain ? a.createGainNode() : a.createGain();
  3872. b.gain.value = 1;
  3873. b.connect(a.destination)
  3874. }
  3875. var d = function() {
  3876. this.init()
  3877. };
  3878. d.prototype = {
  3879. init: function() {
  3880. return this._codecs = {},
  3881. this._howls = [],
  3882. this._muted = !1,
  3883. this._volume = 1,
  3884. this.iOSAutoEnable = !0,
  3885. this.noAudio = h,
  3886. this.usingWebAudio = f,
  3887. this.ctx = a,
  3888. h || this._setupCodecs(),
  3889. this
  3890. },
  3891. volume: function(a) {
  3892. if (a = parseFloat(a), void 0 !== a && 0 <= a && 1 >= a) {
  3893. this._volume = a;
  3894. f && (b.gain.value = a);
  3895. for (var d = 0; d < this._howls.length; d++) if (!this._howls[d]._webAudio) for (var c = this._howls[d]._getSoundIds(), e = 0; e < c.length; e++) {
  3896. var g = this._howls[d]._soundById(c[d]);
  3897. g && (g._node.volume = g._volume * a)
  3898. }
  3899. return this
  3900. }
  3901. return this._volume
  3902. },
  3903. mute: function(a) {
  3904. this._muted = a;
  3905. f && (b.gain.value = a ? 0 : this._volume);
  3906. for (var d = 0; d < this._howls.length; d++) if (!this._howls[d]._webAudio) for (var c = this._howls[d]._getSoundIds(), e = 0; e < c.length; e++) {
  3907. var g = this._howls[d]._soundById(c[d]);
  3908. g && (g._node.muted = a)
  3909. }
  3910. return this
  3911. },
  3912. codecs: function(b) {
  3913. return this._codecs[b]
  3914. },
  3915. _setupCodecs: function() {
  3916. var b = new Audio;
  3917. return this._codecs = {
  3918. mp3: !!b.canPlayType("audio/mpeg;").replace(/^no$/, ""),
  3919. opus: !!b.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ""),
  3920. ogg: !!b.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""),
  3921. wav: !!b.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ""),
  3922. aac: !!b.canPlayType("audio/aac;").replace(/^no$/, ""),
  3923. m4a: !!(b.canPlayType("audio/x-m4a;") || b.canPlayType("audio/m4a;") || b.canPlayType("audio/aac;")).replace(/^no$/, ""),
  3924. mp4: !!(b.canPlayType("audio/x-mp4;") || b.canPlayType("audio/mp4;") || b.canPlayType("audio/aac;")).replace(/^no$/, ""),
  3925. weba: !!b.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ""),
  3926. webm: !!b.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, "")
  3927. },
  3928. this
  3929. },
  3930. _enableiOSAudio: function() {
  3931. var b = this;
  3932. if (!a || !b._iOSEnabled && /iPhone|iPad|iPod/i.test(navigator.userAgent)) {
  3933. b._iOSEnabled = !1;
  3934. var d = function() {
  3935. var c = a.createBuffer(1, 1, 22050),
  3936. e = a.createBufferSource();
  3937. e.buffer = c;
  3938. e.connect(a.destination);
  3939. void 0 === e.start ? e.noteOn(0) : e.start(0);
  3940. setTimeout(function() {
  3941. e.playbackState !== e.PLAYING_STATE && e.playbackState !== e.FINISHED_STATE || (b._iOSEnabled = !0, b.iOSAutoEnable = !1, window.removeEventListener("touchstart", d, !1))
  3942. },
  3943. 0)
  3944. };
  3945. return window.addEventListener("touchstart", d, !1),
  3946. b
  3947. }
  3948. }
  3949. };
  3950. var c = new d,
  3951. e = function(b) {
  3952. return b.src ? void this.init(b) : void console.error("An array of source files must be passed with any new Howl.")
  3953. };
  3954. e.prototype = {
  3955. init: function(b) {
  3956. return this._autoplay = b.autoplay || !1,
  3957. this._ext = b.ext || null,
  3958. this._html5 = b.html5 || !1,
  3959. this._loop = b.loop || !1,
  3960. this._pool = b.pool || 5,
  3961. this._preload = "boolean" == typeof b.preload ? b.preload: !0,
  3962. this._rate = b.rate || 1,
  3963. this._sprite = b.sprite || {},
  3964. this._src = "string" != typeof b.src ? b.src: [b.src],
  3965. this._volume = void 0 !== b.volume ? b.volume: 1,
  3966. this._duration = 0,
  3967. this._muted = !1,
  3968. this._loaded = !1,
  3969. this._sounds = [],
  3970. this._endTimers = {},
  3971. this._onend = b.onend ? [b.onend] : [],
  3972. this._onfaded = b.onfaded ? [b.onfaded] : [],
  3973. this._onload = b.onload ? [b.onload] : [],
  3974. this._onloaderror = b.onloaderror ? [b.onloaderror] : [],
  3975. this._onpause = b.onpause ? [b.onpause] : [],
  3976. this._onplay = b.onplay ? [b.onplay] : [],
  3977. this._webAudio = f && !this._html5,
  3978. void 0 !== a && a && c.iOSAutoEnable && c._enableiOSAudio(),
  3979. c._howls.push(this),
  3980. this._preload && this.load(),
  3981. this
  3982. },
  3983. load: function() {
  3984. var b = null;
  3985. if (h) return void this._emit("loaderror");
  3986. for (var a = 0; a < this._src.length; a++) {
  3987. var d, e;
  3988. if (this._ext && this._ext[a] ? d = this._ext[a] : (e = this._src[a], d = /^data:audio\/([^;,]+);/i.exec(e), d || (d = /\.([^.]+)$/.exec(e.split("?", 1)[0])), d && (d = d[1].toLowerCase())), c.codecs(d)) {
  3989. b = this._src[a];
  3990. break
  3991. }
  3992. }
  3993. return b ? (this._src = b, new g(this), this._webAudio && k(this), this) : void this._emit("loaderror")
  3994. },
  3995. play: function(b) {
  3996. var d = this,
  3997. e = null;
  3998. if ("number" == typeof b) e = b,
  3999. b = null;
  4000. else if (void 0 === b) {
  4001. b = "__default";
  4002. for (var g = 0,
  4003. f = 0; f < d._sounds.length; f++) d._sounds[f]._paused && !d._sounds[f]._ended && (g++, e = d._sounds[f]._id);
  4004. 1 === g ? b = null: e = null
  4005. }
  4006. var l = e ? d._soundById(e) : d._inactiveSound();
  4007. if (e && !b && (b = l._sprite || "__default"), !l) return null;
  4008. if (!d._loaded && !d._sprite[b]) return d.once("load",
  4009. function() {
  4010. d.play(l._id)
  4011. }),
  4012. l._id;
  4013. if (e && !l._paused) return l._id;
  4014. var r = 0 < l._seek ? l._seek: d._sprite[b][0] / 1E3,
  4015. k = (d._sprite[b][0] + d._sprite[b][1]) / 1E3 - r,
  4016. h = !(!d._loop && !d._sprite[b][2]),
  4017. t = function() {
  4018. d._emit("end", l._id); ! d._webAudio && h && d.stop(l._id).play(l._id);
  4019. d._webAudio && h && (d._emit("play", l._id), d._endTimers[l._id] = setTimeout(t, 1E3 * k / Math.abs(d._rate)));
  4020. d._webAudio && !h && (l._paused = !0, l._ended = !0, l._seek = l._start || 0, d._clearTimer(l._id), l._node.bufferSource = null);
  4021. d._webAudio || h || d.stop(l._id)
  4022. };
  4023. d._endTimers[l._id] = setTimeout(t, 1E3 * k / Math.abs(d._rate));
  4024. l._paused = !1;
  4025. l._ended = !1;
  4026. l._sprite = b;
  4027. l._seek = r;
  4028. l._start = d._sprite[b][0] / 1E3;
  4029. l._stop = (d._sprite[b][0] + d._sprite[b][1]) / 1E3;
  4030. l._loop = h;
  4031. var n = l._node;
  4032. if (d._webAudio) b = function() {
  4033. d._refreshBuffer(l);
  4034. var b = l._muted || d._muted ? 0 : l._volume * c.volume();
  4035. n.gain.setValueAtTime(b, a.currentTime);
  4036. l._playStart = a.currentTime;
  4037. void 0 === n.bufferSource.start ? n.bufferSource.noteGrainOn(0, r, k) : n.bufferSource.start(0, r, k);
  4038. d._endTimers[l._id] || (d._endTimers[l._id] = setTimeout(t, 1E3 * k / Math.abs(d._rate)))
  4039. },
  4040. d._loaded ? b() : (d.once("load", b), d._clearTimer(l._id));
  4041. else {
  4042. var v = function() {
  4043. n.currentTime = r;
  4044. n.muted = l._muted || d._muted || c._muted || n.muted;
  4045. n.volume = l._volume * c.volume();
  4046. n.playbackRate = d._rate;
  4047. setTimeout(function() {
  4048. n.play()
  4049. },
  4050. 0)
  4051. };
  4052. if (4 === n.readyState || !n.readyState && navigator.isCocoonJS) v();
  4053. else {
  4054. var p = function() {
  4055. d._endTimers[l._id] = setTimeout(t, 1E3 * k / Math.abs(d._rate));
  4056. v();
  4057. n.removeEventListener("canplaythrough", p, !1)
  4058. };
  4059. n.addEventListener("canplaythrough", p, !1);
  4060. d._clearTimer(l._id)
  4061. }
  4062. }
  4063. return d._emit("play", l._id),
  4064. l._id
  4065. },
  4066. pause: function(b) {
  4067. var a = this;
  4068. if (!a._loaded) return a.once("play",
  4069. function() {
  4070. a.pause(b)
  4071. }),
  4072. a;
  4073. for (var d = a._getSoundIds(b), c = 0; c < d.length; c++) {
  4074. a._clearTimer(d[c]);
  4075. var e = a._soundById(d[c]);
  4076. if (e && !e._paused) if (e._seek = a.seek(d[c]), e._paused = !0, a._webAudio) {
  4077. if (!e._node.bufferSource) break;
  4078. void 0 === e._node.bufferSource.stop ? e._node.bufferSource.noteOff(0) : e._node.bufferSource.stop(0);
  4079. e._node.bufferSource = null
  4080. } else isNaN(e._node.duration) || e._node.pause()
  4081. }
  4082. return a
  4083. },
  4084. stop: function(b) {
  4085. var a = this;
  4086. if (!a._loaded) return a.once("play",
  4087. function() {
  4088. a.stop(b)
  4089. }),
  4090. a;
  4091. for (var d = a._getSoundIds(b), c = 0; c < d.length; c++) {
  4092. a._clearTimer(d[c]);
  4093. var e = a._soundById(d[c]);
  4094. if (e && !e._paused) if (e._seek = e._start || 0, e._paused = !0, e._ended = !0, a._webAudio) {
  4095. if (!e._node.bufferSource) break;
  4096. void 0 === e._node.bufferSource.stop ? e._node.bufferSource.noteOff(0) : e._node.bufferSource.stop(0);
  4097. e._node.bufferSource = null
  4098. } else isNaN(e._node.duration) || (e._node.pause(), e._node.currentTime = e._start || 0)
  4099. }
  4100. return a
  4101. },
  4102. mute: function(b, d) {
  4103. var e = this;
  4104. if (!e._loaded) return e.once("play",
  4105. function() {
  4106. e.mute(b, d)
  4107. }),
  4108. e;
  4109. void 0 === d && (e._muted = b);
  4110. for (var g = e._getSoundIds(d), l = 0; l < g.length; l++) {
  4111. var f = e._soundById(g[l]);
  4112. f && (f._muted = b, e._webAudio ? f._node.gain.setValueAtTime(b ? 0 : f._volume * c.volume(), a.currentTime) : f._node.muted = b)
  4113. }
  4114. return e
  4115. },
  4116. volume: function() {
  4117. var b, d, e = this,
  4118. g = arguments;
  4119. if (0 === g.length) return e._volume;
  4120. 1 === g.length ? 0 <= e._getSoundIds().indexOf(g[0]) ? d = parseInt(g[0], 10) : b = parseFloat(g[0]) : 2 === g.length && (b = parseFloat(g[0]), d = parseInt(g[1], 10));
  4121. var l;
  4122. if (! (void 0 !== b && 0 <= b && 1 >= b)) return l = d ? e._soundById(d) : e._sounds[0],
  4123. l ? l._volume: 0;
  4124. if (!e._loaded) return e.once("play",
  4125. function() {
  4126. e.volume.apply(e, g)
  4127. }),
  4128. e;
  4129. void 0 === d && (e._volume = b);
  4130. d = e._getSoundIds(d);
  4131. for (var f = 0; f < d.length; f++)(l = e._soundById(d[f])) && (l._volume = b, e._webAudio ? l._node.gain.setValueAtTime(b * c.volume(), a.currentTime) : l._node.volume = b * c.volume());
  4132. return e
  4133. },
  4134. fade: function(b, d, c, e) {
  4135. var g = this;
  4136. if (!g._loaded) return g.once("play",
  4137. function() {
  4138. g.fade(b, d, c, e)
  4139. }),
  4140. g;
  4141. g.volume(b, e);
  4142. for (var l = g._getSoundIds(e), f = 0; f < l.length; f++) {
  4143. var r = g._soundById(l[f]);
  4144. if (r) if (g._webAudio) {
  4145. var k = a.currentTime,
  4146. h = k + c / 1E3;
  4147. r._volume = b;
  4148. r._node.gain.setValueAtTime(b, k);
  4149. r._node.gain.linearRampToValueAtTime(d, h);
  4150. setTimeout(function(b, c) {
  4151. setTimeout(function() {
  4152. c._volume = d;
  4153. g._emit("faded", b)
  4154. },
  4155. 0 < h - a.currentTime ? Math.ceil(1E3 * (h - a.currentTime)) : 0)
  4156. }.bind(g, l[f], r), c)
  4157. } else {
  4158. var r = Math.abs(b - d),
  4159. t = b > d ? "out": "in",
  4160. n = c / (r / 0.01); !
  4161. function() {
  4162. var a = b,
  4163. c = setInterval(function(b) {
  4164. a += "in" === t ? 0.01 : -0.01;
  4165. a = Math.max(0, a);
  4166. a = Math.min(1, a);
  4167. g.volume(a, b);
  4168. a === d && (clearInterval(c), g._emit("faded", b))
  4169. }.bind(g, l[f]), n)
  4170. } ()
  4171. }
  4172. }
  4173. return g
  4174. },
  4175. loop: function() {
  4176. var b, a, d, c = arguments;
  4177. if (0 === c.length) return this._loop;
  4178. if (1 === c.length) {
  4179. if ("boolean" != typeof c[0]) return d = this._soundById(parseInt(c[0], 10)),
  4180. d ? d._loop: !1;
  4181. b = c[0]
  4182. } else 2 === c.length && (b = c[0], a = parseInt(c[1], 10));
  4183. a = this._getSoundIds(a);
  4184. for (c = 0; c < a.length; c++)(d = this._soundById(a[c])) && (d._loop = b);
  4185. return this
  4186. },
  4187. seek: function() {
  4188. var b, d, c = this,
  4189. e = arguments;
  4190. 0 === e.length ? d = c._sounds[0]._id: 1 === e.length ? 0 <= c._getSoundIds().indexOf(e[0]) ? d = parseInt(e[0], 10) : (d = c._sounds[0]._id, b = parseFloat(e[0])) : 2 === e.length && (b = parseFloat(e[0]), d = parseInt(e[1], 10));
  4191. if (void 0 === d) return c;
  4192. if (!c._loaded) return c.once("load",
  4193. function() {
  4194. c.seek.apply(c, e)
  4195. }),
  4196. c;
  4197. var g = c._soundById(d);
  4198. if (g) {
  4199. if (! (0 <= b)) return c._webAudio ? g._seek + (a.currentTime - g._playStart) : g._node.currentTime;
  4200. c.pause(d);
  4201. g._seek = b;
  4202. c._clearTimer(d);
  4203. c.play(d)
  4204. }
  4205. return c
  4206. },
  4207. playing: function(b) {
  4208. return (b = this._soundById(b)) ? !!b._paused: !1
  4209. },
  4210. unload: function() {
  4211. for (var b = this,
  4212. a = b._sounds,
  4213. d = 0; d < a.length; d++) {
  4214. a[d]._paused || (b.stop(a[d]._id), b._emit("end", a[d]._id));
  4215. b._webAudio ? a[d]._node.disconnect(0) : a[d]._node.src = "";
  4216. delete a[d]._node;
  4217. b._clearTimer(a[d]._id);
  4218. var e = c._howls.indexOf(b);
  4219. 0 <= e && c._howls.splice(e, 1);
  4220. r && delete r[b._src];
  4221. b = null
  4222. }
  4223. return null
  4224. },
  4225. on: function(b, a) {
  4226. var d = this["_on" + b];
  4227. return "function" == typeof a && d.push(a),
  4228. this
  4229. },
  4230. off: function(b, a) {
  4231. var d = this["_on" + b];
  4232. if (a) for (var c = 0; c < d.length; c++) if (a === d[c]) {
  4233. d.splice(c, 1);
  4234. break
  4235. }
  4236. return this
  4237. },
  4238. once: function(b, a) {
  4239. var d = this,
  4240. c = function() {
  4241. a();
  4242. d.off(b, c)
  4243. };
  4244. return d.on(b, c),
  4245. d
  4246. },
  4247. _emit: function(b, a, d) {
  4248. b = this["_on" + b];
  4249. for (var c = 0; c < b.length; c++) b[c].call(this, a, d);
  4250. return this
  4251. },
  4252. _clearTimer: function(b) {
  4253. return this._endTimers[b] && (clearTimeout(this._endTimers[b]), delete this._endTimers[b]),
  4254. this
  4255. },
  4256. _soundById: function(b) {
  4257. for (var a = 0; a < this._sounds.length; a++) if (b === this._sounds[a]._id) return this._sounds[a];
  4258. return null
  4259. },
  4260. _inactiveSound: function() {
  4261. this._drain();
  4262. for (var b = 0; b < this._sounds.length; b++) if (this._sounds[b]._ended) return this._sounds[b].reset();
  4263. return new g(this)
  4264. },
  4265. _drain: function() {
  4266. var b = this._pool,
  4267. a = 0,
  4268. d = 0;
  4269. if (! (this._sounds.length < b)) {
  4270. for (d = 0; d < this._sounds.length; d++) this._sounds[d]._ended && a++;
  4271. for (d = this._sounds.length - 1; 0 <= d && !(b >= a); d--) this._sounds[d]._ended && (this._webAudio && this._sounds[d]._node && this._sounds[d]._node.disconnect(0), this._sounds.splice(d, 1), a--)
  4272. }
  4273. },
  4274. _getSoundIds: function(b) {
  4275. if (void 0 === b) {
  4276. b = [];
  4277. for (var a = 0; a < this._sounds.length; a++) b.push(this._sounds[a]._id);
  4278. return b
  4279. }
  4280. return [b]
  4281. },
  4282. _refreshBuffer: function(b) {
  4283. return b._node.bufferSource = a.createBufferSource(),
  4284. b._node.bufferSource.buffer = r[this._src],
  4285. b._node.bufferSource.connect(b._panner ? b._panner: b._node),
  4286. b._node.bufferSource.loop = b._loop,
  4287. b._loop && (b._node.bufferSource.loopStart = b._seek, b._node.bufferSource.loopEnd = b._stop),
  4288. b._node.bufferSource.playbackRate.value = this._rate,
  4289. this
  4290. }
  4291. };
  4292. var g = function(b) {
  4293. this._parent = b;
  4294. this.init()
  4295. };
  4296. if (g.prototype = {
  4297. init: function() {
  4298. var b = this._parent;
  4299. return this._muted = b._muted,
  4300. this._loop = b._loop,
  4301. this._volume = b._volume,
  4302. this._muted = b._muted,
  4303. this._seek = 0,
  4304. this._paused = !0,
  4305. this._ended = !1,
  4306. this._id = Math.round(Date.now() * Math.random()),
  4307. b._sounds.push(this),
  4308. this.create(),
  4309. this
  4310. },
  4311. create: function() {
  4312. var d = this,
  4313. e = d._parent,
  4314. g = c._muted || d._muted || d._parent._muted ? 0 : d._volume * c.volume();
  4315. if (e._webAudio) d._node = void 0 === a.createGain ? a.createGainNode() : a.createGain(),
  4316. d._node.gain.setValueAtTime(g, a.currentTime),
  4317. d._node.paused = !0,
  4318. d._node.connect(b);
  4319. else {
  4320. d._node = new Audio;
  4321. var l = function() {
  4322. d._node.error && 4 === d._node.error.code && (c.noAudio = !0);
  4323. e._emit("loaderror", d._id, d._node.error ? d._node.error.code: 0);
  4324. d._node.removeEventListener("error", l, !1)
  4325. };
  4326. d._node.addEventListener("error", l, !1);
  4327. var f = function() {
  4328. e._duration = Math.ceil(10 * d._node.duration) / 10;
  4329. 0 === Object.keys(e._sprite).length && (e._sprite = {
  4330. __default: [0, 1E3 * e._duration]
  4331. });
  4332. e._loaded || (e._loaded = !0, e._emit("load"));
  4333. e._autoplay && e.play();
  4334. d._node.removeEventListener("canplaythrough", f, !1)
  4335. };
  4336. d._node.addEventListener("canplaythrough", f, !1);
  4337. d._node.src = e._src;
  4338. d._node.preload = "auto";
  4339. d._node.volume = g;
  4340. d._node.load()
  4341. }
  4342. return d
  4343. },
  4344. reset: function() {
  4345. var b = this._parent;
  4346. return this._muted = b._muted,
  4347. this._loop = b._loop,
  4348. this._volume = b._volume,
  4349. this._muted = b._muted,
  4350. this._seek = 0,
  4351. this._paused = !0,
  4352. this._ended = !1,
  4353. this._sprite = null,
  4354. this._id = Math.round(Date.now() * Math.random()),
  4355. this
  4356. }
  4357. },
  4358. f) var r = {},
  4359. k = function(b) {
  4360. var a = b._src;
  4361. if (r[a]) return b._duration = r[a].duration,
  4362. void v(b);
  4363. if (/^data:[^;]+;base64,/.test(a)) {
  4364. for (var d = atob(a.split(",")[1]), c = new Uint8Array(d.length), e = 0; e < d.length; ++e) c[e] = d.charCodeAt(e);
  4365. t(c.buffer, b)
  4366. } else {
  4367. var g = new XMLHttpRequest;
  4368. g.open("GET", a, !0);
  4369. g.responseType = "arraybuffer";
  4370. g.onload = function() {
  4371. t(g.response, b)
  4372. };
  4373. g.onerror = function() {
  4374. b._webAudio && (b._buffer = !0, b._webAudio = !1, b._sounds = [], delete r[a], b.load())
  4375. };
  4376. l(g)
  4377. }
  4378. },
  4379. l = function(b) {
  4380. try {
  4381. b.send()
  4382. } catch(a) {
  4383. b.onerror()
  4384. }
  4385. },
  4386. t = function(b, d) {
  4387. a.decodeAudioData(b,
  4388. function(b) {
  4389. b && (r[d._src] = b, v(d, b))
  4390. },
  4391. function() {
  4392. d._emit("loaderror")
  4393. })
  4394. },
  4395. v = function(b, a) {
  4396. a && !b._duration && (b._duration = a.duration);
  4397. 0 === Object.keys(b._sprite).length && (b._sprite = {
  4398. __default: [0, 1E3 * b._duration]
  4399. });
  4400. b._loaded || (b._loaded = !0, b._emit("load"));
  4401. b._autoplay && b.play()
  4402. };
  4403. "function" == typeof define && define.amd && define("howler",
  4404. function() {
  4405. return {
  4406. Howler: c,
  4407. Howl: e
  4408. }
  4409. });
  4410. "undefined" != typeof exports && (exports.Howler = c, exports.Howl = e);
  4411. "undefined" != typeof window && (window.HowlerGlobal = d, window.Howler = c, window.Howl = e, window.Sound = g)
  4412. } (); !
  4413. function() {
  4414. HowlerGlobal.prototype.init = function(a) {
  4415. return function() {
  4416. return this._pos = [0, 0, 0],
  4417. this._orientation = [0, 0, -1, 0, 1, 0],
  4418. this._velocity = [0, 0, 0],
  4419. this._listenerAttr = {
  4420. dopplerFactor: 1,
  4421. speedOfSound: 343.3
  4422. },
  4423. a.call(this, o)
  4424. }
  4425. } (HowlerGlobal.prototype.init);
  4426. HowlerGlobal.prototype.pos = function(a, h, n) {
  4427. return this.ctx && this.ctx.listener ? (h = "number" != typeof h ? this._pos[1] : h, n = "number" != typeof n ? this._pos[2] : n, "number" != typeof a ? this._pos: (this._pos = [a, h, n], this.ctx.listener.setPosition(this._pos[0], this._pos[1], this._Pos[2]), this)) : this
  4428. };
  4429. HowlerGlobal.prototype.orientatin = function(a, h, n, p, b, d) {
  4430. if (!this.ctx || !this.ctx.listener) return this;
  4431. var c = this._orientation;
  4432. return h = "number" != typeof h ? c[1] : h,
  4433. n = "number" != typeof n ? c[2] : n,
  4434. p = "number" != typeof p ? c[3] : p,
  4435. b = "number" != typeof b ? c[4] : b,
  4436. d = "number" != typeof d ? c[5] : d,
  4437. "number" != typeof a ? c: (this._orientation = [a, h, n, p, b, d], this.ctx.listener.setOrientation(c[0], c[1], c[2], c[3], c[4], c[5]), this)
  4438. };
  4439. HowlerGlobal.prototype.velocity = function(a, h, n) {
  4440. return this.ctx && this.ctx.listener ? (h = "number" != typeof h ? this._velocity[1] : h, n = "number" != typeof n ? this._velocity[2] : n, "number" != typeof a ? this._velocity: (this._velocity = [a, h, n], this.ctx.listener.setVelocity(this._velocity[0], this._velocity[1], this._velocity[2]), this)) : this
  4441. };
  4442. HowlerGlobal.prototype.listenerAttr = function(a) {
  4443. if (!this.ctx || !this.ctx.listener) return this;
  4444. var h = this._listenerAttr;
  4445. return a ? (this._listenerAttr = {
  4446. dopplerFactor: void 0 !== a.dopplerFactor ? a.dopplerFactor: h.dopplerFactor,
  4447. speedOfSound: void 0 !== a.speedOfSound ? a.speedOfSound: h.speedOfSound
  4448. },
  4449. this.ctx.listener.dopplerFactor = h.dopplerFactor, this.ctx.listener.speedOfSound = h.speedOfSound, this) : h
  4450. };
  4451. Howl.prototype.init = function(a) {
  4452. return function(h) {
  4453. return this._orientation = h.orientation || [1, 0, 0],
  4454. this._pos = h.pos || null,
  4455. this._velocity = h.velocity || [0, 0, 0],
  4456. this._pannerAttr = {
  4457. coneInnerAngle: void 0 !== h.coneInnerAngle ? h.coneInnerAngle: 360,
  4458. coneOUterAngle: void 0 !== h.coneOUterAngle ? h.coneOUterAngle: 360,
  4459. coneOuterGain: void 0 !== h.coneOuterGain ? h.coneOuterGain: 0,
  4460. distanceModel: void 0 !== h.distanceModel ? h.distanceModel: "inverse",
  4461. maxDistance: void 0 !== h.maxDistance ? h.maxDistance: 1E4,
  4462. panningModel: void 0 !== h.panningModel ? h.panningModel: "HRTF",
  4463. refDistance: void 0 !== h.refDistance ? h.refDistance: 1,
  4464. rolloffFactor: void 0 !== h.rolloffFactor ? h.rolloffFactor: 1
  4465. },
  4466. a.call(this, h)
  4467. }
  4468. } (Howl.prototype.init);
  4469. Howl.prototype.pos = function(f, h, n, p) {
  4470. var b = this;
  4471. if (!b._webAudio) return b;
  4472. if (!b._loaded) return b.once("play",
  4473. function() {
  4474. b.pos(f, h, n, p)
  4475. }),
  4476. b;
  4477. if (h = "number" != typeof h ? 0 : h, n = "number" != typeof n ? -0.5 : n, void 0 === p) {
  4478. if ("number" != typeof f) return b._pos;
  4479. b._pos = [f, h, n]
  4480. }
  4481. for (var d = b._getSoundIds(p), c = 0; c < d.length; c++) {
  4482. var e = b._soundById(d[c]);
  4483. if (e) {
  4484. if ("number" != typeof f) return e._pos;
  4485. e._pos = [f, h, n];
  4486. e._node && (e._panner || a(e), e._panner.setPosition(f, h, n))
  4487. }
  4488. }
  4489. return b
  4490. };
  4491. Howl.prototype.orientation = function(f, h, n, p) {
  4492. var b = this;
  4493. if (!b._webAudio) return b;
  4494. if (!b._loaded) return b.once("play",
  4495. function() {
  4496. b.orientation(f, h, n, p)
  4497. }),
  4498. b;
  4499. if (h = "number" != typeof h ? b._orientation[1] : h, n = "number" != typeof n ? b._orientation[1] : n, void 0 === p) {
  4500. if ("number" != typeof f) return b._orientation;
  4501. b._orientation = [f, h, n]
  4502. }
  4503. for (var d = b._getSoundIds(p), c = 0; c < d.length; c++) {
  4504. var e = b._soundById(d[c]);
  4505. if (e) {
  4506. if ("number" != typeof f) return e._orientation;
  4507. e._orientation = [f, h, n];
  4508. e._node && (e._panner || a(e), e._panner.setOrientation(f, h, n))
  4509. }
  4510. }
  4511. return b
  4512. };
  4513. Howl.prototype.velocity = function(f, h, n, p) {
  4514. var b = this;
  4515. if (!b._webAudio) return b;
  4516. if (!b._loaded) return b.once("play",
  4517. function() {
  4518. b.velocity(f, h, n, p)
  4519. }),
  4520. b;
  4521. if (h = "number" != typeof h ? b._velocity[1] : h, n = "number" != typeof n ? b._velocity[1] : n, void 0 === p) {
  4522. if ("number" != typeof f) return b._velocity;
  4523. b._velocity = [f, h, n]
  4524. }
  4525. for (var d = b._getSoundIds(p), c = 0; c < d.length; c++) {
  4526. var e = b._soundById(d[c]);
  4527. if (e) {
  4528. if ("number" != typeof f) return e._velocity;
  4529. e._velocity = [f, h, n];
  4530. e._node && (e._panner || a(e), e._panner.setVelocity(f, h, n))
  4531. }
  4532. }
  4533. return b
  4534. };
  4535. Howl.prototype.pannerAttr = function() {
  4536. var f, h, n, p = arguments;
  4537. if (!this._webAudio) return this;
  4538. if (0 === p.length) return this._pannerAttr;
  4539. if (1 === p.length) {
  4540. if ("object" != typeof p[0]) return n = this._soundById(parseInt(p[0], 10)),
  4541. n ? n._pannerAttr: this._pannerAttr;
  4542. f = p[0];
  4543. void 0 === h && (this._pannerAttr = {
  4544. coneInnerAngle: void 0 !== f.coneInnerAngle ? f.coneInnerAngle: this._coneInnerAngle,
  4545. coneOUterAngle: void 0 !== f.coneOUterAngle ? f.coneOUterAngle: this._coneOUterAngle,
  4546. coneOuterGain: void 0 !== f.coneOuterGain ? f.coneOuterGain: this._coneOuterGain,
  4547. distanceModel: void 0 !== f.distanceModel ? f.distanceModel: this._distanceModel,
  4548. maxDistance: void 0 !== f.maxDistance ? f.maxDistance: this._maxDistance,
  4549. panningModel: void 0 !== f.panningModel ? f.panningModel: this._panningModel,
  4550. refDistance: void 0 !== f.refDistance ? f.refDistance: this._refDistance,
  4551. rolloffFactor: void 0 !== f.rolloffFactor ? f.rolloffFactor: this._rolloffFactor
  4552. })
  4553. } else 2 === p.length && (f = p[0], h = parseInt(p[1], 10));
  4554. h = this._getSoundIds(h);
  4555. for (p = 0; p < h.length; p++) if (n = this._soundById(h[p])) {
  4556. var b = n._pannerAttr,
  4557. b = {
  4558. coneInnerAngle: void 0 !== f.coneInnerAngle ? f.coneInnerAngle: b.coneInnerAngle,
  4559. coneOUterAngle: void 0 !== f.coneOUterAngle ? f.coneOUterAngle: b.coneOUterAngle,
  4560. coneOuterGain: void 0 !== f.coneOuterGain ? f.coneOuterGain: b.coneOuterGain,
  4561. distanceModel: void 0 !== f.distanceModel ? f.distanceModel: b.distanceModel,
  4562. maxDistance: void 0 !== f.maxDistance ? f.maxDistance: b.maxDistance,
  4563. panningModel: void 0 !== f.panningModel ? f.panningModel: b.panningModel,
  4564. refDistance: void 0 !== f.refDistance ? f.refDistance: b.refDistance,
  4565. rolloffFactor: void 0 !== f.rolloffFactor ? f.rolloffFactor: b.rolloffFactor
  4566. },
  4567. d = n._panner;
  4568. d ? (d.coneInnerAngle = b.coneInnerAngle, d.coneOUterAngle = b.coneOUterAngle, d.coneOuterGain = b.coneOuterGain, d.distanceModel = b.distanceModel, d.maxDistance = b.maxDistance, d.panningModel = b.panningModel, d.refDistance = b.refDistance, d.rolloffFactor = b.rolloffFactor) : (n._pos || (n._pos = this._pos || [0, 0, -0.5]), a(n))
  4569. }
  4570. return this
  4571. };
  4572. Sound.prototype.init = function(a) {
  4573. return function() {
  4574. var h = this._parent;
  4575. this._orientation = h._orientation;
  4576. this._pos = h._pos;
  4577. this._velocity = h._velocity;
  4578. this._pannerAttr = h._pannerAttr;
  4579. a.call(this);
  4580. this._pos && h.pos(this._pos[0], this._pos[1], this._pos[2], this._id)
  4581. }
  4582. } (Sound.prototype.init);
  4583. Sound.prototype.reset = function(a) {
  4584. return function() {
  4585. var h = this._parent;
  4586. return this._orientation = h._orientation,
  4587. this._pos = h._pos,
  4588. this._velocity = h._velocity,
  4589. this._pannerAttr = h._pannerAttr,
  4590. a.call(this)
  4591. }
  4592. } (Sound.prototype.reset);
  4593. var a = function(a) {
  4594. a._panner = Howler.ctx.createPanner();
  4595. a._panner.coneInnerAngle = a._pannerAttr.coneInnerAngle;
  4596. a._panner.coneOUterAngle = a._pannerAttr.coneOUterAngle;
  4597. a._panner.coneOuterGain = a._pannerAttr.coneOuterGain;
  4598. a._panner.distanceModel = a._pannerAttr.distanceModel;
  4599. a._panner.maxDistance = a._pannerAttr.maxDistance;
  4600. a._panner.panningModel = a._pannerAttr.panningModel;
  4601. a._panner.refDistance = a._pannerAttr.refDistance;
  4602. a._panner.rolloffFactor = a._pannerAttr.rolloffFactor;
  4603. a._panner.setPosition(a._pos[0], a._pos[1], a._pos[2]);
  4604. a._panner.setOrientation(a._orientation[0], a._orientation[1], a._orientation[2]);
  4605. a._panner.setVelocity(a._velocity[0], a._velocity[1], a._velocity[2]);
  4606. a._panner.connect(a._node);
  4607. a._paused || a._parent.pause(a._id).play(a._id)
  4608. }
  4609. } (); (function(a) {
  4610. function f() {
  4611. this.fontFamily = "fjs" + (999999 * Math.random() | 0)
  4612. }
  4613. if (!Object.defineProperty) throw "Font.js requires Object.defineProperty, which this browser does not support.";
  4614. if (!document.createElement("canvas").getContext) throw "Font.js requires <canvas> and the Canvas2D API, which this browser does not support."; (function(a) {
  4615. function f(b, a) {
  4616. return this.slice(b, a)
  4617. }
  4618. function p(b, a) {
  4619. var d, f = b.length;
  4620. 2 > arguments.length && (a = 0);
  4621. for (d = 0; d < f; ++d, ++a) this[a] = b[d] & 255
  4622. }
  4623. function b(b) {
  4624. var a, d;
  4625. if ("number" === typeof b) for (a = Array(b), d = 0; d < b; ++d) a[d] = 0;
  4626. else a = b.slice(0);
  4627. a.subarray = f;
  4628. a.buffer = a;
  4629. a.byteLength = a.length;
  4630. a.set = p;
  4631. "object" === typeof b && b.buffer && (a.buffer = b.buffer);
  4632. return a
  4633. }
  4634. try {
  4635. new Uint8Array(1);
  4636. return
  4637. } catch(d) {}
  4638. a.Uint8Array = b;
  4639. a.Uint32Array = b;
  4640. a.Int32Array = b
  4641. })(a); (function(a) {
  4642. a.opera || "response" in XMLHttpRequest.prototype || "mozResponseArrayBuffer" in XMLHttpRequest.prototype || "mozResponse" in XMLHttpRequest.prototype || "responseArrayBuffer" in XMLHttpRequest.prototype || Object.defineProperty(XMLHttpRequest.prototype, "response", {
  4643. get: a.VBArray ?
  4644. function() {
  4645. return new Uint8Array((new VBArray(this.responseBody)).toArray())
  4646. }: function() {
  4647. this.responseBody
  4648. }
  4649. })
  4650. })(a);
  4651. a.btoa || (a.btoa = function(a) {
  4652. var f, p, b, d, c = 0,
  4653. e = 0,
  4654. g = "",
  4655. g = [];
  4656. if (!a) return a;
  4657. do f = a.charCodeAt(c++),
  4658. p = a.charCodeAt(c++),
  4659. b = a.charCodeAt(c++),
  4660. d = f << 16 | p << 8 | b,
  4661. f = d >> 18 & 63,
  4662. p = d >> 12 & 63,
  4663. b = d >> 6 & 63,
  4664. d &= 63,
  4665. g[e++] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(f) + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(p) + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(b) + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d);
  4666. while (c < a.length);
  4667. g = g.join("");
  4668. a = a.length % 3;
  4669. return (a ? g.slice(0, a - 3) : g) + "===".slice(a || 3)
  4670. });
  4671. f.prototype.url = "";
  4672. f.prototype.format = "";
  4673. f.prototype.data = "";
  4674. f.prototype.base64 = "AAEAAAAKAIAAAwAgT1MvMgAAAAAAAACsAAAAWGNtYXAAAAAAAAABBAAAACxnbHlmAAAAAAAAATAAAAAQaGVhZAAAAAAAAAFAAAAAOGhoZWEAAAAAAAABeAAAACRobXR4AAAAAAAAAZwAAAAIbG9jYQAAAAAAAAGkAAAACG1heHAAAAAAAAABrAAAACBuYW1lAAAAAAAAAcwAAAAgcG9zdAAAAAAAAAHsAAAAEAAEAAEAZAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAABAAMAAQAAAAwABAAgAAAABAAEAAEAAABB//8AAABB////wAABAAAAAAABAAAAAAAAAAAAAAAAMQAAAQAAAAAAAAAAAABfDzz1AAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAEAAgAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAIAAAAAQAAAAIAAQABAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAIAHgADAAEECQABAAAAAAADAAEECQACAAIAAAAAAAEAAAAAAAAAAAAAAAAAAA==";
  4675. f.prototype.metrics = {
  4676. quadsize: 0,
  4677. leading: 0,
  4678. ascent: 0,
  4679. descent: 0,
  4680. weightclass: 400
  4681. };
  4682. f.prototype.systemfont = !1;
  4683. f.prototype.loaded = !1;
  4684. f.prototype.onload = function() {};
  4685. f.prototype.onerror = function() {};
  4686. f.prototype.canvas = !1;
  4687. f.prototype.context = !1;
  4688. f.prototype.validate = function(a, f, p, b, d) {
  4689. if (!1 !== d && 0 > d) this.onerror("Requested system font '" + this.fontFamily + "' could not be loaded (it may not be installed).");
  4690. else 0 < getComputedStyle(a, null).getPropertyValue("width").replace("px", "") ? (document.head.removeChild(f), document.body.removeChild(a), this.loaded = !0, this.onload()) : (console.log("Font timing out. Trying again ..."), setTimeout(function() {
  4691. b.validate(a, f, p, b, !1 === d ? !1 : d - 50)
  4692. },
  4693. 1E3))
  4694. };
  4695. f.prototype.ondownloaded = function() {
  4696. var a = this,
  4697. f = function(b) {
  4698. return String.fromCharCode(b)
  4699. },
  4700. p = function(b) {
  4701. if (256 > b) return f(0) + f(b);
  4702. var a = b & 255;
  4703. return f(b >> 8) + f(a)
  4704. },
  4705. b = function(b, a) {
  4706. var d = 1 === b >> 7,
  4707. c;
  4708. c = 256 * (b & 127) + a;
  4709. return d ? c - 32768 : c
  4710. },
  4711. d = f(0) + f(1) + f(0) + f(0),
  4712. c = this.data,
  4713. e = f(c[0]) + f(c[1]) + f(c[2]) + f(c[3]),
  4714. e = (d = e === d) ? !1 : "OTTO" === e;
  4715. if (d) this.format = "truetype";
  4716. else if (e) this.format = "opentype";
  4717. else {
  4718. a.onerror("Error: file at " + this.url + " cannot be interpreted as OpenType font.");
  4719. return
  4720. }
  4721. for (var e = 256 * c[4] + c[5], g = 12 + 16 * e, r = {},
  4722. d = 12; d < g; d += 16) e = f(c[d]) + f(c[d + 1]) + f(c[d + 2]) + f(c[d + 3]),
  4723. r[e] = {
  4724. name: e,
  4725. checksum: 16777216 * c[d + 4] + 65536 * c[d + 5] + 256 * c[d + 6] + c[d + 7],
  4726. offset: 16777216 * c[d + 8] + 65536 * c[d + 9] + 256 * c[d + 10] + c[d + 11],
  4727. length: 16777216 * c[d + 12] + 65536 * c[d + 13] + 256 * c[d + 14] + c[d + 15]
  4728. };
  4729. g = function(b) {
  4730. return r[b] ? b: (a.onerror("Error: font is missing the required OpenType '" + b + "' table."), !1)
  4731. };
  4732. e = g("head");
  4733. if (!1 !== e) {
  4734. d = r[e].offset;
  4735. r[e].version = "" + c[d] + c[d + 1] + c[d + 2] + c[d + 3];
  4736. var k = 256 * c[d + 18] + c[d + 19];
  4737. this.metrics.quadsize = k;
  4738. e = g("hhea");
  4739. if (!1 !== e && (d = r[e].offset, r[e].version = "" + c[d] + c[d + 1] + c[d + 2] + c[d + 3], this.metrics.ascent = b(c[d + 4], c[d + 5]) / k, this.metrics.descent = b(c[d + 6], c[d + 7]) / k, this.metrics.leading = b(c[d + 8], c[d + 9]) / k, e = g("OS/2"), !1 !== e && (d = r[e].offset, r[e].version = "" + c[d] + c[d + 1], this.metrics.weightclass = 256 * c[d + 4] + c[d + 5], e = g("cmap"), !1 !== e))) {
  4740. d = r[e].offset;
  4741. r[e].version = "" + c[d] + c[d + 1];
  4742. for (var e = 256 * c[d + 2] + c[d + 3], l, t, g = !1, b = 0; b < e; b++) l = d + 4 + 8 * b,
  4743. k = 256 * c[l] + c[l + 1],
  4744. t = 256 * c[l + 2] + c[l + 3],
  4745. l = 16777216 * c[l + 4] + 65536 * c[l + 5] + 256 * c[l + 6] + c[l + 7],
  4746. 3 === k && 1 === t && (g = l);
  4747. b = "A";
  4748. if (!1 !== g && (d += g, e = 256 * c[d] + c[d + 1], 4 === e)) {
  4749. e = d + 14;
  4750. g = d + 14 + (256 * c[d + 6] + c[d + 7]) / 2 * 2;
  4751. for (d = !1; e < g; e += 2) {
  4752. d = 256 * c[e] + c[e + 1];
  4753. if ( - 1 === [9, 10, 11, 12, 13, 32, 133, 160, 5760, 6158, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8232, 8233, 8239, 8287, 12288].indexOf(d)) break;
  4754. d = !1
  4755. } ! 1 != d && (b = String.fromCharCode(d), c = ( - (d - 1) + 65536) % 65536, p = f(0) + p(d) + p(65535) + p(0) + p(d) + p(65535) + p(c) + p(1), p = btoa(p), this.base64 = this.base64.substring(0, 380) + p + this.base64.substring(380 + p.length))
  4756. }
  4757. this.bootstrapValidation(b, !1)
  4758. }
  4759. }
  4760. };
  4761. f.prototype.bootstrapValidation = function(a, f) {
  4762. var p = this.fontFamily + " testfont",
  4763. b = document.createElement("style");
  4764. b.setAttribute("type", "text/css");
  4765. b.innerHTML = "@font-face {\n font-family: '" + p + "';\n src: url('data:application/x-font-ttf;base64," + this.base64 + "')\n format('truetype');}";
  4766. document.head.appendChild(b);
  4767. var d = !1;
  4768. this.systemfont || (d = this.toStyleNode(), document.head.appendChild(d));
  4769. var c = document.createElement("p");
  4770. c.style.cssText = "position: absolute; top: 0; left: 0; opacity: 0;";
  4771. c.style.fontFamily = "'" + this.fontFamily + "', '" + p + "'";
  4772. c.innerHTML = a + a + a + a + a + a + a + a + a + a;
  4773. document.body.appendChild(c);
  4774. if ("undefined" === typeof getComputedStyle) this.onload(),
  4775. error("Error: getComputedStyle is not supported by this browser.\nConsequently, Font.onload() cannot be trusted.");
  4776. else {
  4777. var p = this.systemfont ? 1E3: this.metrics.quadsize,
  4778. e = document.createElement("canvas");
  4779. e.width = p;
  4780. e.height = p;
  4781. this.canvas = e;
  4782. e = e.getContext("2d");
  4783. e.font = "1em '" + this.fontFamily + "'";
  4784. e.fillStyle = "white";
  4785. e.fillRect( - 1, -1, p + 2, p + 2);
  4786. e.fillStyle = "black";
  4787. e.fillText("test text", 50, p / 2);
  4788. this.context = e;
  4789. var g = this;
  4790. setTimeout(function() {
  4791. g.validate(c, b, d, g, f)
  4792. },
  4793. 50)
  4794. }
  4795. };
  4796. f.prototype.processSystemFont = function() {
  4797. this.systemfont = !0;
  4798. this.metrics = !1;
  4799. this.bootstrapValidation("A", 1E3)
  4800. };
  4801. f.prototype.loadFont = function() {
  4802. var a = this;
  4803. if ( - 1 === this.url.indexOf(".")) setTimeout(function() {
  4804. a.processSystemFont()
  4805. },
  4806. 10);
  4807. else {
  4808. var f = new XMLHttpRequest;
  4809. f.open("GET", a.url, !0);
  4810. f.responseType = "arraybuffer";
  4811. f.onload = function(p) {
  4812. if (p = f.response) a.data = new Uint8Array(p),
  4813. a.ondownloaded();
  4814. else a.onerror("Error downloading font resource from " + a.url)
  4815. };
  4816. f.send(null)
  4817. }
  4818. };
  4819. f.prototype.styleNode = !1;
  4820. f.prototype.toStyleNode = function() {
  4821. if (this.styleNode) return this.styleNode;
  4822. this.styleNode = document.createElement("style");
  4823. this.styleNode.type = "text/css";
  4824. var a;
  4825. a = "@font-face {\n" + (" font-family: '" + this.fontFamily + "';\n");
  4826. a += " src: url('" + this.url + "') format('" + this.format + "');\n";
  4827. this.styleNode.innerHTML = a + "}";
  4828. return this.styleNode
  4829. };
  4830. f.prototype.measureText = function(a, f) {
  4831. if (!this.loaded) return this.onerror("measureText() was called while the font was not yet loaded"),
  4832. !1;
  4833. this.context.font = f + "px '" + this.fontFamily + "'";
  4834. var p = this.context.measureText(a);
  4835. p.fontsize = f;
  4836. p.ascent = 0;
  4837. p.descent = 0;
  4838. p.bounds = {
  4839. minx: 0,
  4840. maxx: p.width,
  4841. miny: 0,
  4842. maxy: 0
  4843. };
  4844. p.height = 0;
  4845. var b = [];
  4846. b.push(a);
  4847. var d = b.length,
  4848. c;
  4849. for (c = 0; c < d; c++) this.measureSegment(b[c], f, p);
  4850. return p
  4851. };
  4852. f.prototype.measureSegment = function(a, f, p) {
  4853. var b, d = document.createElement("div");
  4854. d.style.position = "absolute";
  4855. d.style.opacity = 0;
  4856. d.style.font = f + "px '" + this.fontFamily + "'";
  4857. d.innerHTML = a;
  4858. for (b = 1; 10 > b; b++) d.innerHTML += "<br/>" + a;
  4859. document.body.appendChild(d);
  4860. p.leading = 1.2 * f;
  4861. b = document.defaultView.getComputedStyle(d, null).getPropertyValue("height");
  4862. b = b.replace("px", "");
  4863. b >= 10 * f && (p.leading = b / 10 | 0);
  4864. document.body.removeChild(d);
  4865. if (/^\s*$/.test(a)) return p;
  4866. b = this.context;
  4867. var c = this.systemfont ? 1E3: this.metrics.quadsize,
  4868. d = c / 2,
  4869. e = (c - p.width) / 2;
  4870. e !== (e | 0) && (e |= 0);
  4871. b.fillStyle = "white";
  4872. b.fillRect( - 50, -50, c + 100, c + 100);
  4873. b.fillStyle = "black";
  4874. b.fillText(a, e, d);
  4875. a = p.width + 50 | 0;
  4876. var g = 4 * f;
  4877. f = b.getImageData(e - 25, d - g / 2, a, g).data;
  4878. d = b = 0;
  4879. e = 4 * a;
  4880. c = f.length;
  4881. for (g /= 2; ++b < c && 255 === f[b];);
  4882. var r = b / e | 0;
  4883. for (b = c - 1; 0 < --b && 255 === f[b];);
  4884. for (var k = b / e | 0,
  4885. d = b = 0; d < a && 255 === f[b];) b += e,
  4886. b >= c && (d++, b = b - c + 4);
  4887. var l = d,
  4888. t = 1;
  4889. b = c - 3;
  4890. for (d = 0; d < a && 255 === f[b];) b -= e,
  4891. 0 > b && (d++, b = c - 3 - 4 * t++);
  4892. p.ascent = g - r;
  4893. p.descent = k - g;
  4894. p.bounds = {
  4895. minx: l - 25,
  4896. maxx: a - d - 25,
  4897. miny: -p.descent,
  4898. maxy: p.ascent
  4899. };
  4900. p.height = 1 + (k - r);
  4901. return p
  4902. };
  4903. Object.defineProperty(f.prototype, "src", {
  4904. set: function(a) {
  4905. this.url = a;
  4906. this.loadFont()
  4907. }
  4908. });
  4909. "undefined" !== typeof define ? define(function() {
  4910. return f
  4911. }) : a.Font = f
  4912. })(window);
  4913. /*
  4914. */
  4915. (function() {
  4916. var a = a || {};
  4917. a.WEBGL_RENDERER = 0;
  4918. a.CANVAS_RENDERER = 1;
  4919. a.VERSION = "v1.6";
  4920. a.blendModes = {
  4921. NORMAL: 0,
  4922. ADD: 1,
  4923. MULTIPLY: 2,
  4924. SCREEN: 3,
  4925. OVERLAY: 4,
  4926. DARKEN: 5,
  4927. LIGHTEN: 6,
  4928. COLOR_DODGE: 7,
  4929. COLOR_BURN: 8,
  4930. HARD_LIGHT: 9,
  4931. SOFT_LIGHT: 10,
  4932. DIFFERENCE: 11,
  4933. EXCLUSION: 12,
  4934. HUE: 13,
  4935. SATURATION: 14,
  4936. COLOR: 15,
  4937. LUMINOSITY: 16
  4938. };
  4939. a.scaleModes = {
  4940. DEFAULT: 0,
  4941. LINEAR: 0,
  4942. NEAREST: 1
  4943. };
  4944. a._UID = 0;
  4945. "undefined" != typeof Float32Array ? (a.Float32Array = Float32Array, a.Uint16Array = Uint16Array) : (a.Float32Array = Array, a.Uint16Array = Array);
  4946. a.INTERACTION_FREQUENCY = 30;
  4947. a.AUTO_PREVENT_DEFAULT = !0;
  4948. a.RAD_TO_DEG = 180 / Math.PI;
  4949. a.DEG_TO_RAD = Math.PI / 180;
  4950. a.dontSayHello = !1;
  4951. a.sayHello = function(b) {
  4952. };
  4953. a.Point = function(b, a) {
  4954. this.x = b || 0;
  4955. this.y = a || 0
  4956. };
  4957. a.Point.prototype.clone = function() {
  4958. return new a.Point(this.x, this.y)
  4959. };
  4960. a.Point.prototype.set = function(b, a) {
  4961. this.x = b || 0;
  4962. this.y = a || (0 !== a ? this.x: 0)
  4963. };
  4964. a.Point.prototype.constructor = a.Point;
  4965. a.Rectangle = function(b, a, c, e) {
  4966. this.x = b || 0;
  4967. this.y = a || 0;
  4968. this.width = c || 0;
  4969. this.height = e || 0
  4970. };
  4971. a.Rectangle.prototype.clone = function() {
  4972. return new a.Rectangle(this.x, this.y, this.width, this.height)
  4973. };
  4974. a.Rectangle.prototype.contains = function(b, a) {
  4975. if (0 >= this.width || 0 >= this.height) return ! 1;
  4976. var c = this.x;
  4977. return b >= c && b <= c + this.width && (c = this.y, a >= c && a <= c + this.height) ? !0 : !1
  4978. };
  4979. a.Rectangle.prototype.constructor = a.Rectangle;
  4980. a.EmptyRectangle = new a.Rectangle(0, 0, 0, 0);
  4981. a.Polygon = function(b) {
  4982. b instanceof Array || (b = Array.prototype.slice.call(arguments));
  4983. if ("number" === typeof b[0]) {
  4984. for (var d = [], c = 0, e = b.length; c < e; c += 2) d.push(new a.Point(b[c], b[c + 1]));
  4985. b = d
  4986. }
  4987. this.points = b
  4988. };
  4989. a.Polygon.prototype.clone = function() {
  4990. for (var b = [], d = 0; d < this.points.length; d++) b.push(this.points[d].clone());
  4991. return new a.Polygon(b)
  4992. };
  4993. a.Polygon.prototype.contains = function(b, a) {
  4994. for (var c = !1,
  4995. e = 0,
  4996. g = this.points.length - 1; e < this.points.length; g = e++) {
  4997. var f = this.points[e].x,
  4998. k = this.points[e].y,
  4999. l = this.points[g].x,
  5000. g = this.points[g].y;
  5001. k > a !== g > a && b < (l - f) * (a - k) / (g - k) + f && (c = !c)
  5002. }
  5003. return c
  5004. };
  5005. a.Polygon.prototype.constructor = a.Polygon;
  5006. a.Circle = function(b, a, c) {
  5007. this.x = b || 0;
  5008. this.y = a || 0;
  5009. this.radius = c || 0
  5010. };
  5011. a.Circle.prototype.clone = function() {
  5012. return new a.Circle(this.x, this.y, this.radius)
  5013. };
  5014. a.Circle.prototype.contains = function(b, a) {
  5015. if (0 >= this.radius) return ! 1;
  5016. var c = this.x - b,
  5017. e = this.y - a,
  5018. g = this.radius * this.radius;
  5019. return c * c + e * e <= g
  5020. };
  5021. a.Circle.prototype.getBounds = function() {
  5022. return new a.Rectangle(this.x - this.radius, this.y - this.radius, this.width, this.height)
  5023. };
  5024. a.Circle.prototype.constructor = a.Circle;
  5025. a.Ellipse = function(b, a, c, e) {
  5026. this.x = b || 0;
  5027. this.y = a || 0;
  5028. this.width = c || 0;
  5029. this.height = e || 0
  5030. };
  5031. a.Ellipse.prototype.clone = function() {
  5032. return new a.Ellipse(this.x, this.y, this.width, this.height)
  5033. };
  5034. a.Ellipse.prototype.contains = function(b, a) {
  5035. if (0 >= this.width || 0 >= this.height) return ! 1;
  5036. var c = (b - this.x) / this.width,
  5037. e = (a - this.y) / this.height;
  5038. return 1 >= c * c + e * e
  5039. };
  5040. a.Ellipse.prototype.getBounds = function() {
  5041. return new a.Rectangle(this.x - this.width, this.y - this.height, this.width, this.height)
  5042. };
  5043. a.Ellipse.prototype.constructor = a.Ellipse;
  5044. a.Matrix = function() {
  5045. this.a = 1;
  5046. this.c = this.b = 0;
  5047. this.d = 1;
  5048. this.ty = this.tx = 0
  5049. };
  5050. a.Matrix.prototype.fromArray = function(b) {
  5051. this.a = b[0];
  5052. this.b = b[1];
  5053. this.c = b[3];
  5054. this.d = b[4];
  5055. this.tx = b[2];
  5056. this.ty = b[5]
  5057. };
  5058. a.Matrix.prototype.toArray = function(b) {
  5059. this.array || (this.array = new Float32Array(9));
  5060. var a = this.array;
  5061. b ? (a[0] = this.a, a[1] = this.c, a[2] = 0, a[3] = this.b, a[4] = this.d, a[5] = 0, a[6] = this.tx, a[7] = this.ty) : (a[0] = this.a, a[1] = this.b, a[2] = this.tx, a[3] = this.c, a[4] = this.d, a[5] = this.ty, a[6] = 0, a[7] = 0);
  5062. a[8] = 1;
  5063. return a
  5064. };
  5065. a.identityMatrix = new a.Matrix;
  5066. a.determineMatrixArrayType = function() {
  5067. return "undefined" !== typeof Float32Array ? Float32Array: Array
  5068. };
  5069. a.Matrix2 = a.determineMatrixArrayType();
  5070. a.DisplayObject = function() {
  5071. this.position = new a.Point;
  5072. this.scale = new a.Point(1, 1);
  5073. this.pivot = new a.Point(0, 0);
  5074. this.rotation = 0;
  5075. this.alpha = 1;
  5076. this.visible = !0;
  5077. this.hitArea = null;
  5078. this.renderable = this.buttonMode = !1;
  5079. this.stage = this.parent = null;
  5080. this.worldAlpha = 1;
  5081. this._interactive = !1;
  5082. this.defaultCursor = "pointer";
  5083. this.worldTransform = new a.Matrix;
  5084. this.color = [];
  5085. this.dynamic = !0;
  5086. this._sr = 0;
  5087. this._cr = 1;
  5088. this.filterArea = null;
  5089. this._bounds = new a.Rectangle(0, 0, 1, 1);
  5090. this._mask = this._currentBounds = null;
  5091. this._cacheIsDirty = this._cacheAsBitmap = !1
  5092. };
  5093. a.DisplayObject.prototype.constructor = a.DisplayObject;
  5094. a.DisplayObject.prototype.setInteractive = function(b) {
  5095. this.interactive = b
  5096. };
  5097. Object.defineProperty(a.DisplayObject.prototype, "interactive", {
  5098. get: function() {
  5099. return this._interactive
  5100. },
  5101. set: function(b) {
  5102. this._interactive = b;
  5103. this.stage && (this.stage.dirty = !0)
  5104. }
  5105. });
  5106. Object.defineProperty(a.DisplayObject.prototype, "worldVisible", {
  5107. get: function() {
  5108. var b = this;
  5109. do {
  5110. if (!b.visible) return ! 1;
  5111. b = b.parent
  5112. } while ( b );
  5113. return ! 0
  5114. }
  5115. });
  5116. Object.defineProperty(a.DisplayObject.prototype, "mask", {
  5117. get: function() {
  5118. return this._mask
  5119. },
  5120. set: function(b) {
  5121. this._mask && (this._mask.isMask = !1);
  5122. if (this._mask = b) this._mask.isMask = !0
  5123. }
  5124. });
  5125. Object.defineProperty(a.DisplayObject.prototype, "filters", {
  5126. get: function() {
  5127. return this._filters
  5128. },
  5129. set: function(b) {
  5130. if (b) {
  5131. for (var a = [], c = 0; c < b.length; c++) for (var e = b[c].passes, g = 0; g < e.length; g++) a.push(e[g]);
  5132. this._filterBlock = {
  5133. target: this,
  5134. filterPasses: a
  5135. }
  5136. }
  5137. this._filters = b
  5138. }
  5139. });
  5140. Object.defineProperty(a.DisplayObject.prototype, "cacheAsBitmap", {
  5141. get: function() {
  5142. return this._cacheAsBitmap
  5143. },
  5144. set: function(b) {
  5145. this._cacheAsBitmap !== b && (b ? this._generateCachedSprite() : this._destroyCachedSprite(), this._cacheAsBitmap = b)
  5146. }
  5147. });
  5148. a.DisplayObject.prototype.updateTransform = function() {
  5149. this.rotation !== this.rotationCache && (this.rotationCache = this.rotation, this._sr = Math.sin(this.rotation), this._cr = Math.cos(this.rotation));
  5150. var b = this.parent.worldTransform,
  5151. a = this.worldTransform,
  5152. c = this.pivot.x,
  5153. e = this.pivot.y,
  5154. g = this._cr * this.scale.x,
  5155. f = -this._sr * this.scale.y,
  5156. k = this._sr * this.scale.x,
  5157. l = this._cr * this.scale.y,
  5158. t = this.position.x - g * c - e * f,
  5159. c = this.position.y - l * e - c * k,
  5160. e = b.a,
  5161. h = b.b,
  5162. q = b.c,
  5163. n = b.d;
  5164. a.a = e * g + h * k;
  5165. a.b = e * f + h * l;
  5166. a.tx = e * t + h * c + b.tx;
  5167. a.c = q * g + n * k;
  5168. a.d = q * f + n * l;
  5169. a.ty = q * t + n * c + b.ty;
  5170. this.worldAlpha = this.alpha * this.parent.worldAlpha
  5171. };
  5172. a.DisplayObject.prototype.getBounds = function(b) {
  5173. return a.EmptyRectangle
  5174. };
  5175. a.DisplayObject.prototype.getLocalBounds = function() {
  5176. return this.getBounds(a.identityMatrix)
  5177. };
  5178. a.DisplayObject.prototype.setStageReference = function(b) {
  5179. this.stage = b;
  5180. this._interactive && (this.stage.dirty = !0)
  5181. };
  5182. a.DisplayObject.prototype.generateTexture = function(b) {
  5183. var d = this.getLocalBounds();
  5184. b = new a.RenderTexture(d.width | 0, d.height | 0, b);
  5185. b.render(this, new a.Point( - d.x, -d.y));
  5186. return b
  5187. };
  5188. a.DisplayObject.prototype.updateCache = function() {
  5189. this._generateCachedSprite()
  5190. };
  5191. a.DisplayObject.prototype._renderCachedSprite = function(b) {
  5192. this._cachedSprite.worldAlpha = this.worldAlpha;
  5193. b.gl ? a.Sprite.prototype._renderWebGL.call(this._cachedSprite, b) : a.Sprite.prototype._renderCanvas.call(this._cachedSprite, b)
  5194. };
  5195. a.DisplayObject.prototype._generateCachedSprite = function() {
  5196. this._cacheAsBitmap = !1;
  5197. var b = this.getLocalBounds();
  5198. if (this._cachedSprite) this._cachedSprite.texture.resize(b.width | 0, b.height | 0);
  5199. else {
  5200. var d = new a.RenderTexture(b.width | 0, b.height | 0);
  5201. this._cachedSprite = new a.Sprite(d);
  5202. this._cachedSprite.worldTransform = this.worldTransform
  5203. }
  5204. d = this._filters;
  5205. this._filters = null;
  5206. this._cachedSprite.filters = d;
  5207. this._cachedSprite.texture.render(this, new a.Point( - b.x, -b.y));
  5208. this._cachedSprite.anchor.x = -(b.x / b.width);
  5209. this._cachedSprite.anchor.y = -(b.y / b.height);
  5210. this._filters = d;
  5211. this._cacheAsBitmap = !0
  5212. };
  5213. a.DisplayObject.prototype._destroyCachedSprite = function() {
  5214. this._cachedSprite && (this._cachedSprite.texture.destroy(!0), this._cachedSprite = null)
  5215. };
  5216. a.DisplayObject.prototype._renderWebGL = function(b) {};
  5217. a.DisplayObject.prototype._renderCanvas = function(b) {};
  5218. Object.defineProperty(a.DisplayObject.prototype, "x", {
  5219. get: function() {
  5220. return this.position.x
  5221. },
  5222. set: function(b) {
  5223. this.position.x = b
  5224. }
  5225. });
  5226. Object.defineProperty(a.DisplayObject.prototype, "y", {
  5227. get: function() {
  5228. return this.position.y
  5229. },
  5230. set: function(b) {
  5231. this.position.y = b
  5232. }
  5233. });
  5234. a.DisplayObjectContainer = function() {
  5235. a.DisplayObject.call(this);
  5236. this.children = []
  5237. };
  5238. a.DisplayObjectContainer.prototype = Object.create(a.DisplayObject.prototype);
  5239. a.DisplayObjectContainer.prototype.constructor = a.DisplayObjectContainer;
  5240. Object.defineProperty(a.DisplayObjectContainer.prototype, "width", {
  5241. get: function() {
  5242. return this.scale.x * this.getLocalBounds().width
  5243. },
  5244. set: function(b) {
  5245. this.scale.x = b / (this.getLocalBounds().width / this.scale.x);
  5246. this._width = b
  5247. }
  5248. });
  5249. Object.defineProperty(a.DisplayObjectContainer.prototype, "height", {
  5250. get: function() {
  5251. return this.scale.y * this.getLocalBounds().height
  5252. },
  5253. set: function(b) {
  5254. this.scale.y = b / (this.getLocalBounds().height / this.scale.y);
  5255. this._height = b
  5256. }
  5257. });
  5258. a.DisplayObjectContainer.prototype.addChild = function(b) {
  5259. return this.addChildAt(b, this.children.length)
  5260. };
  5261. a.DisplayObjectContainer.prototype.addChildAt = function(b, a) {
  5262. if (0 <= a && a <= this.children.length) return b.parent && b.parent.removeChild(b),
  5263. b.parent = this,
  5264. this.children.splice(a, 0, b),
  5265. this.stage && b.setStageReference(this.stage),
  5266. b;
  5267. throw Error(b + " The index " + a + " supplied is out of bounds " + this.children.length);
  5268. };
  5269. a.DisplayObjectContainer.prototype.swapChildren = function(b, a) {
  5270. if (b !== a) {
  5271. var c = this.children.indexOf(b),
  5272. e = this.children.indexOf(a);
  5273. if (0 > c || 0 > e) throw Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller.");
  5274. this.children[c] = a;
  5275. this.children[e] = b
  5276. }
  5277. };
  5278. a.DisplayObjectContainer.prototype.getChildAt = function(b) {
  5279. if (0 <= b && b < this.children.length) return this.children[b];
  5280. throw Error("Supplied index does not exist in the child list, or the supplied DisplayObject must be a child of the caller");
  5281. };
  5282. a.DisplayObjectContainer.prototype.removeChild = function(b) {
  5283. return this.removeChildAt(this.children.indexOf(b))
  5284. };
  5285. a.DisplayObjectContainer.prototype.removeChildAt = function(b) {
  5286. var a = this.getChildAt(b);
  5287. this.stage && a.removeStageReference();
  5288. a.parent = void 0;
  5289. this.children.splice(b, 1);
  5290. return a
  5291. };
  5292. a.DisplayObjectContainer.prototype.removeChildren = function(b, a) {
  5293. var c = b || 0,
  5294. e = "number" === typeof a ? a: this.children.length,
  5295. g = e - c;
  5296. if (0 < g && g <= e) {
  5297. c = this.children.splice(c, g);
  5298. for (e = 0; e < c.length; e++) g = c[e],
  5299. this.stage && g.removeStageReference(),
  5300. g.parent = void 0;
  5301. return c
  5302. }
  5303. throw Error("Range Error, numeric values are outside the acceptable range");
  5304. };
  5305. a.DisplayObjectContainer.prototype.updateTransform = function() {
  5306. if (this.visible && (a.DisplayObject.prototype.updateTransform.call(this), !this._cacheAsBitmap)) for (var b = 0,
  5307. d = this.children.length; b < d; b++) this.children[b].updateTransform()
  5308. };
  5309. a.DisplayObjectContainer.prototype.getBounds = function(b) {
  5310. if (0 === this.children.length) return a.EmptyRectangle;
  5311. if (b) {
  5312. var d = this.worldTransform;
  5313. this.worldTransform = b;
  5314. this.updateTransform();
  5315. this.worldTransform = d
  5316. }
  5317. for (var c = d = Infinity,
  5318. e = -Infinity,
  5319. g = -Infinity,
  5320. f, k, l = !1,
  5321. t = 0,
  5322. h = this.children.length; t < h; t++) this.children[t].visible && (l = !0, f = this.children[t].getBounds(b), d = d < f.x ? d: f.x, c = c < f.y ? c: f.y, k = f.width + f.x, f = f.height + f.y, e = e > k ? e: k, g = g > f ? g: f);
  5323. if (!l) return a.EmptyRectangle;
  5324. b = this._bounds;
  5325. b.x = d;
  5326. b.y = c;
  5327. b.width = e - d;
  5328. b.height = g - c;
  5329. return b
  5330. };
  5331. a.DisplayObjectContainer.prototype.getLocalBounds = function() {
  5332. var b = this.worldTransform;
  5333. this.worldTransform = a.identityMatrix;
  5334. for (var d = 0,
  5335. c = this.children.length; d < c; d++) this.children[d].updateTransform();
  5336. d = this.getBounds();
  5337. this.worldTransform = b;
  5338. return d
  5339. };
  5340. a.DisplayObjectContainer.prototype.setStageReference = function(b) {
  5341. this.stage = b;
  5342. this._interactive && (this.stage.dirty = !0);
  5343. for (var a = 0,
  5344. c = this.children.length; a < c; a++) this.children[a].setStageReference(b)
  5345. };
  5346. a.DisplayObjectContainer.prototype.removeStageReference = function() {
  5347. for (var b = 0,
  5348. a = this.children.length; b < a; b++) this.children[b].removeStageReference();
  5349. this._interactive && (this.stage.dirty = !0);
  5350. this.stage = null
  5351. };
  5352. a.DisplayObjectContainer.prototype._renderWebGL = function(b) {
  5353. if (this.visible && !(0 >= this.alpha)) if (this._cacheAsBitmap) this._renderCachedSprite(b);
  5354. else {
  5355. var a, c;
  5356. if (this._mask || this._filters) {
  5357. this._filters && (b.spriteBatch.flush(), b.filterManager.pushFilter(this._filterBlock));
  5358. this._mask && (b.spriteBatch.stop(), b.maskManager.pushMask(this.mask, b), b.spriteBatch.start());
  5359. a = 0;
  5360. for (c = this.children.length; a < c; a++) this.children[a]._renderWebGL(b);
  5361. b.spriteBatch.stop();
  5362. this._mask && b.maskManager.popMask(this._mask, b);
  5363. this._filters && b.filterManager.popFilter();
  5364. b.spriteBatch.start()
  5365. } else for (a = 0, c = this.children.length; a < c; a++) this.children[a]._renderWebGL(b)
  5366. }
  5367. };
  5368. a.DisplayObjectContainer.prototype._renderCanvas = function(b) {
  5369. if (!1 !== this.visible && 0 !== this.alpha) if (this._cacheAsBitmap) this._renderCachedSprite(b);
  5370. else {
  5371. this._mask && b.maskManager.pushMask(this._mask, b.context);
  5372. for (var a = 0,
  5373. c = this.children.length; a < c; a++) this.children[a]._renderCanvas(b);
  5374. this._mask && b.maskManager.popMask(b.context)
  5375. }
  5376. };
  5377. a.Sprite = function(b) {
  5378. a.DisplayObjectContainer.call(this);
  5379. this.anchor = new a.Point;
  5380. this.texture = b;
  5381. this._height = this._width = 0;
  5382. this.tint = 16777215;
  5383. this.blendMode = a.blendModes.NORMAL;
  5384. if (b.baseTexture.hasLoaded) this.onTextureUpdate();
  5385. else this.onTextureUpdateBind = this.onTextureUpdate.bind(this),
  5386. this.texture.addEventListener("update", this.onTextureUpdateBind);
  5387. this.renderable = !0
  5388. };
  5389. a.Sprite.prototype = Object.create(a.DisplayObjectContainer.prototype);
  5390. a.Sprite.prototype.constructor = a.Sprite;
  5391. Object.defineProperty(a.Sprite.prototype, "width", {
  5392. get: function() {
  5393. return this.scale.x * this.texture.frame.width
  5394. },
  5395. set: function(b) {
  5396. this.scale.x = b / this.texture.frame.width;
  5397. this._width = b
  5398. }
  5399. });
  5400. Object.defineProperty(a.Sprite.prototype, "height", {
  5401. get: function() {
  5402. return this.scale.y * this.texture.frame.height
  5403. },
  5404. set: function(b) {
  5405. this.scale.y = b / this.texture.frame.height;
  5406. this._height = b
  5407. }
  5408. });
  5409. a.Sprite.prototype.setTexture = function(b) {
  5410. this.texture.baseTexture !== b.baseTexture && (this.textureChange = !0);
  5411. this.texture = b;
  5412. this.cachedTint = 16777215
  5413. };
  5414. a.Sprite.prototype.onTextureUpdate = function() {
  5415. this._width && (this.scale.x = this._width / this.texture.frame.width);
  5416. this._height && (this.scale.y = this._height / this.texture.frame.height)
  5417. };
  5418. a.Sprite.prototype.getBounds = function(b) {
  5419. var a = this.texture.frame.width,
  5420. c = this.texture.frame.height,
  5421. e = a * (1 - this.anchor.x),
  5422. g = a * -this.anchor.x,
  5423. f = c * (1 - this.anchor.y),
  5424. k = c * -this.anchor.y;
  5425. b = b || this.worldTransform;
  5426. var l = b.a,
  5427. h = b.c,
  5428. v = b.b,
  5429. q = b.d,
  5430. n = b.tx,
  5431. p = b.ty;
  5432. b = l * g + v * k + n;
  5433. var c = q * k + h * g + p,
  5434. a = l * e + v * k + n,
  5435. k = q * k + h * e + p,
  5436. u = l * e + v * f + n,
  5437. e = q * f + h * e + p,
  5438. l = l * g + v * f + n,
  5439. g = q * f + h * g + p,
  5440. h = f = -Infinity,
  5441. v = q = Infinity,
  5442. q = b < q ? b: q,
  5443. q = a < q ? a: q,
  5444. q = u < q ? u: q,
  5445. q = l < q ? l: q,
  5446. v = c < v ? c: v,
  5447. v = k < v ? k: v,
  5448. v = e < v ? e: v,
  5449. v = g < v ? g: v,
  5450. f = b > f ? b: f,
  5451. f = a > f ? a: f,
  5452. f = u > f ? u: f,
  5453. h = c > h ? c: h,
  5454. h = k > h ? k: h,
  5455. h = e > h ? e: h;
  5456. b = this._bounds;
  5457. b.x = q;
  5458. b.width = (l > f ? l: f) - q;
  5459. b.y = v;
  5460. b.height = (g > h ? g: h) - v;
  5461. return this._currentBounds = b
  5462. };
  5463. a.Sprite.prototype._renderWebGL = function(b) {
  5464. if (this.visible && !(0 >= this.alpha)) {
  5465. var a, c;
  5466. if (this._mask || this._filters) {
  5467. var e = b.spriteBatch;
  5468. this._filters && (e.flush(), b.filterManager.pushFilter(this._filterBlock));
  5469. this._mask && (e.stop(), b.maskManager.pushMask(this.mask, b), e.start());
  5470. e.render(this);
  5471. a = 0;
  5472. for (c = this.children.length; a < c; a++) this.children[a]._renderWebGL(b);
  5473. e.stop();
  5474. this._mask && b.maskManager.popMask(this._mask, b);
  5475. this._filters && b.filterManager.popFilter();
  5476. e.start()
  5477. } else for (b.spriteBatch.render(this), a = 0, c = this.children.length; a < c; a++) this.children[a]._renderWebGL(b)
  5478. }
  5479. };
  5480. a.Sprite.prototype._renderCanvas = function(b) {
  5481. if (!1 !== this.visible && 0 !== this.alpha) {
  5482. this.blendMode !== b.currentBlendMode && (b.currentBlendMode = this.blendMode, b.context.globalCompositeOperation = a.blendModesCanvas[b.currentBlendMode]);
  5483. this._mask && b.maskManager.pushMask(this._mask, b.context);
  5484. if (this.texture.valid) {
  5485. b.context.globalAlpha = this.worldAlpha;
  5486. b.roundPixels ? b.context.setTransform(this.worldTransform.a, this.worldTransform.c, this.worldTransform.b, this.worldTransform.d, this.worldTransform.tx | 0, this.worldTransform.ty | 0) : b.context.setTransform(this.worldTransform.a, this.worldTransform.c, this.worldTransform.b, this.worldTransform.d, this.worldTransform.tx, this.worldTransform.ty);
  5487. b.smoothProperty && b.scaleMode !== this.texture.baseTexture.scaleMode && (b.scaleMode = this.texture.baseTexture.scaleMode, b.context[b.smoothProperty] = b.scaleMode === a.scaleModes.LINEAR);
  5488. var d = this.texture.trim ? this.texture.trim.x - this.anchor.x * this.texture.trim.width: this.anchor.x * -this.texture.frame.width,
  5489. c = this.texture.trim ? this.texture.trim.y - this.anchor.y * this.texture.trim.height: this.anchor.y * -this.texture.frame.height;
  5490. 16777215 !== this.tint ? (this.cachedTint !== this.tint && (this.cachedTint = this.tint, this.tintedTexture = a.CanvasTinter.getTintedTexture(this, this.tint)), b.context.drawImage(this.tintedTexture, 0, 0, this.texture.crop.width, this.texture.crop.height, d, c, this.texture.crop.width, this.texture.crop.height)) : b.context.drawImage(this.texture.baseTexture.source, this.texture.crop.x, this.texture.crop.y, this.texture.crop.width, this.texture.crop.height, d, c, this.texture.crop.width, this.texture.crop.height)
  5491. }
  5492. d = 0;
  5493. for (c = this.children.length; d < c; d++) this.children[d]._renderCanvas(b);
  5494. this._mask && b.maskManager.popMask(b.context)
  5495. }
  5496. };
  5497. a.Sprite.fromFrame = function(b) {
  5498. var d = a.TextureCache[b];
  5499. if (!d) throw Error('The frameId "' + b + '" does not exist in the texture cache' + this);
  5500. return new a.Sprite(d)
  5501. };
  5502. a.Sprite.fromImage = function(b, d, c) {
  5503. b = a.Texture.fromImage(b, d, c);
  5504. return new a.Sprite(b)
  5505. };
  5506. a.SpriteBatch = function(b) {
  5507. a.DisplayObjectContainer.call(this);
  5508. this.textureThing = b;
  5509. this.ready = !1
  5510. };
  5511. a.SpriteBatch.prototype = Object.create(a.DisplayObjectContainer.prototype);
  5512. a.SpriteBatch.constructor = a.SpriteBatch;
  5513. a.SpriteBatch.prototype.initWebGL = function(b) {
  5514. this.fastSpriteBatch = new a.WebGLFastSpriteBatch(b);
  5515. this.ready = !0
  5516. };
  5517. a.SpriteBatch.prototype.updateTransform = function() {
  5518. a.DisplayObject.prototype.updateTransform.call(this)
  5519. };
  5520. a.SpriteBatch.prototype._renderWebGL = function(b) { ! this.visible || 0 >= this.alpha || !this.children.length || (this.ready || this.initWebGL(b.gl), b.spriteBatch.stop(), b.shaderManager.setShader(b.shaderManager.fastShader), this.fastSpriteBatch.begin(this, b), this.fastSpriteBatch.render(this), b.spriteBatch.start())
  5521. };
  5522. a.SpriteBatch.prototype._renderCanvas = function(b) {
  5523. var d = b.context;
  5524. d.globalAlpha = this.worldAlpha;
  5525. a.DisplayObject.prototype.updateTransform.call(this);
  5526. for (var c = this.worldTransform,
  5527. e = !0,
  5528. g = 0; g < this.children.length; g++) {
  5529. var f = this.children[g];
  5530. if (f.visible) {
  5531. var k = f.texture,
  5532. l = k.frame;
  5533. d.globalAlpha = this.worldAlpha * f.alpha;
  5534. if (0 === f.rotation % (2 * Math.PI)) e && (d.setTransform(c.a, c.c, c.b, c.d, c.tx, c.ty), e = !1),
  5535. d.drawImage(k.baseTexture.source, l.x, l.y, l.width, l.height, f.anchor.x * -l.width * f.scale.x + f.position.x + 0.5 | 0, f.anchor.y * -l.height * f.scale.y + f.position.y + 0.5 | 0, l.width * f.scale.x, l.height * f.scale.y);
  5536. else {
  5537. e || (e = !0);
  5538. a.DisplayObject.prototype.updateTransform.call(f);
  5539. var h = f.worldTransform;
  5540. b.roundPixels ? d.setTransform(h.a, h.c, h.b, h.d, h.tx | 0, h.ty | 0) : d.setTransform(h.a, h.c, h.b, h.d, h.tx, h.ty);
  5541. d.drawImage(k.baseTexture.source, l.x, l.y, l.width, l.height, f.anchor.x * -l.width + 0.5 | 0, f.anchor.y * -l.height + 0.5 | 0, l.width, l.height)
  5542. }
  5543. }
  5544. }
  5545. };
  5546. a.MovieClip = function(b) {
  5547. a.Sprite.call(this, b[0]);
  5548. this.textures = b;
  5549. this.animationSpeed = 1;
  5550. this.loop = !0;
  5551. this.onComplete = null;
  5552. this.currentFrame = 0;
  5553. this.playing = !1
  5554. };
  5555. a.MovieClip.prototype = Object.create(a.Sprite.prototype);
  5556. a.MovieClip.prototype.constructor = a.MovieClip;
  5557. Object.defineProperty(a.MovieClip.prototype, "totalFrames", {
  5558. get: function() {
  5559. return this.textures.length
  5560. }
  5561. });
  5562. a.MovieClip.prototype.stop = function() {
  5563. this.playing = !1
  5564. };
  5565. a.MovieClip.prototype.play = function() {
  5566. this.playing = !0
  5567. };
  5568. a.MovieClip.prototype.gotoAndStop = function(b) {
  5569. this.playing = !1;
  5570. this.currentFrame = b;
  5571. this.setTexture(this.textures[(this.currentFrame + 0.5 | 0) % this.textures.length])
  5572. };
  5573. a.MovieClip.prototype.gotoAndPlay = function(b) {
  5574. this.currentFrame = b;
  5575. this.playing = !0
  5576. };
  5577. a.MovieClip.prototype.updateTransform = function() {
  5578. a.Sprite.prototype.updateTransform.call(this);
  5579. if (this.playing) {
  5580. this.currentFrame += this.animationSpeed;
  5581. var b = this.currentFrame + 0.5 | 0;
  5582. this.currentFrame %= this.textures.length;
  5583. if (this.loop || b < this.textures.length) this.setTexture(this.textures[b % this.textures.length]);
  5584. else if (b >= this.textures.length && (this.gotoAndStop(this.textures.length - 1), this.onComplete)) this.onComplete()
  5585. }
  5586. };
  5587. a.MovieClip.fromFrames = function(b) {
  5588. for (var d = [], c = 0; c < b.length; c++) d.push(new a.Texture.fromFrame(b[c]));
  5589. return new a.MovieClip(d)
  5590. };
  5591. a.MovieClip.fromImages = function(b) {
  5592. for (var d = [], c = 0; c < b.length; c++) d.push(new a.Texture.fromImage(b[c]));
  5593. return new a.MovieClip(d)
  5594. };
  5595. a.FilterBlock = function() {
  5596. this.renderable = this.visible = !0
  5597. };
  5598. a.Text = function(b, d) {
  5599. this.canvas = document.createElement("canvas");
  5600. this.context = this.canvas.getContext("2d");
  5601. a.Sprite.call(this, a.Texture.fromCanvas(this.canvas));
  5602. this.setText(b);
  5603. this.setStyle(d);
  5604. this.updateText();
  5605. this.dirty = !1
  5606. };
  5607. a.Text.prototype = Object.create(a.Sprite.prototype);
  5608. a.Text.prototype.constructor = a.Text;
  5609. a.Text.prototype.setStyle = function(b) {
  5610. b = b || {};
  5611. b.font = b.font || "bold 20pt Arial";
  5612. b.fill = b.fill || "black";
  5613. b.align = b.align || "left";
  5614. b.stroke = b.stroke || "black";
  5615. b.strokeThickness = b.strokeThickness || 0;
  5616. b.wordWrap = b.wordWrap || !1;
  5617. b.wordWrapWidth = b.wordWrapWidth || 100;
  5618. b.wordWrapWidth = b.wordWrapWidth || 100;
  5619. b.dropShadow = b.dropShadow || !1;
  5620. b.dropShadowAngle = b.dropShadowAngle || Math.PI / 6;
  5621. b.dropShadowDistance = b.dropShadowDistance || 4;
  5622. b.dropShadowColor = b.dropShadowColor || "black";
  5623. this.style = b;
  5624. this.dirty = !0
  5625. };
  5626. a.Text.prototype.setText = function(b) {
  5627. this.text = b.toString() || " ";
  5628. this.dirty = !0
  5629. };
  5630. a.Text.prototype.updateText = function() {
  5631. this.context.font = this.style.font;
  5632. var b = this.text;
  5633. this.style.wordWrap && (b = this.wordWrap(this.text));
  5634. for (var b = b.split(/(?:\r\n|\r|\n)/), a = [], c = 0, e = 0; e < b.length; e++) {
  5635. var g = this.context.measureText(b[e]).width;
  5636. a[e] = g;
  5637. c = Math.max(c, g)
  5638. }
  5639. e = c + this.style.strokeThickness;
  5640. this.style.dropShadow && (e += this.style.dropShadowDistance);
  5641. this.canvas.width = e + this.context.lineWidth;
  5642. g = this.determineFontHeight("font: " + this.style.font + ";") + this.style.strokeThickness;
  5643. e = g * b.length;
  5644. this.style.dropShadow && (e += this.style.dropShadowDistance);
  5645. this.canvas.height = e;
  5646. navigator.isCocoonJS && this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
  5647. this.context.font = this.style.font;
  5648. this.context.strokeStyle = this.style.stroke;
  5649. this.context.lineWidth = this.style.strokeThickness;
  5650. this.context.textBaseline = "top";
  5651. var f, k;
  5652. if (this.style.dropShadow) {
  5653. this.context.fillStyle = this.style.dropShadowColor;
  5654. for (var l = Math.sin(this.style.dropShadowAngle) * this.style.dropShadowDistance, h = Math.cos(this.style.dropShadowAngle) * this.style.dropShadowDistance, e = 0; e < b.length; e++) f = this.style.strokeThickness / 2,
  5655. k = this.style.strokeThickness / 2 + e * g,
  5656. "right" === this.style.align ? f += c - a[e] : "center" === this.style.align && (f += (c - a[e]) / 2),
  5657. this.style.fill && this.context.fillText(b[e], f + l, k + h)
  5658. }
  5659. this.context.fillStyle = this.style.fill;
  5660. for (e = 0; e < b.length; e++) f = this.style.strokeThickness / 2,
  5661. k = this.style.strokeThickness / 2 + e * g,
  5662. "right" === this.style.align ? f += c - a[e] : "center" === this.style.align && (f += (c - a[e]) / 2),
  5663. this.style.stroke && this.style.strokeThickness && this.context.strokeText(b[e], f, k),
  5664. this.style.fill && this.context.fillText(b[e], f, k);
  5665. this.updateTexture()
  5666. };
  5667. a.Text.prototype.updateTexture = function() {
  5668. this.texture.baseTexture.width = this.canvas.width;
  5669. this.texture.baseTexture.height = this.canvas.height;
  5670. this.texture.crop.width = this.texture.frame.width = this.canvas.width;
  5671. this.texture.crop.height = this.texture.frame.height = this.canvas.height;
  5672. this._width = this.canvas.width;
  5673. this._height = this.canvas.height;
  5674. this.requiresUpdate = !0
  5675. };
  5676. a.Text.prototype._renderWebGL = function(b) {
  5677. this.requiresUpdate && (this.requiresUpdate = !1, a.updateWebGLTexture(this.texture.baseTexture, b.gl));
  5678. a.Sprite.prototype._renderWebGL.call(this, b)
  5679. };
  5680. a.Text.prototype.updateTransform = function() {
  5681. this.dirty && (this.updateText(), this.dirty = !1);
  5682. a.Sprite.prototype.updateTransform.call(this)
  5683. };
  5684. a.Text.prototype.determineFontHeight = function(b) {
  5685. var d = a.Text.heightCache[b];
  5686. if (!d) {
  5687. var c = document.getElementsByTagName("body")[0],
  5688. e = document.createElement("div"),
  5689. d = document.createTextNode("M");
  5690. e.appendChild(d);
  5691. e.setAttribute("style", b + ";position:absolute;top:0;left:0");
  5692. c.appendChild(e);
  5693. d = e.offsetHeight;
  5694. a.Text.heightCache[b] = d;
  5695. c.removeChild(e)
  5696. }
  5697. return d
  5698. };
  5699. a.Text.prototype.wordWrap = function(b) {
  5700. var a = "";
  5701. b = b.split("\n");
  5702. for (var c = 0; c < b.length; c++) {
  5703. for (var e = this.style.wordWrapWidth,
  5704. g = b[c].split(" "), f = 0; f < g.length; f++) {
  5705. var k = this.context.measureText(g[f]).width,
  5706. l = k + this.context.measureText(" ").width;
  5707. 0 === f || l > e ? (0 < f && (a += "\n"), a += g[f], e = this.style.wordWrapWidth - k) : (e -= l, a += " " + g[f])
  5708. }
  5709. c < b.length - 1 && (a += "\n")
  5710. }
  5711. return a
  5712. };
  5713. a.Text.prototype.destroy = function(b) {
  5714. this.canvas = this.context = null;
  5715. this.texture.destroy(void 0 === b ? !0 : b)
  5716. };
  5717. a.Text.heightCache = {};
  5718. a.BitmapText = function(b, d) {
  5719. a.DisplayObjectContainer.call(this);
  5720. this._pool = [];
  5721. this.setText(b);
  5722. this.setStyle(d);
  5723. this.updateText();
  5724. this.dirty = !1
  5725. };
  5726. a.BitmapText.prototype = Object.create(a.DisplayObjectContainer.prototype);
  5727. a.BitmapText.prototype.constructor = a.BitmapText;
  5728. a.BitmapText.prototype.setText = function(b) {
  5729. this.text = b || " ";
  5730. this.dirty = !0
  5731. };
  5732. a.BitmapText.prototype.setStyle = function(b) {
  5733. b = b || {};
  5734. b.align = b.align || "left";
  5735. this.style = b;
  5736. var d = b.font.split(" ");
  5737. this.fontName = d[d.length - 1];
  5738. this.fontSize = 2 <= d.length ? parseInt(d[d.length - 2], 10) : a.BitmapText.fonts[this.fontName].size;
  5739. this.dirty = !0;
  5740. this.tint = b.tint
  5741. };
  5742. a.BitmapText.prototype.updateText = function() {
  5743. for (var b = a.BitmapText.fonts[this.fontName], d = new a.Point, c = null, e = [], g = 0, f = [], k = 0, l = this.fontSize / b.size, h = 0; h < this.text.length; h++) {
  5744. var n = this.text.charCodeAt(h);
  5745. if (/(?:\r\n|\r|\n)/.test(this.text.charAt(h))) f.push(d.x),
  5746. g = Math.max(g, d.x),
  5747. k++,
  5748. d.x = 0,
  5749. d.y += b.lineHeight,
  5750. c = null;
  5751. else {
  5752. var q = b.chars[n];
  5753. q && (c && q[c] && (d.x += q.kerning[c]), e.push({
  5754. texture: q.texture,
  5755. line: k,
  5756. charCode: n,
  5757. position: new a.Point(d.x + q.xOffset, d.y + q.yOffset)
  5758. }), d.x += q.xAdvance, c = n)
  5759. }
  5760. }
  5761. f.push(d.x);
  5762. g = Math.max(g, d.x);
  5763. c = [];
  5764. for (h = 0; h <= k; h++) n = 0,
  5765. "right" === this.style.align ? n = g - f[h] : "center" === this.style.align && (n = (g - f[h]) / 2),
  5766. c.push(n);
  5767. k = this.children.length;
  5768. f = e.length;
  5769. n = this.tint || 16777215;
  5770. for (h = 0; h < f; h++)(q = h < k ? this.children[h] : this._pool.pop()) ? q.setTexture(e[h].texture) : q = new a.Sprite(e[h].texture),
  5771. q.position.x = (e[h].position.x + c[e[h].line]) * l,
  5772. q.position.y = e[h].position.y * l,
  5773. q.scale.x = q.scale.y = l,
  5774. q.tint = n,
  5775. q.parent || this.addChild(q);
  5776. for (; this.children.length > f;) e = this.getChildAt(this.children.length - 1),
  5777. this._pool.push(e),
  5778. this.removeChild(e);
  5779. this.textWidth = g * l;
  5780. this.textHeight = (d.y + b.lineHeight) * l
  5781. };
  5782. a.BitmapText.prototype.updateTransform = function() {
  5783. this.dirty && (this.updateText(), this.dirty = !1);
  5784. a.DisplayObjectContainer.prototype.updateTransform.call(this)
  5785. };
  5786. a.BitmapText.fonts = {};
  5787. a.InteractionData = function() {
  5788. this.global = new a.Point;
  5789. this.originalEvent = this.target = null
  5790. };
  5791. a.InteractionData.prototype.getLocalPosition = function(b) {
  5792. var d = b.worldTransform;
  5793. b = this.global;
  5794. var c = d.a,
  5795. e = d.b,
  5796. g = d.tx,
  5797. f = d.c,
  5798. k = d.d,
  5799. d = d.ty,
  5800. l = 1 / (c * k + e * -f);
  5801. return new a.Point(k * l * b.x + -e * l * b.y + (d * e - g * k) * l, c * l * b.y + -f * l * b.x + ( - d * c + g * f) * l)
  5802. };
  5803. a.InteractionData.prototype.constructor = a.InteractionData;
  5804. a.InteractionManager = function(b) {
  5805. this.stage = b;
  5806. this.mouse = new a.InteractionData;
  5807. this.touchs = {};
  5808. this.tempPoint = new a.Point;
  5809. this.mouseoverEnabled = !0;
  5810. this.pool = [];
  5811. this.interactiveItems = [];
  5812. this.interactionDOMElement = null;
  5813. this.onMouseMove = this.onMouseMove.bind(this);
  5814. this.onMouseDown = this.onMouseDown.bind(this);
  5815. this.onMouseOut = this.onMouseOut.bind(this);
  5816. this.onMouseUp = this.onMouseUp.bind(this);
  5817. this.onTouchStart = this.onTouchStart.bind(this);
  5818. this.onTouchEnd = this.onTouchEnd.bind(this);
  5819. this.onTouchMove = this.onTouchMove.bind(this);
  5820. this.last = 0;
  5821. this.currentCursorStyle = "inherit";
  5822. this.mouseOut = !1
  5823. };
  5824. a.InteractionManager.prototype.constructor = a.InteractionManager;
  5825. a.InteractionManager.prototype.collectInteractiveSprite = function(b, a) {
  5826. for (var c = b.children,
  5827. e = c.length - 1; 0 <= e; e--) {
  5828. var g = c[e];
  5829. g._interactive ? (a.interactiveChildren = !0, this.interactiveItems.push(g), 0 < g.children.length && this.collectInteractiveSprite(g, g)) : (g.__iParent = null, 0 < g.children.length && this.collectInteractiveSprite(g, a))
  5830. }
  5831. };
  5832. a.InteractionManager.prototype.setTarget = function(b) {
  5833. this.target = b;
  5834. null === this.interactionDOMElement && this.setTargetDomElement(b.view)
  5835. };
  5836. a.InteractionManager.prototype.setTargetDomElement = function(b) {
  5837. this.removeEvents();
  5838. window.navigator.msPointerEnabled && (b.style["-ms-content-zooming"] = "none", b.style["-ms-touch-action"] = "none");
  5839. this.interactionDOMElement = b;
  5840. b.addEventListener("mousemove", this.onMouseMove, !0);
  5841. b.addEventListener("mousedown", this.onMouseDown, !0);
  5842. b.addEventListener("mouseout", this.onMouseOut, !0);
  5843. b.addEventListener("touchstart", this.onTouchStart, !0);
  5844. b.addEventListener("touchend", this.onTouchEnd, !0);
  5845. b.addEventListener("touchmove", this.onTouchMove, !0);
  5846. window.addEventListener("mouseup", this.onMouseUp, !0)
  5847. };
  5848. a.InteractionManager.prototype.removeEvents = function() {
  5849. this.interactionDOMElement && (this.interactionDOMElement.style["-ms-content-zooming"] = "", this.interactionDOMElement.style["-ms-touch-action"] = "", this.interactionDOMElement.removeEventListener("mousemove", this.onMouseMove, !0), this.interactionDOMElement.removeEventListener("mousedown", this.onMouseDown, !0), this.interactionDOMElement.removeEventListener("mouseout", this.onMouseOut, !0), this.interactionDOMElement.removeEventListener("touchstart", this.onTouchStart, !0), this.interactionDOMElement.removeEventListener("touchend", this.onTouchEnd, !0), this.interactionDOMElement.removeEventListener("touchmove", this.onTouchMove, !0), this.interactionDOMElement = null, window.removeEventListener("mouseup", this.onMouseUp, !0))
  5850. };
  5851. a.InteractionManager.prototype.update = function() {
  5852. if (this.target) {
  5853. var b = Date.now(),
  5854. d = b - this.last,
  5855. d = d * a.INTERACTION_FREQUENCY / 1E3;
  5856. if (! (1 > d)) {
  5857. this.last = b;
  5858. b = 0;
  5859. this.dirty && this.rebuildInteractiveGraph();
  5860. for (var d = this.interactiveItems.length,
  5861. c = "inherit",
  5862. e = !1,
  5863. b = 0; b < d; b++) {
  5864. var g = this.interactiveItems[b];
  5865. g.__hit = this.hitTest(g, this.mouse);
  5866. this.mouse.target = g;
  5867. g.__hit && !e ? (g.buttonMode && (c = g.defaultCursor), g.interactiveChildren || (e = !0), g.__isOver || (g.mouseover && g.mouseover(this.mouse), g.__isOver = !0)) : g.__isOver && (g.mouseout && g.mouseout(this.mouse), g.__isOver = !1)
  5868. }
  5869. this.currentCursorStyle !== c && (this.currentCursorStyle = c, this.interactionDOMElement.style.cursor = c)
  5870. }
  5871. }
  5872. };
  5873. a.InteractionManager.prototype.rebuildInteractiveGraph = function() {
  5874. this.dirty = !1;
  5875. for (var b = this.interactiveItems.length,
  5876. a = 0; a < b; a++) this.interactiveItems[a].interactiveChildren = !1;
  5877. this.interactiveItems = [];
  5878. this.stage.interactive && this.interactiveItems.push(this.stage);
  5879. this.collectInteractiveSprite(this.stage, this.stage)
  5880. };
  5881. a.InteractionManager.prototype.onMouseMove = function(b) {
  5882. this.dirty && this.rebuildInteractiveGraph();
  5883. this.mouse.originalEvent = b || window.event;
  5884. var a = this.interactionDOMElement.getBoundingClientRect();
  5885. this.mouse.global.x = this.target.width / a.width * (b.clientX - a.left);
  5886. this.mouse.global.y = this.target.height / a.height * (b.clientY - a.top);
  5887. b = this.interactiveItems.length;
  5888. for (a = 0; a < b; a++) {
  5889. var c = this.interactiveItems[a];
  5890. c.mousemove && c.mousemove(this.mouse)
  5891. }
  5892. };
  5893. a.InteractionManager.prototype.onMouseDown = function(b) {
  5894. this.dirty && this.rebuildInteractiveGraph();
  5895. this.mouse.originalEvent = b || window.event;
  5896. a.AUTO_PREVENT_DEFAULT && this.mouse.originalEvent.preventDefault();
  5897. b = this.interactiveItems.length;
  5898. for (var d = 0; d < b; d++) {
  5899. var c = this.interactiveItems[d];
  5900. if (c.mousedown || c.click) if (c.__mouseIsDown = !0, c.__hit = this.hitTest(c, this.mouse), c.__hit && (c.mousedown && c.mousedown(this.mouse), c.__isDown = !0, !c.interactiveChildren)) break
  5901. }
  5902. };
  5903. a.InteractionManager.prototype.onMouseOut = function() {
  5904. this.dirty && this.rebuildInteractiveGraph();
  5905. var b = this.interactiveItems.length;
  5906. this.interactionDOMElement.style.cursor = "inherit";
  5907. for (var a = 0; a < b; a++) {
  5908. var c = this.interactiveItems[a];
  5909. c.__isOver && (this.mouse.target = c, c.mouseout && c.mouseout(this.mouse), c.__isOver = !1)
  5910. }
  5911. this.mouseOut = !0;
  5912. this.mouse.global.x = -1E4;
  5913. this.mouse.global.y = -1E4
  5914. };
  5915. a.InteractionManager.prototype.onMouseUp = function(b) {
  5916. this.dirty && this.rebuildInteractiveGraph();
  5917. this.mouse.originalEvent = b || window.event;
  5918. b = this.interactiveItems.length;
  5919. for (var a = !1,
  5920. c = 0; c < b; c++) {
  5921. var e = this.interactiveItems[c];
  5922. e.__hit = this.hitTest(e, this.mouse);
  5923. e.__hit && !a ? (e.mouseup && e.mouseup(this.mouse), e.__isDown && e.click && e.click(this.mouse), e.interactiveChildren || (a = !0)) : e.__isDown && e.mouseupoutside && e.mouseupoutside(this.mouse);
  5924. e.__isDown = !1
  5925. }
  5926. };
  5927. a.InteractionManager.prototype.hitTest = function(b, d) {
  5928. var c = d.global;
  5929. if (!b.worldVisible) return ! 1;
  5930. var e = b instanceof a.Sprite,
  5931. g = b.worldTransform,
  5932. f = g.a,
  5933. k = g.b,
  5934. l = g.tx,
  5935. h = g.c,
  5936. n = g.d,
  5937. g = g.ty,
  5938. q = 1 / (f * n + k * -h),
  5939. k = n * q * c.x + -k * q * c.y + (g * k - l * n) * q,
  5940. c = f * q * c.y + -h * q * c.x + ( - g * f + l * h) * q;
  5941. d.target = b;
  5942. if (b.hitArea && b.hitArea.contains) return b.hitArea.contains(k, c) ? (d.target = b, !0) : !1;
  5943. if (e && (f = b.texture.frame.width, e = b.texture.frame.height, l = -f * b.anchor.x, k > l && k < l + f && (k = -e * b.anchor.y, c > k && c < k + e))) return d.target = b,
  5944. !0;
  5945. e = b.children.length;
  5946. for (k = 0; k < e; k++) if (this.hitTest(b.children[k], d)) return d.target = b,
  5947. !0;
  5948. return ! 1
  5949. };
  5950. a.InteractionManager.prototype.onTouchMove = function(b) {
  5951. this.dirty && this.rebuildInteractiveGraph();
  5952. for (var a = this.interactionDOMElement.getBoundingClientRect(), c = b.changedTouches, e, g = 0, g = 0; g < c.length; g++) {
  5953. var f = c[g];
  5954. e = this.touchs[f.identifier];
  5955. e.originalEvent = b || window.event;
  5956. e.global.x = this.target.width / a.width * (f.clientX - a.left);
  5957. e.global.y = this.target.height / a.height * (f.clientY - a.top);
  5958. navigator.isCocoonJS && (e.global.x = f.clientX, e.global.y = f.clientY);
  5959. for (var k = 0; k < this.interactiveItems.length; k++) {
  5960. var l = this.interactiveItems[k];
  5961. l.touchmove && l.__touchData && l.__touchData[f.identifier] && l.touchmove(e)
  5962. }
  5963. }
  5964. };
  5965. a.InteractionManager.prototype.onTouchStart = function(b) {
  5966. this.dirty && this.rebuildInteractiveGraph();
  5967. var d = this.interactionDOMElement.getBoundingClientRect();
  5968. a.AUTO_PREVENT_DEFAULT && b.preventDefault();
  5969. for (var c = b.changedTouches,
  5970. e = 0; e < c.length; e++) {
  5971. var g = c[e],
  5972. f = this.pool.pop();
  5973. f || (f = new a.InteractionData);
  5974. f.originalEvent = b || window.event;
  5975. this.touchs[g.identifier] = f;
  5976. f.global.x = this.target.width / d.width * (g.clientX - d.left);
  5977. f.global.y = this.target.height / d.height * (g.clientY - d.top);
  5978. navigator.isCocoonJS && (f.global.x = g.clientX, f.global.y = g.clientY);
  5979. for (var k = this.interactiveItems.length,
  5980. l = 0; l < k; l++) {
  5981. var h = this.interactiveItems[l];
  5982. if (h.touchstart || h.tap) if (h.__hit = this.hitTest(h, f), h.__hit && (h.touchstart && h.touchstart(f), h.__isDown = !0, h.__touchData = h.__touchData || {},
  5983. h.__touchData[g.identifier] = f, !h.interactiveChildren)) break
  5984. }
  5985. }
  5986. };
  5987. a.InteractionManager.prototype.onTouchEnd = function(b) {
  5988. this.dirty && this.rebuildInteractiveGraph();
  5989. for (var a = this.interactionDOMElement.getBoundingClientRect(), c = b.changedTouches, e = 0; e < c.length; e++) {
  5990. var g = c[e],
  5991. f = this.touchs[g.identifier],
  5992. k = !1;
  5993. f.global.x = this.target.width / a.width * (g.clientX - a.left);
  5994. f.global.y = this.target.height / a.height * (g.clientY - a.top);
  5995. navigator.isCocoonJS && (f.global.x = g.clientX, f.global.y = g.clientY);
  5996. for (var l = this.interactiveItems.length,
  5997. h = 0; h < l; h++) {
  5998. var n = this.interactiveItems[h];
  5999. if (n.__touchData && n.__touchData[g.identifier]) {
  6000. n.__hit = this.hitTest(n, n.__touchData[g.identifier]);
  6001. f.originalEvent = b || window.event;
  6002. if (n.touchend || n.tap) n.__hit && !k ? (n.touchend && n.touchend(f), n.__isDown && n.tap && n.tap(f), n.interactiveChildren || (k = !0)) : n.__isDown && n.touchendoutside && n.touchendoutside(f),
  6003. n.__isDown = !1;
  6004. n.__touchData[g.identifier] = null
  6005. }
  6006. }
  6007. this.pool.push(f);
  6008. this.touchs[g.identifier] = null
  6009. }
  6010. };
  6011. a.Stage = function(b) {
  6012. a.DisplayObjectContainer.call(this);
  6013. this.worldTransform = new a.Matrix;
  6014. this.interactive = !0;
  6015. this.interactionManager = new a.InteractionManager(this);
  6016. this.dirty = !0;
  6017. this.stage = this;
  6018. this.stage.hitArea = new a.Rectangle(0, 0, 1E5, 1E5);
  6019. this.setBackgroundColor(b)
  6020. };
  6021. a.Stage.prototype = Object.create(a.DisplayObjectContainer.prototype);
  6022. a.Stage.prototype.constructor = a.Stage;
  6023. a.Stage.prototype.setInteractionDelegate = function(b) {
  6024. this.interactionManager.setTargetDomElement(b)
  6025. };
  6026. a.Stage.prototype.updateTransform = function() {
  6027. this.worldAlpha = 1;
  6028. for (var b = 0,
  6029. a = this.children.length; b < a; b++) this.children[b].updateTransform();
  6030. this.dirty && (this.dirty = !1, this.interactionManager.dirty = !0);
  6031. this.interactive && this.interactionManager.update()
  6032. };
  6033. a.Stage.prototype.setBackgroundColor = function(b) {
  6034. this.backgroundColor = b || 0;
  6035. this.backgroundColorSplit = a.hex2rgb(this.backgroundColor);
  6036. b = this.backgroundColor.toString(16);
  6037. b = "000000".substr(0, 6 - b.length) + b;
  6038. this.backgroundColorString = "#" + b
  6039. };
  6040. a.Stage.prototype.getMousePosition = function() {
  6041. return this.interactionManager.mouse.global
  6042. };
  6043. for (var f = 0,
  6044. h = ["ms", "moz", "webkit", "o"], n = 0; n < h.length && !window.requestAnimationFrame; ++n) window.requestAnimationFrame = window[h[n] + "RequestAnimationFrame"],
  6045. window.cancelAnimationFrame = window[h[n] + "CancelAnimationFrame"] || window[h[n] + "CancelRequestAnimationFrame"];
  6046. window.requestAnimationFrame || (window.requestAnimationFrame = function(b) {
  6047. var a = (new Date).getTime(),
  6048. c = Math.max(0, 16 - (a - f)),
  6049. e = window.setTimeout(function() {
  6050. b(a + c)
  6051. },
  6052. c);
  6053. f = a + c;
  6054. return e
  6055. });
  6056. window.cancelAnimationFrame || (window.cancelAnimationFrame = function(b) {
  6057. clearTimeout(b)
  6058. });
  6059. window.requestAnimFrame = window.requestAnimationFrame;
  6060. a.hex2rgb = function(b) {
  6061. return [(b >> 16 & 255) / 255, (b >> 8 & 255) / 255, (b & 255) / 255]
  6062. };
  6063. a.rgb2hex = function(b) {
  6064. return (255 * b[0] << 16) + (255 * b[1] << 8) + 255 * b[2]
  6065. };
  6066. "function" !== typeof Function.prototype.bind && (Function.prototype.bind = function() {
  6067. var b = Array.prototype.slice;
  6068. return function(a) {
  6069. function c() {
  6070. var f = g.concat(b.call(arguments));
  6071. e.apply(this instanceof c ? this: a, f)
  6072. }
  6073. var e = this,
  6074. g = b.call(arguments, 1);
  6075. if ("function" !== typeof e) throw new TypeError;
  6076. c.prototype = function k(b) {
  6077. b && (k.prototype = b);
  6078. if (! (this instanceof k)) return new k
  6079. } (e.prototype);
  6080. return c
  6081. }
  6082. } ());
  6083. a.AjaxRequest = function() {
  6084. var b = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.3.0", "Microsoft.XMLHTTP"];
  6085. if (window.ActiveXObject) for (var a = 0; a < b.length; a++) try {
  6086. return new window.ActiveXObject(b[a])
  6087. } catch(c) {} else return window.XMLHttpRequest ? new window.XMLHttpRequest: !1
  6088. };
  6089. a.canUseNewCanvasBlendModes = function() {
  6090. var b = document.createElement("canvas");
  6091. b.width = 1;
  6092. b.height = 1;
  6093. b = b.getContext("2d");
  6094. b.fillStyle = "#000";
  6095. b.fillRect(0, 0, 1, 1);
  6096. b.globalCompositeOperation = "multiply";
  6097. b.fillStyle = "#fff";
  6098. b.fillRect(0, 0, 1, 1);
  6099. return 0 === b.getImageData(0, 0, 1, 1).data[0]
  6100. };
  6101. a.getNextPowerOfTwo = function(b) {
  6102. if (0 < b && 0 === (b & b - 1)) return b;
  6103. for (var a = 1; a < b;) a <<= 1;
  6104. return a
  6105. };
  6106. a.EventTarget = function() {
  6107. var b = {};
  6108. this.addEventListener = this.on = function(a, c) {
  6109. void 0 === b[a] && (b[a] = []); - 1 === b[a].indexOf(c) && b[a].unshift(c)
  6110. };
  6111. this.dispatchEvent = this.emit = function(a) {
  6112. if (b[a.type] && b[a.type].length) for (var c = b[a.type].length - 1; 0 <= c; c--) b[a.type][c](a)
  6113. };
  6114. this.removeEventListener = this.off = function(a, c) {
  6115. if (void 0 !== b[a]) {
  6116. var e = b[a].indexOf(c); - 1 !== e && b[a].splice(e, 1)
  6117. }
  6118. };
  6119. this.removeAllEventListeners = function(a) {
  6120. if (a = b[a]) a.length = 0
  6121. }
  6122. };
  6123. a.autoDetectRenderer = function(b, d, c, e, g) {
  6124. b || (b = 800);
  6125. d || (d = 600);
  6126. var f;
  6127. try {
  6128. var k = document.createElement("canvas");
  6129. f = !!window.WebGLRenderingContext && (k.getContext("webgl") || k.getContext("experimental-webgl"))
  6130. } catch(l) {
  6131. f = !1
  6132. }
  6133. return f ? new a.WebGLRenderer(b, d, c, e, g) : new a.CanvasRenderer(b, d, c, e)
  6134. };
  6135. a.autoDetectRecommendedRenderer = function(b, d, c, e, g) {
  6136. b || (b = 800);
  6137. d || (d = 600);
  6138. var f;
  6139. try {
  6140. var k = document.createElement("canvas");
  6141. f = !!window.WebGLRenderingContext && (k.getContext("webgl") || k.getContext("experimental-webgl"))
  6142. } catch(l) {
  6143. f = !1
  6144. }
  6145. k = /Android/i.test(navigator.userAgent);
  6146. return f && !k ? new a.WebGLRenderer(b, d, c, e, g) : new a.CanvasRenderer(b, d, c, e)
  6147. };
  6148. a.PolyK = {};
  6149. a.PolyK.Triangulate = function(b) {
  6150. var d = !0,
  6151. c = b.length >> 1;
  6152. if (3 > c) return [];
  6153. for (var e = [], g = [], f = 0; f < c; f++) g.push(f);
  6154. for (var f = 0,
  6155. k = c; 3 < k;) {
  6156. var l = g[(f + 0) % k],
  6157. h = g[(f + 1) % k],
  6158. n = g[(f + 2) % k],
  6159. q = b[2 * l],
  6160. p = b[2 * l + 1],
  6161. s = b[2 * h],
  6162. u = b[2 * h + 1],
  6163. z = b[2 * n],
  6164. A = b[2 * n + 1],
  6165. x = !1;
  6166. if (a.PolyK._convex(q, p, s, u, z, A, d)) for (var x = !0,
  6167. D = 0; D < k; D++) {
  6168. var B = g[D];
  6169. if (B !== l && B !== h && B !== n && a.PolyK._PointInTriangle(b[2 * B], b[2 * B + 1], q, p, s, u, z, A)) {
  6170. x = !1;
  6171. break
  6172. }
  6173. }
  6174. if (x) e.push(l, h, n),
  6175. g.splice((f + 1) % k, 1),
  6176. k--,
  6177. f = 0;
  6178. else if (f++>3 * k) if (d) {
  6179. e = [];
  6180. g = [];
  6181. for (f = 0; f < c; f++) g.push(f);
  6182. f = 0;
  6183. k = c;
  6184. d = !1
  6185. } else return window.console.log("PIXI Warning: shape too complex to fill"),
  6186. []
  6187. }
  6188. e.push(g[0], g[1], g[2]);
  6189. return e
  6190. };
  6191. a.PolyK._PointInTriangle = function(b, a, c, e, g, f, k, l) {
  6192. k -= c;
  6193. l -= e;
  6194. g -= c;
  6195. f -= e;
  6196. b -= c;
  6197. c = a - e;
  6198. a = k * k + l * l;
  6199. e = k * g + l * f;
  6200. k = k * b + l * c;
  6201. l = g * g + f * f;
  6202. g = g * b + f * c;
  6203. f = 1 / (a * l - e * e);
  6204. l = (l * k - e * g) * f;
  6205. k = (a * g - e * k) * f;
  6206. return 0 <= l && 0 <= k && 1 > l + k
  6207. };
  6208. a.PolyK._convex = function(b, a, c, e, g, f, k) {
  6209. return 0 <= (a - e) * (g - c) + (c - b) * (f - e) === k
  6210. };
  6211. a.initDefaultShaders = function() {};
  6212. a.CompileVertexShader = function(b, d) {
  6213. return a._CompileShader(b, d, b.VERTEX_SHADER)
  6214. };
  6215. a.CompileFragmentShader = function(b, d) {
  6216. return a._CompileShader(b, d, b.FRAGMENT_SHADER)
  6217. };
  6218. a._CompileShader = function(b, a, c) {
  6219. a = a.join("\n");
  6220. c = b.createShader(c);
  6221. b.shaderSource(c, a);
  6222. b.compileShader(c);
  6223. return b.getShaderParameter(c, b.COMPILE_STATUS) ? c: (window.console.log(b.getShaderInfoLog(c)), null)
  6224. };
  6225. a.compileProgram = function(b, d, c) {
  6226. c = a.CompileFragmentShader(b, c);
  6227. d = a.CompileVertexShader(b, d);
  6228. var e = b.createProgram();
  6229. b.attachShader(e, d);
  6230. b.attachShader(e, c);
  6231. b.linkProgram(e);
  6232. b.getProgramParameter(e, b.LINK_STATUS) || window.console.log("Could not initialise shaders");
  6233. return e
  6234. };
  6235. a.PixiShader = function(b) {
  6236. this._UID = a._UID++;
  6237. this.gl = b;
  6238. this.program = null;
  6239. this.fragmentSrc = ["precision lowp float;", "varying vec2 vTextureCoord;", "varying vec4 vColor;", "uniform sampler2D uSampler;", "void main(void) {", " gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;", "}"];
  6240. this.textureCount = 0;
  6241. this.attributes = [];
  6242. this.init()
  6243. };
  6244. a.PixiShader.prototype.init = function() {
  6245. var b = this.gl,
  6246. d = a.compileProgram(b, this.vertexSrc || a.PixiShader.defaultVertexSrc, this.fragmentSrc);
  6247. b.useProgram(d);
  6248. this.uSampler = b.getUniformLocation(d, "uSampler");
  6249. this.projectionVector = b.getUniformLocation(d, "projectionVector");
  6250. this.offsetVector = b.getUniformLocation(d, "offsetVector");
  6251. this.dimensions = b.getUniformLocation(d, "dimensions");
  6252. this.aVertexPosition = b.getAttribLocation(d, "aVertexPosition");
  6253. this.aTextureCoord = b.getAttribLocation(d, "aTextureCoord");
  6254. this.colorAttribute = b.getAttribLocation(d, "aColor"); - 1 === this.colorAttribute && (this.colorAttribute = 2);
  6255. this.attributes = [this.aVertexPosition, this.aTextureCoord, this.colorAttribute];
  6256. for (var c in this.uniforms) this.uniforms[c].uniformLocation = b.getUniformLocation(d, c);
  6257. this.initUniforms();
  6258. this.program = d
  6259. };
  6260. a.PixiShader.prototype.initUniforms = function() {
  6261. this.textureCount = 1;
  6262. var b = this.gl,
  6263. a, c;
  6264. for (c in this.uniforms) {
  6265. a = this.uniforms[c];
  6266. var e = a.type;
  6267. "sampler2D" === e ? (a._init = !1, null !== a.value && this.initSampler2D(a)) : "mat2" === e || "mat3" === e || "mat4" === e ? (a.glMatrix = !0, a.glValueLength = 1, "mat2" === e ? a.glFunc = b.uniformMatrix2fv: "mat3" === e ? a.glFunc = b.uniformMatrix3fv: "mat4" === e && (a.glFunc = b.uniformMatrix4fv)) : (a.glFunc = b["uniform" + e], a.glValueLength = "2f" === e || "2i" === e ? 2 : "3f" === e || "3i" === e ? 3 : "4f" === e || "4i" === e ? 4 : 1)
  6268. }
  6269. };
  6270. a.PixiShader.prototype.initSampler2D = function(b) {
  6271. if (b.value && b.value.baseTexture && b.value.baseTexture.hasLoaded) {
  6272. var a = this.gl;
  6273. a.activeTexture(a["TEXTURE" + this.textureCount]);
  6274. a.bindTexture(a.TEXTURE_2D, b.value.baseTexture._glTextures[a.id]);
  6275. if (b.textureData) {
  6276. var c = b.textureData,
  6277. e = c.magFilter ? c.magFilter: a.LINEAR,
  6278. g = c.minFilter ? c.minFilter: a.LINEAR,
  6279. f = c.wrapS ? c.wrapS: a.CLAMP_TO_EDGE,
  6280. k = c.wrapT ? c.wrapT: a.CLAMP_TO_EDGE,
  6281. l = c.luminance ? a.LUMINANCE: a.RGBA;
  6282. c.repeat && (k = f = a.REPEAT);
  6283. a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL, !!c.flipY);
  6284. c.width ? a.texImage2D(a.TEXTURE_2D, 0, l, c.width ? c.width: 512, c.height ? c.height: 2, c.border ? c.border: 0, l, a.UNSIGNED_BYTE, null) : a.texImage2D(a.TEXTURE_2D, 0, l, a.RGBA, a.UNSIGNED_BYTE, b.value.baseTexture.source);
  6285. a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MAG_FILTER, e);
  6286. a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MIN_FILTER, g);
  6287. a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_S, f);
  6288. a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_T, k)
  6289. }
  6290. a.uniform1i(b.uniformLocation, this.textureCount);
  6291. b._init = !0;
  6292. this.textureCount++
  6293. }
  6294. };
  6295. a.PixiShader.prototype.syncUniforms = function() {
  6296. this.textureCount = 1;
  6297. var b, d = this.gl,
  6298. c;
  6299. for (c in this.uniforms) b = this.uniforms[c],
  6300. 1 === b.glValueLength ? !0 === b.glMatrix ? b.glFunc.call(d, b.uniformLocation, b.transpose, b.value) : b.glFunc.call(d, b.uniformLocation, b.value) : 2 === b.glValueLength ? b.glFunc.call(d, b.uniformLocation, b.value.x, b.value.y) : 3 === b.glValueLength ? b.glFunc.call(d, b.uniformLocation, b.value.x, b.value.y, b.value.z) : 4 === b.glValueLength ? b.glFunc.call(d, b.uniformLocation, b.value.x, b.value.y, b.value.z, b.value.w) : "sampler2D" === b.type && (b._init ? (d.activeTexture(d["TEXTURE" + this.textureCount]), d.bindTexture(d.TEXTURE_2D, b.value.baseTexture._glTextures[d.id] || a.createWebGLTexture(b.value.baseTexture, d)), d.uniform1i(b.uniformLocation, this.textureCount), this.textureCount++) : this.initSampler2D(b))
  6301. };
  6302. a.PixiShader.prototype.destroy = function() {
  6303. this.gl.deleteProgram(this.program);
  6304. this.attributes = this.gl = this.uniforms = null
  6305. };
  6306. a.PixiShader.defaultVertexSrc = ["attribute vec2 aVertexPosition;", "attribute vec2 aTextureCoord;", "attribute vec2 aColor;", "uniform vec2 projectionVector;", "uniform vec2 offsetVector;", "varying vec2 vTextureCoord;", "varying vec4 vColor;", "const vec2 center = vec2(-1.0, 1.0);", "void main(void) {", " gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);", " vTextureCoord = aTextureCoord;", " vec3 color = mod(vec3(aColor.y/65536.0, aColor.y/256.0, aColor.y), 256.0) / 256.0;", " vColor = vec4(color * aColor.x, aColor.x);", "}"];
  6307. a.PixiFastShader = function(b) {
  6308. this._UID = a._UID++;
  6309. this.gl = b;
  6310. this.program = null;
  6311. this.fragmentSrc = ["precision lowp float;", "varying vec2 vTextureCoord;", "varying float vColor;", "uniform sampler2D uSampler;", "void main(void) {", " gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;", "}"];
  6312. this.vertexSrc = ["attribute vec2 aVertexPosition;", "attribute vec2 aPositionCoord;", "attribute vec2 aScale;", "attribute float aRotation;", "attribute vec2 aTextureCoord;", "attribute float aColor;", "uniform vec2 projectionVector;", "uniform vec2 offsetVector;", "uniform mat3 uMatrix;", "varying vec2 vTextureCoord;", "varying float vColor;", "const vec2 center = vec2(-1.0, 1.0);", "void main(void) {", " vec2 v;", " vec2 sv = aVertexPosition * aScale;", " v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);", " v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);", " v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;", " gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);", " vTextureCoord = aTextureCoord;", " vColor = aColor;", "}"];
  6313. this.textureCount = 0;
  6314. this.init()
  6315. };
  6316. a.PixiFastShader.prototype.init = function() {
  6317. var b = this.gl,
  6318. d = a.compileProgram(b, this.vertexSrc, this.fragmentSrc);
  6319. b.useProgram(d);
  6320. this.uSampler = b.getUniformLocation(d, "uSampler");
  6321. this.projectionVector = b.getUniformLocation(d, "projectionVector");
  6322. this.offsetVector = b.getUniformLocation(d, "offsetVector");
  6323. this.dimensions = b.getUniformLocation(d, "dimensions");
  6324. this.uMatrix = b.getUniformLocation(d, "uMatrix");
  6325. this.aVertexPosition = b.getAttribLocation(d, "aVertexPosition");
  6326. this.aPositionCoord = b.getAttribLocation(d, "aPositionCoord");
  6327. this.aScale = b.getAttribLocation(d, "aScale");
  6328. this.aRotation = b.getAttribLocation(d, "aRotation");
  6329. this.aTextureCoord = b.getAttribLocation(d, "aTextureCoord");
  6330. this.colorAttribute = b.getAttribLocation(d, "aColor"); - 1 === this.colorAttribute && (this.colorAttribute = 2);
  6331. this.attributes = [this.aVertexPosition, this.aPositionCoord, this.aScale, this.aRotation, this.aTextureCoord, this.colorAttribute];
  6332. this.program = d
  6333. };
  6334. a.PixiFastShader.prototype.destroy = function() {
  6335. this.gl.deleteProgram(this.program);
  6336. this.attributes = this.gl = this.uniforms = null
  6337. };
  6338. a.StripShader = function(b) {
  6339. this._UID = a._UID++;
  6340. this.gl = b;
  6341. this.program = null;
  6342. this.fragmentSrc = ["precision mediump float;", "varying vec2 vTextureCoord;", "uniform float alpha;", "uniform sampler2D uSampler;", "void main(void) {", " gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));", "}"];
  6343. this.vertexSrc = ["attribute vec2 aVertexPosition;", "attribute vec2 aTextureCoord;", "uniform mat3 translationMatrix;", "uniform vec2 projectionVector;", "uniform vec2 offsetVector;", "varying vec2 vTextureCoord;", "void main(void) {", " vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);", " v -= offsetVector.xyx;", " gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);", " vTextureCoord = aTextureCoord;", "}"];
  6344. this.init()
  6345. };
  6346. a.StripShader.prototype.init = function() {
  6347. var b = this.gl,
  6348. d = a.compileProgram(b, this.vertexSrc, this.fragmentSrc);
  6349. b.useProgram(d);
  6350. this.uSampler = b.getUniformLocation(d, "uSampler");
  6351. this.projectionVector = b.getUniformLocation(d, "projectionVector");
  6352. this.offsetVector = b.getUniformLocation(d, "offsetVector");
  6353. this.colorAttribute = b.getAttribLocation(d, "aColor");
  6354. this.aVertexPosition = b.getAttribLocation(d, "aVertexPosition");
  6355. this.aTextureCoord = b.getAttribLocation(d, "aTextureCoord");
  6356. this.attributes = [this.aVertexPosition, this.aTextureCoord];
  6357. this.translationMatrix = b.getUniformLocation(d, "translationMatrix");
  6358. this.alpha = b.getUniformLocation(d, "alpha");
  6359. this.program = d
  6360. };
  6361. a.PrimitiveShader = function(b) {
  6362. this._UID = a._UID++;
  6363. this.gl = b;
  6364. this.program = null;
  6365. this.fragmentSrc = ["precision mediump float;", "varying vec4 vColor;", "void main(void) {", " gl_FragColor = vColor;", "}"];
  6366. this.vertexSrc = ["attribute vec2 aVertexPosition;", "attribute vec4 aColor;", "uniform mat3 translationMatrix;", "uniform vec2 projectionVector;", "uniform vec2 offsetVector;", "uniform float alpha;", "uniform vec3 tint;", "varying vec4 vColor;", "void main(void) {", " vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);", " v -= offsetVector.xyx;", " gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);", " vColor = aColor * vec4(tint * alpha, alpha);", "}"];
  6367. this.init()
  6368. };
  6369. a.PrimitiveShader.prototype.init = function() {
  6370. var b = this.gl,
  6371. d = a.compileProgram(b, this.vertexSrc, this.fragmentSrc);
  6372. b.useProgram(d);
  6373. this.projectionVector = b.getUniformLocation(d, "projectionVector");
  6374. this.offsetVector = b.getUniformLocation(d, "offsetVector");
  6375. this.tintColor = b.getUniformLocation(d, "tint");
  6376. this.aVertexPosition = b.getAttribLocation(d, "aVertexPosition");
  6377. this.colorAttribute = b.getAttribLocation(d, "aColor");
  6378. this.attributes = [this.aVertexPosition, this.colorAttribute];
  6379. this.translationMatrix = b.getUniformLocation(d, "translationMatrix");
  6380. this.alpha = b.getUniformLocation(d, "alpha");
  6381. this.program = d
  6382. };
  6383. a.PrimitiveShader.prototype.destroy = function() {
  6384. this.gl.deleteProgram(this.program);
  6385. this.attribute = this.gl = this.uniforms = null
  6386. };
  6387. a.ComplexPrimitiveShader = function(b) {
  6388. this._UID = a._UID++;
  6389. this.gl = b;
  6390. this.program = null;
  6391. this.fragmentSrc = ["precision mediump float;", "varying vec4 vColor;", "void main(void) {", " gl_FragColor = vColor;", "}"];
  6392. this.vertexSrc = ["attribute vec2 aVertexPosition;", "uniform mat3 translationMatrix;", "uniform vec2 projectionVector;", "uniform vec2 offsetVector;", "uniform vec3 tint;", "uniform float alpha;", "uniform vec3 color;", "varying vec4 vColor;", "void main(void) {", " vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);", " v -= offsetVector.xyx;", " gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);", " vColor = vec4(color * alpha * tint, alpha);", "}"];
  6393. this.init()
  6394. };
  6395. a.ComplexPrimitiveShader.prototype.init = function() {
  6396. var b = this.gl,
  6397. d = a.compileProgram(b, this.vertexSrc, this.fragmentSrc);
  6398. b.useProgram(d);
  6399. this.projectionVector = b.getUniformLocation(d, "projectionVector");
  6400. this.offsetVector = b.getUniformLocation(d, "offsetVector");
  6401. this.tintColor = b.getUniformLocation(d, "tint");
  6402. this.color = b.getUniformLocation(d, "color");
  6403. this.aVertexPosition = b.getAttribLocation(d, "aVertexPosition");
  6404. this.attributes = [this.aVertexPosition, this.colorAttribute];
  6405. this.translationMatrix = b.getUniformLocation(d, "translationMatrix");
  6406. this.alpha = b.getUniformLocation(d, "alpha");
  6407. this.program = d
  6408. };
  6409. a.ComplexPrimitiveShader.prototype.destroy = function() {
  6410. this.gl.deleteProgram(this.program);
  6411. this.attribute = this.gl = this.uniforms = null
  6412. };
  6413. a.WebGLGraphics = function() {};
  6414. a.WebGLGraphics.renderGraphics = function(b, d) {
  6415. var c = d.gl,
  6416. e = d.projection,
  6417. g = d.offset,
  6418. f = d.shaderManager.primitiveShader,
  6419. k;
  6420. b.dirty && a.WebGLGraphics.updateGraphics(b, c);
  6421. for (var l = b._webGL[c.id], h = 0; h < l.data.length; h++) 1 === l.data[h].mode ? (k = l.data[h], d.stencilManager.pushStencil(b, k, d), c.drawElements(c.TRIANGLE_FAN, 4, c.UNSIGNED_SHORT, 2 * (k.indices.length - 4)), d.stencilManager.popStencil(b, k, d), this.last = k.mode) : (k = l.data[h], d.shaderManager.setShader(f), f = d.shaderManager.primitiveShader, c.uniformMatrix3fv(f.translationMatrix, !1, b.worldTransform.toArray(!0)), c.uniform2f(f.projectionVector, e.x, -e.y), c.uniform2f(f.offsetVector, -g.x, -g.y), c.uniform3fv(f.tintColor, a.hex2rgb(b.tint)), c.uniform1f(f.alpha, b.worldAlpha), c.bindBuffer(c.ARRAY_BUFFER, k.buffer), c.vertexAttribPointer(f.aVertexPosition, 2, c.FLOAT, !1, 24, 0), c.vertexAttribPointer(f.colorAttribute, 4, c.FLOAT, !1, 24, 8), c.bindBuffer(c.ELEMENT_ARRAY_BUFFER, k.indexBuffer), c.drawElements(c.TRIANGLE_STRIP, k.indices.length, c.UNSIGNED_SHORT, 0))
  6422. };
  6423. a.WebGLGraphics.updateGraphics = function(b, d) {
  6424. var c = b._webGL[d.id];
  6425. c || (c = b._webGL[d.id] = {
  6426. lastIndex: 0,
  6427. data: [],
  6428. gl: d
  6429. });
  6430. b.dirty = !1;
  6431. var e;
  6432. if (b.clearDirty) {
  6433. b.clearDirty = !1;
  6434. for (e = 0; e < c.data.length; e++) {
  6435. var g = c.data[e];
  6436. g.reset();
  6437. a.WebGLGraphics.graphicsDataPool.push(g)
  6438. }
  6439. c.data = [];
  6440. c.lastIndex = 0
  6441. }
  6442. for (e = c.lastIndex; e < b.graphicsData.length; e++) {
  6443. var f = b.graphicsData[e];
  6444. f.type === a.Graphics.POLY ? (f.fill && 6 < f.points.length && (10 < f.points.length ? (g = a.WebGLGraphics.switchMode(c, 1), a.WebGLGraphics.buildComplexPoly(f, g)) : (g = a.WebGLGraphics.switchMode(c, 0), a.WebGLGraphics.buildPoly(f, g))), 0 < f.lineWidth && (g = a.WebGLGraphics.switchMode(c, 0), a.WebGLGraphics.buildLine(f, g))) : (g = a.WebGLGraphics.switchMode(c, 0), f.type === a.Graphics.RECT ? a.WebGLGraphics.buildRectangle(f, g) : f.type === a.Graphics.CIRC || f.type === a.Graphics.ELIP ? a.WebGLGraphics.buildCircle(f, g) : f.type === a.Graphics.RREC && a.WebGLGraphics.buildRoundedRectangle(f, c));
  6445. c.lastIndex++
  6446. }
  6447. for (e = 0; e < c.data.length; e++) g = c.data[e],
  6448. g.dirty && g.upload()
  6449. };
  6450. a.WebGLGraphics.switchMode = function(b, d) {
  6451. var c;
  6452. if (b.data.length) {
  6453. if (c = b.data[b.data.length - 1], c.mode !== d || 1 === d) c = a.WebGLGraphics.graphicsDataPool.pop() || new a.WebGLGraphicsData(b.gl),
  6454. c.mode = d,
  6455. b.data.push(c)
  6456. } else c = a.WebGLGraphics.graphicsDataPool.pop() || new a.WebGLGraphicsData(b.gl),
  6457. c.mode = d,
  6458. b.data.push(c);
  6459. c.dirty = !0;
  6460. return c
  6461. };
  6462. a.WebGLGraphics.buildRectangle = function(b, d) {
  6463. var c = b.points,
  6464. e = c[0],
  6465. g = c[1],
  6466. f = c[2],
  6467. c = c[3];
  6468. if (b.fill) {
  6469. var k = a.hex2rgb(b.fillColor),
  6470. l = b.fillAlpha,
  6471. h = k[0] * l,
  6472. n = k[1] * l,
  6473. k = k[2] * l,
  6474. q = d.points,
  6475. p = d.indices,
  6476. s = q.length / 6;
  6477. q.push(e, g);
  6478. q.push(h, n, k, l);
  6479. q.push(e + f, g);
  6480. q.push(h, n, k, l);
  6481. q.push(e, g + c);
  6482. q.push(h, n, k, l);
  6483. q.push(e + f, g + c);
  6484. q.push(h, n, k, l);
  6485. p.push(s, s, s + 1, s + 2, s + 3, s + 3)
  6486. }
  6487. b.lineWidth && (l = b.points, b.points = [e, g, e + f, g, e + f, g + c, e, g + c, e, g], a.WebGLGraphics.buildLine(b, d), b.points = l)
  6488. };
  6489. a.WebGLGraphics.buildRoundedRectangle = function(b, d) {
  6490. function c(b, a, d, c, e, g) {
  6491. for (var f, l, k, r, h = [], n = 0, t = 0; 20 >= t; t++) n = t / 20,
  6492. f = b + (d - b) * n,
  6493. l = a + (c - a) * n,
  6494. k = d + (e - d) * n,
  6495. r = c + (g - c) * n,
  6496. f += (k - f) * n,
  6497. l += (r - l) * n,
  6498. h.push(f, l);
  6499. return h
  6500. }
  6501. var e = b.points,
  6502. g = e[0],
  6503. f = e[1],
  6504. k = e[2],
  6505. l = e[3],
  6506. h = e[4],
  6507. e = [];
  6508. e.push(g, f + h);
  6509. e = e.concat(c(g, f + l - h, g, f + l, g + h, f + l));
  6510. e = e.concat(c(g + k - h, f + l, g + k, f + l, g + k, f + l - h));
  6511. e = e.concat(c(g + k, f + h, g + k, f, g + k - h, f));
  6512. e = e.concat(c(g + h, f, g, f, g, f + h));
  6513. if (b.fill) {
  6514. for (var l = a.hex2rgb(b.fillColor), g = b.fillAlpha, f = l[0] * g, k = l[1] * g, l = l[2] * g, h = d.points, n = d.indices, q = h.length / 6, p = a.PolyK.Triangulate(e), s = 0, s = 0; s < p.length; s += 3) n.push(p[s] + q),
  6515. n.push(p[s] + q),
  6516. n.push(p[s + 1] + q),
  6517. n.push(p[s + 2] + q),
  6518. n.push(p[s + 2] + q);
  6519. for (s = 0; s < e.length; s++) h.push(e[s], e[++s], f, k, l, g)
  6520. }
  6521. b.lineWidth && (g = b.points, b.points = e, a.WebGLGraphics.buildLine(b, d), b.points = g)
  6522. };
  6523. a.WebGLGraphics.buildCircle = function(b, d) {
  6524. var c = b.points,
  6525. e = c[0],
  6526. g = c[1],
  6527. f = c[2],
  6528. c = c[3],
  6529. k = 2 * Math.PI / 40,
  6530. l = 0;
  6531. if (b.fill) {
  6532. var l = a.hex2rgb(b.fillColor),
  6533. h = b.fillAlpha,
  6534. n = l[0] * h,
  6535. q = l[1] * h,
  6536. p = l[2] * h,
  6537. s = d.points,
  6538. u = d.indices,
  6539. z = s.length / 6;
  6540. u.push(z);
  6541. for (l = 0; 41 > l; l++) s.push(e, g, n, q, p, h),
  6542. s.push(e + Math.sin(k * l) * f, g + Math.cos(k * l) * c, n, q, p, h),
  6543. u.push(z++, z++);
  6544. u.push(z - 1)
  6545. }
  6546. if (b.lineWidth) {
  6547. h = b.points;
  6548. b.points = [];
  6549. for (l = 0; 41 > l; l++) b.points.push(e + Math.sin(k * l) * f, g + Math.cos(k * l) * c);
  6550. a.WebGLGraphics.buildLine(b, d);
  6551. b.points = h
  6552. }
  6553. };
  6554. a.WebGLGraphics.buildLine = function(b, d) {
  6555. var c = 0,
  6556. e = b.points;
  6557. if (0 !== e.length) {
  6558. if (b.lineWidth % 2) for (c = 0; c < e.length; c++) e[c] += 0.5;
  6559. var g = new a.Point(e[0], e[1]),
  6560. f = new a.Point(e[e.length - 2], e[e.length - 1]);
  6561. if (g.x === f.x && g.y === f.y) {
  6562. e = e.slice();
  6563. e.pop();
  6564. e.pop();
  6565. var f = new a.Point(e[e.length - 2], e[e.length - 1]),
  6566. k = f.x + 0.5 * (g.x - f.x),
  6567. g = f.y + 0.5 * (g.y - f.y);
  6568. e.unshift(k, g);
  6569. e.push(k, g)
  6570. }
  6571. var k = d.points,
  6572. g = d.indices,
  6573. f = e.length / 2,
  6574. l = e.length,
  6575. h = k.length / 6,
  6576. n = b.lineWidth / 2,
  6577. c = a.hex2rgb(b.lineColor),
  6578. q = b.lineAlpha,
  6579. p = c[0] * q,
  6580. s = c[1] * q,
  6581. u = c[2] * q,
  6582. z,
  6583. A,
  6584. x,
  6585. D,
  6586. B,
  6587. F,
  6588. L,
  6589. O,
  6590. C,
  6591. G,
  6592. w,
  6593. J,
  6594. V;
  6595. x = e[0];
  6596. D = e[1];
  6597. B = e[2];
  6598. F = e[3];
  6599. C = -(D - F);
  6600. G = x - B;
  6601. A = Math.sqrt(C * C + G * G);
  6602. C = C / A * n;
  6603. G = G / A * n;
  6604. k.push(x - C, D - G, p, s, u, q);
  6605. k.push(x + C, D + G, p, s, u, q);
  6606. for (c = 1; c < f - 1; c++) x = e[2 * (c - 1)],
  6607. D = e[2 * (c - 1) + 1],
  6608. B = e[2 * c],
  6609. F = e[2 * c + 1],
  6610. L = e[2 * (c + 1)],
  6611. O = e[2 * (c + 1) + 1],
  6612. C = -(D - F),
  6613. G = x - B,
  6614. A = Math.sqrt(C * C + G * G),
  6615. C /= A,
  6616. G /= A,
  6617. C *= n,
  6618. G *= n,
  6619. w = -(F - O),
  6620. J = B - L,
  6621. A = Math.sqrt(w * w + J * J),
  6622. w /= A,
  6623. J /= A,
  6624. w *= n,
  6625. J *= n,
  6626. A = -G + D - ( - G + F),
  6627. z = -C + B - ( - C + x),
  6628. x = ( - C + x) * ( - G + F) - ( - C + B) * ( - G + D),
  6629. D = -J + O - ( - J + F),
  6630. V = -w + B - ( - w + L),
  6631. L = ( - w + L) * ( - J + F) - ( - w + B) * ( - J + O),
  6632. O = A * V - D * z,
  6633. 0.1 > Math.abs(O) ? (k.push(B - C, F - G, p, s, u, q), k.push(B + C, F + G, p, s, u, q)) : (z = (z * L - V * x) / O, A = (D * x - A * L) / O, L = (z - B) * (z - B) + (A - F) + (A - F), 19600 < L ? (C -= w, G -= J, A = Math.sqrt(C * C + G * G), C /= A, G /= A, C *= n, G *= n, k.push(B - C, F - G), k.push(p, s, u, q), k.push(B + C, F + G), k.push(p, s, u, q), k.push(B - C, F - G), k.push(p, s, u, q), l++) : (k.push(z, A), k.push(p, s, u, q), k.push(B - (z - B), F - (A - F)), k.push(p, s, u, q)));
  6634. x = e[2 * (f - 2)];
  6635. D = e[2 * (f - 2) + 1];
  6636. B = e[2 * (f - 1)];
  6637. F = e[2 * (f - 1) + 1];
  6638. C = -(D - F);
  6639. G = x - B;
  6640. A = Math.sqrt(C * C + G * G);
  6641. C /= A;
  6642. G /= A;
  6643. C *= n;
  6644. G *= n;
  6645. k.push(B - C, F - G);
  6646. k.push(p, s, u, q);
  6647. k.push(B + C, F + G);
  6648. k.push(p, s, u, q);
  6649. g.push(h);
  6650. for (c = 0; c < l; c++) g.push(h++);
  6651. g.push(h - 1)
  6652. }
  6653. };
  6654. a.WebGLGraphics.buildComplexPoly = function(b, d) {
  6655. var c = b.points.slice();
  6656. if (! (6 > c.length)) {
  6657. var e = d.indices;
  6658. d.points = c;
  6659. d.alpha = b.fillAlpha;
  6660. d.color = a.hex2rgb(b.fillColor);
  6661. for (var g = Infinity,
  6662. f = -Infinity,
  6663. k = Infinity,
  6664. l = -Infinity,
  6665. h, n, q = 0; q < c.length; q += 2) h = c[q],
  6666. n = c[q + 1],
  6667. g = h < g ? h: g,
  6668. f = h > f ? h: f,
  6669. k = n < k ? n: k,
  6670. l = n > l ? n: l;
  6671. c.push(g, k, f, k, f, l, g, l);
  6672. c = c.length / 2;
  6673. for (q = 0; q < c; q++) e.push(q)
  6674. }
  6675. };
  6676. a.WebGLGraphics.buildPoly = function(b, d) {
  6677. var c = b.points;
  6678. if (! (6 > c.length)) {
  6679. for (var e = d.points,
  6680. g = d.indices,
  6681. f = c.length / 2,
  6682. k = a.hex2rgb(b.fillColor), l = b.fillAlpha, h = k[0] * l, n = k[1] * l, k = k[2] * l, q = a.PolyK.Triangulate(c), p = e.length / 6, s = 0, s = 0; s < q.length; s += 3) g.push(q[s] + p),
  6683. g.push(q[s] + p),
  6684. g.push(q[s + 1] + p),
  6685. g.push(q[s + 2] + p),
  6686. g.push(q[s + 2] + p);
  6687. for (s = 0; s < f; s++) e.push(c[2 * s], c[2 * s + 1], h, n, k, l)
  6688. }
  6689. };
  6690. a.WebGLGraphics.graphicsDataPool = [];
  6691. a.WebGLGraphicsData = function(b) {
  6692. this.gl = b;
  6693. this.color = [0, 0, 0];
  6694. this.points = [];
  6695. this.indices = [];
  6696. this.lastIndex = 0;
  6697. this.buffer = b.createBuffer();
  6698. this.indexBuffer = b.createBuffer();
  6699. this.alpha = this.mode = 1;
  6700. this.dirty = !0
  6701. };
  6702. a.WebGLGraphicsData.prototype.reset = function() {
  6703. this.points = [];
  6704. this.indices = [];
  6705. this.lastIndex = 0
  6706. };
  6707. a.WebGLGraphicsData.prototype.upload = function() {
  6708. var b = this.gl;
  6709. this.glPoints = new Float32Array(this.points);
  6710. b.bindBuffer(b.ARRAY_BUFFER, this.buffer);
  6711. b.bufferData(b.ARRAY_BUFFER, this.glPoints, b.STATIC_DRAW);
  6712. this.glIndicies = new Uint16Array(this.indices);
  6713. b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
  6714. b.bufferData(b.ELEMENT_ARRAY_BUFFER, this.glIndicies, b.STATIC_DRAW);
  6715. this.dirty = !1
  6716. };
  6717. a.glContexts = [];
  6718. a.WebGLRenderer = function(b, d, c, e, g, f) {
  6719. a.defaultRenderer || (a.sayHello("webGL"), a.defaultRenderer = this);
  6720. this.type = a.WEBGL_RENDERER;
  6721. this.transparent = !!e;
  6722. this.preserveDrawingBuffer = f;
  6723. this.width = b || 800;
  6724. this.height = d || 600;
  6725. this.view = c || document.createElement("canvas");
  6726. this.view.width = this.width;
  6727. this.view.height = this.height;
  6728. this.contextLost = this.handleContextLost.bind(this);
  6729. this.contextRestoredLost = this.handleContextRestored.bind(this);
  6730. this.view.addEventListener("webglcontextlost", this.contextLost, !1);
  6731. this.view.addEventListener("webglcontextrestored", this.contextRestoredLost, !1);
  6732. this.options = {
  6733. alpha: this.transparent,
  6734. antialias: !!g,
  6735. premultipliedAlpha: !!e,
  6736. stencil: !0,
  6737. preserveDrawingBuffer: f
  6738. };
  6739. var k = null; ["experimental-webgl", "webgl"].forEach(function(b) {
  6740. try {
  6741. k = k || this.view.getContext(b, this.options)
  6742. } catch(a) {}
  6743. },
  6744. this);
  6745. if (!k) throw Error("This browser does not support webGL. Try using the canvas renderer" + this);
  6746. this.gl = k;
  6747. this.glContextId = k.id = a.WebGLRenderer.glContextId++;
  6748. a.glContexts[this.glContextId] = k;
  6749. a.blendModesWebGL || (a.blendModesWebGL = [], a.blendModesWebGL[a.blendModes.NORMAL] = [k.ONE, k.ONE_MINUS_SRC_ALPHA], a.blendModesWebGL[a.blendModes.ADD] = [k.SRC_ALPHA, k.DST_ALPHA], a.blendModesWebGL[a.blendModes.MULTIPLY] = [k.DST_COLOR, k.ONE_MINUS_SRC_ALPHA], a.blendModesWebGL[a.blendModes.SCREEN] = [k.SRC_ALPHA, k.ONE], a.blendModesWebGL[a.blendModes.OVERLAY] = [k.ONE, k.ONE_MINUS_SRC_ALPHA], a.blendModesWebGL[a.blendModes.DARKEN] = [k.ONE, k.ONE_MINUS_SRC_ALPHA], a.blendModesWebGL[a.blendModes.LIGHTEN] = [k.ONE, k.ONE_MINUS_SRC_ALPHA], a.blendModesWebGL[a.blendModes.COLOR_DODGE] = [k.ONE, k.ONE_MINUS_SRC_ALPHA], a.blendModesWebGL[a.blendModes.COLOR_BURN] = [k.ONE, k.ONE_MINUS_SRC_ALPHA], a.blendModesWebGL[a.blendModes.HARD_LIGHT] = [k.ONE, k.ONE_MINUS_SRC_ALPHA], a.blendModesWebGL[a.blendModes.SOFT_LIGHT] = [k.ONE, k.ONE_MINUS_SRC_ALPHA], a.blendModesWebGL[a.blendModes.DIFFERENCE] = [k.ONE, k.ONE_MINUS_SRC_ALPHA], a.blendModesWebGL[a.blendModes.EXCLUSION] = [k.ONE, k.ONE_MINUS_SRC_ALPHA], a.blendModesWebGL[a.blendModes.HUE] = [k.ONE, k.ONE_MINUS_SRC_ALPHA], a.blendModesWebGL[a.blendModes.SATURATION] = [k.ONE, k.ONE_MINUS_SRC_ALPHA], a.blendModesWebGL[a.blendModes.COLOR] = [k.ONE, k.ONE_MINUS_SRC_ALPHA], a.blendModesWebGL[a.blendModes.LUMINOSITY] = [k.ONE, k.ONE_MINUS_SRC_ALPHA]);
  6750. this.projection = new a.Point;
  6751. this.projection.x = this.width / 2;
  6752. this.projection.y = -this.height / 2;
  6753. this.offset = new a.Point(0, 0);
  6754. this.resize(this.width, this.height);
  6755. this.contextLost = !1;
  6756. this.shaderManager = new a.WebGLShaderManager(k);
  6757. this.spriteBatch = new a.WebGLSpriteBatch(k);
  6758. this.maskManager = new a.WebGLMaskManager(k);
  6759. this.filterManager = new a.WebGLFilterManager(k, this.transparent);
  6760. this.stencilManager = new a.WebGLStencilManager(k);
  6761. this.blendModeManager = new a.WebGLBlendModeManager(k);
  6762. this.renderSession = {};
  6763. this.renderSession.gl = this.gl;
  6764. this.renderSession.drawCount = 0;
  6765. this.renderSession.shaderManager = this.shaderManager;
  6766. this.renderSession.maskManager = this.maskManager;
  6767. this.renderSession.filterManager = this.filterManager;
  6768. this.renderSession.blendModeManager = this.blendModeManager;
  6769. this.renderSession.spriteBatch = this.spriteBatch;
  6770. this.renderSession.stencilManager = this.stencilManager;
  6771. this.renderSession.renderer = this;
  6772. k.useProgram(this.shaderManager.defaultShader.program);
  6773. k.disable(k.DEPTH_TEST);
  6774. k.disable(k.CULL_FACE);
  6775. k.enable(k.BLEND);
  6776. k.colorMask(!0, !0, !0, this.transparent)
  6777. };
  6778. a.WebGLRenderer.prototype.constructor = a.WebGLRenderer;
  6779. a.WebGLRenderer.prototype.render = function(b) {
  6780. if (!this.contextLost) {
  6781. this.__stage !== b && (b.interactive && b.interactionManager.removeEvents(), this.__stage = b);
  6782. a.WebGLRenderer.updateTextures();
  6783. b.updateTransform();
  6784. b._interactive && !b._interactiveEventsAdded && (b._interactiveEventsAdded = !0, b.interactionManager.setTarget(this));
  6785. var d = this.gl;
  6786. d.viewport(0, 0, this.width, this.height);
  6787. d.bindFramebuffer(d.FRAMEBUFFER, null);
  6788. this.transparent ? d.clearColor(0, 0, 0, 0) : d.clearColor(b.backgroundColorSplit[0], b.backgroundColorSplit[1], b.backgroundColorSplit[2], 1);
  6789. d.clear(d.COLOR_BUFFER_BIT);
  6790. this.renderDisplayObject(b, this.projection);
  6791. b.interactive ? b._interactiveEventsAdded || (b._interactiveEventsAdded = !0, b.interactionManager.setTarget(this)) : b._interactiveEventsAdded && (b._interactiveEventsAdded = !1, b.interactionManager.setTarget(this))
  6792. }
  6793. };
  6794. a.WebGLRenderer.prototype.renderDisplayObject = function(b, d, c) {
  6795. this.renderSession.blendModeManager.setBlendMode(a.blendModes.NORMAL);
  6796. this.renderSession.drawCount = 0;
  6797. this.renderSession.currentBlendMode = 9999;
  6798. this.renderSession.projection = d;
  6799. this.renderSession.offset = this.offset;
  6800. this.spriteBatch.begin(this.renderSession);
  6801. this.filterManager.begin(this.renderSession, c);
  6802. b._renderWebGL(this.renderSession);
  6803. this.spriteBatch.end()
  6804. };
  6805. a.WebGLRenderer.updateTextures = function() {
  6806. for (var b = 0,
  6807. b = 0; b < a.Texture.frameUpdates.length; b++) a.WebGLRenderer.updateTextureFrame(a.Texture.frameUpdates[b]);
  6808. for (b = 0; b < a.texturesToDestroy.length; b++) a.WebGLRenderer.destroyTexture(a.texturesToDestroy[b]);
  6809. a.texturesToUpdate.length = 0;
  6810. a.texturesToDestroy.length = 0;
  6811. a.Texture.frameUpdates.length = 0
  6812. };
  6813. a.WebGLRenderer.destroyTexture = function(b) {
  6814. for (var d = b._glTextures.length - 1; 0 <= d; d--) {
  6815. var c = b._glTextures[d],
  6816. e = a.glContexts[d];
  6817. e && c && e.deleteTexture(c)
  6818. }
  6819. b._glTextures.length = 0
  6820. };
  6821. a.WebGLRenderer.updateTextureFrame = function(b) {
  6822. b._updateWebGLuvs()
  6823. };
  6824. a.WebGLRenderer.prototype.resize = function(b, a) {
  6825. this.width = b;
  6826. this.height = a;
  6827. this.view.width = b;
  6828. this.view.height = a;
  6829. this.gl.viewport(0, 0, this.width, this.height);
  6830. this.projection.x = this.width / 2;
  6831. this.projection.y = -this.height / 2
  6832. };
  6833. a.createWebGLTexture = function(b, d) {
  6834. b.hasLoaded && (b._glTextures[d.id] = d.createTexture(), d.bindTexture(d.TEXTURE_2D, b._glTextures[d.id]), d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL, b.premultipliedAlpha), d.texImage2D(d.TEXTURE_2D, 0, d.RGBA, d.RGBA, d.UNSIGNED_BYTE, b.source), d.texParameteri(d.TEXTURE_2D, d.TEXTURE_MAG_FILTER, b.scaleMode === a.scaleModes.LINEAR ? d.LINEAR: d.NEAREST), d.texParameteri(d.TEXTURE_2D, d.TEXTURE_MIN_FILTER, b.scaleMode === a.scaleModes.LINEAR ? d.LINEAR: d.NEAREST), b._powerOf2 ? (d.texParameteri(d.TEXTURE_2D, d.TEXTURE_WRAP_S, d.REPEAT), d.texParameteri(d.TEXTURE_2D, d.TEXTURE_WRAP_T, d.REPEAT)) : (d.texParameteri(d.TEXTURE_2D, d.TEXTURE_WRAP_S, d.CLAMP_TO_EDGE), d.texParameteri(d.TEXTURE_2D, d.TEXTURE_WRAP_T, d.CLAMP_TO_EDGE)), d.bindTexture(d.TEXTURE_2D, null), b._dirty[d.id] = !1);
  6835. return b._glTextures[d.id]
  6836. };
  6837. a.updateWebGLTexture = function(b, d) {
  6838. b._glTextures[d.id] && (d.bindTexture(d.TEXTURE_2D, b._glTextures[d.id]), d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL, b.premultipliedAlpha), d.texImage2D(d.TEXTURE_2D, 0, d.RGBA, d.RGBA, d.UNSIGNED_BYTE, b.source), d.texParameteri(d.TEXTURE_2D, d.TEXTURE_MAG_FILTER, b.scaleMode === a.scaleModes.LINEAR ? d.LINEAR: d.NEAREST), d.texParameteri(d.TEXTURE_2D, d.TEXTURE_MIN_FILTER, b.scaleMode === a.scaleModes.LINEAR ? d.LINEAR: d.NEAREST), b._powerOf2 ? (d.texParameteri(d.TEXTURE_2D, d.TEXTURE_WRAP_S, d.REPEAT), d.texParameteri(d.TEXTURE_2D, d.TEXTURE_WRAP_T, d.REPEAT)) : (d.texParameteri(d.TEXTURE_2D, d.TEXTURE_WRAP_S, d.CLAMP_TO_EDGE), d.texParameteri(d.TEXTURE_2D, d.TEXTURE_WRAP_T, d.CLAMP_TO_EDGE)), b._dirty[d.id] = !1)
  6839. };
  6840. a.WebGLRenderer.prototype.handleContextLost = function(b) {
  6841. b.preventDefault();
  6842. this.contextLost = !0
  6843. };
  6844. a.WebGLRenderer.prototype.handleContextRestored = function() {
  6845. try {
  6846. this.gl = this.view.getContext("experimental-webgl", this.options)
  6847. } catch(b) {
  6848. try {
  6849. this.gl = this.view.getContext("webgl", this.options)
  6850. } catch(d) {
  6851. throw Error(" This browser does not support webGL. Try using the canvas renderer" + this);
  6852. }
  6853. }
  6854. var c = this.gl;
  6855. c.id = a.WebGLRenderer.glContextId++;
  6856. this.shaderManager.setContext(c);
  6857. this.spriteBatch.setContext(c);
  6858. this.primitiveBatch.setContext(c);
  6859. this.maskManager.setContext(c);
  6860. this.filterManager.setContext(c);
  6861. this.renderSession.gl = this.gl;
  6862. c.disable(c.DEPTH_TEST);
  6863. c.disable(c.CULL_FACE);
  6864. c.enable(c.BLEND);
  6865. c.colorMask(!0, !0, !0, this.transparent);
  6866. this.gl.viewport(0, 0, this.width, this.height);
  6867. for (var e in a.TextureCache) a.TextureCache[e].baseTexture._glTextures = [];
  6868. this.contextLost = !1
  6869. };
  6870. a.WebGLRenderer.prototype.destroy = function() {
  6871. this.view.removeEventListener("webglcontextlost", this.contextLost);
  6872. this.view.removeEventListener("webglcontextrestored", this.contextRestoredLost);
  6873. this.offset = this.projection = a.glContexts[this.glContextId] = null;
  6874. this.shaderManager.destroy();
  6875. this.spriteBatch.destroy();
  6876. this.primitiveBatch.destroy();
  6877. this.maskManager.destroy();
  6878. this.filterManager.destroy();
  6879. this.renderSession = this.gl = this.filterManager = this.maskManager = this.spriteBatch = this.shaderManager = null
  6880. };
  6881. a.WebGLRenderer.glContextId = 0;
  6882. a.WebGLBlendModeManager = function(b) {
  6883. this.gl = b;
  6884. this.currentBlendMode = 99999
  6885. };
  6886. a.WebGLBlendModeManager.prototype.setBlendMode = function(b) {
  6887. if (this.currentBlendMode === b) return ! 1;
  6888. this.currentBlendMode = b;
  6889. b = a.blendModesWebGL[this.currentBlendMode];
  6890. this.gl.blendFunc(b[0], b[1]);
  6891. return ! 0
  6892. };
  6893. a.WebGLBlendModeManager.prototype.destroy = function() {
  6894. this.gl = null
  6895. };
  6896. a.WebGLMaskManager = function(b) {
  6897. this.maskStack = [];
  6898. this.maskPosition = 0;
  6899. this.setContext(b);
  6900. this.reverse = !1;
  6901. this.count = 0
  6902. };
  6903. a.WebGLMaskManager.prototype.setContext = function(b) {
  6904. this.gl = b
  6905. };
  6906. a.WebGLMaskManager.prototype.pushMask = function(b, d) {
  6907. var c = d.gl;
  6908. b.dirty && a.WebGLGraphics.updateGraphics(b, c);
  6909. b._webGL[c.id].data.length && d.stencilManager.pushStencil(b, b._webGL[c.id].data[0], d)
  6910. };
  6911. a.WebGLMaskManager.prototype.popMask = function(b, a) {
  6912. a.stencilManager.popStencil(b, b._webGL[this.gl.id].data[0], a)
  6913. };
  6914. a.WebGLMaskManager.prototype.destroy = function() {
  6915. this.gl = this.maskStack = null
  6916. };
  6917. a.WebGLStencilManager = function(b) {
  6918. this.stencilStack = [];
  6919. this.setContext(b);
  6920. this.reverse = !0;
  6921. this.count = 0
  6922. };
  6923. a.WebGLStencilManager.prototype.setContext = function(b) {
  6924. this.gl = b
  6925. };
  6926. a.WebGLStencilManager.prototype.pushStencil = function(b, a, c) {
  6927. var e = this.gl;
  6928. this.bindGraphics(b, a, c);
  6929. 0 === this.stencilStack.length && (e.enable(e.STENCIL_TEST), e.clear(e.STENCIL_BUFFER_BIT), this.reverse = !0, this.count = 0);
  6930. this.stencilStack.push(a);
  6931. b = this.count;
  6932. e.colorMask(!1, !1, !1, !1);
  6933. e.stencilFunc(e.ALWAYS, 0, 255);
  6934. e.stencilOp(e.KEEP, e.KEEP, e.INVERT);
  6935. 1 === a.mode ? (e.drawElements(e.TRIANGLE_FAN, a.indices.length - 4, e.UNSIGNED_SHORT, 0), this.reverse ? (e.stencilFunc(e.EQUAL, 255 - b, 255), e.stencilOp(e.KEEP, e.KEEP, e.DECR)) : (e.stencilFunc(e.EQUAL, b, 255), e.stencilOp(e.KEEP, e.KEEP, e.INCR)), e.drawElements(e.TRIANGLE_FAN, 4, e.UNSIGNED_SHORT, 2 * (a.indices.length - 4)), this.reverse ? e.stencilFunc(e.EQUAL, 255 - (b + 1), 255) : e.stencilFunc(e.EQUAL, b + 1, 255), this.reverse = !this.reverse) : (this.reverse ? (e.stencilFunc(e.EQUAL, b, 255), e.stencilOp(e.KEEP, e.KEEP, e.INCR)) : (e.stencilFunc(e.EQUAL, 255 - b, 255), e.stencilOp(e.KEEP, e.KEEP, e.DECR)), e.drawElements(e.TRIANGLE_STRIP, a.indices.length, e.UNSIGNED_SHORT, 0), this.reverse ? e.stencilFunc(e.EQUAL, b + 1, 255) : e.stencilFunc(e.EQUAL, 255 - (b + 1), 255));
  6936. e.colorMask(!0, !0, !0, !0);
  6937. e.stencilOp(e.KEEP, e.KEEP, e.KEEP);
  6938. this.count++
  6939. };
  6940. a.WebGLStencilManager.prototype.bindGraphics = function(b, d, c) {
  6941. this._currentGraphics = b;
  6942. var e = this.gl,
  6943. g = c.projection,
  6944. f = c.offset,
  6945. k;
  6946. 1 === d.mode ? (k = c.shaderManager.complexPrimativeShader, c.shaderManager.setShader(k), e.uniformMatrix3fv(k.translationMatrix, !1, b.worldTransform.toArray(!0)), e.uniform2f(k.projectionVector, g.x, -g.y), e.uniform2f(k.offsetVector, -f.x, -f.y), e.uniform3fv(k.tintColor, a.hex2rgb(b.tint)), e.uniform3fv(k.color, d.color), e.uniform1f(k.alpha, b.worldAlpha * d.alpha), e.bindBuffer(e.ARRAY_BUFFER, d.buffer), e.vertexAttribPointer(k.aVertexPosition, 2, e.FLOAT, !1, 8, 0)) : (k = c.shaderManager.primitiveShader, c.shaderManager.setShader(k), e.uniformMatrix3fv(k.translationMatrix, !1, b.worldTransform.toArray(!0)), e.uniform2f(k.projectionVector, g.x, -g.y), e.uniform2f(k.offsetVector, -f.x, -f.y), e.uniform3fv(k.tintColor, a.hex2rgb(b.tint)), e.uniform1f(k.alpha, b.worldAlpha), e.bindBuffer(e.ARRAY_BUFFER, d.buffer), e.vertexAttribPointer(k.aVertexPosition, 2, e.FLOAT, !1, 24, 0), e.vertexAttribPointer(k.colorAttribute, 4, e.FLOAT, !1, 24, 8));
  6947. e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, d.indexBuffer)
  6948. };
  6949. a.WebGLStencilManager.prototype.popStencil = function(b, a, c) {
  6950. var e = this.gl;
  6951. this.stencilStack.pop();
  6952. this.count--;
  6953. if (0 === this.stencilStack.length) e.disable(e.STENCIL_TEST);
  6954. else {
  6955. var g = this.count;
  6956. this.bindGraphics(b, a, c);
  6957. e.colorMask(!1, !1, !1, !1);
  6958. 1 === a.mode ? ((this.reverse = !this.reverse) ? (e.stencilFunc(e.EQUAL, 255 - (g + 1), 255), e.stencilOp(e.KEEP, e.KEEP, e.INCR)) : (e.stencilFunc(e.EQUAL, g + 1, 255), e.stencilOp(e.KEEP, e.KEEP, e.DECR)), e.drawElements(e.TRIANGLE_FAN, 4, e.UNSIGNED_SHORT, 2 * (a.indices.length - 4)), e.stencilFunc(e.ALWAYS, 0, 255), e.stencilOp(e.KEEP, e.KEEP, e.INVERT), e.drawElements(e.TRIANGLE_FAN, a.indices.length - 4, e.UNSIGNED_SHORT, 0)) : (this.reverse ? (e.stencilFunc(e.EQUAL, g + 1, 255), e.stencilOp(e.KEEP, e.KEEP, e.DECR)) : (e.stencilFunc(e.EQUAL, 255 - (g + 1), 255), e.stencilOp(e.KEEP, e.KEEP, e.INCR)), e.drawElements(e.TRIANGLE_STRIP, a.indices.length, e.UNSIGNED_SHORT, 0));
  6959. this.reverse ? e.stencilFunc(e.EQUAL, g, 255) : e.stencilFunc(e.EQUAL, 255 - g, 255);
  6960. e.colorMask(!0, !0, !0, !0);
  6961. e.stencilOp(e.KEEP, e.KEEP, e.KEEP)
  6962. }
  6963. };
  6964. a.WebGLStencilManager.prototype.destroy = function() {
  6965. this.gl = this.maskStack = null
  6966. };
  6967. a.WebGLShaderManager = function(b) {
  6968. this.maxAttibs = 10;
  6969. this.attribState = [];
  6970. this.tempAttribState = [];
  6971. this.shaderMap = [];
  6972. for (var a = 0; a < this.maxAttibs; a++) this.attribState[a] = !1;
  6973. this.setContext(b)
  6974. };
  6975. a.WebGLShaderManager.prototype.setContext = function(b) {
  6976. this.gl = b;
  6977. this.primitiveShader = new a.PrimitiveShader(b);
  6978. this.complexPrimativeShader = new a.ComplexPrimitiveShader(b);
  6979. this.defaultShader = new a.PixiShader(b);
  6980. this.fastShader = new a.PixiFastShader(b);
  6981. this.stripShader = new a.StripShader(b);
  6982. this.setShader(this.defaultShader)
  6983. };
  6984. a.WebGLShaderManager.prototype.setAttribs = function(b) {
  6985. var a;
  6986. for (a = 0; a < this.tempAttribState.length; a++) this.tempAttribState[a] = !1;
  6987. for (a = 0; a < b.length; a++) this.tempAttribState[b[a]] = !0;
  6988. b = this.gl;
  6989. for (a = 0; a < this.attribState.length; a++) this.attribState[a] !== this.tempAttribState[a] && (this.attribState[a] = this.tempAttribState[a], this.tempAttribState[a] ? b.enableVertexAttribArray(a) : b.disableVertexAttribArray(a))
  6990. };
  6991. a.WebGLShaderManager.prototype.setShader = function(b) {
  6992. if (this._currentId === b._UID) return ! 1;
  6993. this._currentId = b._UID;
  6994. this.currentShader = b;
  6995. this.gl.useProgram(b.program);
  6996. this.setAttribs(b.attributes);
  6997. return ! 0
  6998. };
  6999. a.WebGLShaderManager.prototype.destroy = function() {
  7000. this.tempAttribState = this.attribState = null;
  7001. this.primitiveShader.destroy();
  7002. this.defaultShader.destroy();
  7003. this.fastShader.destroy();
  7004. this.stripShader.destroy();
  7005. this.gl = null
  7006. };
  7007. a.WebGLSpriteBatch = function(b) {
  7008. this.vertSize = 6;
  7009. this.size = 2E3;
  7010. var a = 6 * this.size;
  7011. this.vertices = new Float32Array(4 * this.size * this.vertSize);
  7012. this.indices = new Uint16Array(a);
  7013. for (var c = this.lastIndexCount = 0,
  7014. e = 0; c < a; c += 6, e += 4) this.indices[c + 0] = e + 0,
  7015. this.indices[c + 1] = e + 1,
  7016. this.indices[c + 2] = e + 2,
  7017. this.indices[c + 3] = e + 0,
  7018. this.indices[c + 4] = e + 2,
  7019. this.indices[c + 5] = e + 3;
  7020. this.drawing = !1;
  7021. this.currentBatchSize = 0;
  7022. this.currentBaseTexture = null;
  7023. this.setContext(b);
  7024. this.dirty = !0
  7025. };
  7026. a.WebGLSpriteBatch.prototype.setContext = function(b) {
  7027. this.gl = b;
  7028. this.vertexBuffer = b.createBuffer();
  7029. this.indexBuffer = b.createBuffer();
  7030. b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
  7031. b.bufferData(b.ELEMENT_ARRAY_BUFFER, this.indices, b.STATIC_DRAW);
  7032. b.bindBuffer(b.ARRAY_BUFFER, this.vertexBuffer);
  7033. b.bufferData(b.ARRAY_BUFFER, this.vertices, b.DYNAMIC_DRAW);
  7034. this.currentBlendMode = 99999
  7035. };
  7036. a.WebGLSpriteBatch.prototype.begin = function(b) {
  7037. this.renderSession = b;
  7038. this.shader = this.renderSession.shaderManager.defaultShader;
  7039. this.start()
  7040. };
  7041. a.WebGLSpriteBatch.prototype.end = function() {
  7042. this.flush()
  7043. };
  7044. a.WebGLSpriteBatch.prototype.render = function(b) {
  7045. var a = b.texture,
  7046. c = this.renderSession.blendModeManager.currentBlendMode !== b.blendMode;
  7047. if (a.baseTexture !== this.currentBaseTexture || this.currentBatchSize >= this.size || c) this.flush(),
  7048. this.currentBaseTexture = a.baseTexture,
  7049. this.renderSession.blendModeManager.setBlendMode(b.blendMode);
  7050. if (c = a._uvs) {
  7051. var e = b.worldAlpha,
  7052. g = b.tint,
  7053. f = this.vertices,
  7054. k = b.anchor.x,
  7055. l = b.anchor.y,
  7056. h, n;
  7057. a.trim ? (n = a.trim, k = n.x - k * n.width, h = k + a.crop.width, l = n.y - l * n.height, n = l + a.crop.height) : (h = a.frame.width * (1 - k), k = a.frame.width * -k, n = a.frame.height * (1 - l), l = a.frame.height * -l);
  7058. var a = 4 * this.currentBatchSize * this.vertSize,
  7059. q = b.worldTransform;
  7060. b = q.a;
  7061. var p = q.c,
  7062. s = q.b,
  7063. u = q.d,
  7064. z = q.tx,
  7065. q = q.ty;
  7066. f[a++] = b * k + s * l + z;
  7067. f[a++] = u * l + p * k + q;
  7068. f[a++] = c.x0;
  7069. f[a++] = c.y0;
  7070. f[a++] = e;
  7071. f[a++] = g;
  7072. f[a++] = b * h + s * l + z;
  7073. f[a++] = u * l + p * h + q;
  7074. f[a++] = c.x1;
  7075. f[a++] = c.y1;
  7076. f[a++] = e;
  7077. f[a++] = g;
  7078. f[a++] = b * h + s * n + z;
  7079. f[a++] = u * n + p * h + q;
  7080. f[a++] = c.x2;
  7081. f[a++] = c.y2;
  7082. f[a++] = e;
  7083. f[a++] = g;
  7084. f[a++] = b * k + s * n + z;
  7085. f[a++] = u * n + p * k + q;
  7086. f[a++] = c.x3;
  7087. f[a++] = c.y3;
  7088. f[a++] = e;
  7089. f[a++] = g;
  7090. this.currentBatchSize++
  7091. }
  7092. };
  7093. a.WebGLSpriteBatch.prototype.renderTilingSprite = function(b) {
  7094. var d = b.tilingTexture,
  7095. c = this.renderSession.blendModeManager.currentBlendMode !== b.blendMode;
  7096. if (d.baseTexture !== this.currentBaseTexture || this.currentBatchSize >= this.size || c) this.flush(),
  7097. this.currentBaseTexture = d.baseTexture,
  7098. this.renderSession.blendModeManager.setBlendMode(b.blendMode);
  7099. b._uvs || (b._uvs = new a.TextureUvs);
  7100. c = b._uvs;
  7101. b.tilePosition.x %= d.baseTexture.width * b.tileScaleOffset.x;
  7102. b.tilePosition.y %= d.baseTexture.height * b.tileScaleOffset.y;
  7103. var e = b.tilePosition.x / (d.baseTexture.width * b.tileScaleOffset.x),
  7104. g = b.tilePosition.y / (d.baseTexture.height * b.tileScaleOffset.y),
  7105. f = b.width / d.baseTexture.width / (b.tileScale.x * b.tileScaleOffset.x),
  7106. d = b.height / d.baseTexture.height / (b.tileScale.y * b.tileScaleOffset.y);
  7107. c.x0 = 0 - e;
  7108. c.y0 = 0 - g;
  7109. c.x1 = 1 * f - e;
  7110. c.y1 = 0 - g;
  7111. c.x2 = 1 * f - e;
  7112. c.y2 = 1 * d - g;
  7113. c.x3 = 0 - e;
  7114. c.y3 = 1 * d - g;
  7115. var d = b.worldAlpha,
  7116. e = b.tint,
  7117. g = this.vertices,
  7118. k = b.width,
  7119. l = b.height,
  7120. h = b.anchor.x,
  7121. n = b.anchor.y,
  7122. f = k * (1 - h),
  7123. k = k * -h,
  7124. h = l * (1 - n),
  7125. l = l * -n,
  7126. n = 4 * this.currentBatchSize * this.vertSize,
  7127. q = b.worldTransform;
  7128. b = q.a;
  7129. var p = q.c,
  7130. s = q.b,
  7131. u = q.d,
  7132. z = q.tx,
  7133. q = q.ty;
  7134. g[n++] = b * k + s * l + z;
  7135. g[n++] = u * l + p * k + q;
  7136. g[n++] = c.x0;
  7137. g[n++] = c.y0;
  7138. g[n++] = d;
  7139. g[n++] = e;
  7140. g[n++] = b * f + s * l + z;
  7141. g[n++] = u * l + p * f + q;
  7142. g[n++] = c.x1;
  7143. g[n++] = c.y1;
  7144. g[n++] = d;
  7145. g[n++] = e;
  7146. g[n++] = b * f + s * h + z;
  7147. g[n++] = u * h + p * f + q;
  7148. g[n++] = c.x2;
  7149. g[n++] = c.y2;
  7150. g[n++] = d;
  7151. g[n++] = e;
  7152. g[n++] = b * k + s * h + z;
  7153. g[n++] = u * h + p * k + q;
  7154. g[n++] = c.x3;
  7155. g[n++] = c.y3;
  7156. g[n++] = d;
  7157. g[n++] = e;
  7158. this.currentBatchSize++
  7159. };
  7160. a.WebGLSpriteBatch.prototype.flush = function() {
  7161. if (0 !== this.currentBatchSize) {
  7162. var b = this.gl;
  7163. this.renderSession.shaderManager.setShader(this.renderSession.shaderManager.defaultShader);
  7164. if (this.dirty) {
  7165. this.dirty = !1;
  7166. b.activeTexture(b.TEXTURE0);
  7167. b.bindBuffer(b.ARRAY_BUFFER, this.vertexBuffer);
  7168. b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
  7169. var d = this.renderSession.projection;
  7170. b.uniform2f(this.shader.projectionVector, d.x, d.y);
  7171. d = 4 * this.vertSize;
  7172. b.vertexAttribPointer(this.shader.aVertexPosition, 2, b.FLOAT, !1, d, 0);
  7173. b.vertexAttribPointer(this.shader.aTextureCoord, 2, b.FLOAT, !1, d, 8);
  7174. b.vertexAttribPointer(this.shader.colorAttribute, 2, b.FLOAT, !1, d, 16)
  7175. }
  7176. b.bindTexture(b.TEXTURE_2D, this.currentBaseTexture._glTextures[b.id] || a.createWebGLTexture(this.currentBaseTexture, b));
  7177. this.currentBaseTexture._dirty[b.id] && a.updateWebGLTexture(this.currentBaseTexture, b);
  7178. this.currentBatchSize > 0.5 * this.size ? b.bufferSubData(b.ARRAY_BUFFER, 0, this.vertices) : (d = this.vertices.subarray(0, 4 * this.currentBatchSize * this.vertSize), b.bufferSubData(b.ARRAY_BUFFER, 0, d));
  7179. b.drawElements(b.TRIANGLES, 6 * this.currentBatchSize, b.UNSIGNED_SHORT, 0);
  7180. this.currentBatchSize = 0;
  7181. this.renderSession.drawCount++
  7182. }
  7183. };
  7184. a.WebGLSpriteBatch.prototype.stop = function() {
  7185. this.flush()
  7186. };
  7187. a.WebGLSpriteBatch.prototype.start = function() {
  7188. this.dirty = !0
  7189. };
  7190. a.WebGLSpriteBatch.prototype.destroy = function() {
  7191. this.indices = this.vertices = null;
  7192. this.gl.deleteBuffer(this.vertexBuffer);
  7193. this.gl.deleteBuffer(this.indexBuffer);
  7194. this.gl = this.currentBaseTexture = null
  7195. };
  7196. a.WebGLFastSpriteBatch = function(b) {
  7197. this.vertSize = 10;
  7198. this.size = this.maxSize = 6E3;
  7199. var a = 6 * this.maxSize;
  7200. this.vertices = new Float32Array(4 * this.size * this.vertSize);
  7201. this.indices = new Uint16Array(a);
  7202. this.indexBuffer = this.vertexBuffer = null;
  7203. for (var c = this.lastIndexCount = 0,
  7204. e = 0; c < a; c += 6, e += 4) this.indices[c + 0] = e + 0,
  7205. this.indices[c + 1] = e + 1,
  7206. this.indices[c + 2] = e + 2,
  7207. this.indices[c + 3] = e + 0,
  7208. this.indices[c + 4] = e + 2,
  7209. this.indices[c + 5] = e + 3;
  7210. this.drawing = !1;
  7211. this.currentBatchSize = 0;
  7212. this.currentBaseTexture = null;
  7213. this.currentBlendMode = 0;
  7214. this.matrix = this.shader = this.renderSession = null;
  7215. this.setContext(b)
  7216. };
  7217. a.WebGLFastSpriteBatch.prototype.setContext = function(b) {
  7218. this.gl = b;
  7219. this.vertexBuffer = b.createBuffer();
  7220. this.indexBuffer = b.createBuffer();
  7221. b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
  7222. b.bufferData(b.ELEMENT_ARRAY_BUFFER, this.indices, b.STATIC_DRAW);
  7223. b.bindBuffer(b.ARRAY_BUFFER, this.vertexBuffer);
  7224. b.bufferData(b.ARRAY_BUFFER, this.vertices, b.DYNAMIC_DRAW)
  7225. };
  7226. a.WebGLFastSpriteBatch.prototype.begin = function(b, a) {
  7227. this.renderSession = a;
  7228. this.shader = this.renderSession.shaderManager.fastShader;
  7229. this.matrix = b.worldTransform.toArray(!0);
  7230. this.start()
  7231. };
  7232. a.WebGLFastSpriteBatch.prototype.end = function() {
  7233. this.flush()
  7234. };
  7235. a.WebGLFastSpriteBatch.prototype.render = function(b) {
  7236. b = b.children;
  7237. var a = b[0];
  7238. if (a.texture._uvs) {
  7239. this.currentBaseTexture = a.texture.baseTexture;
  7240. a.blendMode !== this.renderSession.blendModeManager.currentBlendMode && (this.flush(), this.renderSession.blendModeManager.setBlendMode(a.blendMode));
  7241. for (var a = 0,
  7242. c = b.length; a < c; a++) this.renderSprite(b[a]);
  7243. this.flush()
  7244. }
  7245. };
  7246. a.WebGLFastSpriteBatch.prototype.renderSprite = function(b) {
  7247. if (b.visible) {
  7248. if (b.texture.baseTexture !== this.currentBaseTexture && (this.flush(), this.currentBaseTexture = b.texture.baseTexture, !b.texture._uvs)) return;
  7249. var a, c = this.vertices,
  7250. e, g, f, k, l;
  7251. a = b.texture._uvs;
  7252. b.texture.trim ? (f = b.texture.trim, g = f.x - b.anchor.x * f.width, e = g + b.texture.crop.width, k = f.y - b.anchor.y * f.height, f = k + b.texture.crop.height) : (e = b.texture.frame.width * (1 - b.anchor.x), g = b.texture.frame.width * -b.anchor.x, f = b.texture.frame.height * (1 - b.anchor.y), k = b.texture.frame.height * -b.anchor.y);
  7253. l = 4 * this.currentBatchSize * this.vertSize;
  7254. c[l++] = g;
  7255. c[l++] = k;
  7256. c[l++] = b.position.x;
  7257. c[l++] = b.position.y;
  7258. c[l++] = b.scale.x;
  7259. c[l++] = b.scale.y;
  7260. c[l++] = b.rotation;
  7261. c[l++] = a.x0;
  7262. c[l++] = a.y1;
  7263. c[l++] = b.alpha;
  7264. c[l++] = e;
  7265. c[l++] = k;
  7266. c[l++] = b.position.x;
  7267. c[l++] = b.position.y;
  7268. c[l++] = b.scale.x;
  7269. c[l++] = b.scale.y;
  7270. c[l++] = b.rotation;
  7271. c[l++] = a.x1;
  7272. c[l++] = a.y1;
  7273. c[l++] = b.alpha;
  7274. c[l++] = e;
  7275. c[l++] = f;
  7276. c[l++] = b.position.x;
  7277. c[l++] = b.position.y;
  7278. c[l++] = b.scale.x;
  7279. c[l++] = b.scale.y;
  7280. c[l++] = b.rotation;
  7281. c[l++] = a.x2;
  7282. c[l++] = a.y2;
  7283. c[l++] = b.alpha;
  7284. c[l++] = g;
  7285. c[l++] = f;
  7286. c[l++] = b.position.x;
  7287. c[l++] = b.position.y;
  7288. c[l++] = b.scale.x;
  7289. c[l++] = b.scale.y;
  7290. c[l++] = b.rotation;
  7291. c[l++] = a.x3;
  7292. c[l++] = a.y3;
  7293. c[l++] = b.alpha;
  7294. this.currentBatchSize++;
  7295. this.currentBatchSize >= this.size && this.flush()
  7296. }
  7297. };
  7298. a.WebGLFastSpriteBatch.prototype.flush = function() {
  7299. if (0 !== this.currentBatchSize) {
  7300. var b = this.gl;
  7301. this.currentBaseTexture._glTextures[b.id] || a.createWebGLTexture(this.currentBaseTexture, b);
  7302. b.bindTexture(b.TEXTURE_2D, this.currentBaseTexture._glTextures[b.id]);
  7303. if (this.currentBatchSize > 0.5 * this.size) b.bufferSubData(b.ARRAY_BUFFER, 0, this.vertices);
  7304. else {
  7305. var d = this.vertices.subarray(0, 4 * this.currentBatchSize * this.vertSize);
  7306. b.bufferSubData(b.ARRAY_BUFFER, 0, d)
  7307. }
  7308. b.drawElements(b.TRIANGLES, 6 * this.currentBatchSize, b.UNSIGNED_SHORT, 0);
  7309. this.currentBatchSize = 0;
  7310. this.renderSession.drawCount++
  7311. }
  7312. };
  7313. a.WebGLFastSpriteBatch.prototype.stop = function() {
  7314. this.flush()
  7315. };
  7316. a.WebGLFastSpriteBatch.prototype.start = function() {
  7317. var b = this.gl;
  7318. b.activeTexture(b.TEXTURE0);
  7319. b.bindBuffer(b.ARRAY_BUFFER, this.vertexBuffer);
  7320. b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
  7321. var a = this.renderSession.projection;
  7322. b.uniform2f(this.shader.projectionVector, a.x, a.y);
  7323. b.uniformMatrix3fv(this.shader.uMatrix, !1, this.matrix);
  7324. a = 4 * this.vertSize;
  7325. b.vertexAttribPointer(this.shader.aVertexPosition, 2, b.FLOAT, !1, a, 0);
  7326. b.vertexAttribPointer(this.shader.aPositionCoord, 2, b.FLOAT, !1, a, 8);
  7327. b.vertexAttribPointer(this.shader.aScale, 2, b.FLOAT, !1, a, 16);
  7328. b.vertexAttribPointer(this.shader.aRotation, 1, b.FLOAT, !1, a, 24);
  7329. b.vertexAttribPointer(this.shader.aTextureCoord, 2, b.FLOAT, !1, a, 28);
  7330. b.vertexAttribPointer(this.shader.colorAttribute, 1, b.FLOAT, !1, a, 36)
  7331. };
  7332. a.WebGLFilterManager = function(b, a) {
  7333. this.transparent = a;
  7334. this.filterStack = [];
  7335. this.offsetY = this.offsetX = 0;
  7336. this.setContext(b)
  7337. };
  7338. a.WebGLFilterManager.prototype.setContext = function(b) {
  7339. this.gl = b;
  7340. this.texturePool = [];
  7341. this.initShaderBuffers()
  7342. };
  7343. a.WebGLFilterManager.prototype.begin = function(b, a) {
  7344. this.renderSession = b;
  7345. this.defaultShader = b.shaderManager.defaultShader;
  7346. var c = this.renderSession.projection;
  7347. this.width = 2 * c.x;
  7348. this.height = 2 * -c.y;
  7349. this.buffer = a
  7350. };
  7351. a.WebGLFilterManager.prototype.pushFilter = function(b) {
  7352. var d = this.gl,
  7353. c = this.renderSession.projection,
  7354. e = this.renderSession.offset;
  7355. b._filterArea = b.target.filterArea || b.target.getBounds();
  7356. this.filterStack.push(b);
  7357. var g = b.filterPasses[0];
  7358. this.offsetX += b._filterArea.x;
  7359. this.offsetY += b._filterArea.y;
  7360. var f = this.texturePool.pop();
  7361. f ? f.resize(this.width, this.height) : f = new a.FilterTexture(this.gl, this.width, this.height);
  7362. d.bindTexture(d.TEXTURE_2D, f.texture);
  7363. var k = b._filterArea,
  7364. g = g.padding;
  7365. k.x -= g;
  7366. k.y -= g;
  7367. k.width += 2 * g;
  7368. k.height += 2 * g;
  7369. 0 > k.x && (k.x = 0);
  7370. k.width > this.width && (k.width = this.width);
  7371. 0 > k.y && (k.y = 0);
  7372. k.height > this.height && (k.height = this.height);
  7373. d.bindFramebuffer(d.FRAMEBUFFER, f.frameBuffer);
  7374. d.viewport(0, 0, k.width, k.height);
  7375. c.x = k.width / 2;
  7376. c.y = -k.height / 2;
  7377. e.x = -k.x;
  7378. e.y = -k.y;
  7379. this.renderSession.shaderManager.setShader(this.defaultShader);
  7380. d.uniform2f(this.defaultShader.projectionVector, k.width / 2, -k.height / 2);
  7381. d.uniform2f(this.defaultShader.offsetVector, -k.x, -k.y);
  7382. d.colorMask(!0, !0, !0, !0);
  7383. d.clearColor(0, 0, 0, 0);
  7384. d.clear(d.COLOR_BUFFER_BIT);
  7385. b._glFilterTexture = f
  7386. };
  7387. a.WebGLFilterManager.prototype.popFilter = function() {
  7388. var b = this.gl,
  7389. d = this.filterStack.pop(),
  7390. c = d._filterArea,
  7391. e = d._glFilterTexture,
  7392. g = this.renderSession.projection,
  7393. f = this.renderSession.offset;
  7394. if (1 < d.filterPasses.length) {
  7395. b.viewport(0, 0, c.width, c.height);
  7396. b.bindBuffer(b.ARRAY_BUFFER, this.vertexBuffer);
  7397. this.vertexArray[0] = 0;
  7398. this.vertexArray[1] = c.height;
  7399. this.vertexArray[2] = c.width;
  7400. this.vertexArray[3] = c.height;
  7401. this.vertexArray[4] = 0;
  7402. this.vertexArray[5] = 0;
  7403. this.vertexArray[6] = c.width;
  7404. this.vertexArray[7] = 0;
  7405. b.bufferSubData(b.ARRAY_BUFFER, 0, this.vertexArray);
  7406. b.bindBuffer(b.ARRAY_BUFFER, this.uvBuffer);
  7407. this.uvArray[2] = c.width / this.width;
  7408. this.uvArray[5] = c.height / this.height;
  7409. this.uvArray[6] = c.width / this.width;
  7410. this.uvArray[7] = c.height / this.height;
  7411. b.bufferSubData(b.ARRAY_BUFFER, 0, this.uvArray);
  7412. var k = this.texturePool.pop();
  7413. k || (k = new a.FilterTexture(this.gl, this.width, this.height));
  7414. k.resize(this.width, this.height);
  7415. b.bindFramebuffer(b.FRAMEBUFFER, k.frameBuffer);
  7416. b.clear(b.COLOR_BUFFER_BIT);
  7417. b.disable(b.BLEND);
  7418. for (var l = 0; l < d.filterPasses.length - 1; l++) {
  7419. var h = d.filterPasses[l];
  7420. b.bindFramebuffer(b.FRAMEBUFFER, k.frameBuffer);
  7421. b.activeTexture(b.TEXTURE0);
  7422. b.bindTexture(b.TEXTURE_2D, e.texture);
  7423. this.applyFilterPass(h, c, c.width, c.height);
  7424. h = e;
  7425. e = k;
  7426. k = h
  7427. }
  7428. b.enable(b.BLEND);
  7429. this.texturePool.push(k)
  7430. }
  7431. k = d.filterPasses[d.filterPasses.length - 1];
  7432. this.offsetX -= c.x;
  7433. this.offsetY -= c.y;
  7434. var l = this.width,
  7435. h = this.height,
  7436. n = 0,
  7437. q = 0,
  7438. p = this.buffer;
  7439. 0 === this.filterStack.length ? b.colorMask(!0, !0, !0, !0) : (p = this.filterStack[this.filterStack.length - 1], c = p._filterArea, l = c.width, h = c.height, n = c.x, q = c.y, p = p._glFilterTexture.frameBuffer);
  7440. g.x = l / 2;
  7441. g.y = -h / 2;
  7442. f.x = n;
  7443. f.y = q;
  7444. c = d._filterArea;
  7445. g = c.x - n;
  7446. f = c.y - q;
  7447. b.bindBuffer(b.ARRAY_BUFFER, this.vertexBuffer);
  7448. this.vertexArray[0] = g;
  7449. this.vertexArray[1] = f + c.height;
  7450. this.vertexArray[2] = g + c.width;
  7451. this.vertexArray[3] = f + c.height;
  7452. this.vertexArray[4] = g;
  7453. this.vertexArray[5] = f;
  7454. this.vertexArray[6] = g + c.width;
  7455. this.vertexArray[7] = f;
  7456. b.bufferSubData(b.ARRAY_BUFFER, 0, this.vertexArray);
  7457. b.bindBuffer(b.ARRAY_BUFFER, this.uvBuffer);
  7458. this.uvArray[2] = c.width / this.width;
  7459. this.uvArray[5] = c.height / this.height;
  7460. this.uvArray[6] = c.width / this.width;
  7461. this.uvArray[7] = c.height / this.height;
  7462. b.bufferSubData(b.ARRAY_BUFFER, 0, this.uvArray);
  7463. b.viewport(0, 0, l, h);
  7464. b.bindFramebuffer(b.FRAMEBUFFER, p);
  7465. b.activeTexture(b.TEXTURE0);
  7466. b.bindTexture(b.TEXTURE_2D, e.texture);
  7467. this.applyFilterPass(k, c, l, h);
  7468. this.renderSession.shaderManager.setShader(this.defaultShader);
  7469. b.uniform2f(this.defaultShader.projectionVector, l / 2, -h / 2);
  7470. b.uniform2f(this.defaultShader.offsetVector, -n, -q);
  7471. this.texturePool.push(e);
  7472. d._glFilterTexture = null
  7473. };
  7474. a.WebGLFilterManager.prototype.applyFilterPass = function(b, d, c, e) {
  7475. d = this.gl;
  7476. var g = b.shaders[d.id];
  7477. g || (g = new a.PixiShader(d), g.fragmentSrc = b.fragmentSrc, g.uniforms = b.uniforms, g.init(), b.shaders[d.id] = g);
  7478. this.renderSession.shaderManager.setShader(g);
  7479. d.uniform2f(g.projectionVector, c / 2, -e / 2);
  7480. d.uniform2f(g.offsetVector, 0, 0);
  7481. b.uniforms.dimensions && (b.uniforms.dimensions.value[0] = this.width, b.uniforms.dimensions.value[1] = this.height, b.uniforms.dimensions.value[2] = this.vertexArray[0], b.uniforms.dimensions.value[3] = this.vertexArray[5]);
  7482. g.syncUniforms();
  7483. d.bindBuffer(d.ARRAY_BUFFER, this.vertexBuffer);
  7484. d.vertexAttribPointer(g.aVertexPosition, 2, d.FLOAT, !1, 0, 0);
  7485. d.bindBuffer(d.ARRAY_BUFFER, this.uvBuffer);
  7486. d.vertexAttribPointer(g.aTextureCoord, 2, d.FLOAT, !1, 0, 0);
  7487. d.bindBuffer(d.ARRAY_BUFFER, this.colorBuffer);
  7488. d.vertexAttribPointer(g.colorAttribute, 2, d.FLOAT, !1, 0, 0);
  7489. d.bindBuffer(d.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
  7490. d.drawElements(d.TRIANGLES, 6, d.UNSIGNED_SHORT, 0);
  7491. this.renderSession.drawCount++
  7492. };
  7493. a.WebGLFilterManager.prototype.initShaderBuffers = function() {
  7494. var b = this.gl;
  7495. this.vertexBuffer = b.createBuffer();
  7496. this.uvBuffer = b.createBuffer();
  7497. this.colorBuffer = b.createBuffer();
  7498. this.indexBuffer = b.createBuffer();
  7499. this.vertexArray = new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]);
  7500. b.bindBuffer(b.ARRAY_BUFFER, this.vertexBuffer);
  7501. b.bufferData(b.ARRAY_BUFFER, this.vertexArray, b.STATIC_DRAW);
  7502. this.uvArray = new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]);
  7503. b.bindBuffer(b.ARRAY_BUFFER, this.uvBuffer);
  7504. b.bufferData(b.ARRAY_BUFFER, this.uvArray, b.STATIC_DRAW);
  7505. this.colorArray = new Float32Array([1, 16777215, 1, 16777215, 1, 16777215, 1, 16777215]);
  7506. b.bindBuffer(b.ARRAY_BUFFER, this.colorBuffer);
  7507. b.bufferData(b.ARRAY_BUFFER, this.colorArray, b.STATIC_DRAW);
  7508. b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
  7509. b.bufferData(b.ELEMENT_ARRAY_BUFFER, new Uint16Array([0, 1, 2, 1, 3, 2]), b.STATIC_DRAW)
  7510. };
  7511. a.WebGLFilterManager.prototype.destroy = function() {
  7512. var b = this.gl;
  7513. this.filterStack = null;
  7514. for (var a = this.offsetY = this.offsetX = 0; a < this.texturePool.length; a++) this.texturePool[a].destroy();
  7515. this.texturePool = null;
  7516. b.deleteBuffer(this.vertexBuffer);
  7517. b.deleteBuffer(this.uvBuffer);
  7518. b.deleteBuffer(this.colorBuffer);
  7519. b.deleteBuffer(this.indexBuffer)
  7520. };
  7521. a.FilterTexture = function(b, d, c, e) {
  7522. this.gl = b;
  7523. this.frameBuffer = b.createFramebuffer();
  7524. this.texture = b.createTexture();
  7525. e = e || a.scaleModes.DEFAULT;
  7526. b.bindTexture(b.TEXTURE_2D, this.texture);
  7527. b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MAG_FILTER, e === a.scaleModes.LINEAR ? b.LINEAR: b.NEAREST);
  7528. b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MIN_FILTER, e === a.scaleModes.LINEAR ? b.LINEAR: b.NEAREST);
  7529. b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_S, b.CLAMP_TO_EDGE);
  7530. b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_T, b.CLAMP_TO_EDGE);
  7531. b.bindFramebuffer(b.FRAMEBUFFER, this.framebuffer);
  7532. b.bindFramebuffer(b.FRAMEBUFFER, this.frameBuffer);
  7533. b.framebufferTexture2D(b.FRAMEBUFFER, b.COLOR_ATTACHMENT0, b.TEXTURE_2D, this.texture, 0);
  7534. this.renderBuffer = b.createRenderbuffer();
  7535. b.bindRenderbuffer(b.RENDERBUFFER, this.renderBuffer);
  7536. b.framebufferRenderbuffer(b.FRAMEBUFFER, b.DEPTH_STENCIL_ATTACHMENT, b.RENDERBUFFER, this.renderBuffer);
  7537. this.resize(d, c)
  7538. };
  7539. a.FilterTexture.prototype.clear = function() {
  7540. var b = this.gl;
  7541. b.clearColor(0, 0, 0, 0);
  7542. b.clear(b.COLOR_BUFFER_BIT)
  7543. };
  7544. a.FilterTexture.prototype.resize = function(b, a) {
  7545. if (this.width !== b || this.height !== a) {
  7546. this.width = b;
  7547. this.height = a;
  7548. var c = this.gl;
  7549. c.bindTexture(c.TEXTURE_2D, this.texture);
  7550. c.texImage2D(c.TEXTURE_2D, 0, c.RGBA, b, a, 0, c.RGBA, c.UNSIGNED_BYTE, null);
  7551. c.bindRenderbuffer(c.RENDERBUFFER, this.renderBuffer);
  7552. c.renderbufferStorage(c.RENDERBUFFER, c.DEPTH_STENCIL, b, a)
  7553. }
  7554. };
  7555. a.FilterTexture.prototype.destroy = function() {
  7556. var b = this.gl;
  7557. b.deleteFramebuffer(this.frameBuffer);
  7558. b.deleteTexture(this.texture);
  7559. this.texture = this.frameBuffer = null
  7560. };
  7561. a.CanvasMaskManager = function() {};
  7562. a.CanvasMaskManager.prototype.pushMask = function(b, d) {
  7563. d.save();
  7564. var c = b.alpha,
  7565. e = b.worldTransform;
  7566. d.setTransform(e.a, e.c, e.b, e.d, e.tx, e.ty);
  7567. a.CanvasGraphics.renderGraphicsMask(b, d);
  7568. d.clip();
  7569. b.worldAlpha = c
  7570. };
  7571. a.CanvasMaskManager.prototype.popMask = function(b) {
  7572. b.restore()
  7573. };
  7574. a.CanvasTinter = function() {};
  7575. a.CanvasTinter.getTintedTexture = function(b, d) {
  7576. var c = b.texture;
  7577. d = a.CanvasTinter.roundColor(d);
  7578. var e = "#" + ("00000" + (d | 0).toString(16)).substr( - 6);
  7579. c.tintCache = c.tintCache || {};
  7580. if (c.tintCache[e]) return c.tintCache[e];
  7581. var g = a.CanvasTinter.canvas || document.createElement("canvas");
  7582. a.CanvasTinter.tintMethod(c, d, g);
  7583. if (a.CanvasTinter.convertTintToImage) {
  7584. var f = new Image;
  7585. f.src = g.toDataURL();
  7586. c.tintCache[e] = f
  7587. } else c.tintCache[e] = g,
  7588. a.CanvasTinter.canvas = null;
  7589. return g
  7590. };
  7591. a.CanvasTinter.tintWithMultiply = function(b, a, c) {
  7592. var e = c.getContext("2d"),
  7593. g = b.frame;
  7594. c.width = g.width;
  7595. c.height = g.height;
  7596. e.fillStyle = "#" + ("00000" + (a | 0).toString(16)).substr( - 6);
  7597. e.fillRect(0, 0, g.width, g.height);
  7598. e.globalCompositeOperation = "multiply";
  7599. e.drawImage(b.baseTexture.source, g.x, g.y, g.width, g.height, 0, 0, g.width, g.height);
  7600. e.globalCompositeOperation = "destination-atop";
  7601. e.drawImage(b.baseTexture.source, g.x, g.y, g.width, g.height, 0, 0, g.width, g.height)
  7602. };
  7603. a.CanvasTinter.tintWithOverlay = function(b, a, c) {
  7604. var e = c.getContext("2d"),
  7605. g = b.frame;
  7606. c.width = g.width;
  7607. c.height = g.height;
  7608. e.globalCompositeOperation = "copy";
  7609. e.fillStyle = "#" + ("00000" + (a | 0).toString(16)).substr( - 6);
  7610. e.fillRect(0, 0, g.width, g.height);
  7611. e.globalCompositeOperation = "destination-atop";
  7612. e.drawImage(b.baseTexture.source, g.x, g.y, g.width, g.height, 0, 0, g.width, g.height)
  7613. };
  7614. a.CanvasTinter.tintWithPerPixel = function(b, d, c) {
  7615. var e = c.getContext("2d"),
  7616. g = b.frame;
  7617. c.width = g.width;
  7618. c.height = g.height;
  7619. e.globalCompositeOperation = "copy";
  7620. e.drawImage(b.baseTexture.source, g.x, g.y, g.width, g.height, 0, 0, g.width, g.height);
  7621. c = a.hex2rgb(d);
  7622. b = c[0];
  7623. d = c[1];
  7624. c = c[2];
  7625. for (var g = e.getImageData(0, 0, g.width, g.height), f = g.data, k = 0; k < f.length; k += 4) f[k + 0] *= b,
  7626. f[k + 1] *= d,
  7627. f[k + 2] *= c;
  7628. e.putImageData(g, 0, 0)
  7629. };
  7630. a.CanvasTinter.roundColor = function(b) {
  7631. var d = a.CanvasTinter.cacheStepsPerColorChannel;
  7632. b = a.hex2rgb(b);
  7633. b[0] = Math.min(255, b[0] / d * d);
  7634. b[1] = Math.min(255, b[1] / d * d);
  7635. b[2] = Math.min(255, b[2] / d * d);
  7636. return a.rgb2hex(b)
  7637. };
  7638. a.CanvasTinter.cacheStepsPerColorChannel = 8;
  7639. a.CanvasTinter.convertTintToImage = !1;
  7640. a.CanvasTinter.canUseMultiply = a.canUseNewCanvasBlendModes();
  7641. a.CanvasTinter.tintMethod = a.CanvasTinter.canUseMultiply ? a.CanvasTinter.tintWithMultiply: a.CanvasTinter.tintWithPerPixel;
  7642. a.CanvasRenderer = function(b, d, c, e) {
  7643. a.defaultRenderer || (a.sayHello("Canvas"), a.defaultRenderer = this);
  7644. this.type = a.CANVAS_RENDERER;
  7645. this.clearBeforeRender = !0;
  7646. this.transparent = !!e;
  7647. a.blendModesCanvas || (a.blendModesCanvas = [], a.canUseNewCanvasBlendModes() ? (a.blendModesCanvas[a.blendModes.NORMAL] = "source-over", a.blendModesCanvas[a.blendModes.ADD] = "lighter", a.blendModesCanvas[a.blendModes.MULTIPLY] = "multiply", a.blendModesCanvas[a.blendModes.SCREEN] = "screen", a.blendModesCanvas[a.blendModes.OVERLAY] = "overlay", a.blendModesCanvas[a.blendModes.DARKEN] = "darken", a.blendModesCanvas[a.blendModes.LIGHTEN] = "lighten", a.blendModesCanvas[a.blendModes.COLOR_DODGE] = "color-dodge", a.blendModesCanvas[a.blendModes.COLOR_BURN] = "color-burn", a.blendModesCanvas[a.blendModes.HARD_LIGHT] = "hard-light", a.blendModesCanvas[a.blendModes.SOFT_LIGHT] = "soft-light", a.blendModesCanvas[a.blendModes.DIFFERENCE] = "difference", a.blendModesCanvas[a.blendModes.EXCLUSION] = "exclusion", a.blendModesCanvas[a.blendModes.HUE] = "hue", a.blendModesCanvas[a.blendModes.SATURATION] = "saturation", a.blendModesCanvas[a.blendModes.COLOR] = "color", a.blendModesCanvas[a.blendModes.LUMINOSITY] = "luminosity") : (a.blendModesCanvas[a.blendModes.NORMAL] = "source-over", a.blendModesCanvas[a.blendModes.ADD] = "lighter", a.blendModesCanvas[a.blendModes.MULTIPLY] = "source-over", a.blendModesCanvas[a.blendModes.SCREEN] = "source-over", a.blendModesCanvas[a.blendModes.OVERLAY] = "source-over", a.blendModesCanvas[a.blendModes.DARKEN] = "source-over", a.blendModesCanvas[a.blendModes.LIGHTEN] = "source-over", a.blendModesCanvas[a.blendModes.COLOR_DODGE] = "source-over", a.blendModesCanvas[a.blendModes.COLOR_BURN] = "source-over", a.blendModesCanvas[a.blendModes.HARD_LIGHT] = "source-over", a.blendModesCanvas[a.blendModes.SOFT_LIGHT] = "source-over", a.blendModesCanvas[a.blendModes.DIFFERENCE] = "source-over", a.blendModesCanvas[a.blendModes.EXCLUSION] = "source-over", a.blendModesCanvas[a.blendModes.HUE] = "source-over", a.blendModesCanvas[a.blendModes.SATURATION] = "source-over", a.blendModesCanvas[a.blendModes.COLOR] = "source-over", a.blendModesCanvas[a.blendModes.LUMINOSITY] = "source-over"));
  7648. this.width = b || 800;
  7649. this.height = d || 600;
  7650. this.view = c || document.createElement("canvas");
  7651. this.context = this.view.getContext("2d", {
  7652. alpha: this.transparent
  7653. });
  7654. this.refresh = !0;
  7655. this.view.width = this.width;
  7656. this.view.height = this.height;
  7657. this.count = 0;
  7658. this.maskManager = new a.CanvasMaskManager;
  7659. this.renderSession = {
  7660. context: this.context,
  7661. maskManager: this.maskManager,
  7662. scaleMode: null,
  7663. smoothProperty: null,
  7664. roundPixels: !1
  7665. };
  7666. "imageSmoothingEnabled" in this.context ? this.renderSession.smoothProperty = "imageSmoothingEnabled": "webkitImageSmoothingEnabled" in this.context ? this.renderSession.smoothProperty = "webkitImageSmoothingEnabled": "mozImageSmoothingEnabled" in this.context ? this.renderSession.smoothProperty = "mozImageSmoothingEnabled": "oImageSmoothingEnabled" in this.context && (this.renderSession.smoothProperty = "oImageSmoothingEnabled")
  7667. };
  7668. a.CanvasRenderer.prototype.constructor = a.CanvasRenderer;
  7669. a.CanvasRenderer.prototype.render = function(b) {
  7670. a.texturesToUpdate.length = 0;
  7671. a.texturesToDestroy.length = 0;
  7672. b.updateTransform();
  7673. this.context.setTransform(1, 0, 0, 1, 0, 0);
  7674. this.context.globalAlpha = 1;
  7675. navigator.isCocoonJS && this.view.screencanvas && (this.context.fillStyle = "black", this.context.clear()); ! this.transparent && this.clearBeforeRender ? (this.context.fillStyle = b.backgroundColorString, this.context.fillRect(0, 0, this.width, this.height)) : this.transparent && this.clearBeforeRender && this.context.clearRect(0, 0, this.width, this.height);
  7676. this.renderDisplayObject(b);
  7677. b.interactive && !b._interactiveEventsAdded && (b._interactiveEventsAdded = !0, b.interactionManager.setTarget(this));
  7678. 0 < a.Texture.frameUpdates.length && (a.Texture.frameUpdates.length = 0)
  7679. };
  7680. a.CanvasRenderer.prototype.resize = function(b, a) {
  7681. this.width = b;
  7682. this.height = a;
  7683. this.view.width = b;
  7684. this.view.height = a
  7685. };
  7686. a.CanvasRenderer.prototype.renderDisplayObject = function(b, a) {
  7687. this.renderSession.context = a || this.context;
  7688. b._renderCanvas(this.renderSession)
  7689. };
  7690. a.CanvasRenderer.prototype.renderStripFlat = function(b) {
  7691. var a = this.context;
  7692. b = b.verticies;
  7693. var c = b.length / 2;
  7694. this.count++;
  7695. a.beginPath();
  7696. for (var e = 1; e < c - 2; e++) {
  7697. var g = 2 * e,
  7698. f = b[g + 2],
  7699. k = b[g + 4],
  7700. l = b[g + 3],
  7701. h = b[g + 5];
  7702. a.moveTo(b[g], b[g + 1]);
  7703. a.lineTo(f, l);
  7704. a.lineTo(k, h)
  7705. }
  7706. a.fillStyle = "#FF0000";
  7707. a.fill();
  7708. a.closePath()
  7709. };
  7710. a.CanvasRenderer.prototype.renderStrip = function(b) {
  7711. var a = this.context,
  7712. c = b.verticies,
  7713. e = b.uvs,
  7714. g = c.length / 2;
  7715. this.count++;
  7716. for (var f = 1; f < g - 2; f++) {
  7717. var k = 2 * f,
  7718. l = c[k],
  7719. h = c[k + 2],
  7720. n = c[k + 4],
  7721. q = c[k + 1],
  7722. p = c[k + 3],
  7723. s = c[k + 5],
  7724. u = e[k] * b.texture.width,
  7725. z = e[k + 2] * b.texture.width,
  7726. A = e[k + 4] * b.texture.width,
  7727. x = e[k + 1] * b.texture.height,
  7728. D = e[k + 3] * b.texture.height,
  7729. k = e[k + 5] * b.texture.height;
  7730. a.save();
  7731. a.beginPath();
  7732. a.moveTo(l, q);
  7733. a.lineTo(h, p);
  7734. a.lineTo(n, s);
  7735. a.closePath();
  7736. a.clip();
  7737. var B = u * D + x * A + z * k - D * A - x * z - u * k;
  7738. a.transform((l * D + x * n + h * k - D * n - x * h - l * k) / B, (q * D + x * s + p * k - D * s - x * p - q * k) / B, (u * h + l * A + z * n - h * A - l * z - u * n) / B, (u * p + q * A + z * s - p * A - q * z - u * s) / B, (u * D * n + x * h * A + l * z * k - l * D * A - x * z * n - u * h * k) / B, (u * D * s + x * p * A + q * z * k - q * D * A - x * z * s - u * p * k) / B);
  7739. a.drawImage(b.texture.baseTexture.source, 0, 0);
  7740. a.restore()
  7741. }
  7742. };
  7743. a.CanvasBuffer = function(b, a) {
  7744. this.width = b;
  7745. this.height = a;
  7746. this.canvas = document.createElement("canvas");
  7747. this.context = this.canvas.getContext("2d");
  7748. this.canvas.width = b;
  7749. this.canvas.height = a
  7750. };
  7751. a.CanvasBuffer.prototype.clear = function() {
  7752. this.context.clearRect(0, 0, this.width, this.height)
  7753. };
  7754. a.CanvasBuffer.prototype.resize = function(b, a) {
  7755. this.width = this.canvas.width = b;
  7756. this.height = this.canvas.height = a
  7757. };
  7758. a.CanvasGraphics = function() {};
  7759. a.CanvasGraphics.renderGraphics = function(b, d) {
  7760. for (var c = b.worldAlpha,
  7761. e = 0; e < b.graphicsData.length; e++) {
  7762. var g = b.graphicsData[e],
  7763. f = g.points;
  7764. d.strokeStyle = "#" + ("00000" + (g.lineColor | 0).toString(16)).substr( - 6);
  7765. d.lineWidth = g.lineWidth;
  7766. if (g.type === a.Graphics.POLY) {
  7767. d.beginPath();
  7768. d.moveTo(f[0], f[1]);
  7769. for (var k = 1; k < f.length / 2; k++) d.lineTo(f[2 * k], f[2 * k + 1]);
  7770. f[0] === f[f.length - 2] && f[1] === f[f.length - 1] && d.closePath();
  7771. g.fill && (d.globalAlpha = g.fillAlpha * c, d.fillStyle = "#" + ("00000" + (g.fillColor | 0).toString(16)).substr( - 6), d.fill());
  7772. g.lineWidth && (d.globalAlpha = g.lineAlpha * c, d.stroke())
  7773. } else if (g.type === a.Graphics.RECT) {
  7774. if (g.fillColor || 0 === g.fillColor) d.globalAlpha = g.fillAlpha * c,
  7775. d.fillStyle = "#" + ("00000" + (g.fillColor | 0).toString(16)).substr( - 6),
  7776. d.fillRect(f[0], f[1], f[2], f[3]);
  7777. g.lineWidth && (d.globalAlpha = g.lineAlpha * c, d.strokeRect(f[0], f[1], f[2], f[3]))
  7778. } else if (g.type === a.Graphics.CIRC) d.beginPath(),
  7779. d.arc(f[0], f[1], f[2], 0, 2 * Math.PI),
  7780. d.closePath(),
  7781. g.fill && (d.globalAlpha = g.fillAlpha * c, d.fillStyle = "#" + ("00000" + (g.fillColor | 0).toString(16)).substr( - 6), d.fill()),
  7782. g.lineWidth && (d.globalAlpha = g.lineAlpha * c, d.stroke());
  7783. else if (g.type === a.Graphics.ELIP) {
  7784. var l = g.points,
  7785. h = 2 * l[2],
  7786. n = 2 * l[3],
  7787. k = l[0] - h / 2,
  7788. l = l[1] - n / 2;
  7789. d.beginPath();
  7790. var q = h / 2 * 0.5522848,
  7791. f = n / 2 * 0.5522848,
  7792. p = k + h,
  7793. s = l + n,
  7794. h = k + h / 2,
  7795. n = l + n / 2;
  7796. d.moveTo(k, n);
  7797. d.bezierCurveTo(k, n - f, h - q, l, h, l);
  7798. d.bezierCurveTo(h + q, l, p, n - f, p, n);
  7799. d.bezierCurveTo(p, n + f, h + q, s, h, s);
  7800. d.bezierCurveTo(h - q, s, k, n + f, k, n);
  7801. d.closePath();
  7802. g.fill && (d.globalAlpha = g.fillAlpha * c, d.fillStyle = "#" + ("00000" + (g.fillColor | 0).toString(16)).substr( - 6), d.fill());
  7803. g.lineWidth && (d.globalAlpha = g.lineAlpha * c, d.stroke())
  7804. } else if (g.type === a.Graphics.RREC) {
  7805. k = f[0];
  7806. n = f[1];
  7807. l = f[2];
  7808. q = f[3];
  7809. f = f[4];
  7810. p = Math.min(l, q) / 2 | 0;
  7811. f = f > p ? p: f;
  7812. d.beginPath();
  7813. d.moveTo(k, n + f);
  7814. d.lineTo(k, n + q - f);
  7815. d.quadraticCurveTo(k, n + q, k + f, n + q);
  7816. d.lineTo(k + l - f, n + q);
  7817. d.quadraticCurveTo(k + l, n + q, k + l, n + q - f);
  7818. d.lineTo(k + l, n + f);
  7819. d.quadraticCurveTo(k + l, n, k + l - f, n);
  7820. d.lineTo(k + f, n);
  7821. d.quadraticCurveTo(k, n, k, n + f);
  7822. d.closePath();
  7823. if (g.fillColor || 0 === g.fillColor) d.globalAlpha = g.fillAlpha * c,
  7824. d.fillStyle = "#" + ("00000" + (g.fillColor | 0).toString(16)).substr( - 6),
  7825. d.fill();
  7826. g.lineWidth && (d.globalAlpha = g.lineAlpha * c, d.stroke())
  7827. }
  7828. }
  7829. };
  7830. a.CanvasGraphics.renderGraphicsMask = function(b, d) {
  7831. var c = b.graphicsData.length;
  7832. if (0 !== c) for (1 < c && window.console.log("Pixi.js warning: masks in canvas can only mask using the first path in the graphics object"), c = 0; 1 > c; c++) {
  7833. var e = b.graphicsData[c],
  7834. f = e.points;
  7835. if (e.type === a.Graphics.POLY) {
  7836. d.beginPath();
  7837. d.moveTo(f[0], f[1]);
  7838. for (e = 1; e < f.length / 2; e++) d.lineTo(f[2 * e], f[2 * e + 1]);
  7839. f[0] === f[f.length - 2] && f[1] === f[f.length - 1] && d.closePath()
  7840. } else if (e.type === a.Graphics.RECT) d.beginPath(),
  7841. d.rect(f[0], f[1], f[2], f[3]),
  7842. d.closePath();
  7843. else if (e.type === a.Graphics.CIRC) d.beginPath(),
  7844. d.arc(f[0], f[1], f[2], 0, 2 * Math.PI),
  7845. d.closePath();
  7846. else if (e.type === a.Graphics.ELIP) {
  7847. var h = e.points,
  7848. k = 2 * h[2],
  7849. e = 2 * h[3],
  7850. f = h[0] - k / 2,
  7851. h = h[1] - e / 2;
  7852. d.beginPath();
  7853. var l = k / 2 * 0.5522848,
  7854. n = e / 2 * 0.5522848,
  7855. p = f + k,
  7856. q = h + e,
  7857. k = f + k / 2,
  7858. e = h + e / 2;
  7859. d.moveTo(f, e);
  7860. d.bezierCurveTo(f, e - n, k - l, h, k, h);
  7861. d.bezierCurveTo(k + l, h, p, e - n, p, e);
  7862. d.bezierCurveTo(p, e + n, k + l, q, k, q);
  7863. d.bezierCurveTo(k - l, q, f, e + n, f, e);
  7864. d.closePath()
  7865. } else e.type === a.Graphics.RREC && (e = f[0], h = f[1], l = f[2], n = f[3], f = f[4], p = Math.min(l, n) / 2 | 0, f = f > p ? p: f, d.beginPath(), d.moveTo(e, h + f), d.lineTo(e, h + n - f), d.quadraticCurveTo(e, h + n, e + f, h + n), d.lineTo(e + l - f, h + n), d.quadraticCurveTo(e + l, h + n, e + l, h + n - f), d.lineTo(e + l, h + f), d.quadraticCurveTo(e + l, h, e + l - f, h), d.lineTo(e + f, h), d.quadraticCurveTo(e, h, e, h + f), d.closePath())
  7866. }
  7867. };
  7868. a.Graphics = function() {
  7869. a.DisplayObjectContainer.call(this);
  7870. this.renderable = !0;
  7871. this.fillAlpha = 1;
  7872. this.lineWidth = 0;
  7873. this.lineColor = "black";
  7874. this.graphicsData = [];
  7875. this.tint = 16777215;
  7876. this.blendMode = a.blendModes.NORMAL;
  7877. this.currentPath = {
  7878. points: []
  7879. };
  7880. this._webGL = [];
  7881. this.isMask = !1;
  7882. this.bounds = null;
  7883. this.boundsPadding = 10;
  7884. this.dirty = !0
  7885. };
  7886. a.Graphics.prototype = Object.create(a.DisplayObjectContainer.prototype);
  7887. a.Graphics.prototype.constructor = a.Graphics;
  7888. Object.defineProperty(a.Graphics.prototype, "cacheAsBitmap", {
  7889. get: function() {
  7890. return this._cacheAsBitmap
  7891. },
  7892. set: function(b) { (this._cacheAsBitmap = b) ? this._generateCachedSprite() : (this.destroyCachedSprite(), this.dirty = !0)
  7893. }
  7894. });
  7895. a.Graphics.prototype.lineStyle = function(b, d, c) {
  7896. this.currentPath.points.length || this.graphicsData.pop();
  7897. this.lineWidth = b || 0;
  7898. this.lineColor = d || 0;
  7899. this.lineAlpha = 3 > arguments.length ? 1 : c;
  7900. this.currentPath = {
  7901. lineWidth: this.lineWidth,
  7902. lineColor: this.lineColor,
  7903. lineAlpha: this.lineAlpha,
  7904. fillColor: this.fillColor,
  7905. fillAlpha: this.fillAlpha,
  7906. fill: this.filling,
  7907. points: [],
  7908. type: a.Graphics.POLY
  7909. };
  7910. this.graphicsData.push(this.currentPath);
  7911. return this
  7912. };
  7913. a.Graphics.prototype.moveTo = function(b, d) {
  7914. this.currentPath.points.length || this.graphicsData.pop();
  7915. this.currentPath = this.currentPath = {
  7916. lineWidth: this.lineWidth,
  7917. lineColor: this.lineColor,
  7918. lineAlpha: this.lineAlpha,
  7919. fillColor: this.fillColor,
  7920. fillAlpha: this.fillAlpha,
  7921. fill: this.filling,
  7922. points: [],
  7923. type: a.Graphics.POLY
  7924. };
  7925. this.currentPath.points.push(b, d);
  7926. this.graphicsData.push(this.currentPath);
  7927. return this
  7928. };
  7929. a.Graphics.prototype.lineTo = function(b, a) {
  7930. this.currentPath.points.push(b, a);
  7931. this.dirty = !0;
  7932. return this
  7933. };
  7934. a.Graphics.prototype.quadraticCurveTo = function(b, a, c, e) {
  7935. for (var f, h, k = this.currentPath.points,
  7936. l = k[k.length - 2], n = k[k.length - 1], p = 0, q = 1; 20 >= q; q++) p = q / 20,
  7937. f = l + (b - l) * p,
  7938. h = n + (a - n) * p,
  7939. k.push(f + (b + (c - b) * p - f) * p, h + (a + (e - a) * p - h) * p);
  7940. this.dirty = !0;
  7941. return this
  7942. };
  7943. a.Graphics.prototype.bezierCurveTo = function(b, a, c, e, f, h) {
  7944. for (var k, l, n, p, q, y = this.currentPath.points,
  7945. s = y[y.length - 2], u = y[y.length - 1], z = 0, A = 1; 20 > A; A++) z = A / 20,
  7946. k = 1 - z,
  7947. l = k * k,
  7948. n = l * k,
  7949. p = z * z,
  7950. q = p * z,
  7951. y.push(n * s + 3 * l * z * b + 3 * k * p * c + q * f, n * u + 3 * l * z * a + 3 * k * p * e + q * h);
  7952. this.dirty = !0;
  7953. return this
  7954. };
  7955. a.Graphics.prototype.arcTo = function(b, a, c, e, f) {
  7956. var h = this.currentPath.points,
  7957. k = h[h.length - 1] - a,
  7958. l = h[h.length - 2] - b;
  7959. e -= a;
  7960. c -= b;
  7961. var n = Math.abs(k * c - l * e);
  7962. if (1E-8 > n || 0 === f) h.push(b, a);
  7963. else {
  7964. var p = k * k + l * l,
  7965. q = e * e + c * c,
  7966. y = k * e + l * c,
  7967. h = f * Math.sqrt(p) / n,
  7968. n = f * Math.sqrt(q) / n,
  7969. p = h * y / p,
  7970. s = n * y / q,
  7971. q = h * c + n * l,
  7972. y = h * e + n * k,
  7973. u = c * (h + s),
  7974. h = e * (h + s),
  7975. n = Math.atan2(k * (n + p) - y, l * (n + p) - q),
  7976. h = Math.atan2(h - y, u - q);
  7977. this.arc(q + b, y + a, f, n, h, l * e > c * k)
  7978. }
  7979. this.dirty = !0;
  7980. return this
  7981. };
  7982. a.Graphics.prototype.arc = function(b, a, c, e, f, h) {
  7983. var k = b + Math.cos(e) * c,
  7984. l = a + Math.sin(e) * c,
  7985. n = this.currentPath.points,
  7986. p = n[n.length - 1];
  7987. n[n.length - 2] === k && p === l || n.push(k, l);
  7988. if (e === f) return this; ! h && f <= e ? f += 2 * Math.PI: h && e <= f && (e += 2 * Math.PI);
  7989. h = h ? -1 * (e - f) : f - e;
  7990. f = Math.abs(h) / (2 * Math.PI) * 40;
  7991. if (0 === h) return this;
  7992. h /= 2 * f;
  7993. for (var k = 2 * h,
  7994. l = Math.cos(h), p = Math.sin(h), q = f % 1 / f, y = 0; y <= f; y++) {
  7995. var s = h + e + k * (y + q * y),
  7996. u = Math.cos(s),
  7997. s = -Math.sin(s);
  7998. n.push((l * u + p * s) * c + b, (l * -s + p * u) * c + a)
  7999. }
  8000. this.dirty = !0;
  8001. return this
  8002. };
  8003. a.Graphics.prototype.drawPath = function(b) {
  8004. this.currentPath.points.length || this.graphicsData.pop();
  8005. this.currentPath = this.currentPath = {
  8006. lineWidth: this.lineWidth,
  8007. lineColor: this.lineColor,
  8008. lineAlpha: this.lineAlpha,
  8009. fillColor: this.fillColor,
  8010. fillAlpha: this.fillAlpha,
  8011. fill: this.filling,
  8012. points: [],
  8013. type: a.Graphics.POLY
  8014. };
  8015. this.graphicsData.push(this.currentPath);
  8016. this.currentPath.points = this.currentPath.points.concat(b);
  8017. this.dirty = !0;
  8018. return this
  8019. };
  8020. a.Graphics.prototype.beginFill = function(b, a) {
  8021. this.filling = !0;
  8022. this.fillColor = b || 0;
  8023. this.fillAlpha = 2 > arguments.length ? 1 : a;
  8024. return this
  8025. };
  8026. a.Graphics.prototype.endFill = function() {
  8027. this.filling = !1;
  8028. this.fillColor = null;
  8029. this.fillAlpha = 1;
  8030. return this
  8031. };
  8032. a.Graphics.prototype.drawRect = function(b, d, c, e) {
  8033. this.currentPath.points.length || this.graphicsData.pop();
  8034. this.currentPath = {
  8035. lineWidth: this.lineWidth,
  8036. lineColor: this.lineColor,
  8037. lineAlpha: this.lineAlpha,
  8038. fillColor: this.fillColor,
  8039. fillAlpha: this.fillAlpha,
  8040. fill: this.filling,
  8041. points: [b, d, c, e],
  8042. type: a.Graphics.RECT
  8043. };
  8044. this.graphicsData.push(this.currentPath);
  8045. this.dirty = !0;
  8046. return this
  8047. };
  8048. a.Graphics.prototype.drawRoundedRect = function(b, d, c, e, f) {
  8049. this.currentPath.points.length || this.graphicsData.pop();
  8050. this.currentPath = {
  8051. lineWidth: this.lineWidth,
  8052. lineColor: this.lineColor,
  8053. lineAlpha: this.lineAlpha,
  8054. fillColor: this.fillColor,
  8055. fillAlpha: this.fillAlpha,
  8056. fill: this.filling,
  8057. points: [b, d, c, e, f],
  8058. type: a.Graphics.RREC
  8059. };
  8060. this.graphicsData.push(this.currentPath);
  8061. this.dirty = !0;
  8062. return this
  8063. };
  8064. a.Graphics.prototype.drawCircle = function(b, d, c) {
  8065. this.currentPath.points.length || this.graphicsData.pop();
  8066. this.currentPath = {
  8067. lineWidth: this.lineWidth,
  8068. lineColor: this.lineColor,
  8069. lineAlpha: this.lineAlpha,
  8070. fillColor: this.fillColor,
  8071. fillAlpha: this.fillAlpha,
  8072. fill: this.filling,
  8073. points: [b, d, c, c],
  8074. type: a.Graphics.CIRC
  8075. };
  8076. this.graphicsData.push(this.currentPath);
  8077. this.dirty = !0;
  8078. return this
  8079. };
  8080. a.Graphics.prototype.drawEllipse = function(b, d, c, e) {
  8081. this.currentPath.points.length || this.graphicsData.pop();
  8082. this.currentPath = {
  8083. lineWidth: this.lineWidth,
  8084. lineColor: this.lineColor,
  8085. lineAlpha: this.lineAlpha,
  8086. fillColor: this.fillColor,
  8087. fillAlpha: this.fillAlpha,
  8088. fill: this.filling,
  8089. points: [b, d, c, e],
  8090. type: a.Graphics.ELIP
  8091. };
  8092. this.graphicsData.push(this.currentPath);
  8093. this.dirty = !0;
  8094. return this
  8095. };
  8096. a.Graphics.prototype.clear = function() {
  8097. this.lineWidth = 0;
  8098. this.filling = !1;
  8099. this.clearDirty = this.dirty = !0;
  8100. this.graphicsData = [];
  8101. this.bounds = null;
  8102. return this
  8103. };
  8104. a.Graphics.prototype.generateTexture = function() {
  8105. var b = this.getBounds(),
  8106. d = new a.CanvasBuffer(b.width, b.height),
  8107. c = a.Texture.fromCanvas(d.canvas);
  8108. d.context.translate( - b.x, -b.y);
  8109. a.CanvasGraphics.renderGraphics(this, d.context);
  8110. return c
  8111. };
  8112. a.Graphics.prototype._renderWebGL = function(b) {
  8113. if (!1 !== this.visible && 0 !== this.alpha && !0 !== this.isMask) if (this._cacheAsBitmap) this.dirty && (this._generateCachedSprite(), a.updateWebGLTexture(this._cachedSprite.texture.baseTexture, b.gl), this.dirty = !1),
  8114. this._cachedSprite.alpha = this.alpha,
  8115. a.Sprite.prototype._renderWebGL.call(this._cachedSprite, b);
  8116. else {
  8117. b.spriteBatch.stop();
  8118. b.blendModeManager.setBlendMode(this.blendMode);
  8119. this._mask && b.maskManager.pushMask(this._mask, b);
  8120. this._filters && b.filterManager.pushFilter(this._filterBlock);
  8121. if (this.blendMode !== b.spriteBatch.currentBlendMode) {
  8122. b.spriteBatch.currentBlendMode = this.blendMode;
  8123. var d = a.blendModesWebGL[b.spriteBatch.currentBlendMode];
  8124. b.spriteBatch.gl.blendFunc(d[0], d[1])
  8125. }
  8126. a.WebGLGraphics.renderGraphics(this, b);
  8127. if (this.children.length) {
  8128. b.spriteBatch.start();
  8129. for (var d = 0,
  8130. c = this.children.length; d < c; d++) this.children[d]._renderWebGL(b);
  8131. b.spriteBatch.stop()
  8132. }
  8133. this._filters && b.filterManager.popFilter();
  8134. this._mask && b.maskManager.popMask(this.mask, b);
  8135. b.drawCount++;
  8136. b.spriteBatch.start()
  8137. }
  8138. };
  8139. a.Graphics.prototype._renderCanvas = function(b) {
  8140. if (!1 !== this.visible && 0 !== this.alpha && !0 !== this.isMask) {
  8141. var d = b.context,
  8142. c = this.worldTransform;
  8143. this.blendMode !== b.currentBlendMode && (b.currentBlendMode = this.blendMode, d.globalCompositeOperation = a.blendModesCanvas[b.currentBlendMode]);
  8144. this._mask && b.maskManager.pushMask(this._mask, b.context);
  8145. d.setTransform(c.a, c.c, c.b, c.d, c.tx, c.ty);
  8146. a.CanvasGraphics.renderGraphics(this, d);
  8147. d = 0;
  8148. for (c = this.children.length; d < c; d++) this.children[d]._renderCanvas(b);
  8149. this._mask && b.maskManager.popMask(b.context)
  8150. }
  8151. };
  8152. a.Graphics.prototype.getBounds = function(b) {
  8153. this.bounds || this.updateBounds();
  8154. var a = this.bounds.x,
  8155. c = this.bounds.width + this.bounds.x,
  8156. e = this.bounds.y,
  8157. f = this.bounds.height + this.bounds.y;
  8158. b = b || this.worldTransform;
  8159. var h = b.a,
  8160. k = b.c,
  8161. l = b.b,
  8162. n = b.d,
  8163. p = b.tx,
  8164. q = b.ty,
  8165. y = h * c + l * f + p,
  8166. s = n * f + k * c + q;
  8167. b = h * a + l * f + p;
  8168. var f = n * f + k * a + q,
  8169. u = h * a + l * e + p,
  8170. a = n * e + k * a + q,
  8171. h = h * c + l * e + p,
  8172. c = n * e + k * c + q,
  8173. e = y,
  8174. k = s,
  8175. y = b < y ? b: y,
  8176. y = u < y ? u: y,
  8177. y = h < y ? h: y,
  8178. s = f < s ? f: s,
  8179. s = a < s ? a: s,
  8180. s = c < s ? c: s,
  8181. e = b > e ? b: e,
  8182. e = u > e ? u: e,
  8183. k = f > k ? f: k,
  8184. k = a > k ? a: k;
  8185. b = this._bounds;
  8186. b.x = y;
  8187. b.width = (h > e ? h: e) - y;
  8188. b.y = s;
  8189. b.height = (c > k ? c: k) - s;
  8190. return b
  8191. };
  8192. a.Graphics.prototype.updateBounds = function() {
  8193. for (var b = Infinity,
  8194. d = -Infinity,
  8195. c = Infinity,
  8196. e = -Infinity,
  8197. f, h, k, l, n, p = 0; p < this.graphicsData.length; p++) if (f = this.graphicsData[p], h = f.type, n = f.lineWidth, f = f.points, h === a.Graphics.RECT) h = f[0] - n / 2,
  8198. k = f[1] - n / 2,
  8199. l = f[2] + n,
  8200. n = f[3] + n,
  8201. b = h < b ? h: b,
  8202. d = h + l > d ? h + l: d,
  8203. c = k < c ? h: c,
  8204. e = k + n > e ? k + n: e;
  8205. else if (h === a.Graphics.CIRC || h === a.Graphics.ELIP) h = f[0],
  8206. k = f[1],
  8207. l = f[2] + n / 2,
  8208. n = f[3] + n / 2,
  8209. b = h - l < b ? h - l: b,
  8210. d = h + l > d ? h + l: d,
  8211. c = k - n < c ? k - n: c,
  8212. e = k + n > e ? k + n: e;
  8213. else for (l = 0; l < f.length; l += 2) h = f[l],
  8214. k = f[l + 1],
  8215. b = h - n < b ? h - n: b,
  8216. d = h + n > d ? h + n: d,
  8217. c = k - n < c ? k - n: c,
  8218. e = k + n > e ? k + n: e;
  8219. p = this.boundsPadding;
  8220. this.bounds = new a.Rectangle(b - p, c - p, d - b + 2 * p, e - c + 2 * p)
  8221. };
  8222. a.Graphics.prototype._generateCachedSprite = function() {
  8223. var b = this.getLocalBounds();
  8224. if (this._cachedSprite) this._cachedSprite.buffer.resize(b.width, b.height);
  8225. else {
  8226. var d = new a.CanvasBuffer(b.width, b.height),
  8227. c = a.Texture.fromCanvas(d.canvas);
  8228. this._cachedSprite = new a.Sprite(c);
  8229. this._cachedSprite.buffer = d;
  8230. this._cachedSprite.worldTransform = this.worldTransform
  8231. }
  8232. this._cachedSprite.anchor.x = -(b.x / b.width);
  8233. this._cachedSprite.anchor.y = -(b.y / b.height);
  8234. this._cachedSprite.buffer.context.translate( - b.x, -b.y);
  8235. a.CanvasGraphics.renderGraphics(this, this._cachedSprite.buffer.context);
  8236. this._cachedSprite.alpha = this.alpha
  8237. };
  8238. a.Graphics.prototype.destroyCachedSprite = function() {
  8239. this._cachedSprite.texture.destroy(!0);
  8240. this._cachedSprite = null
  8241. };
  8242. a.Graphics.POLY = 0;
  8243. a.Graphics.RECT = 1;
  8244. a.Graphics.CIRC = 2;
  8245. a.Graphics.ELIP = 3;
  8246. a.Graphics.RREC = 4;
  8247. a.Strip = function(b) {
  8248. a.DisplayObjectContainer.call(this);
  8249. this.texture = b;
  8250. this.uvs = new a.Float32Array([0, 1, 1, 1, 1, 0, 0, 1]);
  8251. this.verticies = new a.Float32Array([0, 0, 100, 0, 100, 100, 0, 100]);
  8252. this.colors = new a.Float32Array([1, 1, 1, 1]);
  8253. this.indices = new a.Uint16Array([0, 1, 2, 3]);
  8254. this.dirty = !0
  8255. };
  8256. a.Strip.prototype = Object.create(a.DisplayObjectContainer.prototype);
  8257. a.Strip.prototype.constructor = a.Strip;
  8258. a.Strip.prototype._renderWebGL = function(b) { ! this.visible || 0 >= this.alpha || (b.spriteBatch.stop(), this._vertexBuffer || this._initWebGL(b), b.shaderManager.setShader(b.shaderManager.stripShader), this._renderStrip(b), b.spriteBatch.start())
  8259. };
  8260. a.Strip.prototype._initWebGL = function(b) {
  8261. b = b.gl;
  8262. this._vertexBuffer = b.createBuffer();
  8263. this._indexBuffer = b.createBuffer();
  8264. this._uvBuffer = b.createBuffer();
  8265. this._colorBuffer = b.createBuffer();
  8266. b.bindBuffer(b.ARRAY_BUFFER, this._vertexBuffer);
  8267. b.bufferData(b.ARRAY_BUFFER, this.verticies, b.DYNAMIC_DRAW);
  8268. b.bindBuffer(b.ARRAY_BUFFER, this._uvBuffer);
  8269. b.bufferData(b.ARRAY_BUFFER, this.uvs, b.STATIC_DRAW);
  8270. b.bindBuffer(b.ARRAY_BUFFER, this._colorBuffer);
  8271. b.bufferData(b.ARRAY_BUFFER, this.colors, b.STATIC_DRAW);
  8272. b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
  8273. b.bufferData(b.ELEMENT_ARRAY_BUFFER, this.indices, b.STATIC_DRAW)
  8274. };
  8275. a.Strip.prototype._renderStrip = function(b) {
  8276. var d = b.gl,
  8277. c = b.projection,
  8278. e = b.offset;
  8279. b = b.shaderManager.stripShader;
  8280. d.blendFunc(d.ONE, d.ONE_MINUS_SRC_ALPHA);
  8281. d.uniformMatrix3fv(b.translationMatrix, !1, this.worldTransform.toArray(!0));
  8282. d.uniform2f(b.projectionVector, c.x, -c.y);
  8283. d.uniform2f(b.offsetVector, -e.x, -e.y);
  8284. d.uniform1f(b.alpha, 1);
  8285. this.dirty ? (this.dirty = !1, d.bindBuffer(d.ARRAY_BUFFER, this._vertexBuffer), d.bufferData(d.ARRAY_BUFFER, this.verticies, d.STATIC_DRAW), d.vertexAttribPointer(b.aVertexPosition, 2, d.FLOAT, !1, 0, 0), d.bindBuffer(d.ARRAY_BUFFER, this._uvBuffer), d.bufferData(d.ARRAY_BUFFER, this.uvs, d.STATIC_DRAW), d.vertexAttribPointer(b.aTextureCoord, 2, d.FLOAT, !1, 0, 0), d.activeTexture(d.TEXTURE0), d.bindTexture(d.TEXTURE_2D, this.texture.baseTexture._glTextures[d.id] || a.createWebGLTexture(this.texture.baseTexture, d)), d.bindBuffer(d.ELEMENT_ARRAY_BUFFER, this._indexBuffer), d.bufferData(d.ELEMENT_ARRAY_BUFFER, this.indices, d.STATIC_DRAW)) : (d.bindBuffer(d.ARRAY_BUFFER, this._vertexBuffer), d.bufferSubData(d.ARRAY_BUFFER, 0, this.verticies), d.vertexAttribPointer(b.aVertexPosition, 2, d.FLOAT, !1, 0, 0), d.bindBuffer(d.ARRAY_BUFFER, this._uvBuffer), d.vertexAttribPointer(b.aTextureCoord, 2, d.FLOAT, !1, 0, 0), d.activeTexture(d.TEXTURE0), d.bindTexture(d.TEXTURE_2D, this.texture.baseTexture._glTextures[d.id] || a.createWebGLTexture(this.texture.baseTexture, d)), d.bindBuffer(d.ELEMENT_ARRAY_BUFFER, this._indexBuffer));
  8286. d.drawElements(d.TRIANGLE_STRIP, this.indices.length, d.UNSIGNED_SHORT, 0)
  8287. };
  8288. a.Strip.prototype._renderCanvas = function(b) {
  8289. var a = b.context,
  8290. c = this.worldTransform;
  8291. b.roundPixels ? a.setTransform(c.a, c.c, c.b, c.d, c.tx | 0, c.ty | 0) : a.setTransform(c.a, c.c, c.b, c.d, c.tx, c.ty);
  8292. b = this.verticies;
  8293. var c = this.uvs,
  8294. e = b.length / 2;
  8295. this.count++;
  8296. for (var f = 0; f < e - 2; f++) {
  8297. var h = 2 * f,
  8298. k = b[h],
  8299. l = b[h + 2],
  8300. n = b[h + 4],
  8301. p = b[h + 1],
  8302. q = b[h + 3],
  8303. y = b[h + 5],
  8304. s = (k + l + n) / 3,
  8305. u = (p + q + y) / 3,
  8306. z = k - s,
  8307. A = p - u,
  8308. x = Math.sqrt(z * z + A * A),
  8309. k = s + z / x * (x + 3),
  8310. p = u + A / x * (x + 3),
  8311. z = l - s,
  8312. A = q - u,
  8313. x = Math.sqrt(z * z + A * A),
  8314. l = s + z / x * (x + 3),
  8315. q = u + A / x * (x + 3),
  8316. z = n - s,
  8317. A = y - u,
  8318. x = Math.sqrt(z * z + A * A),
  8319. n = s + z / x * (x + 3),
  8320. y = u + A / x * (x + 3),
  8321. s = c[h] * this.texture.width,
  8322. u = c[h + 2] * this.texture.width,
  8323. z = c[h + 4] * this.texture.width,
  8324. A = c[h + 1] * this.texture.height,
  8325. x = c[h + 3] * this.texture.height,
  8326. h = c[h + 5] * this.texture.height;
  8327. a.save();
  8328. a.beginPath();
  8329. a.moveTo(k, p);
  8330. a.lineTo(l, q);
  8331. a.lineTo(n, y);
  8332. a.closePath();
  8333. a.clip();
  8334. var D = s * x + A * z + u * h - x * z - A * u - s * h;
  8335. a.transform((k * x + A * n + l * h - x * n - A * l - k * h) / D, (p * x + A * y + q * h - x * y - A * q - p * h) / D, (s * l + k * z + u * n - l * z - k * u - s * n) / D, (s * q + p * z + u * y - q * z - p * u - s * y) / D, (s * x * n + A * l * z + k * u * h - k * x * z - A * u * n - s * l * h) / D, (s * x * y + A * q * z + p * u * h - p * x * z - A * u * y - s * q * h) / D);
  8336. a.drawImage(this.texture.baseTexture.source, 0, 0);
  8337. a.restore()
  8338. }
  8339. };
  8340. a.Strip.prototype.onTextureUpdate = function() {
  8341. this.updateFrame = !0
  8342. };
  8343. a.Rope = function(b, d) {
  8344. a.Strip.call(this, b);
  8345. this.points = d;
  8346. this.verticies = new a.Float32Array(4 * d.length);
  8347. this.uvs = new a.Float32Array(4 * d.length);
  8348. this.colors = new a.Float32Array(2 * d.length);
  8349. this.indices = new a.Uint16Array(2 * d.length);
  8350. this.refresh()
  8351. };
  8352. a.Rope.prototype = Object.create(a.Strip.prototype);
  8353. a.Rope.prototype.constructor = a.Rope;
  8354. a.Rope.prototype.refresh = function() {
  8355. var b = this.points;
  8356. if (! (1 > b.length)) {
  8357. var a = this.uvs,
  8358. c = this.indices,
  8359. e = this.colors;
  8360. this.count -= 0.2;
  8361. a[0] = 0;
  8362. a[1] = 0;
  8363. a[2] = 0;
  8364. a[3] = 1;
  8365. e[0] = 1;
  8366. e[1] = 1;
  8367. c[0] = 0;
  8368. c[1] = 1;
  8369. for (var b = b.length,
  8370. f, h, k = 1; k < b; k++) f = 4 * k,
  8371. h = k / (b - 1),
  8372. a[f] = h,
  8373. a[f + 1] = 0,
  8374. a[f + 2] = h,
  8375. a[f + 3] = 1,
  8376. f = 2 * k,
  8377. e[f] = 1,
  8378. e[f + 1] = 1,
  8379. f = 2 * k,
  8380. c[f] = f,
  8381. c[f + 1] = f + 1
  8382. }
  8383. };
  8384. a.Rope.prototype.updateTransform = function() {
  8385. var b = this.points;
  8386. if (! (1 > b.length)) {
  8387. var d = b[0],
  8388. c,
  8389. e = c = 0;
  8390. this.count -= 0.2;
  8391. for (var f = this.verticies,
  8392. h = b.length,
  8393. k, l, n, p = 0; p < h; p++) k = b[p],
  8394. l = 4 * p,
  8395. c = p < b.length - 1 ? b[p + 1] : k,
  8396. e = -(c.x - d.x),
  8397. c = c.y - d.y,
  8398. d = Math.sqrt(c * c + e * e),
  8399. n = this.texture.height / 2,
  8400. c /= d,
  8401. e /= d,
  8402. c *= n,
  8403. e *= n,
  8404. f[l] = k.x + c,
  8405. f[l + 1] = k.y + e,
  8406. f[l + 2] = k.x - c,
  8407. f[l + 3] = k.y - e,
  8408. d = k;
  8409. a.DisplayObjectContainer.prototype.updateTransform.call(this)
  8410. }
  8411. };
  8412. a.Rope.prototype.setTexture = function(b) {
  8413. this.texture = b
  8414. };
  8415. a.TilingSprite = function(b, d, c) {
  8416. a.Sprite.call(this, b);
  8417. this.width = d || 100;
  8418. this.height = c || 100;
  8419. this.tileScale = new a.Point(1, 1);
  8420. this.tileScaleOffset = new a.Point(1, 1);
  8421. this.tilePosition = new a.Point(0, 0);
  8422. this.renderable = !0;
  8423. this.tint = 16777215;
  8424. this.blendMode = a.blendModes.NORMAL
  8425. };
  8426. a.TilingSprite.prototype = Object.create(a.Sprite.prototype);
  8427. a.TilingSprite.prototype.constructor = a.TilingSprite;
  8428. Object.defineProperty(a.TilingSprite.prototype, "width", {
  8429. get: function() {
  8430. return this._width
  8431. },
  8432. set: function(b) {
  8433. this._width = b
  8434. }
  8435. });
  8436. Object.defineProperty(a.TilingSprite.prototype, "height", {
  8437. get: function() {
  8438. return this._height
  8439. },
  8440. set: function(b) {
  8441. this._height = b
  8442. }
  8443. });
  8444. a.TilingSprite.prototype.setTexture = function(b) {
  8445. this.texture !== b && (this.texture = b, this.refreshTexture = !0, this.cachedTint = 16777215)
  8446. };
  8447. a.TilingSprite.prototype._renderWebGL = function(b) {
  8448. if (!1 !== this.visible && 0 !== this.alpha) {
  8449. var d, c;
  8450. this.mask && (b.spriteBatch.stop(), b.maskManager.pushMask(this.mask, b), b.spriteBatch.start());
  8451. this.filters && (b.spriteBatch.flush(), b.filterManager.pushFilter(this._filterBlock)); ! this.tilingTexture || this.refreshTexture ? (this.generateTilingTexture(!0), this.tilingTexture && this.tilingTexture.needsUpdate && (a.updateWebGLTexture(this.tilingTexture.baseTexture, b.gl), this.tilingTexture.needsUpdate = !1)) : b.spriteBatch.renderTilingSprite(this);
  8452. d = 0;
  8453. for (c = this.children.length; d < c; d++) this.children[d]._renderWebGL(b);
  8454. b.spriteBatch.stop();
  8455. this.filters && b.filterManager.popFilter();
  8456. this.mask && b.maskManager.popMask(b);
  8457. b.spriteBatch.start()
  8458. }
  8459. };
  8460. a.TilingSprite.prototype._renderCanvas = function(b) {
  8461. if (!1 !== this.visible && 0 !== this.alpha) {
  8462. var d = b.context;
  8463. this._mask && b.maskManager.pushMask(this._mask, d);
  8464. d.globalAlpha = this.worldAlpha;
  8465. var c = this.worldTransform;
  8466. d.setTransform(c.a, c.c, c.b, c.d, c.tx, c.ty);
  8467. if (!this.__tilePattern || this.refreshTexture) if (this.generateTilingTexture(!1), this.tilingTexture) this.__tilePattern = d.createPattern(this.tilingTexture.baseTexture.source, "repeat");
  8468. else return;
  8469. this.blendMode !== b.currentBlendMode && (b.currentBlendMode = this.blendMode, d.globalCompositeOperation = a.blendModesCanvas[b.currentBlendMode]);
  8470. var c = this.tilePosition,
  8471. e = this.tileScale;
  8472. c.x %= this.tilingTexture.baseTexture.width;
  8473. c.y %= this.tilingTexture.baseTexture.height;
  8474. d.scale(e.x, e.y);
  8475. d.translate(c.x, c.y);
  8476. d.fillStyle = this.__tilePattern;
  8477. d.fillRect( - c.x + this.anchor.x * -this._width, -c.y + this.anchor.y * -this._height, this._width / e.x, this._height / e.y);
  8478. d.scale(1 / e.x, 1 / e.y);
  8479. d.translate( - c.x, -c.y);
  8480. this._mask && b.maskManager.popMask(b.context);
  8481. d = 0;
  8482. for (c = this.children.length; d < c; d++) this.children[d]._renderCanvas(b)
  8483. }
  8484. };
  8485. a.TilingSprite.prototype.getBounds = function() {
  8486. var b = this._width,
  8487. a = this._height,
  8488. c = b * (1 - this.anchor.x),
  8489. e = b * -this.anchor.x,
  8490. f = a * (1 - this.anchor.y),
  8491. h = a * -this.anchor.y,
  8492. a = this.worldTransform,
  8493. k = a.a,
  8494. l = a.c,
  8495. n = a.b,
  8496. p = a.d,
  8497. q = a.tx,
  8498. y = a.ty,
  8499. a = k * e + n * h + q,
  8500. b = p * h + l * e + y,
  8501. s = k * c + n * h + q,
  8502. h = p * h + l * c + y,
  8503. u = k * c + n * f + q,
  8504. c = p * f + l * c + y,
  8505. k = k * e + n * f + q,
  8506. e = p * f + l * e + y,
  8507. l = f = -Infinity,
  8508. n = p = Infinity,
  8509. p = a < p ? a: p,
  8510. p = s < p ? s: p,
  8511. p = u < p ? u: p,
  8512. p = k < p ? k: p,
  8513. n = b < n ? b: n,
  8514. n = h < n ? h: n,
  8515. n = c < n ? c: n,
  8516. n = e < n ? e: n,
  8517. f = a > f ? a: f,
  8518. f = s > f ? s: f,
  8519. f = u > f ? u: f,
  8520. l = b > l ? b: l,
  8521. l = h > l ? h: l,
  8522. l = c > l ? c: l,
  8523. a = this._bounds;
  8524. a.x = p;
  8525. a.width = (k > f ? k: f) - p;
  8526. a.y = n;
  8527. a.height = (e > l ? e: l) - n;
  8528. return this._currentBounds = a
  8529. };
  8530. a.TilingSprite.prototype.generateTilingTexture = function(b) {
  8531. if (this.texture.baseTexture.hasLoaded) {
  8532. var d = this.texture,
  8533. c = d.frame,
  8534. e, f, h = c.width !== d.baseTexture.width || c.height !== d.baseTexture.height,
  8535. k = !1;
  8536. if (b) {
  8537. if (e = a.getNextPowerOfTwo(c.width), f = a.getNextPowerOfTwo(c.height), c.width !== e || c.height !== f) k = !0
  8538. } else h && (e = c.width, f = c.height, k = !0);
  8539. k ? (this.tilingTexture && this.tilingTexture.isTiling ? (b = this.tilingTexture.canvasBuffer, b.resize(e, f), this.tilingTexture.baseTexture.width = e, this.tilingTexture.baseTexture.height = f, this.tilingTexture.needsUpdate = !0) : (b = new a.CanvasBuffer(e, f), this.tilingTexture = a.Texture.fromCanvas(b.canvas), this.tilingTexture.canvasBuffer = b, this.tilingTexture.isTiling = !0), b.context.drawImage(d.baseTexture.source, d.crop.x, d.crop.y, d.crop.width, d.crop.height, 0, 0, e, f), this.tileScaleOffset.x = c.width / e, this.tileScaleOffset.y = c.height / f) : (this.tilingTexture && this.tilingTexture.isTiling && this.tilingTexture.destroy(!0), this.tileScaleOffset.x = 1, this.tileScaleOffset.y = 1, this.tilingTexture = d);
  8540. this.refreshTexture = !1;
  8541. this.tilingTexture.baseTexture._powerOf2 = !0
  8542. }
  8543. };
  8544. var p = {
  8545. BoneData: function(b, a) {
  8546. this.name = b;
  8547. this.parent = a
  8548. }
  8549. };
  8550. p.BoneData.prototype = {
  8551. length: 0,
  8552. x: 0,
  8553. y: 0,
  8554. rotation: 0,
  8555. scaleX: 1,
  8556. scaleY: 1
  8557. };
  8558. p.SlotData = function(b, a) {
  8559. this.name = b;
  8560. this.boneData = a
  8561. };
  8562. p.SlotData.prototype = {
  8563. r: 1,
  8564. g: 1,
  8565. b: 1,
  8566. a: 1,
  8567. attachmentName: null
  8568. };
  8569. p.Bone = function(b, a) {
  8570. this.data = b;
  8571. this.parent = a;
  8572. this.setToSetupPose()
  8573. };
  8574. p.Bone.yDown = !1;
  8575. p.Bone.prototype = {
  8576. x: 0,
  8577. y: 0,
  8578. rotation: 0,
  8579. scaleX: 1,
  8580. scaleY: 1,
  8581. m00: 0,
  8582. m01: 0,
  8583. worldX: 0,
  8584. m10: 0,
  8585. m11: 0,
  8586. worldY: 0,
  8587. worldRotation: 0,
  8588. worldScaleX: 1,
  8589. worldScaleY: 1,
  8590. updateWorldTransform: function(b, a) {
  8591. var c = this.parent;
  8592. null != c ? (this.worldX = this.x * c.m00 + this.y * c.m01 + c.worldX, this.worldY = this.x * c.m10 + this.y * c.m11 + c.worldY, this.worldScaleX = c.worldScaleX * this.scaleX, this.worldScaleY = c.worldScaleY * this.scaleY, this.worldRotation = c.worldRotation + this.rotation) : (this.worldX = this.x, this.worldY = this.y, this.worldScaleX = this.scaleX, this.worldScaleY = this.scaleY, this.worldRotation = this.rotation);
  8593. var e = this.worldRotation * Math.PI / 180,
  8594. c = Math.cos(e),
  8595. e = Math.sin(e);
  8596. this.m00 = c * this.worldScaleX;
  8597. this.m10 = e * this.worldScaleX;
  8598. this.m01 = -e * this.worldScaleY;
  8599. this.m11 = c * this.worldScaleY;
  8600. b && (this.m00 = -this.m00, this.m01 = -this.m01);
  8601. a && (this.m10 = -this.m10, this.m11 = -this.m11);
  8602. p.Bone.yDown && (this.m10 = -this.m10, this.m11 = -this.m11)
  8603. },
  8604. setToSetupPose: function() {
  8605. var b = this.data;
  8606. this.x = b.x;
  8607. this.y = b.y;
  8608. this.rotation = b.rotation;
  8609. this.scaleX = b.scaleX;
  8610. this.scaleY = b.scaleY
  8611. }
  8612. };
  8613. p.Slot = function(b, a, c) {
  8614. this.data = b;
  8615. this.skeleton = a;
  8616. this.bone = c;
  8617. this.setToSetupPose()
  8618. };
  8619. p.Slot.prototype = {
  8620. r: 1,
  8621. g: 1,
  8622. b: 1,
  8623. a: 1,
  8624. _attachmentTime: 0,
  8625. attachment: null,
  8626. setAttachment: function(b) {
  8627. this.attachment = b;
  8628. this._attachmentTime = this.skeleton.time
  8629. },
  8630. setAttachmentTime: function(b) {
  8631. this._attachmentTime = this.skeleton.time - b
  8632. },
  8633. getAttachmentTime: function() {
  8634. return this.skeleton.time - this._attachmentTime
  8635. },
  8636. setToSetupPose: function() {
  8637. var b = this.data;
  8638. this.r = b.r;
  8639. this.g = b.g;
  8640. this.b = b.b;
  8641. this.a = b.a;
  8642. for (var a = this.skeleton.data.slots,
  8643. c = 0,
  8644. e = a.length; c < e; c++) if (a[c] == b) {
  8645. this.setAttachment(b.attachmentName ? this.skeleton.getAttachmentBySlotIndex(c, b.attachmentName) : null);
  8646. break
  8647. }
  8648. }
  8649. };
  8650. p.Skin = function(b) {
  8651. this.name = b;
  8652. this.attachments = {}
  8653. };
  8654. p.Skin.prototype = {
  8655. addAttachment: function(b, a, c) {
  8656. this.attachments[b + ":" + a] = c
  8657. },
  8658. getAttachment: function(b, a) {
  8659. return this.attachments[b + ":" + a]
  8660. },
  8661. _attachAll: function(b, a) {
  8662. for (var c in a.attachments) {
  8663. var e = c.indexOf(":"),
  8664. f = parseInt(c.substring(0, e), 10),
  8665. h = c.substring(e + 1),
  8666. e = b.slots[f];
  8667. e.attachment && e.attachment.name == h && (f = this.getAttachment(f, h)) && e.setAttachment(f)
  8668. }
  8669. }
  8670. };
  8671. p.Animation = function(b, a, c) {
  8672. this.name = b;
  8673. this.timelines = a;
  8674. this.duration = c
  8675. };
  8676. p.Animation.prototype = {
  8677. apply: function(b, a, c) {
  8678. c && this.duration && (a %= this.duration);
  8679. c = this.timelines;
  8680. for (var e = 0,
  8681. f = c.length; e < f; e++) c[e].apply(b, a, 1)
  8682. },
  8683. mix: function(b, a, c, e) {
  8684. c && this.duration && (a %= this.duration);
  8685. c = this.timelines;
  8686. for (var f = 0,
  8687. h = c.length; f < h; f++) c[f].apply(b, a, e)
  8688. }
  8689. };
  8690. p.binarySearch = function(b, a, c) {
  8691. var e = 0,
  8692. f = Math.floor(b.length / c) - 2;
  8693. if (!f) return c;
  8694. for (var h = f >>> 1;;) {
  8695. b[(h + 1) * c] <= a ? e = h + 1 : f = h;
  8696. if (e == f) return (e + 1) * c;
  8697. h = e + f >>> 1
  8698. }
  8699. };
  8700. p.linearSearch = function(b, a, c) {
  8701. for (var e = 0,
  8702. f = b.length - c; e <= f; e += c) if (b[e] > a) return e;
  8703. return - 1
  8704. };
  8705. p.Curves = function(b) {
  8706. this.curves = [];
  8707. this.curves.length = 6 * (b - 1)
  8708. };
  8709. p.Curves.prototype = {
  8710. setLinear: function(b) {
  8711. this.curves[6 * b] = 0
  8712. },
  8713. setStepped: function(b) {
  8714. this.curves[6 * b] = -1
  8715. },
  8716. setCurve: function(b, a, c, e, f) {
  8717. var h = 0.1 * 0.1,
  8718. k = 0.1 * h,
  8719. l = 3 * 0.1,
  8720. n = 3 * h,
  8721. h = 6 * h,
  8722. p = 6 * k,
  8723. q = 2 * -a + e,
  8724. y = 2 * -c + f;
  8725. e = 3 * (a - e) + 1;
  8726. f = 3 * (c - f) + 1;
  8727. b *= 6;
  8728. var s = this.curves;
  8729. s[b] = a * l + q * n + e * k;
  8730. s[b + 1] = c * l + y * n + f * k;
  8731. s[b + 2] = q * h + e * p;
  8732. s[b + 3] = y * h + f * p;
  8733. s[b + 4] = e * p;
  8734. s[b + 5] = f * p
  8735. },
  8736. getCurvePercent: function(b, a) {
  8737. a = 0 > a ? 0 : 1 < a ? 1 : a;
  8738. var c = 6 * b,
  8739. e = this.curves,
  8740. f = e[c];
  8741. if (!f) return a;
  8742. if ( - 1 == f) return 0;
  8743. for (var h = e[c + 1], k = e[c + 2], l = e[c + 3], n = e[c + 4], p = e[c + 5], c = f, e = h, q = 8;;) {
  8744. if (c >= a) return f = c - f,
  8745. h = e - h,
  8746. h + (e - h) * (a - f) / (c - f);
  8747. if (!q) break;
  8748. q--;
  8749. f += k;
  8750. h += l;
  8751. k += n;
  8752. l += p;
  8753. c += f;
  8754. e += h
  8755. }
  8756. return e + (1 - e) * (a - c) / (1 - c)
  8757. }
  8758. };
  8759. p.RotateTimeline = function(b) {
  8760. this.curves = new p.Curves(b);
  8761. this.frames = [];
  8762. this.frames.length = 2 * b
  8763. };
  8764. p.RotateTimeline.prototype = {
  8765. boneIndex: 0,
  8766. getFrameCount: function() {
  8767. return this.frames.length / 2
  8768. },
  8769. setFrame: function(b, a, c) {
  8770. b *= 2;
  8771. this.frames[b] = a;
  8772. this.frames[b + 1] = c
  8773. },
  8774. apply: function(b, a, c) {
  8775. var e = this.frames;
  8776. if (! (a < e[0])) {
  8777. b = b.bones[this.boneIndex];
  8778. if (a >= e[e.length - 2]) e = b.data.rotation + e[e.length - 1] - b.rotation;
  8779. else {
  8780. var f = p.binarySearch(e, a, 2),
  8781. h = e[f - 1],
  8782. k = e[f];
  8783. a = 1 - (a - k) / (e[f - 2] - k);
  8784. a = this.curves.getCurvePercent(f / 2 - 1, a);
  8785. for (e = e[f + 1] - h; 180 < e;) e -= 360;
  8786. for (; - 180 > e;) e += 360;
  8787. e = b.data.rotation + (h + e * a) - b.rotation
  8788. }
  8789. for (; 180 < e;) e -= 360;
  8790. for (; - 180 > e;) e += 360;
  8791. b.rotation += e * c
  8792. }
  8793. }
  8794. };
  8795. p.TranslateTimeline = function(b) {
  8796. this.curves = new p.Curves(b);
  8797. this.frames = [];
  8798. this.frames.length = 3 * b
  8799. };
  8800. p.TranslateTimeline.prototype = {
  8801. boneIndex: 0,
  8802. getFrameCount: function() {
  8803. return this.frames.length / 3
  8804. },
  8805. setFrame: function(b, a, c, e) {
  8806. b *= 3;
  8807. this.frames[b] = a;
  8808. this.frames[b + 1] = c;
  8809. this.frames[b + 2] = e
  8810. },
  8811. apply: function(b, a, c) {
  8812. var e = this.frames;
  8813. if (! (a < e[0])) if (b = b.bones[this.boneIndex], a >= e[e.length - 3]) b.x += (b.data.x + e[e.length - 2] - b.x) * c,
  8814. b.y += (b.data.y + e[e.length - 1] - b.y) * c;
  8815. else {
  8816. var f = p.binarySearch(e, a, 3),
  8817. h = e[f - 2],
  8818. k = e[f - 1],
  8819. l = e[f];
  8820. a = 1 - (a - l) / (e[f + -3] - l);
  8821. a = this.curves.getCurvePercent(f / 3 - 1, a);
  8822. b.x += (b.data.x + h + (e[f + 1] - h) * a - b.x) * c;
  8823. b.y += (b.data.y + k + (e[f + 2] - k) * a - b.y) * c
  8824. }
  8825. }
  8826. };
  8827. p.ScaleTimeline = function(b) {
  8828. this.curves = new p.Curves(b);
  8829. this.frames = [];
  8830. this.frames.length = 3 * b
  8831. };
  8832. p.ScaleTimeline.prototype = {
  8833. boneIndex: 0,
  8834. getFrameCount: function() {
  8835. return this.frames.length / 3
  8836. },
  8837. setFrame: function(b, a, c, e) {
  8838. b *= 3;
  8839. this.frames[b] = a;
  8840. this.frames[b + 1] = c;
  8841. this.frames[b + 2] = e
  8842. },
  8843. apply: function(b, a, c) {
  8844. var e = this.frames;
  8845. if (! (a < e[0])) if (b = b.bones[this.boneIndex], a >= e[e.length - 3]) b.scaleX += (b.data.scaleX - 1 + e[e.length - 2] - b.scaleX) * c,
  8846. b.scaleY += (b.data.scaleY - 1 + e[e.length - 1] - b.scaleY) * c;
  8847. else {
  8848. var f = p.binarySearch(e, a, 3),
  8849. h = e[f - 2],
  8850. k = e[f - 1],
  8851. l = e[f];
  8852. a = 1 - (a - l) / (e[f + -3] - l);
  8853. a = this.curves.getCurvePercent(f / 3 - 1, a);
  8854. b.scaleX += (b.data.scaleX - 1 + h + (e[f + 1] - h) * a - b.scaleX) * c;
  8855. b.scaleY += (b.data.scaleY - 1 + k + (e[f + 2] - k) * a - b.scaleY) * c
  8856. }
  8857. }
  8858. };
  8859. p.ColorTimeline = function(b) {
  8860. this.curves = new p.Curves(b);
  8861. this.frames = [];
  8862. this.frames.length = 5 * b
  8863. };
  8864. p.ColorTimeline.prototype = {
  8865. slotIndex: 0,
  8866. getFrameCount: function() {
  8867. return this.frames.length / 5
  8868. },
  8869. setFrame: function(b, a, c, e, f, h) {
  8870. b *= 5;
  8871. this.frames[b] = a;
  8872. this.frames[b + 1] = c;
  8873. this.frames[b + 2] = e;
  8874. this.frames[b + 3] = f;
  8875. this.frames[b + 4] = h
  8876. },
  8877. apply: function(b, a, c) {
  8878. var e = this.frames;
  8879. if (! (a < e[0])) if (b = b.slots[this.slotIndex], a >= e[e.length - 5]) c = e.length - 1,
  8880. b.r = e[c - 3],
  8881. b.g = e[c - 2],
  8882. b.b = e[c - 1],
  8883. b.a = e[c];
  8884. else {
  8885. var f = p.binarySearch(e, a, 5),
  8886. h = e[f - 4],
  8887. k = e[f - 3],
  8888. l = e[f - 2],
  8889. n = e[f - 1],
  8890. v = e[f];
  8891. a = 1 - (a - v) / (e[f - 5] - v);
  8892. a = this.curves.getCurvePercent(f / 5 - 1, a);
  8893. h += (e[f + 1] - h) * a;
  8894. k += (e[f + 2] - k) * a;
  8895. l += (e[f + 3] - l) * a;
  8896. e = n + (e[f + 4] - n) * a;
  8897. 1 > c ? (b.r += (h - b.r) * c, b.g += (k - b.g) * c, b.b += (l - b.b) * c, b.a += (e - b.a) * c) : (b.r = h, b.g = k, b.b = l, b.a = e)
  8898. }
  8899. }
  8900. };
  8901. p.AttachmentTimeline = function(b) {
  8902. this.curves = new p.Curves(b);
  8903. this.frames = [];
  8904. this.frames.length = b;
  8905. this.attachmentNames = [];
  8906. this.attachmentNames.length = b
  8907. };
  8908. p.AttachmentTimeline.prototype = {
  8909. slotIndex: 0,
  8910. getFrameCount: function() {
  8911. return this.frames.length
  8912. },
  8913. setFrame: function(b, a, c) {
  8914. this.frames[b] = a;
  8915. this.attachmentNames[b] = c
  8916. },
  8917. apply: function(b, a, c) {
  8918. c = this.frames;
  8919. a < c[0] || (a = a >= c[c.length - 1] ? c.length - 1 : p.binarySearch(c, a, 1) - 1, a = this.attachmentNames[a], b.slots[this.slotIndex].setAttachment(a ? b.getAttachmentBySlotIndex(this.slotIndex, a) : null))
  8920. }
  8921. };
  8922. p.SkeletonData = function() {
  8923. this.bones = [];
  8924. this.slots = [];
  8925. this.skins = [];
  8926. this.animations = []
  8927. };
  8928. p.SkeletonData.prototype = {
  8929. defaultSkin: null,
  8930. findBone: function(b) {
  8931. for (var a = this.bones,
  8932. c = 0,
  8933. e = a.length; c < e; c++) if (a[c].name == b) return a[c];
  8934. return null
  8935. },
  8936. findBoneIndex: function(b) {
  8937. for (var a = this.bones,
  8938. c = 0,
  8939. e = a.length; c < e; c++) if (a[c].name == b) return c;
  8940. return - 1
  8941. },
  8942. findSlot: function(b) {
  8943. for (var a = this.slots,
  8944. c = 0,
  8945. e = a.length; c < e; c++) if (a[c].name == b) return slot[c];
  8946. return null
  8947. },
  8948. findSlotIndex: function(b) {
  8949. for (var a = this.slots,
  8950. c = 0,
  8951. e = a.length; c < e; c++) if (a[c].name == b) return c;
  8952. return - 1
  8953. },
  8954. findSkin: function(b) {
  8955. for (var a = this.skins,
  8956. c = 0,
  8957. e = a.length; c < e; c++) if (a[c].name == b) return a[c];
  8958. return null
  8959. },
  8960. findAnimation: function(b) {
  8961. for (var a = this.animations,
  8962. c = 0,
  8963. e = a.length; c < e; c++) if (a[c].name == b) return a[c];
  8964. return null
  8965. }
  8966. };
  8967. p.Skeleton = function(b) {
  8968. this.data = b;
  8969. this.bones = [];
  8970. for (var a = 0,
  8971. c = b.bones.length; a < c; a++) {
  8972. var e = b.bones[a],
  8973. f = e.parent ? this.bones[b.bones.indexOf(e.parent)] : null;
  8974. this.bones.push(new p.Bone(e, f))
  8975. }
  8976. this.slots = [];
  8977. this.drawOrder = [];
  8978. a = 0;
  8979. for (c = b.slots.length; a < c; a++) e = b.slots[a],
  8980. f = this.bones[b.bones.indexOf(e.boneData)],
  8981. e = new p.Slot(e, this, f),
  8982. this.slots.push(e),
  8983. this.drawOrder.push(e)
  8984. };
  8985. p.Skeleton.prototype = {
  8986. x: 0,
  8987. y: 0,
  8988. skin: null,
  8989. r: 1,
  8990. g: 1,
  8991. b: 1,
  8992. a: 1,
  8993. time: 0,
  8994. flipX: !1,
  8995. flipY: !1,
  8996. updateWorldTransform: function() {
  8997. for (var b = this.flipX,
  8998. a = this.flipY,
  8999. c = this.bones,
  9000. e = 0,
  9001. f = c.length; e < f; e++) c[e].updateWorldTransform(b, a)
  9002. },
  9003. setToSetupPose: function() {
  9004. this.setBonesToSetupPose();
  9005. this.setSlotsToSetupPose()
  9006. },
  9007. setBonesToSetupPose: function() {
  9008. for (var b = this.bones,
  9009. a = 0,
  9010. c = b.length; a < c; a++) b[a].setToSetupPose()
  9011. },
  9012. setSlotsToSetupPose: function() {
  9013. for (var b = this.slots,
  9014. a = 0,
  9015. c = b.length; a < c; a++) b[a].setToSetupPose(a)
  9016. },
  9017. getRootBone: function() {
  9018. return this.bones.length ? this.bones[0] : null
  9019. },
  9020. findBone: function(b) {
  9021. for (var a = this.bones,
  9022. c = 0,
  9023. e = a.length; c < e; c++) if (a[c].data.name == b) return a[c];
  9024. return null
  9025. },
  9026. findBoneIndex: function(b) {
  9027. for (var a = this.bones,
  9028. c = 0,
  9029. e = a.length; c < e; c++) if (a[c].data.name == b) return c;
  9030. return - 1
  9031. },
  9032. findSlot: function(b) {
  9033. for (var a = this.slots,
  9034. c = 0,
  9035. e = a.length; c < e; c++) if (a[c].data.name == b) return a[c];
  9036. return null
  9037. },
  9038. findSlotIndex: function(b) {
  9039. for (var a = this.slots,
  9040. c = 0,
  9041. e = a.length; c < e; c++) if (a[c].data.name == b) return c;
  9042. return - 1
  9043. },
  9044. setSkinByName: function(b) {
  9045. var a = this.data.findSkin(b);
  9046. if (!a) throw "Skin not found: " + b;
  9047. this.setSkin(a)
  9048. },
  9049. setSkin: function(b) {
  9050. this.skin && b && b._attachAll(this, this.skin);
  9051. this.skin = b
  9052. },
  9053. getAttachmentBySlotName: function(b, a) {
  9054. return this.getAttachmentBySlotIndex(this.data.findSlotIndex(b), a)
  9055. },
  9056. getAttachmentBySlotIndex: function(b, a) {
  9057. if (this.skin) {
  9058. var c = this.skin.getAttachment(b, a);
  9059. if (c) return c
  9060. }
  9061. return this.data.defaultSkin ? this.data.defaultSkin.getAttachment(b, a) : null
  9062. },
  9063. setAttachment: function(b, a) {
  9064. for (var c = this.slots,
  9065. e = 0,
  9066. f = c.size; e < f; e++) {
  9067. var h = c[e];
  9068. if (h.data.name == b) {
  9069. c = null;
  9070. if (a && (c = this.getAttachment(e, a), null == c)) throw "Attachment not found: " + a + ", for slot: " + b;
  9071. h.setAttachment(c);
  9072. return
  9073. }
  9074. }
  9075. throw "Slot not found: " + b;
  9076. },
  9077. update: function(b) {
  9078. time += b
  9079. }
  9080. };
  9081. p.AttachmentType = {
  9082. region: 0
  9083. };
  9084. p.RegionAttachment = function() {
  9085. this.offset = [];
  9086. this.offset.length = 8;
  9087. this.uvs = [];
  9088. this.uvs.length = 8
  9089. };
  9090. p.RegionAttachment.prototype = {
  9091. x: 0,
  9092. y: 0,
  9093. rotation: 0,
  9094. scaleX: 1,
  9095. scaleY: 1,
  9096. width: 0,
  9097. height: 0,
  9098. rendererObject: null,
  9099. regionOffsetX: 0,
  9100. regionOffsetY: 0,
  9101. regionWidth: 0,
  9102. regionHeight: 0,
  9103. regionOriginalWidth: 0,
  9104. regionOriginalHeight: 0,
  9105. setUVs: function(b, a, c, e, f) {
  9106. var h = this.uvs;
  9107. f ? (h[2] = b, h[3] = e, h[4] = b, h[5] = a, h[6] = c, h[7] = a, h[0] = c, h[1] = e) : (h[0] = b, h[1] = e, h[2] = b, h[3] = a, h[4] = c, h[5] = a, h[6] = c, h[7] = e)
  9108. },
  9109. updateOffset: function() {
  9110. var b = this.width / this.regionOriginalWidth * this.scaleX,
  9111. a = this.height / this.regionOriginalHeight * this.scaleY,
  9112. c = -this.width / 2 * this.scaleX + this.regionOffsetX * b,
  9113. e = -this.height / 2 * this.scaleY + this.regionOffsetY * a,
  9114. f = c + this.regionWidth * b,
  9115. b = e + this.regionHeight * a,
  9116. a = this.rotation * Math.PI / 180,
  9117. h = Math.cos(a),
  9118. k = Math.sin(a),
  9119. a = c * h + this.x,
  9120. c = c * k,
  9121. l = e * h + this.y,
  9122. e = e * k,
  9123. n = f * h + this.x,
  9124. f = f * k,
  9125. h = b * h + this.y,
  9126. b = b * k,
  9127. k = this.offset;
  9128. k[0] = a - e;
  9129. k[1] = l + c;
  9130. k[2] = a - b;
  9131. k[3] = h + c;
  9132. k[4] = n - b;
  9133. k[5] = h + f;
  9134. k[6] = n - e;
  9135. k[7] = l + f
  9136. },
  9137. computeVertices: function(b, a, c, e) {
  9138. b += c.worldX;
  9139. a += c.worldY;
  9140. var f = c.m00,
  9141. h = c.m01,
  9142. k = c.m10;
  9143. c = c.m11;
  9144. var l = this.offset;
  9145. e[0] = l[0] * f + l[1] * h + b;
  9146. e[1] = l[0] * k + l[1] * c + a;
  9147. e[2] = l[2] * f + l[3] * h + b;
  9148. e[3] = l[2] * k + l[3] * c + a;
  9149. e[4] = l[4] * f + l[5] * h + b;
  9150. e[5] = l[4] * k + l[5] * c + a;
  9151. e[6] = l[6] * f + l[7] * h + b;
  9152. e[7] = l[6] * k + l[7] * c + a
  9153. }
  9154. };
  9155. p.AnimationStateData = function(b) {
  9156. this.skeletonData = b;
  9157. this.animationToMixTime = {}
  9158. };
  9159. p.AnimationStateData.prototype = {
  9160. defaultMix: 0,
  9161. setMixByName: function(b, a, c) {
  9162. var e = this.skeletonData.findAnimation(b);
  9163. if (!e) throw "Animation not found: " + b;
  9164. b = this.skeletonData.findAnimation(a);
  9165. if (!b) throw "Animation not found: " + a;
  9166. this.setMix(e, b, c)
  9167. },
  9168. setMix: function(b, a, c) {
  9169. this.animationToMixTime[b.name + ":" + a.name] = c
  9170. },
  9171. getMix: function(b, a) {
  9172. var c = this.animationToMixTime[b.name + ":" + a.name];
  9173. return c ? c: this.defaultMix
  9174. }
  9175. };
  9176. p.AnimationState = function(b) {
  9177. this.data = b;
  9178. this.queue = []
  9179. };
  9180. p.AnimationState.prototype = {
  9181. animationSpeed: 1,
  9182. current: null,
  9183. previous: null,
  9184. currentTime: 0,
  9185. previousTime: 0,
  9186. currentLoop: !1,
  9187. previousLoop: !1,
  9188. mixTime: 0,
  9189. mixDuration: 0,
  9190. update: function(b) {
  9191. this.currentTime += b * this.animationSpeed;
  9192. this.previousTime += b;
  9193. this.mixTime += b;
  9194. 0 < this.queue.length && (b = this.queue[0], this.currentTime >= b.delay && (this._setAnimation(b.animation, b.loop), this.queue.shift()))
  9195. },
  9196. apply: function(b) {
  9197. if (this.current) if (this.previous) {
  9198. this.previous.apply(b, this.previousTime, this.previousLoop);
  9199. var a = this.mixTime / this.mixDuration;
  9200. 1 <= a && (a = 1, this.previous = null);
  9201. this.current.mix(b, this.currentTime, this.currentLoop, a)
  9202. } else this.current.apply(b, this.currentTime, this.currentLoop)
  9203. },
  9204. clearAnimation: function() {
  9205. this.current = this.previous = null;
  9206. this.queue.length = 0
  9207. },
  9208. _setAnimation: function(a, d) {
  9209. this.previous = null;
  9210. a && this.current && (this.mixDuration = this.data.getMix(this.current, a), 0 < this.mixDuration && (this.mixTime = 0, this.previous = this.current, this.previousTime = this.currentTime, this.previousLoop = this.currentLoop));
  9211. this.current = a;
  9212. this.currentLoop = d;
  9213. this.currentTime = 0
  9214. },
  9215. setAnimationByName: function(a, d) {
  9216. var c = this.data.skeletonData.findAnimation(a);
  9217. if (!c) throw "Animation not found: " + a;
  9218. this.setAnimation(c, d)
  9219. },
  9220. setAnimation: function(a, d) {
  9221. this.queue.length = 0;
  9222. this._setAnimation(a, d)
  9223. },
  9224. addAnimationByName: function(a, d, c) {
  9225. var e = this.data.skeletonData.findAnimation(a);
  9226. if (!e) throw "Animation not found: " + a;
  9227. this.addAnimation(e, d, c)
  9228. },
  9229. addAnimation: function(a, d, c) {
  9230. var e = {};
  9231. e.animation = a;
  9232. e.loop = d;
  9233. if (!c || 0 >= c) d = this.queue.length ? this.queue[this.queue.length - 1].animation: this.current,
  9234. c = null != d ? d.duration - this.data.getMix(d, a) + (c || 0) : 0;
  9235. e.delay = c;
  9236. this.queue.push(e)
  9237. },
  9238. isComplete: function() {
  9239. return ! this.current || this.currentTime >= this.current.duration
  9240. }
  9241. };
  9242. p.SkeletonJson = function(a) {
  9243. this.attachmentLoader = a
  9244. };
  9245. p.SkeletonJson.prototype = {
  9246. scale: 1,
  9247. readSkeletonData: function(a) {
  9248. for (var d = new p.SkeletonData,
  9249. c, e = a.bones,
  9250. f = 0,
  9251. h = e.length; f < h; f++) {
  9252. var k = e[f];
  9253. c = null;
  9254. if (k.parent && (c = d.findBone(k.parent), !c)) throw "Parent bone not found: " + k.parent;
  9255. c = new p.BoneData(k.name, c);
  9256. c.length = (k.length || 0) * this.scale;
  9257. c.x = (k.x || 0) * this.scale;
  9258. c.y = (k.y || 0) * this.scale;
  9259. c.rotation = k.rotation || 0;
  9260. c.scaleX = k.scaleX || 1;
  9261. c.scaleY = k.scaleY || 1;
  9262. d.bones.push(c)
  9263. }
  9264. e = a.slots;
  9265. f = 0;
  9266. for (h = e.length; f < h; f++) {
  9267. k = e[f];
  9268. c = d.findBone(k.bone);
  9269. if (!c) throw "Slot bone not found: " + k.bone;
  9270. c = new p.SlotData(k.name, c);
  9271. var l = k.color;
  9272. l && (c.r = p.SkeletonJson.toColor(l, 0), c.g = p.SkeletonJson.toColor(l, 1), c.b = p.SkeletonJson.toColor(l, 2), c.a = p.SkeletonJson.toColor(l, 3));
  9273. c.attachmentName = k.attachment;
  9274. d.slots.push(c)
  9275. }
  9276. var f = a.skins,
  9277. n;
  9278. for (n in f) if (f.hasOwnProperty(n)) {
  9279. h = f[n];
  9280. c = new p.Skin(n);
  9281. for (var v in h) if (h.hasOwnProperty(v)) {
  9282. var e = d.findSlotIndex(v),
  9283. k = h[v],
  9284. q;
  9285. for (q in k) k.hasOwnProperty(q) && (l = this.readAttachment(c, q, k[q]), null != l && c.addAttachment(e, q, l))
  9286. }
  9287. d.skins.push(c);
  9288. "default" == c.name && (d.defaultSkin = c)
  9289. }
  9290. a = a.animations;
  9291. for (var y in a) a.hasOwnProperty(y) && this.readAnimation(y, a[y], d);
  9292. return d
  9293. },
  9294. readAttachment: function(a, d, c) {
  9295. d = c.name || d;
  9296. a = p.AttachmentType[c.type || "region"];
  9297. if (a == p.AttachmentType.region) return a = new p.RegionAttachment,
  9298. a.x = (c.x || 0) * this.scale,
  9299. a.y = (c.y || 0) * this.scale,
  9300. a.scaleX = c.scaleX || 1,
  9301. a.scaleY = c.scaleY || 1,
  9302. a.rotation = c.rotation || 0,
  9303. a.width = (c.width || 32) * this.scale,
  9304. a.height = (c.height || 32) * this.scale,
  9305. a.updateOffset(),
  9306. a.rendererObject = {},
  9307. a.rendererObject.name = d,
  9308. a.rendererObject.scale = {},
  9309. a.rendererObject.scale.x = a.scaleX,
  9310. a.rendererObject.scale.y = a.scaleY,
  9311. a.rendererObject.rotation = -a.rotation * Math.PI / 180,
  9312. a;
  9313. throw "Unknown attachment type: " + a;
  9314. },
  9315. readAnimation: function(a, d, c) {
  9316. var e = [],
  9317. f = 0,
  9318. h,
  9319. k,
  9320. l,
  9321. n,
  9322. v,
  9323. q,
  9324. y,
  9325. s = d.bones,
  9326. u;
  9327. for (u in s) if (s.hasOwnProperty(u)) {
  9328. var z = c.findBoneIndex(u);
  9329. if ( - 1 == z) throw "Bone not found: " + u;
  9330. var A = s[u];
  9331. for (l in A) if (A.hasOwnProperty(l)) if (v = A[l], "rotate" == l) {
  9332. k = new p.RotateTimeline(v.length);
  9333. k.boneIndex = z;
  9334. q = h = 0;
  9335. for (y = v.length; q < y; q++) n = v[q],
  9336. k.setFrame(h, n.time, n.angle),
  9337. p.SkeletonJson.readCurve(k, h, n),
  9338. h++;
  9339. e.push(k);
  9340. f = Math.max(f, k.frames[2 * k.getFrameCount() - 2])
  9341. } else if ("translate" == l || "scale" == l) {
  9342. var x = 1;
  9343. "scale" == l ? k = new p.ScaleTimeline(v.length) : (k = new p.TranslateTimeline(v.length), x = this.scale);
  9344. k.boneIndex = z;
  9345. q = h = 0;
  9346. for (y = v.length; q < y; q++) n = v[q],
  9347. k.setFrame(h, n.time, (n.x || 0) * x, (n.y || 0) * x),
  9348. p.SkeletonJson.readCurve(k, h, n),
  9349. h++;
  9350. e.push(k);
  9351. f = Math.max(f, k.frames[3 * k.getFrameCount() - 3])
  9352. } else throw "Invalid timeline type for a bone: " + l + " (" + u + ")";
  9353. }
  9354. d = d.slots;
  9355. for (var D in d) if (d.hasOwnProperty(D)) for (l in s = d[D], u = c.findSlotIndex(D), s) if (s.hasOwnProperty(l)) if (v = s[l], "color" == l) {
  9356. k = new p.ColorTimeline(v.length);
  9357. k.slotIndex = u;
  9358. q = h = 0;
  9359. for (y = v.length; q < y; q++) {
  9360. n = v[q];
  9361. var B = n.color,
  9362. z = p.SkeletonJson.toColor(B, 0),
  9363. A = p.SkeletonJson.toColor(B, 1),
  9364. x = p.SkeletonJson.toColor(B, 2),
  9365. B = p.SkeletonJson.toColor(B, 3);
  9366. k.setFrame(h, n.time, z, A, x, B);
  9367. p.SkeletonJson.readCurve(k, h, n);
  9368. h++
  9369. }
  9370. e.push(k);
  9371. f = Math.max(f, k.frames[5 * k.getFrameCount() - 5])
  9372. } else if ("attachment" == l) {
  9373. k = new p.AttachmentTimeline(v.length);
  9374. k.slotIndex = u;
  9375. q = h = 0;
  9376. for (y = v.length; q < y; q++) n = v[q],
  9377. k.setFrame(h++, n.time, n.name);
  9378. e.push(k);
  9379. f = Math.max(f, k.frames[k.getFrameCount() - 1])
  9380. } else throw "Invalid timeline type for a slot: " + l + " (" + D + ")";
  9381. c.animations.push(new p.Animation(a, e, f))
  9382. }
  9383. };
  9384. p.SkeletonJson.readCurve = function(a, d, c) { (c = c.curve) && ("stepped" == c ? a.curves.setStepped(d) : c instanceof Array && a.curves.setCurve(d, c[0], c[1], c[2], c[3]))
  9385. };
  9386. p.SkeletonJson.toColor = function(a, d) {
  9387. if (8 != a.length) throw "Color hexidecimal length must be 8, recieved: " + a;
  9388. return parseInt(a.substr(2 * d, 2), 16) / 255
  9389. };
  9390. p.Atlas = function(a, d) {
  9391. this.textureLoader = d;
  9392. this.pages = [];
  9393. this.regions = [];
  9394. var c = new p.AtlasReader(a),
  9395. e = [];
  9396. e.length = 4;
  9397. for (var f = null;;) {
  9398. var h = c.readLine();
  9399. if (null == h) break;
  9400. h = c.trim(h);
  9401. if (h.length) if (f) {
  9402. var k = new p.AtlasRegion;
  9403. k.name = h;
  9404. k.page = f;
  9405. k.rotate = "true" == c.readValue();
  9406. c.readTuple(e);
  9407. var h = parseInt(e[0], 10),
  9408. l = parseInt(e[1], 10);
  9409. c.readTuple(e);
  9410. var n = parseInt(e[0], 10),
  9411. v = parseInt(e[1], 10);
  9412. k.u = h / f.width;
  9413. k.v = l / f.height;
  9414. k.rotate ? (k.u2 = (h + v) / f.width, k.v2 = (l + n) / f.height) : (k.u2 = (h + n) / f.width, k.v2 = (l + v) / f.height);
  9415. k.x = h;
  9416. k.y = l;
  9417. k.width = Math.abs(n);
  9418. k.height = Math.abs(v);
  9419. 4 == c.readTuple(e) && (k.splits = [parseInt(e[0], 10), parseInt(e[1], 10), parseInt(e[2], 10), parseInt(e[3], 10)], 4 == c.readTuple(e) && (k.pads = [parseInt(e[0], 10), parseInt(e[1], 10), parseInt(e[2], 10), parseInt(e[3], 10)], c.readTuple(e)));
  9420. k.originalWidth = parseInt(e[0], 10);
  9421. k.originalHeight = parseInt(e[1], 10);
  9422. c.readTuple(e);
  9423. k.offsetX = parseInt(e[0], 10);
  9424. k.offsetY = parseInt(e[1], 10);
  9425. k.index = parseInt(c.readValue(), 10);
  9426. this.regions.push(k)
  9427. } else f = new p.AtlasPage,
  9428. f.name = h,
  9429. f.format = p.Atlas.Format[c.readValue()],
  9430. c.readTuple(e),
  9431. f.minFilter = p.Atlas.TextureFilter[e[0]],
  9432. f.magFilter = p.Atlas.TextureFilter[e[1]],
  9433. k = c.readValue(),
  9434. f.uWrap = p.Atlas.TextureWrap.clampToEdge,
  9435. f.vWrap = p.Atlas.TextureWrap.clampToEdge,
  9436. "x" == k ? f.uWrap = p.Atlas.TextureWrap.repeat: "y" == k ? f.vWrap = p.Atlas.TextureWrap.repeat: "xy" == k && (f.uWrap = f.vWrap = p.Atlas.TextureWrap.repeat),
  9437. d.load(f, h),
  9438. this.pages.push(f);
  9439. else f = null
  9440. }
  9441. };
  9442. p.Atlas.prototype = {
  9443. findRegion: function(a) {
  9444. for (var d = this.regions,
  9445. c = 0,
  9446. e = d.length; c < e; c++) if (d[c].name == a) return d[c];
  9447. return null
  9448. },
  9449. dispose: function() {
  9450. for (var a = this.pages,
  9451. d = 0,
  9452. c = a.length; d < c; d++) this.textureLoader.unload(a[d].rendererObject)
  9453. },
  9454. updateUVs: function(a) {
  9455. for (var d = this.regions,
  9456. c = 0,
  9457. e = d.length; c < e; c++) {
  9458. var f = d[c];
  9459. f.page == a && (f.u = f.x / a.width, f.v = f.y / a.height, f.rotate ? (f.u2 = (f.x + f.height) / a.width, f.v2 = (f.y + f.width) / a.height) : (f.u2 = (f.x + f.width) / a.width, f.v2 = (f.y + f.height) / a.height))
  9460. }
  9461. }
  9462. };
  9463. p.Atlas.Format = {
  9464. alpha: 0,
  9465. intensity: 1,
  9466. luminanceAlpha: 2,
  9467. rgb565: 3,
  9468. rgba4444: 4,
  9469. rgb888: 5,
  9470. rgba8888: 6
  9471. };
  9472. p.Atlas.TextureFilter = {
  9473. nearest: 0,
  9474. linear: 1,
  9475. mipMap: 2,
  9476. mipMapNearestNearest: 3,
  9477. mipMapLinearNearest: 4,
  9478. mipMapNearestLinear: 5,
  9479. mipMapLinearLinear: 6
  9480. };
  9481. p.Atlas.TextureWrap = {
  9482. mirroredRepeat: 0,
  9483. clampToEdge: 1,
  9484. repeat: 2
  9485. };
  9486. p.AtlasPage = function() {};
  9487. p.AtlasPage.prototype = {
  9488. name: null,
  9489. format: null,
  9490. minFilter: null,
  9491. magFilter: null,
  9492. uWrap: null,
  9493. vWrap: null,
  9494. rendererObject: null,
  9495. width: 0,
  9496. height: 0
  9497. };
  9498. p.AtlasRegion = function() {};
  9499. p.AtlasRegion.prototype = {
  9500. page: null,
  9501. name: null,
  9502. x: 0,
  9503. y: 0,
  9504. width: 0,
  9505. height: 0,
  9506. u: 0,
  9507. v: 0,
  9508. u2: 0,
  9509. v2: 0,
  9510. offsetX: 0,
  9511. offsetY: 0,
  9512. originalWidth: 0,
  9513. originalHeight: 0,
  9514. index: 0,
  9515. rotate: !1,
  9516. splits: null,
  9517. pads: null
  9518. };
  9519. p.AtlasReader = function(a) {
  9520. this.lines = a.split(/\r\n|\r|\n/)
  9521. };
  9522. p.AtlasReader.prototype = {
  9523. index: 0,
  9524. trim: function(a) {
  9525. return a.replace(/^\s+|\s+$/g, "")
  9526. },
  9527. readLine: function() {
  9528. return this.index >= this.lines.length ? null: this.lines[this.index++]
  9529. },
  9530. readValue: function() {
  9531. var a = this.readLine(),
  9532. d = a.indexOf(":");
  9533. if ( - 1 == d) throw "Invalid line: " + a;
  9534. return this.trim(a.substring(d + 1))
  9535. },
  9536. readTuple: function(a) {
  9537. var d = this.readLine(),
  9538. c = d.indexOf(":");
  9539. if ( - 1 == c) throw "Invalid line: " + d;
  9540. for (var e = 0,
  9541. c = c + 1; 3 > e; e++) {
  9542. var f = d.indexOf(",", c);
  9543. if ( - 1 == f) {
  9544. if (!e) throw "Invalid line: " + d;
  9545. break
  9546. }
  9547. a[e] = this.trim(d.substr(c, f - c));
  9548. c = f + 1
  9549. }
  9550. a[e] = this.trim(d.substring(c));
  9551. return e + 1
  9552. }
  9553. };
  9554. p.AtlasAttachmentLoader = function(a) {
  9555. this.atlas = a
  9556. };
  9557. p.AtlasAttachmentLoader.prototype = {
  9558. newAttachment: function(a, d, c) {
  9559. switch (d) {
  9560. case p.AttachmentType.region:
  9561. a = this.atlas.findRegion(c);
  9562. if (!a) throw "Region not found in atlas: " + c + " (" + d + ")";
  9563. d = new p.RegionAttachment(c);
  9564. d.rendererObject = a;
  9565. d.setUVs(a.u, a.v, a.u2, a.v2, a.rotate);
  9566. d.regionOffsetX = a.offsetX;
  9567. d.regionOffsetY = a.offsetY;
  9568. d.regionWidth = a.width;
  9569. d.regionHeight = a.height;
  9570. d.regionOriginalWidth = a.originalWidth;
  9571. d.regionOriginalHeight = a.originalHeight;
  9572. return d
  9573. }
  9574. throw "Unknown attachment type: " + d;
  9575. }
  9576. };
  9577. p.Bone.yDown = !0;
  9578. a.AnimCache = {};
  9579. a.Spine = function(b) {
  9580. a.DisplayObjectContainer.call(this);
  9581. this.spineData = a.AnimCache[b];
  9582. if (!this.spineData) throw Error("Spine data must be preloaded using PIXI.SpineLoader or PIXI.AssetLoader: " + b);
  9583. this.skeleton = new p.Skeleton(this.spineData);
  9584. this.skeleton.updateWorldTransform();
  9585. this.stateData = new p.AnimationStateData(this.spineData);
  9586. this.state = new p.AnimationState(this.stateData);
  9587. this.slotContainers = [];
  9588. b = 0;
  9589. for (var d = this.skeleton.drawOrder.length; b < d; b++) {
  9590. var c = this.skeleton.drawOrder[b],
  9591. e = c.attachment,
  9592. f = new a.DisplayObjectContainer;
  9593. this.slotContainers.push(f);
  9594. this.addChild(f);
  9595. if (e instanceof p.RegionAttachment) {
  9596. var h = e.rendererObject.name,
  9597. e = this.createSprite(c, e.rendererObject);
  9598. c.currentSprite = e;
  9599. c.currentSpriteName = h;
  9600. f.addChild(e)
  9601. }
  9602. }
  9603. };
  9604. a.Spine.prototype = Object.create(a.DisplayObjectContainer.prototype);
  9605. a.Spine.prototype.constructor = a.Spine;
  9606. a.Spine.prototype.updateTransform = function() {
  9607. this.lastTime = this.lastTime || Date.now();
  9608. var b = 0.001 * (Date.now() - this.lastTime);
  9609. this.lastTime = Date.now();
  9610. this.state.update(b);
  9611. this.state.apply(this.skeleton);
  9612. this.skeleton.updateWorldTransform();
  9613. for (var b = this.skeleton.drawOrder,
  9614. d = 0,
  9615. c = b.length; d < c; d++) {
  9616. var e = b[d],
  9617. f = e.attachment,
  9618. h = this.slotContainers[d];
  9619. if (f instanceof p.RegionAttachment) {
  9620. if (f.rendererObject && (!e.currentSpriteName || e.currentSpriteName != f.name)) {
  9621. var k = f.rendererObject.name;
  9622. void 0 !== e.currentSprite && (e.currentSprite.visible = !1);
  9623. e.sprites = e.sprites || {};
  9624. if (void 0 !== e.sprites[k]) e.sprites[k].visible = !0;
  9625. else {
  9626. var l = this.createSprite(e, f.rendererObject);
  9627. h.addChild(l)
  9628. }
  9629. e.currentSprite = e.sprites[k];
  9630. e.currentSpriteName = k
  9631. }
  9632. h.visible = !0;
  9633. k = e.bone;
  9634. h.position.x = k.worldX + f.x * k.m00 + f.y * k.m01;
  9635. h.position.y = k.worldY + f.x * k.m10 + f.y * k.m11;
  9636. h.scale.x = k.worldScaleX;
  9637. h.scale.y = k.worldScaleY;
  9638. h.rotation = -(e.bone.worldRotation * Math.PI / 180);
  9639. h.alpha = e.a;
  9640. e.currentSprite.tint = a.rgb2hex([e.r, e.g, e.b])
  9641. } else h.visible = !1
  9642. }
  9643. a.DisplayObjectContainer.prototype.updateTransform.call(this)
  9644. };
  9645. a.Spine.prototype.createSprite = function(b, d) {
  9646. var c = new a.Sprite(a.Texture.fromFrame(a.TextureCache[d.name] ? d.name: d.name + ".png"));
  9647. c.scale = d.scale;
  9648. c.rotation = d.rotation;
  9649. c.anchor.x = c.anchor.y = 0.5;
  9650. b.sprites = b.sprites || {};
  9651. return b.sprites[d.name] = c
  9652. };
  9653. a.BaseTextureCache = {};
  9654. a.texturesToUpdate = [];
  9655. a.texturesToDestroy = [];
  9656. a.BaseTextureCacheIdGenerator = 0;
  9657. a.BaseTexture = function(b, d) {
  9658. a.EventTarget.call(this);
  9659. this.height = this.width = 100;
  9660. this.scaleMode = d || a.scaleModes.DEFAULT;
  9661. this.hasLoaded = !1;
  9662. this.source = b;
  9663. this.id = a.BaseTextureCacheIdGenerator++;
  9664. this.premultipliedAlpha = !0;
  9665. this._glTextures = [];
  9666. this._dirty = [];
  9667. if (b) {
  9668. if ((this.source.complete || this.source.getContext) && this.source.width && this.source.height) this.hasLoaded = !0,
  9669. this.width = this.source.width,
  9670. this.height = this.source.height,
  9671. a.texturesToUpdate.push(this);
  9672. else {
  9673. var c = this;
  9674. this.source.onload = function() {
  9675. c.hasLoaded = !0;
  9676. c.width = c.source.width;
  9677. c.height = c.source.height;
  9678. for (var a = 0; a < c._glTextures.length; a++) c._dirty[a] = !0;
  9679. c.dispatchEvent({
  9680. type: "loaded",
  9681. content: c
  9682. })
  9683. };
  9684. this.source.onerror = function() {
  9685. c.dispatchEvent({
  9686. type: "error",
  9687. content: c
  9688. })
  9689. }
  9690. }
  9691. this.imageUrl = null;
  9692. this._powerOf2 = !1
  9693. }
  9694. };
  9695. a.BaseTexture.prototype.constructor = a.BaseTexture;
  9696. a.BaseTexture.prototype.destroy = function() {
  9697. this.imageUrl ? (delete a.BaseTextureCache[this.imageUrl], delete a.TextureCache[this.imageUrl], this.imageUrl = null) : this.source && this.source._pixiId && delete a.BaseTextureCache[this.source._pixiId];
  9698. this.source = null;
  9699. a.texturesToDestroy.push(this)
  9700. };
  9701. a.BaseTexture.prototype.updateSourceImage = function(a) {
  9702. this.hasLoaded = !1;
  9703. this.source.src = null;
  9704. this.source.src = a
  9705. };
  9706. a.BaseTexture.fromImage = function(b, d, c) {
  9707. var e = a.BaseTextureCache[b];
  9708. void 0 === d && -1 === b.indexOf("data:") && (d = !0);
  9709. e || (e = new Image, d && (e.crossOrigin = ""), e.src = b, e = new a.BaseTexture(e, c), e.imageUrl = b, a.BaseTextureCache[b] = e);
  9710. return e
  9711. };
  9712. a.BaseTexture.fromCanvas = function(b, d) {
  9713. b._pixiId || (b._pixiId = "canvas_" + a.TextureCacheIdGenerator++);
  9714. var c = a.BaseTextureCache[b._pixiId];
  9715. c || (c = new a.BaseTexture(b, d), a.BaseTextureCache[b._pixiId] = c);
  9716. return c
  9717. };
  9718. a.TextureCache = {};
  9719. a.FrameCache = {};
  9720. a.TextureCacheIdGenerator = 0;
  9721. a.Texture = function(b, d) {
  9722. a.EventTarget.call(this);
  9723. this.noFrame = !1;
  9724. d || (this.noFrame = !0, d = new a.Rectangle(0, 0, 1, 1));
  9725. b instanceof a.Texture && (b = b.baseTexture);
  9726. this.baseTexture = b;
  9727. this.frame = d;
  9728. this.trim = null;
  9729. this.valid = !1;
  9730. this.scope = this;
  9731. this._uvs = null;
  9732. this.height = this.width = 0;
  9733. this.crop = new a.Rectangle(0, 0, 1, 1);
  9734. if (b.hasLoaded) this.noFrame && (d = new a.Rectangle(0, 0, b.width, b.height)),
  9735. this.setFrame(d);
  9736. else {
  9737. var c = this;
  9738. b.addEventListener("loaded",
  9739. function() {
  9740. c.onBaseTextureLoaded()
  9741. })
  9742. }
  9743. };
  9744. a.Texture.prototype.constructor = a.Texture;
  9745. a.Texture.prototype.onBaseTextureLoaded = function() {
  9746. var b = this.baseTexture;
  9747. b.removeEventListener("loaded", this.onLoaded);
  9748. this.noFrame && (this.frame = new a.Rectangle(0, 0, b.width, b.height));
  9749. this.setFrame(this.frame);
  9750. this.scope.dispatchEvent({
  9751. type: "update",
  9752. content: this
  9753. })
  9754. };
  9755. a.Texture.prototype.destroy = function(a) {
  9756. a && this.baseTexture.destroy();
  9757. this.valid = !1
  9758. };
  9759. a.Texture.prototype.setFrame = function(b) {
  9760. this.noFrame = !1;
  9761. this.frame = b;
  9762. this.width = b.width;
  9763. this.height = b.height;
  9764. this.crop.x = b.x;
  9765. this.crop.y = b.y;
  9766. this.crop.width = b.width;
  9767. this.crop.height = b.height;
  9768. if (!this.trim && (b.x + b.width > this.baseTexture.width || b.y + b.height > this.baseTexture.height)) throw Error("Texture Error: frame does not fit inside the base Texture dimensions " + this);
  9769. this.valid = b && b.width && b.height && this.baseTexture.source && this.baseTexture.hasLoaded;
  9770. this.trim && (this.width = this.trim.width, this.height = this.trim.height, this.frame.width = this.trim.width, this.frame.height = this.trim.height);
  9771. this.valid && a.Texture.frameUpdates.push(this)
  9772. };
  9773. a.Texture.prototype._updateWebGLuvs = function() {
  9774. this._uvs || (this._uvs = new a.TextureUvs);
  9775. var b = this.crop,
  9776. d = this.baseTexture.width,
  9777. c = this.baseTexture.height;
  9778. this._uvs.x0 = b.x / d;
  9779. this._uvs.y0 = b.y / c;
  9780. this._uvs.x1 = (b.x + b.width) / d;
  9781. this._uvs.y1 = b.y / c;
  9782. this._uvs.x2 = (b.x + b.width) / d;
  9783. this._uvs.y2 = (b.y + b.height) / c;
  9784. this._uvs.x3 = b.x / d;
  9785. this._uvs.y3 = (b.y + b.height) / c
  9786. };
  9787. a.Texture.fromImage = function(b, d, c) {
  9788. var e = a.TextureCache[b];
  9789. e || (e = new a.Texture(a.BaseTexture.fromImage(b, d, c)), a.TextureCache[b] = e);
  9790. return e
  9791. };
  9792. a.Texture.fromFrame = function(b) {
  9793. var d = a.TextureCache[b];
  9794. if (!d) throw Error('The frameId "' + b + '" does not exist in the texture cache ');
  9795. return d
  9796. };
  9797. a.Texture.fromCanvas = function(b, d) {
  9798. var c = a.BaseTexture.fromCanvas(b, d);
  9799. return new a.Texture(c)
  9800. };
  9801. a.Texture.addTextureToCache = function(b, d) {
  9802. a.TextureCache[d] = b
  9803. };
  9804. a.Texture.removeTextureFromCache = function(b) {
  9805. var d = a.TextureCache[b];
  9806. delete a.TextureCache[b];
  9807. delete a.BaseTextureCache[b];
  9808. return d
  9809. };
  9810. a.Texture.frameUpdates = [];
  9811. a.TextureUvs = function() {
  9812. this.y3 = this.x3 = this.y2 = this.x2 = this.y1 = this.x1 = this.y0 = this.x0 = 0
  9813. };
  9814. a.RenderTexture = function(b, d, c, e) {
  9815. a.EventTarget.call(this);
  9816. this.width = b || 100;
  9817. this.height = d || 100;
  9818. this.frame = new a.Rectangle(0, 0, this.width, this.height);
  9819. this.crop = new a.Rectangle(0, 0, this.width, this.height);
  9820. this.baseTexture = new a.BaseTexture;
  9821. this.baseTexture.width = this.width;
  9822. this.baseTexture.height = this.height;
  9823. this.baseTexture._glTextures = [];
  9824. this.baseTexture.scaleMode = e || a.scaleModes.DEFAULT;
  9825. this.baseTexture.hasLoaded = !0;
  9826. this.renderer = c || a.defaultRenderer;
  9827. this.renderer.type === a.WEBGL_RENDERER ? (b = this.renderer.gl, this.textureBuffer = new a.FilterTexture(b, this.width, this.height, this.baseTexture.scaleMode), this.baseTexture._glTextures[b.id] = this.textureBuffer.texture, this.render = this.renderWebGL, this.projection = new a.Point(this.width / 2, -this.height / 2)) : (this.render = this.renderCanvas, this.textureBuffer = new a.CanvasBuffer(this.width, this.height), this.baseTexture.source = this.textureBuffer.canvas);
  9828. this.valid = !0;
  9829. a.Texture.frameUpdates.push(this)
  9830. };
  9831. a.RenderTexture.prototype = Object.create(a.Texture.prototype);
  9832. a.RenderTexture.prototype.constructor = a.RenderTexture;
  9833. a.RenderTexture.prototype.resize = function(b, d, c) {
  9834. if (b !== this.width || d !== this.height) this.width = this.frame.width = this.crop.width = b,
  9835. this.height = this.frame.height = this.crop.height = d,
  9836. c && (this.baseTexture.width = this.width, this.baseTexture.height = this.height),
  9837. this.renderer.type === a.WEBGL_RENDERER && (this.projection.x = this.width / 2, this.projection.y = -this.height / 2),
  9838. this.textureBuffer.resize(this.width, this.height)
  9839. };
  9840. a.RenderTexture.prototype.clear = function() {
  9841. this.renderer.type === a.WEBGL_RENDERER && this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER, this.textureBuffer.frameBuffer);
  9842. this.textureBuffer.clear()
  9843. };
  9844. a.RenderTexture.prototype.renderWebGL = function(b, d, c) {
  9845. var e = this.renderer.gl;
  9846. e.colorMask(!0, !0, !0, !0);
  9847. e.viewport(0, 0, this.width, this.height);
  9848. e.bindFramebuffer(e.FRAMEBUFFER, this.textureBuffer.frameBuffer);
  9849. c && this.textureBuffer.clear();
  9850. c = b.children;
  9851. e = b.worldTransform;
  9852. b.worldTransform = a.RenderTexture.tempMatrix;
  9853. b.worldTransform.d = -1;
  9854. b.worldTransform.ty = -2 * this.projection.y;
  9855. d && (b.worldTransform.tx = d.x, b.worldTransform.ty -= d.y);
  9856. d = 0;
  9857. for (var f = c.length; d < f; d++) c[d].updateTransform();
  9858. a.WebGLRenderer.updateTextures();
  9859. this.renderer.spriteBatch.dirty = !0;
  9860. this.renderer.renderDisplayObject(b, this.projection, this.textureBuffer.frameBuffer);
  9861. b.worldTransform = e;
  9862. this.renderer.spriteBatch.dirty = !0
  9863. };
  9864. a.RenderTexture.prototype.renderCanvas = function(b, d, c) {
  9865. var e = b.children,
  9866. f = b.worldTransform;
  9867. b.worldTransform = a.RenderTexture.tempMatrix;
  9868. d ? (b.worldTransform.tx = d.x, b.worldTransform.ty = d.y) : (b.worldTransform.tx = 0, b.worldTransform.ty = 0);
  9869. d = 0;
  9870. for (var h = e.length; d < h; d++) e[d].updateTransform();
  9871. c && this.textureBuffer.clear();
  9872. c = this.textureBuffer.context;
  9873. this.renderer.renderDisplayObject(b, c);
  9874. c.setTransform(1, 0, 0, 1, 0, 0);
  9875. b.worldTransform = f
  9876. };
  9877. a.RenderTexture.tempMatrix = new a.Matrix;
  9878. a.AssetLoader = function(b, d) {
  9879. a.EventTarget.call(this);
  9880. this.assetURLs = b;
  9881. this.crossorigin = d;
  9882. this.loadersByType = {
  9883. jpg: a.ImageLoader,
  9884. jpeg: a.ImageLoader,
  9885. png: a.ImageLoader,
  9886. gif: a.ImageLoader,
  9887. webp: a.ImageLoader,
  9888. json: a.JsonLoader,
  9889. atlas: a.AtlasLoader,
  9890. anim: a.SpineLoader,
  9891. xml: a.BitmapFontLoader,
  9892. fnt: a.BitmapFontLoader
  9893. }
  9894. };
  9895. a.AssetLoader.prototype.constructor = a.AssetLoader;
  9896. a.AssetLoader.prototype._getDataType = function(a) {
  9897. if ("data:" === a.slice(0, 5).toLowerCase()) {
  9898. a = a.slice(5);
  9899. var d = a.indexOf(",");
  9900. return - 1 === d ? null: (a = a.slice(0, d).split(";")[0]) && "text/plain" !== a.toLowerCase() ? a.split("/").pop().toLowerCase() : "txt"
  9901. }
  9902. return null
  9903. };
  9904. a.AssetLoader.prototype.load = function() {
  9905. function a(b) {
  9906. d.onAssetLoaded(b.content)
  9907. }
  9908. var d = this;
  9909. this.loadCount = this.assetURLs.length;
  9910. for (var c = 0; c < this.assetURLs.length; c++) {
  9911. var e = this.assetURLs[c],
  9912. f = this._getDataType(e);
  9913. f || (f = e.split("?").shift().split(".").pop().toLowerCase());
  9914. var h = this.loadersByType[f];
  9915. if (!h) throw Error(f + " is an unsupported file type");
  9916. e = new h(e, this.crossorigin);
  9917. e.addEventListener("loaded", a);
  9918. e.load()
  9919. }
  9920. };
  9921. a.AssetLoader.prototype.onAssetLoaded = function(a) {
  9922. this.loadCount--;
  9923. this.dispatchEvent({
  9924. type: "onProgress",
  9925. content: this,
  9926. loader: a
  9927. });
  9928. if (this.onProgress) this.onProgress(a);
  9929. if (!this.loadCount && (this.dispatchEvent({
  9930. type: "onComplete",
  9931. content: this
  9932. }), this.onComplete)) this.onComplete()
  9933. };
  9934. a.JsonLoader = function(b, d) {
  9935. a.EventTarget.call(this);
  9936. this.url = b;
  9937. this.crossorigin = d;
  9938. this.baseUrl = b.replace(/[^\/]*$/, "");
  9939. this.loaded = !1
  9940. };
  9941. a.JsonLoader.prototype.constructor = a.JsonLoader;
  9942. a.JsonLoader.prototype.load = function() {
  9943. var a = this;
  9944. window.XDomainRequest && a.crossorigin ? (this.ajaxRequest = new window.XDomainRequest, this.ajaxRequest.timeout = 3E3, this.ajaxRequest.onerror = function() {
  9945. a.onError()
  9946. },
  9947. this.ajaxRequest.ontimeout = function() {
  9948. a.onError()
  9949. },
  9950. this.ajaxRequest.onprogress = function() {}) : this.ajaxRequest = window.XMLHttpRequest ? new window.XMLHttpRequest: new window.ActiveXObject("Microsoft.XMLHTTP");
  9951. this.ajaxRequest.onload = function() {
  9952. a.onJSONLoaded()
  9953. };
  9954. this.ajaxRequest.open("GET", this.url, !0);
  9955. this.ajaxRequest.send()
  9956. };
  9957. a.JsonLoader.prototype.onJSONLoaded = function() {
  9958. if (this.ajaxRequest.responseText) if (this.json = JSON.parse(this.ajaxRequest.responseText), this.json.frames) {
  9959. var b = this,
  9960. d = new a.ImageLoader(this.baseUrl + this.json.meta.image, this.crossorigin),
  9961. c = this.json.frames;
  9962. this.texture = d.texture.baseTexture;
  9963. d.addEventListener("loaded",
  9964. function() {
  9965. b.onLoaded()
  9966. });
  9967. for (var e in c) {
  9968. var f = c[e].frame;
  9969. if (f && (a.TextureCache[e] = new a.Texture(this.texture, {
  9970. x: f.x,
  9971. y: f.y,
  9972. width: f.w,
  9973. height: f.h
  9974. }), a.TextureCache[e].crop = new a.Rectangle(f.x, f.y, f.w, f.h), c[e].trimmed)) {
  9975. var f = c[e].sourceSize,
  9976. h = c[e].spriteSourceSize;
  9977. a.TextureCache[e].trim = new a.Rectangle(h.x, h.y, f.w, f.h)
  9978. }
  9979. }
  9980. d.load()
  9981. } else this.json.bones && (d = (new p.SkeletonJson).readSkeletonData(this.json), a.AnimCache[this.url] = d),
  9982. this.onLoaded();
  9983. else this.onError()
  9984. };
  9985. a.JsonLoader.prototype.onLoaded = function() {
  9986. this.loaded = !0;
  9987. this.dispatchEvent({
  9988. type: "loaded",
  9989. content: this
  9990. })
  9991. };
  9992. a.JsonLoader.prototype.onError = function() {
  9993. this.dispatchEvent({
  9994. type: "error",
  9995. content: this
  9996. })
  9997. };
  9998. a.AtlasLoader = function(b, d) {
  9999. a.EventTarget.call(this);
  10000. this.url = b;
  10001. this.baseUrl = b.replace(/[^\/]*$/, "");
  10002. this.crossorigin = d;
  10003. this.loaded = !1
  10004. };
  10005. a.AtlasLoader.constructor = a.AtlasLoader;
  10006. a.AtlasLoader.prototype.load = function() {
  10007. this.ajaxRequest = new a.AjaxRequest;
  10008. this.ajaxRequest.onreadystatechange = this.onAtlasLoaded.bind(this);
  10009. this.ajaxRequest.open("GET", this.url, !0);
  10010. this.ajaxRequest.overrideMimeType && this.ajaxRequest.overrideMimeType("application/json");
  10011. this.ajaxRequest.send(null)
  10012. };
  10013. a.AtlasLoader.prototype.onAtlasLoaded = function() {
  10014. if (4 === this.ajaxRequest.readyState) if (200 === this.ajaxRequest.status || -1 === window.location.href.indexOf("http")) {
  10015. this.atlas = {
  10016. meta: {
  10017. image: []
  10018. },
  10019. frames: []
  10020. };
  10021. for (var b = this.ajaxRequest.responseText.split(/\r?\n/), d = -3, c = 0, e = null, f = !1, h = 0, k = 0, l = this.onLoaded.bind(this), h = 0; h < b.length; h++) b[h] = b[h].replace(/^\s+|\s+$/g, ""),
  10022. "" === b[h] && (f = h + 1),
  10023. 0 < b[h].length && (f === h ? (this.atlas.meta.image.push(b[h]), c = this.atlas.meta.image.length - 1, this.atlas.frames.push({}), d = -3) : 0 < d && (1 === d % 7 ? (null != e && (this.atlas.frames[c][e.name] = e), e = {
  10024. name: b[h],
  10025. frame: {}
  10026. }) : (k = b[h].split(" "), 3 === d % 7 ? (e.frame.x = Number(k[1].replace(",", "")), e.frame.y = Number(k[2])) : 4 === d % 7 ? (e.frame.w = Number(k[1].replace(",", "")), e.frame.h = Number(k[2])) : 5 === d % 7 && (k = {
  10027. x: 0,
  10028. y: 0,
  10029. w: Number(k[1].replace(",", "")),
  10030. h: Number(k[2])
  10031. },
  10032. k.w > e.frame.w || k.h > e.frame.h ? (e.trimmed = !0, e.realSize = k) : e.trimmed = !1))), d++);
  10033. null != e && (this.atlas.frames[c][e.name] = e);
  10034. if (0 < this.atlas.meta.image.length) {
  10035. this.images = [];
  10036. for (k = 0; k < this.atlas.meta.image.length; k++) for (h in b = this.atlas.frames[k], this.images.push(new a.ImageLoader(this.baseUrl + this.atlas.meta.image[k], this.crossorigin)), b) if (d = b[h].frame) a.TextureCache[h] = new a.Texture(this.images[k].texture.baseTexture, {
  10037. x: d.x,
  10038. y: d.y,
  10039. width: d.w,
  10040. height: d.h
  10041. }),
  10042. b[h].trimmed && (a.TextureCache[h].realSize = b[h].realSize, a.TextureCache[h].trim.x = 0, a.TextureCache[h].trim.y = 0);
  10043. for (k = this.currentImageId = 0; k < this.images.length; k++) this.images[k].addEventListener("loaded", l);
  10044. this.images[this.currentImageId].load()
  10045. } else this.onLoaded()
  10046. } else this.onError()
  10047. };
  10048. a.AtlasLoader.prototype.onLoaded = function() {
  10049. this.images.length - 1 > this.currentImageId ? (this.currentImageId++, this.images[this.currentImageId].load()) : (this.loaded = !0, this.dispatchEvent({
  10050. type: "loaded",
  10051. content: this
  10052. }))
  10053. };
  10054. a.AtlasLoader.prototype.onError = function() {
  10055. this.dispatchEvent({
  10056. type: "error",
  10057. content: this
  10058. })
  10059. };
  10060. a.SpriteSheetLoader = function(b, d) {
  10061. a.EventTarget.call(this);
  10062. this.url = b;
  10063. this.crossorigin = d;
  10064. this.baseUrl = b.replace(/[^\/]*$/, "");
  10065. this.texture = null;
  10066. this.frames = {}
  10067. };
  10068. a.SpriteSheetLoader.prototype.constructor = a.SpriteSheetLoader;
  10069. a.SpriteSheetLoader.prototype.load = function() {
  10070. var b = this,
  10071. d = new a.JsonLoader(this.url, this.crossorigin);
  10072. d.addEventListener("loaded",
  10073. function(a) {
  10074. b.json = a.content.json;
  10075. b.onLoaded()
  10076. });
  10077. d.load()
  10078. };
  10079. a.SpriteSheetLoader.prototype.onLoaded = function() {
  10080. this.dispatchEvent({
  10081. type: "loaded",
  10082. content: this
  10083. })
  10084. };
  10085. a.ImageLoader = function(b, d) {
  10086. a.EventTarget.call(this);
  10087. this.texture = a.Texture.fromImage(b, d);
  10088. this.frames = []
  10089. };
  10090. a.ImageLoader.prototype.constructor = a.ImageLoader;
  10091. a.ImageLoader.prototype.load = function() {
  10092. if (this.texture.baseTexture.hasLoaded) this.onLoaded();
  10093. else {
  10094. var a = this;
  10095. this.texture.baseTexture.addEventListener("loaded",
  10096. function() {
  10097. a.onLoaded()
  10098. })
  10099. }
  10100. };
  10101. a.ImageLoader.prototype.onLoaded = function() {
  10102. this.dispatchEvent({
  10103. type: "loaded",
  10104. content: this
  10105. })
  10106. };
  10107. a.ImageLoader.prototype.loadFramedSpriteSheet = function(b, d, c) {
  10108. this.frames = [];
  10109. for (var e = Math.floor(this.texture.width / b), f = Math.floor(this.texture.height / d), h = 0, k = 0; k < f; k++) for (var l = 0; l < e; l++, h++) {
  10110. var n = new a.Texture(this.texture, {
  10111. x: l * b,
  10112. y: k * d,
  10113. width: b,
  10114. height: d
  10115. });
  10116. this.frames.push(n);
  10117. c && (a.TextureCache[c + "-" + h] = n)
  10118. }
  10119. if (this.texture.baseTexture.hasLoaded) this.onLoaded();
  10120. else {
  10121. var p = this;
  10122. this.texture.baseTexture.addEventListener("loaded",
  10123. function() {
  10124. p.onLoaded()
  10125. })
  10126. }
  10127. };
  10128. a.BitmapFontLoader = function(b, d) {
  10129. a.EventTarget.call(this);
  10130. this.url = b;
  10131. this.crossorigin = d;
  10132. this.baseUrl = b.replace(/[^\/]*$/, "");
  10133. this.texture = null
  10134. };
  10135. a.BitmapFontLoader.prototype.constructor = a.BitmapFontLoader;
  10136. a.BitmapFontLoader.prototype.load = function() {
  10137. this.ajaxRequest = new a.AjaxRequest;
  10138. var b = this;
  10139. this.ajaxRequest.onreadystatechange = function() {
  10140. b.onXMLLoaded()
  10141. };
  10142. this.ajaxRequest.open("GET", this.url, !0);
  10143. this.ajaxRequest.overrideMimeType && this.ajaxRequest.overrideMimeType("application/xml");
  10144. this.ajaxRequest.send(null)
  10145. };
  10146. a.BitmapFontLoader.prototype.onXMLLoaded = function() {
  10147. if (4 === this.ajaxRequest.readyState && (200 === this.ajaxRequest.status || -1 === window.location.protocol.indexOf("http"))) {
  10148. var b = this.ajaxRequest.responseXML;
  10149. if (!b || /MSIE 9/i.test(navigator.userAgent) || navigator.isCocoonJS) if ("function" === typeof window.DOMParser) b = (new DOMParser).parseFromString(this.ajaxRequest.responseText, "text/xml");
  10150. else {
  10151. var d = document.createElement("div");
  10152. d.innerHTML = this.ajaxRequest.responseText;
  10153. b = d
  10154. }
  10155. d = this.baseUrl + b.getElementsByTagName("page")[0].getAttribute("file");
  10156. d = new a.ImageLoader(d, this.crossorigin);
  10157. this.texture = d.texture.baseTexture;
  10158. var c = {},
  10159. e = b.getElementsByTagName("info")[0],
  10160. f = b.getElementsByTagName("common")[0];
  10161. c.font = e.getAttribute("face");
  10162. c.size = parseInt(e.getAttribute("size"), 10);
  10163. c.lineHeight = parseInt(f.getAttribute("lineHeight"), 10);
  10164. c.chars = {};
  10165. f = b.getElementsByTagName("char");
  10166. for (e = 0; e < f.length; e++) {
  10167. var h = parseInt(f[e].getAttribute("id"), 10),
  10168. k = new a.Rectangle(parseInt(f[e].getAttribute("x"), 10), parseInt(f[e].getAttribute("y"), 10), parseInt(f[e].getAttribute("width"), 10), parseInt(f[e].getAttribute("height"), 10));
  10169. c.chars[h] = {
  10170. xOffset: parseInt(f[e].getAttribute("xoffset"), 10),
  10171. yOffset: parseInt(f[e].getAttribute("yoffset"), 10),
  10172. xAdvance: parseInt(f[e].getAttribute("xadvance"), 10),
  10173. kerning: {},
  10174. texture: a.TextureCache[h] = new a.Texture(this.texture, k)
  10175. }
  10176. }
  10177. b = b.getElementsByTagName("kerning");
  10178. for (e = 0; e < b.length; e++) f = parseInt(b[e].getAttribute("first"), 10),
  10179. h = parseInt(b[e].getAttribute("second"), 10),
  10180. k = parseInt(b[e].getAttribute("amount"), 10),
  10181. c.chars[h].kerning[f] = k;
  10182. a.BitmapText.fonts[c.font] = c;
  10183. var l = this;
  10184. d.addEventListener("loaded",
  10185. function() {
  10186. l.onLoaded()
  10187. });
  10188. d.load()
  10189. }
  10190. };
  10191. a.BitmapFontLoader.prototype.onLoaded = function() {
  10192. this.dispatchEvent({
  10193. type: "loaded",
  10194. content: this
  10195. })
  10196. };
  10197. a.SpineLoader = function(b, d) {
  10198. a.EventTarget.call(this);
  10199. this.url = b;
  10200. this.crossorigin = d;
  10201. this.loaded = !1
  10202. };
  10203. a.SpineLoader.prototype.constructor = a.SpineLoader;
  10204. a.SpineLoader.prototype.load = function() {
  10205. var b = this,
  10206. d = new a.JsonLoader(this.url, this.crossorigin);
  10207. d.addEventListener("loaded",
  10208. function(a) {
  10209. b.json = a.content.json;
  10210. b.onLoaded()
  10211. });
  10212. d.load()
  10213. };
  10214. a.SpineLoader.prototype.onLoaded = function() {
  10215. this.loaded = !0;
  10216. this.dispatchEvent({
  10217. type: "loaded",
  10218. content: this
  10219. })
  10220. };
  10221. a.AbstractFilter = function(a, d) {
  10222. this.passes = [this];
  10223. this.shaders = [];
  10224. this.dirty = !0;
  10225. this.padding = 0;
  10226. this.uniforms = d || {};
  10227. this.fragmentSrc = a || []
  10228. };
  10229. a.AlphaMaskFilter = function(b) {
  10230. a.AbstractFilter.call(this);
  10231. this.passes = [this];
  10232. b.baseTexture._powerOf2 = !0;
  10233. this.uniforms = {
  10234. mask: {
  10235. type: "sampler2D",
  10236. value: b
  10237. },
  10238. mapDimensions: {
  10239. type: "2f",
  10240. value: {
  10241. x: 1,
  10242. y: 5112
  10243. }
  10244. },
  10245. dimensions: {
  10246. type: "4fv",
  10247. value: [0, 0, 0, 0]
  10248. }
  10249. };
  10250. b.baseTexture.hasLoaded ? (this.uniforms.mask.value.x = b.width, this.uniforms.mask.value.y = b.height) : (this.boundLoadedFunction = this.onTextureLoaded.bind(this), b.baseTexture.on("loaded", this.boundLoadedFunction));
  10251. this.fragmentSrc = ["precision mediump float;", "varying vec2 vTextureCoord;", "varying vec4 vColor;", "uniform sampler2D mask;", "uniform sampler2D uSampler;", "uniform vec2 offset;", "uniform vec4 dimensions;", "uniform vec2 mapDimensions;", "void main(void) {", " vec2 mapCords = vTextureCoord.xy;", " mapCords += (dimensions.zw + offset)/ dimensions.xy ;", " mapCords.y *= -1.0;", " mapCords.y += 1.0;", " mapCords *= dimensions.xy / mapDimensions;", " vec4 original = texture2D(uSampler, vTextureCoord);", " float maskAlpha = texture2D(mask, mapCords).r;", " original *= maskAlpha;", " gl_FragColor = original;", "}"]
  10252. };
  10253. a.AlphaMaskFilter.prototype = Object.create(a.AbstractFilter.prototype);
  10254. a.AlphaMaskFilter.prototype.constructor = a.AlphaMaskFilter;
  10255. a.AlphaMaskFilter.prototype.onTextureLoaded = function() {
  10256. this.uniforms.mapDimensions.value.x = this.uniforms.mask.value.width;
  10257. this.uniforms.mapDimensions.value.y = this.uniforms.mask.value.height;
  10258. this.uniforms.mask.value.baseTexture.off("loaded", this.boundLoadedFunction)
  10259. };
  10260. Object.defineProperty(a.AlphaMaskFilter.prototype, "map", {
  10261. get: function() {
  10262. return this.uniforms.mask.value
  10263. },
  10264. set: function(a) {
  10265. this.uniforms.mask.value = a
  10266. }
  10267. });
  10268. a.ColorMatrixFilter = function() {
  10269. a.AbstractFilter.call(this);
  10270. this.passes = [this];
  10271. this.uniforms = {
  10272. matrix: {
  10273. type: "mat4",
  10274. value: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
  10275. }
  10276. };
  10277. this.fragmentSrc = ["precision mediump float;", "varying vec2 vTextureCoord;", "varying vec4 vColor;", "uniform float invert;", "uniform mat4 matrix;", "uniform sampler2D uSampler;", "void main(void) {", " gl_FragColor = texture2D(uSampler, vTextureCoord) * matrix;", "}"]
  10278. };
  10279. a.ColorMatrixFilter.prototype = Object.create(a.AbstractFilter.prototype);
  10280. a.ColorMatrixFilter.prototype.constructor = a.ColorMatrixFilter;
  10281. Object.defineProperty(a.ColorMatrixFilter.prototype, "matrix", {
  10282. get: function() {
  10283. return this.uniforms.matrix.value
  10284. },
  10285. set: function(a) {
  10286. this.uniforms.matrix.value = a
  10287. }
  10288. });
  10289. a.GrayFilter = function() {
  10290. a.AbstractFilter.call(this);
  10291. this.passes = [this];
  10292. this.uniforms = {
  10293. gray: {
  10294. type: "1f",
  10295. value: 1
  10296. }
  10297. };
  10298. this.fragmentSrc = ["precision mediump float;", "varying vec2 vTextureCoord;", "varying vec4 vColor;", "uniform sampler2D uSampler;", "uniform float gray;", "void main(void) {", " gl_FragColor = texture2D(uSampler, vTextureCoord);", " gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.2126*gl_FragColor.r + 0.7152*gl_FragColor.g + 0.0722*gl_FragColor.b), gray);", "}"]
  10299. };
  10300. a.GrayFilter.prototype = Object.create(a.AbstractFilter.prototype);
  10301. a.GrayFilter.prototype.constructor = a.GrayFilter;
  10302. Object.defineProperty(a.GrayFilter.prototype, "gray", {
  10303. get: function() {
  10304. return this.uniforms.gray.value
  10305. },
  10306. set: function(a) {
  10307. this.uniforms.gray.value = a
  10308. }
  10309. });
  10310. a.DisplacementFilter = function(b) {
  10311. a.AbstractFilter.call(this);
  10312. this.passes = [this];
  10313. b.baseTexture._powerOf2 = !0;
  10314. this.uniforms = {
  10315. displacementMap: {
  10316. type: "sampler2D",
  10317. value: b
  10318. },
  10319. scale: {
  10320. type: "2f",
  10321. value: {
  10322. x: 30,
  10323. y: 30
  10324. }
  10325. },
  10326. offset: {
  10327. type: "2f",
  10328. value: {
  10329. x: 0,
  10330. y: 0
  10331. }
  10332. },
  10333. mapDimensions: {
  10334. type: "2f",
  10335. value: {
  10336. x: 1,
  10337. y: 5112
  10338. }
  10339. },
  10340. dimensions: {
  10341. type: "4fv",
  10342. value: [0, 0, 0, 0]
  10343. }
  10344. };
  10345. b.baseTexture.hasLoaded ? (this.uniforms.mapDimensions.value.x = b.width, this.uniforms.mapDimensions.value.y = b.height) : (this.boundLoadedFunction = this.onTextureLoaded.bind(this), b.baseTexture.on("loaded", this.boundLoadedFunction));
  10346. this.fragmentSrc = ["precision mediump float;", "varying vec2 vTextureCoord;", "varying vec4 vColor;", "uniform sampler2D displacementMap;", "uniform sampler2D uSampler;", "uniform vec2 scale;", "uniform vec2 offset;", "uniform vec4 dimensions;", "uniform vec2 mapDimensions;", "void main(void) {", " vec2 mapCords = vTextureCoord.xy;", " mapCords += (dimensions.zw + offset)/ dimensions.xy ;", " mapCords.y *= -1.0;", " mapCords.y += 1.0;", " vec2 matSample = texture2D(displacementMap, mapCords).xy;", " matSample -= 0.5;", " matSample *= scale;", " matSample /= mapDimensions;", " gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x + matSample.x, vTextureCoord.y + matSample.y));", " gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb, 1.0);", " vec2 cord = vTextureCoord;", "}"]
  10347. };
  10348. a.DisplacementFilter.prototype = Object.create(a.AbstractFilter.prototype);
  10349. a.DisplacementFilter.prototype.constructor = a.DisplacementFilter;
  10350. a.DisplacementFilter.prototype.onTextureLoaded = function() {
  10351. this.uniforms.mapDimensions.value.x = this.uniforms.displacementMap.value.width;
  10352. this.uniforms.mapDimensions.value.y = this.uniforms.displacementMap.value.height;
  10353. this.uniforms.displacementMap.value.baseTexture.off("loaded", this.boundLoadedFunction)
  10354. };
  10355. Object.defineProperty(a.DisplacementFilter.prototype, "map", {
  10356. get: function() {
  10357. return this.uniforms.displacementMap.value
  10358. },
  10359. set: function(a) {
  10360. this.uniforms.displacementMap.value = a
  10361. }
  10362. });
  10363. Object.defineProperty(a.DisplacementFilter.prototype, "scale", {
  10364. get: function() {
  10365. return this.uniforms.scale.value
  10366. },
  10367. set: function(a) {
  10368. this.uniforms.scale.value = a
  10369. }
  10370. });
  10371. Object.defineProperty(a.DisplacementFilter.prototype, "offset", {
  10372. get: function() {
  10373. return this.uniforms.offset.value
  10374. },
  10375. set: function(a) {
  10376. this.uniforms.offset.value = a
  10377. }
  10378. });
  10379. a.PixelateFilter = function() {
  10380. a.AbstractFilter.call(this);
  10381. this.passes = [this];
  10382. this.uniforms = {
  10383. invert: {
  10384. type: "1f",
  10385. value: 0
  10386. },
  10387. dimensions: {
  10388. type: "4fv",
  10389. value: new Float32Array([1E4, 100, 10, 10])
  10390. },
  10391. pixelSize: {
  10392. type: "2f",
  10393. value: {
  10394. x: 10,
  10395. y: 10
  10396. }
  10397. }
  10398. };
  10399. this.fragmentSrc = ["precision mediump float;", "varying vec2 vTextureCoord;", "varying vec4 vColor;", "uniform vec2 testDim;", "uniform vec4 dimensions;", "uniform vec2 pixelSize;", "uniform sampler2D uSampler;", "void main(void) {", " vec2 coord = vTextureCoord;", " vec2 size = dimensions.xy/pixelSize;", " vec2 color = floor( ( vTextureCoord * size ) ) / size + pixelSize/dimensions.xy * 0.5;", " gl_FragColor = texture2D(uSampler, color);", "}"]
  10400. };
  10401. a.PixelateFilter.prototype = Object.create(a.AbstractFilter.prototype);
  10402. a.PixelateFilter.prototype.constructor = a.PixelateFilter;
  10403. Object.defineProperty(a.PixelateFilter.prototype, "size", {
  10404. get: function() {
  10405. return this.uniforms.pixelSize.value
  10406. },
  10407. set: function(a) {
  10408. this.dirty = !0;
  10409. this.uniforms.pixelSize.value = a
  10410. }
  10411. });
  10412. a.BlurXFilter = function() {
  10413. a.AbstractFilter.call(this);
  10414. this.passes = [this];
  10415. this.uniforms = {
  10416. blur: {
  10417. type: "1f",
  10418. value: 1 / 512
  10419. }
  10420. };
  10421. this.fragmentSrc = ["precision mediump float;", "varying vec2 vTextureCoord;", "varying vec4 vColor;", "uniform float blur;", "uniform sampler2D uSampler;", "void main(void) {", " vec4 sum = vec4(0.0);", " sum += texture2D(uSampler, vec2(vTextureCoord.x - 4.0*blur, vTextureCoord.y)) * 0.05;", " sum += texture2D(uSampler, vec2(vTextureCoord.x - 3.0*blur, vTextureCoord.y)) * 0.09;", " sum += texture2D(uSampler, vec2(vTextureCoord.x - 2.0*blur, vTextureCoord.y)) * 0.12;", " sum += texture2D(uSampler, vec2(vTextureCoord.x - blur, vTextureCoord.y)) * 0.15;", " sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;", " sum += texture2D(uSampler, vec2(vTextureCoord.x + blur, vTextureCoord.y)) * 0.15;", " sum += texture2D(uSampler, vec2(vTextureCoord.x + 2.0*blur, vTextureCoord.y)) * 0.12;", " sum += texture2D(uSampler, vec2(vTextureCoord.x + 3.0*blur, vTextureCoord.y)) * 0.09;", " sum += texture2D(uSampler, vec2(vTextureCoord.x + 4.0*blur, vTextureCoord.y)) * 0.05;", " gl_FragColor = sum;", "}"]
  10422. };
  10423. a.BlurXFilter.prototype = Object.create(a.AbstractFilter.prototype);
  10424. a.BlurXFilter.prototype.constructor = a.BlurXFilter;
  10425. Object.defineProperty(a.BlurXFilter.prototype, "blur", {
  10426. get: function() {
  10427. return this.uniforms.blur.value / (1 / 7E3)
  10428. },
  10429. set: function(a) {
  10430. this.dirty = !0;
  10431. this.uniforms.blur.value = 1 / 7E3 * a
  10432. }
  10433. });
  10434. a.BlurYFilter = function() {
  10435. a.AbstractFilter.call(this);
  10436. this.passes = [this];
  10437. this.uniforms = {
  10438. blur: {
  10439. type: "1f",
  10440. value: 1 / 512
  10441. }
  10442. };
  10443. this.fragmentSrc = ["precision mediump float;", "varying vec2 vTextureCoord;", "varying vec4 vColor;", "uniform float blur;", "uniform sampler2D uSampler;", "void main(void) {", " vec4 sum = vec4(0.0);", " sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 4.0*blur)) * 0.05;", " sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 3.0*blur)) * 0.09;", " sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 2.0*blur)) * 0.12;", " sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - blur)) * 0.15;", " sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;", " sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + blur)) * 0.15;", " sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 2.0*blur)) * 0.12;", " sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 3.0*blur)) * 0.09;", " sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 4.0*blur)) * 0.05;", " gl_FragColor = sum;", "}"]
  10444. };
  10445. a.BlurYFilter.prototype = Object.create(a.AbstractFilter.prototype);
  10446. a.BlurYFilter.prototype.constructor = a.BlurYFilter;
  10447. Object.defineProperty(a.BlurYFilter.prototype, "blur", {
  10448. get: function() {
  10449. return this.uniforms.blur.value / (1 / 7E3)
  10450. },
  10451. set: function(a) {
  10452. this.uniforms.blur.value = 1 / 7E3 * a
  10453. }
  10454. });
  10455. a.BlurFilter = function() {
  10456. this.blurXFilter = new a.BlurXFilter;
  10457. this.blurYFilter = new a.BlurYFilter;
  10458. this.passes = [this.blurXFilter, this.blurYFilter]
  10459. };
  10460. Object.defineProperty(a.BlurFilter.prototype, "blur", {
  10461. get: function() {
  10462. return this.blurXFilter.blur
  10463. },
  10464. set: function(a) {
  10465. this.blurXFilter.blur = this.blurYFilter.blur = a
  10466. }
  10467. });
  10468. Object.defineProperty(a.BlurFilter.prototype, "blurX", {
  10469. get: function() {
  10470. return this.blurXFilter.blur
  10471. },
  10472. set: function(a) {
  10473. this.blurXFilter.blur = a
  10474. }
  10475. });
  10476. Object.defineProperty(a.BlurFilter.prototype, "blurY", {
  10477. get: function() {
  10478. return this.blurYFilter.blur
  10479. },
  10480. set: function(a) {
  10481. this.blurYFilter.blur = a
  10482. }
  10483. });
  10484. a.InvertFilter = function() {
  10485. a.AbstractFilter.call(this);
  10486. this.passes = [this];
  10487. this.uniforms = {
  10488. invert: {
  10489. type: "1f",
  10490. value: 1
  10491. }
  10492. };
  10493. this.fragmentSrc = ["precision mediump float;", "varying vec2 vTextureCoord;", "varying vec4 vColor;", "uniform float invert;", "uniform sampler2D uSampler;", "void main(void) {", " gl_FragColor = texture2D(uSampler, vTextureCoord);", " gl_FragColor.rgb = mix( (vec3(1)-gl_FragColor.rgb) * gl_FragColor.a, gl_FragColor.rgb, 1.0 - invert);", "}"]
  10494. };
  10495. a.InvertFilter.prototype = Object.create(a.AbstractFilter.prototype);
  10496. a.InvertFilter.prototype.constructor = a.InvertFilter;
  10497. Object.defineProperty(a.InvertFilter.prototype, "invert", {
  10498. get: function() {
  10499. return this.uniforms.invert.value
  10500. },
  10501. set: function(a) {
  10502. this.uniforms.invert.value = a
  10503. }
  10504. });
  10505. a.SepiaFilter = function() {
  10506. a.AbstractFilter.call(this);
  10507. this.passes = [this];
  10508. this.uniforms = {
  10509. sepia: {
  10510. type: "1f",
  10511. value: 1
  10512. }
  10513. };
  10514. this.fragmentSrc = ["precision mediump float;", "varying vec2 vTextureCoord;", "varying vec4 vColor;", "uniform float sepia;", "uniform sampler2D uSampler;", "const mat3 sepiaMatrix = mat3(0.3588, 0.7044, 0.1368, 0.2990, 0.5870, 0.1140, 0.2392, 0.4696, 0.0912);", "void main(void) {", " gl_FragColor = texture2D(uSampler, vTextureCoord);", " gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb * sepiaMatrix, sepia);", "}"]
  10515. };
  10516. a.SepiaFilter.prototype = Object.create(a.AbstractFilter.prototype);
  10517. a.SepiaFilter.prototype.constructor = a.SepiaFilter;
  10518. Object.defineProperty(a.SepiaFilter.prototype, "sepia", {
  10519. get: function() {
  10520. return this.uniforms.sepia.value
  10521. },
  10522. set: function(a) {
  10523. this.uniforms.sepia.value = a
  10524. }
  10525. });
  10526. a.TwistFilter = function() {
  10527. a.AbstractFilter.call(this);
  10528. this.passes = [this];
  10529. this.uniforms = {
  10530. radius: {
  10531. type: "1f",
  10532. value: 0.5
  10533. },
  10534. angle: {
  10535. type: "1f",
  10536. value: 5
  10537. },
  10538. offset: {
  10539. type: "2f",
  10540. value: {
  10541. x: 0.5,
  10542. y: 0.5
  10543. }
  10544. }
  10545. };
  10546. this.fragmentSrc = ["precision mediump float;", "varying vec2 vTextureCoord;", "varying vec4 vColor;", "uniform vec4 dimensions;", "uniform sampler2D uSampler;", "uniform float radius;", "uniform float angle;", "uniform vec2 offset;", "void main(void) {", " vec2 coord = vTextureCoord - offset;", " float distance = length(coord);", " if (distance < radius) {", " float ratio = (radius - distance) / radius;", " float angleMod = ratio * ratio * angle;", " float s = sin(angleMod);", " float c = cos(angleMod);", " coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);", " }", " gl_FragColor = texture2D(uSampler, coord+offset);", "}"]
  10547. };
  10548. a.TwistFilter.prototype = Object.create(a.AbstractFilter.prototype);
  10549. a.TwistFilter.prototype.constructor = a.TwistFilter;
  10550. Object.defineProperty(a.TwistFilter.prototype, "offset", {
  10551. get: function() {
  10552. return this.uniforms.offset.value
  10553. },
  10554. set: function(a) {
  10555. this.dirty = !0;
  10556. this.uniforms.offset.value = a
  10557. }
  10558. });
  10559. Object.defineProperty(a.TwistFilter.prototype, "radius", {
  10560. get: function() {
  10561. return this.uniforms.radius.value
  10562. },
  10563. set: function(a) {
  10564. this.dirty = !0;
  10565. this.uniforms.radius.value = a
  10566. }
  10567. });
  10568. Object.defineProperty(a.TwistFilter.prototype, "angle", {
  10569. get: function() {
  10570. return this.uniforms.angle.value
  10571. },
  10572. set: function(a) {
  10573. this.dirty = !0;
  10574. this.uniforms.angle.value = a
  10575. }
  10576. });
  10577. a.ColorStepFilter = function() {
  10578. a.AbstractFilter.call(this);
  10579. this.passes = [this];
  10580. this.uniforms = {
  10581. step: {
  10582. type: "1f",
  10583. value: 5
  10584. }
  10585. };
  10586. this.fragmentSrc = ["precision mediump float;", "varying vec2 vTextureCoord;", "varying vec4 vColor;", "uniform sampler2D uSampler;", "uniform float step;", "void main(void) {", " vec4 color = texture2D(uSampler, vTextureCoord);", " color = floor(color * step) / step;", " gl_FragColor = color;", "}"]
  10587. };
  10588. a.ColorStepFilter.prototype = Object.create(a.AbstractFilter.prototype);
  10589. a.ColorStepFilter.prototype.constructor = a.ColorStepFilter;
  10590. Object.defineProperty(a.ColorStepFilter.prototype, "step", {
  10591. get: function() {
  10592. return this.uniforms.step.value
  10593. },
  10594. set: function(a) {
  10595. this.uniforms.step.value = a
  10596. }
  10597. });
  10598. a.DotScreenFilter = function() {
  10599. a.AbstractFilter.call(this);
  10600. this.passes = [this];
  10601. this.uniforms = {
  10602. scale: {
  10603. type: "1f",
  10604. value: 1
  10605. },
  10606. angle: {
  10607. type: "1f",
  10608. value: 5
  10609. },
  10610. dimensions: {
  10611. type: "4fv",
  10612. value: [0, 0, 0, 0]
  10613. }
  10614. };
  10615. this.fragmentSrc = ["precision mediump float;", "varying vec2 vTextureCoord;", "varying vec4 vColor;", "uniform vec4 dimensions;", "uniform sampler2D uSampler;", "uniform float angle;", "uniform float scale;", "float pattern() {", " float s = sin(angle), c = cos(angle);", " vec2 tex = vTextureCoord * dimensions.xy;", " vec2 point = vec2(", " c * tex.x - s * tex.y,", " s * tex.x + c * tex.y", " ) * scale;", " return (sin(point.x) * sin(point.y)) * 4.0;", "}", "void main() {", " vec4 color = texture2D(uSampler, vTextureCoord);", " float average = (color.r + color.g + color.b) / 3.0;", " gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);", "}"]
  10616. };
  10617. a.DotScreenFilter.prototype = Object.create(a.AbstractFilter.prototype);
  10618. a.DotScreenFilter.prototype.constructor = a.DotScreenFilter;
  10619. Object.defineProperty(a.DotScreenFilter.prototype, "scale", {
  10620. get: function() {
  10621. return this.uniforms.scale.value
  10622. },
  10623. set: function(a) {
  10624. this.dirty = !0;
  10625. this.uniforms.scale.value = a
  10626. }
  10627. });
  10628. Object.defineProperty(a.DotScreenFilter.prototype, "angle", {
  10629. get: function() {
  10630. return this.uniforms.angle.value
  10631. },
  10632. set: function(a) {
  10633. this.dirty = !0;
  10634. this.uniforms.angle.value = a
  10635. }
  10636. });
  10637. a.CrossHatchFilter = function() {
  10638. a.AbstractFilter.call(this);
  10639. this.passes = [this];
  10640. this.uniforms = {
  10641. blur: {
  10642. type: "1f",
  10643. value: 1 / 512
  10644. }
  10645. };
  10646. this.fragmentSrc = ["precision mediump float;", "varying vec2 vTextureCoord;", "varying vec4 vColor;", "uniform float blur;", "uniform sampler2D uSampler;", "void main(void) {", " float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);", " gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);", " if (lum < 1.00) {", " if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) {", " gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);", " }", " }", " if (lum < 0.75) {", " if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) {", " gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);", " }", " }", " if (lum < 0.50) {", " if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) {", " gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);", " }", " }", " if (lum < 0.3) {", " if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) {", " gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);", " }", " }", "}"]
  10647. };
  10648. a.CrossHatchFilter.prototype = Object.create(a.AbstractFilter.prototype);
  10649. a.CrossHatchFilter.prototype.constructor = a.BlurYFilter;
  10650. Object.defineProperty(a.CrossHatchFilter.prototype, "blur", {
  10651. get: function() {
  10652. return this.uniforms.blur.value / (1 / 7E3)
  10653. },
  10654. set: function(a) {
  10655. this.uniforms.blur.value = 1 / 7E3 * a
  10656. }
  10657. });
  10658. a.RGBSplitFilter = function() {
  10659. a.AbstractFilter.call(this);
  10660. this.passes = [this];
  10661. this.uniforms = {
  10662. red: {
  10663. type: "2f",
  10664. value: {
  10665. x: 20,
  10666. y: 20
  10667. }
  10668. },
  10669. green: {
  10670. type: "2f",
  10671. value: {
  10672. x: -20,
  10673. y: 20
  10674. }
  10675. },
  10676. blue: {
  10677. type: "2f",
  10678. value: {
  10679. x: 20,
  10680. y: -20
  10681. }
  10682. },
  10683. dimensions: {
  10684. type: "4fv",
  10685. value: [0, 0, 0, 0]
  10686. }
  10687. };
  10688. this.fragmentSrc = ["precision mediump float;", "varying vec2 vTextureCoord;", "varying vec4 vColor;", "uniform vec2 red;", "uniform vec2 green;", "uniform vec2 blue;", "uniform vec4 dimensions;", "uniform sampler2D uSampler;", "void main(void) {", " gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/dimensions.xy).r;", " gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/dimensions.xy).g;", " gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/dimensions.xy).b;", " gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;", "}"]
  10689. };
  10690. a.RGBSplitFilter.prototype = Object.create(a.AbstractFilter.prototype);
  10691. a.RGBSplitFilter.prototype.constructor = a.RGBSplitFilter;
  10692. Object.defineProperty(a.RGBSplitFilter.prototype, "angle", {
  10693. get: function() {
  10694. return this.uniforms.blur.value / (1 / 7E3)
  10695. },
  10696. set: function(a) {
  10697. this.uniforms.blur.value = 1 / 7E3 * a
  10698. }
  10699. });
  10700. "undefined" !== typeof exports ? ("undefined" !== typeof module && module.exports && (exports = module.exports = a), exports.PIXI = a) : "undefined" !== typeof define && define.amd ? define(a) : this.PIXI = a
  10701. }).call(this); (function() {
  10702. var a = a || {};
  10703. a.viewporter;
  10704. a.VERSION = "1.6";
  10705. a.CANVAS = 0;
  10706. a.WEBGL = 1;
  10707. a.AUTO = 2;
  10708. a.HD = 640;
  10709. a.LANDSCAPE = 0;
  10710. a.PORTRAIT = 1;
  10711. a.SCROLL = 2E3;
  10712. var f = null;
  10713. a._isVisible = null;
  10714. a._isWebGL = null;
  10715. a._isCanvas = !1;
  10716. a._currentRenderer = null;
  10717. a._isHD = !1;
  10718. a._isOrientation = !1;
  10719. a._isTouchable = null;
  10720. a._isLocalStorage = !1;
  10721. a._isWebAudio = !1;
  10722. a._isHtmlAudio = !1;
  10723. a._isAndroid = !1;
  10724. a._isChromeOS = !1;
  10725. a._isiOS = !1;
  10726. a._isArora = !1;
  10727. a._isChrome = !1;
  10728. a._isDolphin = !1;
  10729. a._isEpiphany = !1;
  10730. a._isFirefox = !1;
  10731. a._isMobileSafari = !1;
  10732. a._isStockAndroid = !1;
  10733. a._isIE = !1;
  10734. a._ieVersion = 0;
  10735. a._isMidori = !1;
  10736. a._isOpera = !1;
  10737. a._isSafari = !1;
  10738. a._isWebApp = !1;
  10739. a._isWebOS = !1;
  10740. a._isWindowsPhone = !1;
  10741. a._isBlackBerry = !1;
  10742. a._isKindle = !1;
  10743. a._isCocoonJS = !1;
  10744. a._pixelRatio = null;
  10745. a._isiPhone = !1;
  10746. a._isiPhone4 = !1;
  10747. a._isiPad = !1;
  10748. a._isDesktop = !1;
  10749. a._isLinux = !1;
  10750. a._isMacOS = !1;
  10751. a._isWindows = !1;
  10752. a._checkVisibility = function() { (this._hiddenVar = void 0 !== document.webkitHidden ? "webkitvisibilitychange": void 0 !== document.mozHidden ? "mozvisibilitychange": void 0 !== document.msHidden ? "msvisibilitychange": void 0 !== document.hidden ? "visibilitychange": null) && document.addEventListener(this._hiddenVar, this._onVisibilityChange, !1);
  10753. window.onpagehide = a._onVisibilityChange;
  10754. window.onpageshow = a._onVisibilityChange;
  10755. window.onblur = a._onVisibilityChange;
  10756. window.onfocus = a._onVisibilityChange
  10757. };
  10758. a.visibilityChange = function(b) {
  10759. if ("pagehide" === b.type || "blur" === b.type || "pageshow" === b.type || "focus" === b.type) if ("pagehide" === b.type || "blur" === b.type) a._isVisible = !1,
  10760. a.onFocusLost && a.onFocusLost.call();
  10761. else if ("pageshow" === b.type || "focus" === b.type) a._isVisible = !0,
  10762. a.onFocusGain && a.onFocusGain.call()
  10763. };
  10764. a._checkCanvas = function() {
  10765. try {
  10766. a._isCanvas = !!window.CanvasRenderingContext2D || navigator.isCocoonJS
  10767. } catch(b) {
  10768. a._isCanvas = !1
  10769. }
  10770. };
  10771. a._checkWebGL = function() {
  10772. var b = null;
  10773. try {
  10774. var c = document.createElement(navigator.isCocoonJS ? "screencanvas": "canvas"),
  10775. b = !!window.WebGLRenderingContext && (c.getContext("experimental-webgl") || c.getContext("webgl"))
  10776. } catch(d) {
  10777. return a._isWebGL = !1
  10778. }
  10779. a._isWebGL = null != b && !1 != b ? !0 : !1
  10780. };
  10781. var h = a,
  10782. n = function() {
  10783. a._onVisibilityChange = function(b) {
  10784. return a.visibilityChange(b)
  10785. };
  10786. a._checkVisibility()
  10787. } (),
  10788. p = function() {
  10789. "loading" === document.readyState ? document.addEventListener("DOMContentLoaded",
  10790. function() {
  10791. a._checkCanvas()
  10792. },
  10793. !1) : a._checkCanvas()
  10794. } (),
  10795. b = function() {
  10796. "loading" === document.readyState ? document.addEventListener("DOMContentLoaded",
  10797. function() {
  10798. a._checkWebGL()
  10799. },
  10800. !1) : a._checkWebGL()
  10801. } ();
  10802. a._isTouchable = "ontouchstart" in window || "onmsgesturechange" in window;
  10803. try {
  10804. localStorage.setItem("ENEAtestItem", "testValue"),
  10805. localStorage.removeItem("ENEAtestItem"),
  10806. a._isLocalStorage = !!window.localStorage
  10807. } catch(d) {
  10808. a._isLocalStorage = !1
  10809. }
  10810. var c = a._isWebAudio = !!window.AudioContext || !!window.webkitAudioContext || !!window.mozAudioContext,
  10811. e = a._isHtmlAudio = !!document.createElement("audio").canPlayType && !!window.Audio,
  10812. g = function() {
  10813. var b = navigator.userAgent;
  10814. /Android/.test(b) ? a._isAndroid = !0 : /CrOS/.test(b) ? a._isChromeOS = !0 : /iP[ao]d|iPhone/i.test(b) ? a._isiOS = !0 : /Linux/.test(b) ? a._isLinux = !0 : /Mac OS/.test(b) ? a._isMacOS = !0 : /Windows/.test(b) && (a._isWindows = !0);
  10815. if (a._isWindows || a._isMacOS || a._isLinux && 0 > b.indexOf("Silk")) a._isDesktop = !0
  10816. } (),
  10817. r = function() {
  10818. var b = navigator.userAgent;
  10819. /Arora/.test(b) ? a._isArora = !0 : /Dolfin/.test(b) ? a._isDolphin = !0 : /Chrome/.test(b) ? a._isChrome = !0 : /Epiphany/.test(b) ? a._isEpiphany = !0 : /Firefox/.test(b) ? a._isFirefox = !0 : /Mobile/.test(b) ? /Safari/.test(b) && (a._isMobileSafari = !0) : /Linux/.test(b) && ( - 1 < b.indexOf("Silk") || -1 < b.indexOf("Kindle")) ? a._isKindle = !0 : -1 < b.indexOf("Mozilla/5.0") && ( - 1 < b.indexOf("Android") || -1 < b.indexOf("Linux")) && -1 < b.indexOf("AppleWebKit") && !( - 1 < b.indexOf("Chrome")) ? a._isStockAndroid = !0 : /MSIE (\d+\.\d+);/.test(b) ? (a._isIE = !0, a._ieVersion = parseInt(RegExp.$1, 10)) : /Trident\/(\d+\.\d+);/.test(b) ? (a._isIE = !0, a._ieVersion = parseInt(RegExp.$1, 10)) : /Midori/.test(b) ? a._isMidori = !0 : /Opera/.test(b) ? a._isOpera = !0 : /Safari/.test(b) ? a._isSafari = !0 : /webos/i.test(b) ? a._isWebOS = !0 : /Windows Phone/i.test(b) ? a._isWindowsPhone = !0 : /BlackBerry/i.test(b) && (a._isBlackBerry = !0);
  10820. navigator.standalone && (a._isWebApp = !0);
  10821. a._isCocoonJS = navigator.isCocoonJS ? !0 : !1
  10822. } (),
  10823. k = function() {
  10824. a._pixelRatio = window.devicePixelRatio || 1;
  10825. a._isiPhone = -1 != navigator.userAgent.toLowerCase().indexOf("iphone");
  10826. a._isiPhone4 = 2 == this.pixelRatio && this.iPhone;
  10827. a._isiPad = -1 != navigator.userAgent.toLowerCase().indexOf("ipad")
  10828. } ();
  10829. a._screen = {
  10830. width: window.screen.availWidth * a._pixelRatio,
  10831. height: window.screen.availHeight * a._pixelRatio
  10832. };
  10833. a._isOrientation = window.orientation;
  10834. Math.min(a._screen.width, a._screen.height) >= a.HD && (a._isHD = !0);
  10835. h._checkDevice = {
  10836. _visibility: n,
  10837. _canvas: p,
  10838. _webGL: b,
  10839. _touchDevice: void 0,
  10840. _localStorage: void 0,
  10841. _webAudio: c,
  10842. _htmlAudio: e,
  10843. _checkOS: g,
  10844. _checkBrowser: r,
  10845. _device: k,
  10846. _detectScreenResolution: void 0
  10847. };
  10848. a.Game = function(b, c) {
  10849. f = this;
  10850. var d = b || {};
  10851. d.background = b.background || 0;
  10852. d.canvas = b.canvas || null;
  10853. d.transparent = b.transparent || !1;
  10854. d.width = b.width || 320;
  10855. d.height = b.height || 480;
  10856. d.forceLandscape = b.forceLandscape || !1;
  10857. d.forcePortrait = b.forcePortrait || !1;
  10858. d.noResize = b.noResize || !1;
  10859. d.desktopFullScreen = b.desktopFullScreen || !1;
  10860. this.container = "string" === typeof c ? document.getElementById(c) : c;
  10861. this.container || (this.container = document.body);
  10862. this._frameEnd = this._frameStart = null;
  10863. this.width = d.width;
  10864. this.halfWidth = d.width / 2;
  10865. this.height = d.height;
  10866. this.halfHeight = d.height / 2;
  10867. isNaN(d.renderer) || d.renderer == a.AUTO ? this.renderMethod = a.AUTO: this.renderMethod = d.renderer;
  10868. this.transparent = d.transparent;
  10869. this.background = d.background;
  10870. isNaN(d.interactive) || d.interactive ? this.interactive = !0 : this.interactive = !1;
  10871. isNaN(d.antialias) || !d.antialias ? this.antialias = !1 : this.antialias = !0;
  10872. this.canvas = d.canvas;
  10873. this.__updateList = [];
  10874. isNaN(d.keepAspectRatio) || d.keepAspectRatio ? this.keepAspectRatio = !0 : this.keepAspectRatio = !1;
  10875. isNaN(d.desktopFullScreen) || d.desktopFullScreen ? this.desktopFullScreen = !0 : this.desktopFullScreen = !1;
  10876. this.noResize = d.noResize;
  10877. isNaN(d.alignHorizontally) || d.alignHorizontally ? this.alignHorizontally = !0 : this.alignHorizontally = !1;
  10878. this.aspectRatio = this.width / this.height;
  10879. if (!a._isDesktop) {
  10880. document.body.style.overflow = "visible";
  10881. var e = document.createElement("div");
  10882. document.body.appendChild(e)
  10883. }
  10884. this.canvas || (this.canvas = document.createElement(navigator.isCocoonJS ? "screencanvas": "canvas"));
  10885. this.stage = new PIXI.Stage(this.background);
  10886. this.stage.interactive = this.interactive;
  10887. this.renderer = this._createRenderer();
  10888. this.container.appendChild(this.renderer.view);
  10889. this.renderer.view.style.width = this.width + "px";
  10890. this.renderer.view.style.height = this.height + "px";
  10891. setTimeout(function() {
  10892. f.resize()
  10893. },
  10894. 10);
  10895. window.addEventListener("resize", this.resize.bind(this), !1);
  10896. document.body.addEventListener("touchmove",
  10897. function(a) {
  10898. a.preventDefault()
  10899. },
  10900. !1);
  10901. document.body.addEventListener("touchstart",
  10902. function(a) {
  10903. a.preventDefault()
  10904. },
  10905. !1);
  10906. this.forceLandscape = d.forceLandscape;
  10907. this.forcePortrait = d.forcePortrait;
  10908. this.onChangeOrientation = this.onWrongOrientation = null;
  10909. setTimeout(function() {
  10910. f.orientation = new a.Orientation
  10911. },
  10912. 10)
  10913. };
  10914. a.Game.prototype._createRenderer = function() {
  10915. var b = null,
  10916. c = a._isDesktop ? "DESKTOP": "MOBILE";
  10917. if (this.renderMethod != a.AUTO && this.renderMethod != a.WEBGL || !a._isWebGL) {
  10918. if (this.renderMethod != a.AUTO && this.renderMethod != a.CANVAS || !a._isCanvas) throw Error("ENEA.Game : can't initialize Canvas or WebGL. Try to download newer browser");
  10919. b = new PIXI.CanvasRenderer(this.width, this.height, this.canvas, this.transparent);
  10920. a._currentRenderer = a.CANVAS;
  10921. console.log("%cENEA v" + a.VERSION + " | " + c + " | CANVAS |", "color: #009;")
  10922. } else b = new PIXI.WebGLRenderer(this.width, this.height, this.canvas, this.transparent, this.antialias),
  10923. a._currentRenderer = a.WEBGL,
  10924. console.log("%cENEA v" + a.VERSION + " | " + c + " | WEBGL |", "color: #009;");
  10925. return b
  10926. };
  10927. a.Game.prototype.setContextSmoothing = function(b) {
  10928. a._currentRenderer == a.CANVAS && (this.renderer.context.imageSmoothingEnabled = b, this.renderer.context.mozImageSmoothingEnabled = b, this.renderer.context.oImageSmoothingEnabled = b, this.renderer.context.webkitImageSmoothingEnabled = b, this.renderer.context.msImageSmoothingEnabled = b)
  10929. };
  10930. a.Game.prototype.render = function() {
  10931. this._frameEnd = Date.now();
  10932. requestAnimFrame(this.render.bind(this));
  10933. for (var b in this.__updateList) if (!this.__updateList[b].postponed) this.__updateList[b]();
  10934. a.Tweener.update();
  10935. this.renderer.render(this.stage);
  10936. this._frameStart = Date.now()
  10937. };
  10938. a.Game.prototype.getFrameTime = function() {
  10939. return this._frameEnd - this._frameStart
  10940. };
  10941. a.Game.prototype.addUpdate = function(a, b) {
  10942. if ("function" == typeof b) this.__updateList[a] = b,
  10943. this.__updateList[a].postponed = !1;
  10944. else throw Error("ENEA.Game.addUpdate : input must be an function");
  10945. };
  10946. a.Game.prototype.postponeAllUpdates = function() {
  10947. for (var a in this.__updateList) this.__updateList[a].postponed = !0
  10948. };
  10949. a.Game.prototype.postponeUpdate = function(a) {
  10950. if (void 0 !== this.__updateList[a] && null !== this.__updateList[a]) this.__updateList[a].postponed = !0;
  10951. else throw Error("ENEA.Game.postponeUpdate : update not found");
  10952. };
  10953. a.Game.prototype.reinstateAllUpdates = function() {
  10954. for (var a in this.__updateList) this.__updateList[a].postponed = !1
  10955. };
  10956. a.Game.prototype.reinstateUpdate = function(a) {
  10957. if (void 0 !== this.__updateList[a] && null !== this.__updateList[a]) this.__updateList[a].postponed = !1;
  10958. else throw Error("ENEA.Game.reinstateUpdate : update not found");
  10959. };
  10960. a.Game.prototype.removeUpdate = function(a) {
  10961. this.__updateList[a] = null;
  10962. delete this.__updateList[a]
  10963. };
  10964. a.Game.prototype.removeAllUpdates = function() {
  10965. this.__updateList = []
  10966. };
  10967. a.Game.prototype.resize = function() {
  10968. this.noResize || (this.renderer.view.style.width = this.keepAspectRatio || a._isDesktop ? window.innerHeight * this.aspectRatio + "px": window.innerWidth + "px", this.renderer.view.style.height = window.innerHeight + "px", a._isDesktop && this.desktopFullScreen && (this.renderer.view.style.width = window.innerWidth + "px", this.renderer.view.style.height = this.keepAspectRatio ? Math.floor(window.innerWidth / this.aspectRatio) + "px": window.innerHeight + "px"));
  10969. this._alignHorizontally()
  10970. };
  10971. a.Game.prototype._alignHorizontally = function() {
  10972. if (this.alignHorizontally) {
  10973. var a = this.renderer.view.style.width,
  10974. a = parseInt(a.substring(0, a.length - 2), 10);
  10975. this.renderer.view.style.marginLeft = Math.floor((window.innerWidth - a) / 2) + "px"
  10976. } else this.renderer.view.style.marginLeft = "0px"
  10977. };
  10978. a.Game.prototype.relativeX = a.Game.prototype.relX = function(a) {
  10979. return~~ (this.width * a)
  10980. };
  10981. a.Game.prototype.relativeY = a.Game.prototype.relY = function(a) {
  10982. return~~ (this.height * a)
  10983. };
  10984. Object.defineProperty(a.Game.prototype, "centerX", {
  10985. get: function() {
  10986. return~~ (this.width >> 1)
  10987. }
  10988. });
  10989. Object.defineProperty(a.Game.prototype, "centerY", {
  10990. get: function() {
  10991. return~~ (this.height >> 1)
  10992. }
  10993. });
  10994. a.Container = function(a, b) {
  10995. PIXI.DisplayObjectContainer.call(this);
  10996. if (null != a) if ("function" == typeof a) a.call(this, b);
  10997. else throw Error("ENEA.Container : input needs to be an function");
  10998. };
  10999. a.Container.prototype.constructor = a.Container;
  11000. a.Container.prototype = Object.create(PIXI.DisplayObjectContainer.prototype);
  11001. a.Sprite = function(a) {
  11002. PIXI.Sprite.call(this, a.texture);
  11003. this.applyParams(a);
  11004. return this
  11005. };
  11006. a.Sprite.prototype = Object.create(PIXI.Sprite.prototype);
  11007. a.Sprite.prototype.constructor = a.Sprite;
  11008. a.Sprite.prototype.applyParams = function(a) {
  11009. for (var b in a)"texture" != b && (this[b] = a[b]);
  11010. return this
  11011. };
  11012. a.Sprite.prototype.addTo = function(a) {
  11013. a.addChild(this);
  11014. return this
  11015. };
  11016. PIXI.Sprite.prototype.applyParams = function(a) {
  11017. for (var b in a)"texture" != b && (this[b] = a[b]);
  11018. return this
  11019. };
  11020. PIXI.Sprite.prototype.addTo = function(a) {
  11021. a.addChild(this);
  11022. return this
  11023. };
  11024. Object.defineProperty(PIXI.DisplayObject.prototype, "numChildren", {
  11025. get: function() {
  11026. return this.children.length
  11027. }
  11028. });
  11029. a.Container.prototype.removeAllChildren = function() {
  11030. try {
  11031. for (; this.children.length;) ! this.children[0].destroy || this.children[0] instanceof a.Container || this.children[0].destroy(!0),
  11032. this.removeChild(this.children[0])
  11033. } catch(b) {
  11034. throw Error("ENEA.Container.removeAllChildren : can't delete all children");
  11035. }
  11036. };
  11037. Object.defineProperty(PIXI.DisplayObject.prototype, "responsive", {
  11038. set: function(a) {
  11039. this.buttonMode = this.interactive = a
  11040. }
  11041. });
  11042. Object.defineProperty(PIXI.DisplayObject.prototype, "scaleX", {
  11043. get: function() {
  11044. return this.scale.x
  11045. },
  11046. set: function(a) {
  11047. this.scale.x = a
  11048. }
  11049. });
  11050. Object.defineProperty(PIXI.DisplayObject.prototype, "scaleY", {
  11051. get: function() {
  11052. return this.scale.y
  11053. },
  11054. set: function(a) {
  11055. this.scale.y = a
  11056. }
  11057. });
  11058. Object.defineProperty(PIXI.DisplayObject.prototype, "scaleXY", {
  11059. set: function(a) {
  11060. this.scale.x = a;
  11061. this.scale.y = a
  11062. }
  11063. });
  11064. a.Container.prototype.destroy = function() {
  11065. this.removeAllChildren();
  11066. this.parent && this.parent.removeChild(this)
  11067. };
  11068. Object.defineProperty(PIXI.Sprite.prototype, "anchorX", {
  11069. get: function() {
  11070. return this.anchor.x
  11071. },
  11072. set: function(a) {
  11073. this.anchor.x = a
  11074. }
  11075. });
  11076. Object.defineProperty(PIXI.Sprite.prototype, "anchorY", {
  11077. get: function() {
  11078. return this.anchor.y
  11079. },
  11080. set: function(a) {
  11081. this.anchor.y = a
  11082. }
  11083. });
  11084. Object.defineProperty(PIXI.Sprite.prototype, "anchorXY", {
  11085. set: function(a) {
  11086. this.anchor.x = a;
  11087. this.anchor.y = a
  11088. }
  11089. });
  11090. a.Preloader = function() {
  11091. if (null == f) throw Error("ENEA.Preloader : ENEA.Game needs to be initialized first");
  11092. this.loaded = this.count = 0;
  11093. this.list = []
  11094. };
  11095. a.Preloader.prototype.start = function() {
  11096. var a = this;
  11097. this.loader = new PIXI.AssetLoader(this.list);
  11098. this.loader.onProgress = function() {
  11099. a.loaded++;
  11100. if (a.onProgress) a.onProgress()
  11101. };
  11102. this.loader.onComplete = function() {
  11103. if (a.onComplete) a.onComplete()
  11104. };
  11105. this.loader.load()
  11106. };
  11107. a.Preloader.prototype.add = function(a) {
  11108. this.list.push(a);
  11109. this.count++
  11110. };
  11111. a.Preloader.prototype.addImage = function(a) {
  11112. this.list.push(a);
  11113. this.count++
  11114. };
  11115. a.Preloader.prototype.addBitmapFont = function(a, b) {
  11116. this.list.push(a);
  11117. this.count++;
  11118. this.list.push(b);
  11119. this.count++
  11120. };
  11121. a.Preloader.prototype.addAtlas = function(a, b) {
  11122. this.list.push(a);
  11123. this.count++;
  11124. this.list.push(b);
  11125. this.count++
  11126. };
  11127. a.ProgressBar = function(a) {
  11128. if (null == f) throw Error("ENEA.ProgressBar : ENEA.Game needs to be initialized first");
  11129. this._checkParameters(a);
  11130. this.loaded = 0;
  11131. this.error = !1;
  11132. this._x = f.centerX - this.pbParams.width / 2;
  11133. this._y = f.centerY - this.pbParams.height / 2;
  11134. this._step = this.pbParams.width / this.pbParams.count;
  11135. null == this.pbParams.bitmap ? this.draw() : (this.bitmapDimensions = this.pbParams.bitmap.frame, this.pbParams.bitmap.setFrame(new PIXI.Rectangle(this.bitmapDimensions.x, this.bitmapDimensions.y, 1, this.bitmapDimensions.height)), this._step = this.bitmapDimensions.width / this.pbParams.count)
  11136. };
  11137. a.ProgressBar.prototype._checkParameters = function(b) {
  11138. var c = {
  11139. silent: !1,
  11140. width: Math.floor(f.width / 1.5),
  11141. height: 2,
  11142. text: "LOADING",
  11143. fontFace: "Tahoma",
  11144. fontSize: "11pt",
  11145. fontColor: "#FFFFFF",
  11146. bgColor: 8421504,
  11147. fgColor: 16777215,
  11148. errColor: 16711680,
  11149. count: 1,
  11150. bitmap: null
  11151. };
  11152. this.pbParams = null == b || "undefined" == b ? c: a.mergeParams(c, b)
  11153. };
  11154. a.ProgressBar.prototype.draw = function() {
  11155. this.pbParams.silent || (this.container = new PIXI.DisplayObjectContainer, f.stage.addChild(this.container), navigator.isCocoonJS || (this.pbText = new PIXI.Text(this.pbParams.text, {
  11156. font: this.pbParams.fontSize + " " + this.pbParams.fontFace,
  11157. fill: this.pbParams.fontColor,
  11158. align: "center"
  11159. }), this.pbText.position.x = f.centerX - this.pbText.width / 2, this.pbText.position.y = this._y - this.pbText.height - 2, this.container.addChild(this.pbText)), this.graphics = new PIXI.Graphics, this.graphics.beginFill(this.pbParams.bgColor, 1), this.graphics.lineStyle(0, this.pbParams.bgColor, 1), this.graphics.drawRect(this._x, this._y, this.pbParams.width, this.pbParams.height), this.graphics.endFill(), this.container.addChild(this.graphics))
  11160. };
  11161. a.ProgressBar.prototype.update = function() {
  11162. this.pbParams.silent || (null == this.pbParams.bitmap ? (this.graphics.clear(), this.graphics.beginFill(this.pbParams.bgColor, 1), this.graphics.lineStyle(0, this.pbParams.bgColor, 1), this.graphics.drawRect(this._x + this._step * this.loaded, this._y, this.pbParams.width - this._step * this.loaded, this.pbParams.height), this.graphics.endFill(), this.graphics.beginFill(this.error ? this.pbParams.errColor: this.pbParams.fgColor, 1), this.graphics.lineStyle(0, this.error ? this.pbParams.errColor: this.pbParams.fgColor, 1), this.graphics.drawRect(this._x, this._y, this._step * this.loaded, this.pbParams.height), this.graphics.endFill()) : this.pbParams.bitmap.setFrame(new PIXI.Rectangle(this.bitmapDimensions.x, this.bitmapDimensions.y, this._step * this.loaded, this.bitmapDimensions.height)));
  11163. if (this.loaded >= this.pbParams.count && (null != this.pbParams.bitmap && this.pbParams.bitmap.setFrame(new PIXI.Rectangle(this.bitmapDimensions.x, this.bitmapDimensions.y, this.bitmapDimensions.width, this.bitmapDimensions.height)), this.onComplete)) this.onComplete()
  11164. };
  11165. a.ProgressBar.prototype.removeAllChildren = function() {
  11166. try {
  11167. for (; this.container.children.length;) this.container.children[0].destroy && this.container.children[0].destroy(),
  11168. this.container.removeChild(this.container.children[0])
  11169. } catch(a) {
  11170. throw Error("ENEA.ProgressBar.removeAllChildren : can't delete all children");
  11171. }
  11172. };
  11173. a.ProgressBar.prototype.destroy = function() {
  11174. this.pbParams.silent || null != this.pbParams.bitmap || (this.graphics.clear(), this.removeAllChildren(), this.container.parent && this.container.parent.removeChild(this.container))
  11175. };
  11176. a.Timer = function() {
  11177. this._isActive = !1;
  11178. this._addToStartTime = 0;
  11179. this._dirty = !1
  11180. };
  11181. a.Timer.prototype.reset = function() {
  11182. this.timerStart = 0;
  11183. this.timerEnd = null;
  11184. this.isPaused = !1;
  11185. this._pauseStart = Date.now();
  11186. this._pauseTime = 0;
  11187. this._isActive = !1;
  11188. this._dirty || (this._addToStartTime = 0)
  11189. };
  11190. a.Timer.prototype.start = function() {
  11191. this.reset();
  11192. this._isActive = !0;
  11193. this.timerStart = Date.now();
  11194. if (null !== this.onStarted) this.onStarted()
  11195. };
  11196. a.Timer.prototype.addStartTime = function(a) {
  11197. this._addToStartTime = a;
  11198. this._dirty = !0
  11199. };
  11200. a.Timer.prototype.isActive = function() {
  11201. return this._isActive
  11202. };
  11203. a.Timer.prototype.stop = function() {
  11204. this.isPaused && this.resume();
  11205. this._dirty = this._isActive = !1;
  11206. this.timerEnd = Date.now();
  11207. if (null !== this.onStopped) this.onStopped()
  11208. };
  11209. a.Timer.prototype.pause = function() {
  11210. if (!this.isPaused && (this._pauseStart = Date.now(), this.isPaused = !0, null !== this.onPaused)) this.onPaused()
  11211. };
  11212. a.Timer.prototype.resume = function() {
  11213. if (this.isPaused && (this._pauseEnd = Date.now(), this.isPaused = !1, this._pauseTime += this._pauseEnd - this._pauseStart, null !== this.onResumed)) this.onResumed()
  11214. };
  11215. a.Timer.prototype.onStarted = function() {};
  11216. a.Timer.prototype.onPaused = function() {};
  11217. a.Timer.prototype.onResumed = function() {};
  11218. a.Timer.prototype.onStopped = function() {};
  11219. a.Timer.prototype.getTotalTime = function() {
  11220. return null == this.timerEnd ? !1 : this.timerEnd - this.timerStart + this._addToStartTime
  11221. };
  11222. a.Timer.prototype.getExecutionTime = function() {
  11223. var a = Date.now();
  11224. return this.isPaused ? a - this.timerStart - (a - this._pauseStart) + this._addToStartTime - this._pauseTime: null == this.timerEnd ? a - this.timerStart - this._pauseTime + this._addToStartTime: this.timerEnd - this.timerStart - this._pauseTime + this._addToStartTime
  11225. };
  11226. a.Emitter = function(b) {
  11227. var c = {
  11228. spawnTime: 1,
  11229. maxParticles: 20,
  11230. x: 0,
  11231. y: 0,
  11232. dxInterval: [ - 0.5, 0.5],
  11233. dyInterval: [ - 0.5, 0.5],
  11234. liveInterval: [500, 1E3],
  11235. frameRate: 60
  11236. };
  11237. this.params = null == b || "undefined" == b ? c: a.mergeParams(c, b);
  11238. this._now = this._delta = null;
  11239. this._then = Date.now();
  11240. this._emiting = !1;
  11241. this._currentSpawned = this._lastSpawned = null;
  11242. this.frameRate = this.params.frameRate;
  11243. this._spawnTime = this.params.spawnTime;
  11244. this.maxParticles = this.params.maxParticles;
  11245. this.x = this.params.x;
  11246. this.y = this.params.y;
  11247. this.particles = Array(this.maxParticles)
  11248. };
  11249. a.Emitter.prototype.init = function() {
  11250. for (var a = 0; a < this.maxParticles; a++) this.particles[a] = this.createParticle()
  11251. };
  11252. a.Emitter.prototype.initDead = function() {
  11253. for (var a = 0; a < this.maxParticles; a++) this.particles[a] = this.createParticle(),
  11254. this.particles[a].dead = !0
  11255. };
  11256. a.Emitter.prototype.createParticle = function() {
  11257. return {
  11258. x: this.x,
  11259. y: this.y,
  11260. dx: a.randomInterval(this.params.dxInterval[0], this.params.dxInterval[1]),
  11261. dy: a.randomInterval(this.params.dyInterval[0], this.params.dyInterval[1]),
  11262. dead: !1,
  11263. live: a.randomInterval(this.params.liveInterval[0], this.params.liveInterval[1])
  11264. }
  11265. };
  11266. a.Emitter.prototype.setDxInterval = function(a, b) {
  11267. this.params.dxInterval[0] = a;
  11268. this.params.dxInterval[1] = b
  11269. };
  11270. a.Emitter.prototype.setDyInterval = function(a, b) {
  11271. this.params.dyInterval[0] = a;
  11272. this.params.dyInterval[1] = b
  11273. };
  11274. a.Emitter.prototype.setLiveInterval = function(a, b) {
  11275. this.params.liveInterval[0] = a;
  11276. this.params.liveInterval[1] = b
  11277. };
  11278. a.Emitter.prototype.update = function() {
  11279. this._now = Date.now();
  11280. this._delta = this._now - this._then;
  11281. for (var a = 0; a < this.maxParticles; a++) this.particles[a].live -= this._delta,
  11282. 0 < this.particles[a].live ? (this.particles[a].x += this.calculate(this._delta, this.particles[a].dx), this.particles[a].y += this.calculate(this._delta, this.particles[a].dy)) : this._emiting ? (this._currentSpawned = Date.now(), this._currentSpawned - this._lastSpawned <= this._spawnTime && (this._lastSpawned = this._currentSpawned, this.particles[a] = this.createParticle())) : this.particles[a].dead = !0;
  11283. this._then = this._now
  11284. };
  11285. a.Emitter.prototype.calculate = function(a, b) {
  11286. return this.frameRate / 1E3 * a * b
  11287. };
  11288. a.Emitter.prototype.start = function() {
  11289. this._emiting = !0;
  11290. this._lastSpawned = Date.now()
  11291. };
  11292. a.Emitter.prototype.stop = function() {
  11293. this._emiting = !1
  11294. };
  11295. a.createCanvas = function(b) {
  11296. var c = {
  11297. id: "eneaDefaultCanvas",
  11298. width: 2,
  11299. height: 2,
  11300. border: "1px solid",
  11301. display: "none"
  11302. };
  11303. this.params = null == b || "undefined" == b ? c: a.mergeParams(c, b);
  11304. this.canvas = document.createElement(a._isCocoonJS ? "screencanvas": "canvas");
  11305. this.canvas.id = this.params.id;
  11306. this.canvas.width = this.params.width;
  11307. this.canvas.height = this.params.height;
  11308. this.canvas.style.border = this.params.border;
  11309. this.canvas.style.display = this.params.display;
  11310. document.body.appendChild(this.canvas);
  11311. this.context = this.canvas.getContext("2d");
  11312. null == this.context && console.log("ENEA.createCanvas error : context is null")
  11313. };
  11314. a.createCanvas.prototype.getTexture = function() {
  11315. return PIXI.Texture.fromCanvas(this.canvas)
  11316. };
  11317. a.createCanvas.prototype.destroy = function() {
  11318. this.canvas.parentNode.removeChild(this.canvas)
  11319. };
  11320. a.randomInterval = function(a, b) {
  11321. return Math.random() * (b - a) + a
  11322. };
  11323. a.Orientation = function() {
  11324. if (!a._isDesktop) {
  11325. if (isNaN(a._isOrientation)) throw Error("ENEA.Orientation : device doesn't support window.orientation method");
  11326. this.check();
  11327. var b = this;
  11328. window.addEventListener("orientationchange",
  11329. function() {
  11330. b.check();
  11331. b.onChangeOrientation()
  11332. },
  11333. !1)
  11334. }
  11335. };
  11336. a.Orientation.prototype.check = function() {
  11337. if (90 === Math.abs(window.orientation)) {
  11338. if (f._isLandscape = !0, f._isPortrait = !1, f.forcePortrait) this.onWrongOrientation()
  11339. } else if (f._isPortrait = !0, f._isLandscape = !1, f.forceLandscape) this.onWrongOrientation()
  11340. };
  11341. a.Orientation.prototype.onWrongOrientation = function() {
  11342. if ("function" == typeof f.onWrongOrientation) f.onWrongOrientation()
  11343. };
  11344. a.Orientation.prototype.onChangeOrientation = function() {
  11345. f.resize();
  11346. if ("function" == typeof f.onChangeOrientation) f.onChangeOrientation()
  11347. };
  11348. a.Language = function() {
  11349. this._defaultLanguage = "en";
  11350. this.languageDirectoryPath = "lang/";
  11351. this.forceLanguage = null;
  11352. this._isAddressBarLang = !1;
  11353. this._langsrc = this._language = null
  11354. };
  11355. a.Language.prototype._checkAddressBar = function() {
  11356. try {
  11357. var a = window.location.href.split("?");
  11358. 1 != a.length && (a = a[1].split("="), "lang" == a[0] && "" != a[1] && (this._isAddressBarLang = !0, this._language = a[1]))
  11359. } catch(b) {
  11360. console.log("Error : " + b)
  11361. }
  11362. return this._isAddressBarLang
  11363. };
  11364. a.Language.prototype.start = function() {
  11365. var a = document.createElement("script");
  11366. a.type = "text/javascript";
  11367. this._langsrc = this.languageDirectoryPath;
  11368. this._langsrc = null != this.forceLanguage ? this._langsrc + this.forceLanguage: this._langsrc + (this._checkAddressBar() ? this._language: this._defaultLanguage);
  11369. this._langsrc += ".js";
  11370. a.src = this._langsrc;
  11371. var b = this;
  11372. a.onload = function() {
  11373. if ("function" == typeof b.onLoad) b.onLoad()
  11374. };
  11375. document.getElementsByTagName("head")[0].appendChild(a)
  11376. };
  11377. a.fadeElement = function(b, c, d, e, f, g) {
  11378. var h = {
  11379. something: c
  11380. };
  11381. c = {
  11382. something: d
  11383. }; (new a.Tweener.Tween(h)).to(c, e).easing(a.Tweener.Easing.Linear.None).onStart(function() {
  11384. f && f.call()
  11385. }).onUpdate(function() {
  11386. b.alpha = a.normalize(h.something)
  11387. }).onComplete(function() {
  11388. g && g.call()
  11389. }).start()
  11390. };
  11391. a.hideAddressBar = function() {
  11392. a._isCocoonjs || (a.viewporter.preventPageScroll = !0, a.viewporter.forceDetection = !0, a.viewporter.refresh());
  11393. f.resize()
  11394. };
  11395. a.randomString = function() {
  11396. return Math.floor(Date.now() * Math.random()).toString()
  11397. };
  11398. a.normalize = function(a) {
  11399. return 1 < a ? 1 : 0 > a ? 0 : a
  11400. };
  11401. a.mergeParams = function(a, b) {
  11402. for (var c in a) for (var d in b) c == d && null != b[d] && (a[c] = b[d]);
  11403. return a
  11404. };
  11405. a.emptyTween = function(b, c) { (new a.Tweener.Tween({
  11406. something: 1
  11407. })).to({
  11408. something: 1
  11409. },
  11410. b).easing(a.Tweener.Easing.Linear.None).onComplete(function() {
  11411. c && c.call()
  11412. }).start()
  11413. };
  11414. a._storage = function() {
  11415. this.id = "enea.sk"
  11416. };
  11417. a._storage.prototype = {
  11418. get: function(a, b) {
  11419. var c = localStorage.getItem(this.id + "." + a);
  11420. return null == c ? b: c
  11421. },
  11422. set: function(a, b) {
  11423. localStorage.setItem(this.id + "." + a, b)
  11424. },
  11425. remove: function(a) {
  11426. localStorage.removeItem(this.id + "." + a)
  11427. },
  11428. has: function(a) {
  11429. return null !== localStorage.getItem(this.id + "." + a)
  11430. },
  11431. removeAllById: function() {
  11432. for (var a = localStorage.length - 1; 0 <= a; a--) {
  11433. var b = localStorage.key(a); - 1 !== b.indexOf(this.id + ".") && localStorage.removeItem(b)
  11434. }
  11435. }
  11436. };
  11437. a._isLocalStorage ? a.Storage = new a._storage: console.log("ENEA : localStorage is not available");
  11438. a.seededRandom = function(b, c) {
  11439. c = c || 0;
  11440. a.SEED = (9301 * a.SEED + 49297) % 233280;
  11441. return c + a.SEED / 233280 * ((b || 1) - c)
  11442. };
  11443. a.debug = function() {
  11444. console.log("---------------------------");
  11445. for (var b in a) a.hasOwnProperty(b) && ("function" == typeof a[b] ? console.log("%c" + b + " : function", "color: #00b") : "object" == typeof a[b] ? console.log("%c" + b + " : object", "color: #0b0") : console.log(b + " : " + a[b]));
  11446. console.log("---------------------------")
  11447. };
  11448. "undefined" !== typeof exports ? ("undefined" !== typeof module && module.exports && (exports = module.exports = a), exports.ENEA = a) : this.ENEA = a
  11449. }).call(this);
  11450. ENEA.Signal = function() {
  11451. this._bindings = [];
  11452. this._prevParams = null;
  11453. var a = this;
  11454. this.dispatch = function() {
  11455. ENEA.Signal.prototype.dispatch.apply(a, arguments)
  11456. }
  11457. };
  11458. ENEA.Signal.prototype = {
  11459. VERSION: "::VERSION_NUMBER::",
  11460. memorize: !1,
  11461. _shouldPropagate: !0,
  11462. active: !0,
  11463. validateListener: function(a, f) {
  11464. if ("function" !== typeof a) throw Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}", f));
  11465. },
  11466. _registerListener: function(a, f, h, n) {
  11467. var p = this._indexOfListener(a, h);
  11468. if ( - 1 !== p) {
  11469. if (a = this._bindings[p], a.isOnce() !== f) throw Error("You cannot add" + (f ? "": "Once") + "() then add" + (f ? "Once": "") + "() the same listener without removing the relationship first.");
  11470. } else a = new ENEA.SignalBinding(this, a, f, h, n),
  11471. this._addBinding(a);
  11472. this.memorize && this._prevParams && a.execute(this._prevParams);
  11473. return a
  11474. },
  11475. _addBinding: function(a) {
  11476. var f = this._bindings.length;
  11477. do--f;
  11478. while (this._bindings[f] && a._priority <= this._bindings[f]._priority);
  11479. this._bindings.splice(f + 1, 0, a)
  11480. },
  11481. _indexOfListener: function(a, f) {
  11482. for (var h = this._bindings.length,
  11483. n; h--;) if (n = this._bindings[h], n._listener === a && n.context === f) return h;
  11484. return - 1
  11485. },
  11486. has: function(a, f) {
  11487. return - 1 !== this._indexOfListener(a, f)
  11488. },
  11489. add: function(a, f, h) {
  11490. this.validateListener(a, "add");
  11491. return this._registerListener(a, !1, f, h)
  11492. },
  11493. addOnce: function(a, f, h) {
  11494. this.validateListener(a, "addOnce");
  11495. return this._registerListener(a, !0, f, h)
  11496. },
  11497. remove: function(a, f) {
  11498. this.validateListener(a, "remove");
  11499. var h = this._indexOfListener(a, f); - 1 !== h && (this._bindings[h]._destroy(), this._bindings.splice(h, 1));
  11500. return a
  11501. },
  11502. removeAll: function() {
  11503. for (var a = this._bindings.length; a--;) this._bindings[a]._destroy();
  11504. this._bindings.length = 0
  11505. },
  11506. getNumListeners: function() {
  11507. return this._bindings.length
  11508. },
  11509. halt: function() {
  11510. this._shouldPropagate = !1
  11511. },
  11512. dispatch: function(a) {
  11513. if (this.active) {
  11514. var f = Array.prototype.slice.call(arguments),
  11515. h = this._bindings.length,
  11516. n;
  11517. this.memorize && (this._prevParams = f);
  11518. if (h) {
  11519. n = this._bindings.slice();
  11520. this._shouldPropagate = !0;
  11521. do h--;
  11522. while (n[h] && this._shouldPropagate && !1 !== n[h].execute(f))
  11523. }
  11524. }
  11525. },
  11526. forget: function() {
  11527. this._prevParams = null
  11528. },
  11529. dispose: function() {
  11530. this.removeAll();
  11531. delete this._bindings;
  11532. delete this._prevParams
  11533. },
  11534. toString: function() {
  11535. return "[Signal active:" + this.active + " numListeners:" + this.getNumListeners() + "]"
  11536. }
  11537. };
  11538. ENEA.Signal.prototype.constructor = ENEA.Signal;
  11539. ENEA.SignalBinding = function(a, f, h, n, p) {
  11540. this._listener = f;
  11541. this._isOnce = h;
  11542. this.context = n;
  11543. this._signal = a;
  11544. this._priority = p || 0
  11545. };
  11546. ENEA.SignalBinding.prototype = {
  11547. active: !0,
  11548. params: null,
  11549. execute: function(a) {
  11550. var f;
  11551. this.active && this._listener && (a = this.params ? this.params.concat(a) : a, f = this._listener.apply(this.context, a), this._isOnce && this.detach());
  11552. return f
  11553. },
  11554. detach: function() {
  11555. return this.isBound() ? this._signal.remove(this._listener, this.context) : null
  11556. },
  11557. isBound: function() {
  11558. return !! this._signal && !!this._listener
  11559. },
  11560. isOnce: function() {
  11561. return this._isOnce
  11562. },
  11563. getListener: function() {
  11564. return this._listener
  11565. },
  11566. getSignal: function() {
  11567. return this._signal
  11568. },
  11569. _destroy: function() {
  11570. delete this._signal;
  11571. delete this._listener;
  11572. delete this.context
  11573. },
  11574. toString: function() {
  11575. return "[SignalBinding isOnce:" + this._isOnce + ", isBound:" + this.isBound() + ", active:" + this.active + "]"
  11576. }
  11577. };
  11578. ENEA.SignalBinding.prototype.constructor = ENEA.SignalBinding;
  11579. void 0 === Date.now && (Date.now = function() {
  11580. return (new Date).valueOf()
  11581. });
  11582. ENEA.Tweener = ENEA.Tweener ||
  11583. function() {
  11584. var a = [];
  11585. return {
  11586. REVISION: "14",
  11587. getAll: function() {
  11588. return a
  11589. },
  11590. removeAll: function() {
  11591. a = []
  11592. },
  11593. add: function(f) {
  11594. a.push(f)
  11595. },
  11596. remove: function(f) {
  11597. f = a.indexOf(f); - 1 !== f && a.splice(f, 1)
  11598. },
  11599. update: function(f) {
  11600. if (0 === a.length) return ! 1;
  11601. var h = 0;
  11602. for (f = void 0 !== f ? f: "undefined" !== typeof window && void 0 !== window.performance && void 0 !== window.performance.now ? window.performance.now() : Date.now(); h < a.length;) a[h].update(f) ? h++:a.splice(h, 1);
  11603. return ! 0
  11604. }
  11605. }
  11606. } ();
  11607. ENEA.Tweener.Tween = function(a) {
  11608. var f = {},
  11609. h = {},
  11610. n = {},
  11611. p = 1E3,
  11612. b = 0,
  11613. d = !1,
  11614. c = !1,
  11615. e = 0,
  11616. g = null,
  11617. r = ENEA.Tweener.Easing.Linear.None,
  11618. k = ENEA.Tweener.Interpolation.Linear,
  11619. l = [],
  11620. t = null,
  11621. v = null,
  11622. q = null,
  11623. y = null,
  11624. s = null,
  11625. u;
  11626. for (u in a) f[u] = parseFloat(a[u], 10);
  11627. this.to = function(a, b) {
  11628. void 0 !== b && (p = b);
  11629. h = a;
  11630. return this
  11631. };
  11632. this.start = function(b) {
  11633. ENEA.Tweener.add(this);
  11634. c = !0;
  11635. g = void 0 !== b ? b: "undefined" !== typeof window && void 0 !== window.performance && void 0 !== window.performance.now ? window.performance.now() : Date.now();
  11636. g += e;
  11637. for (var d in h) {
  11638. if (h[d] instanceof Array) {
  11639. if (0 === h[d].length) continue;
  11640. h[d] = [a[d]].concat(h[d])
  11641. }
  11642. f[d] = a[d]; ! 1 === f[d] instanceof Array && (f[d] *= 1);
  11643. n[d] = f[d] || 0
  11644. }
  11645. return this
  11646. };
  11647. this.stop = function() {
  11648. if (!c) return this;
  11649. ENEA.Tweener.remove(this);
  11650. c = !1;
  11651. null !== s && s.dispatch(a);
  11652. s = y = q = v = t = null;
  11653. this.stopChainedTweens();
  11654. return this
  11655. };
  11656. this.stopChainedTweens = function() {
  11657. for (var a = 0,
  11658. b = l.length; a < b; a++) l[a].stop()
  11659. };
  11660. this.delay = function(a) {
  11661. e = a;
  11662. return this
  11663. };
  11664. this.repeat = function(a) {
  11665. b = a;
  11666. return this
  11667. };
  11668. this.yoyo = function(a) {
  11669. d = a;
  11670. return this
  11671. };
  11672. this.easing = function(a) {
  11673. r = a;
  11674. return this
  11675. };
  11676. this.interpolation = function(a) {
  11677. k = a;
  11678. return this
  11679. };
  11680. this.chain = function() {
  11681. l = arguments;
  11682. return this
  11683. };
  11684. this.onStart = function(a) {
  11685. t = new ENEA.Signal;
  11686. t.addOnce(a);
  11687. return this
  11688. };
  11689. this.onUpdate = function(a) {
  11690. v = a;
  11691. return this
  11692. };
  11693. this.onComplete = function(a) {
  11694. q = new ENEA.Signal;
  11695. q.addOnce(a);
  11696. return this
  11697. };
  11698. this.onYoyo = function(a) {
  11699. y = new ENEA.Signal;
  11700. y.add(a);
  11701. return this
  11702. };
  11703. this.onStop = function(a) {
  11704. s = new ENEA.Signal;
  11705. s.addOnce(a);
  11706. return this
  11707. };
  11708. this.update = function(c) {
  11709. var s;
  11710. if (c < g) return ! 0;
  11711. null !== t && (t.dispatch(a), t = null);
  11712. var u = (c - g) / p,
  11713. u = 1 < u ? 1 : u,
  11714. D = r(u);
  11715. for (s in h) {
  11716. var B = f[s] || 0,
  11717. F = h[s];
  11718. F instanceof Array ? a[s] = k(F, D) : ("string" === typeof F && (F = B + parseFloat(F, 10)), "number" === typeof F && (a[s] = B + (F - B) * D))
  11719. }
  11720. null !== v && v.call(a, D);
  11721. if (1 == u) if (0 < b) {
  11722. isFinite(b) && b--;
  11723. for (s in n)"string" === typeof h[s] && (n[s] += parseFloat(h[s], 10)),
  11724. d && (u = n[s], n[s] = h[s], h[s] = u),
  11725. f[s] = n[s];
  11726. d && null !== y && y.dispatch(a);
  11727. g = c + e
  11728. } else {
  11729. null !== q && q.dispatch(a);
  11730. s = 0;
  11731. for (u = l.length; s < u; s++) l[s].start(c);
  11732. return ! 1
  11733. }
  11734. return ! 0
  11735. }
  11736. };
  11737. ENEA.Tweener.Easing = {
  11738. Linear: {
  11739. None: function(a) {
  11740. return a
  11741. }
  11742. },
  11743. Quadratic: {
  11744. In: function(a) {
  11745. return a * a
  11746. },
  11747. Out: function(a) {
  11748. return a * (2 - a)
  11749. },
  11750. InOut: function(a) {
  11751. return 1 > (a *= 2) ? 0.5 * a * a: -0.5 * (--a * (a - 2) - 1)
  11752. }
  11753. },
  11754. Cubic: {
  11755. In: function(a) {
  11756. return a * a * a
  11757. },
  11758. Out: function(a) {
  11759. return--a * a * a + 1
  11760. },
  11761. InOut: function(a) {
  11762. return 1 > (a *= 2) ? 0.5 * a * a * a: 0.5 * ((a -= 2) * a * a + 2)
  11763. }
  11764. },
  11765. Quartic: {
  11766. In: function(a) {
  11767. return a * a * a * a
  11768. },
  11769. Out: function(a) {
  11770. return 1 - --a * a * a * a
  11771. },
  11772. InOut: function(a) {
  11773. return 1 > (a *= 2) ? 0.5 * a * a * a * a: -0.5 * ((a -= 2) * a * a * a - 2)
  11774. }
  11775. },
  11776. Quintic: {
  11777. In: function(a) {
  11778. return a * a * a * a * a
  11779. },
  11780. Out: function(a) {
  11781. return--a * a * a * a * a + 1
  11782. },
  11783. InOut: function(a) {
  11784. return 1 > (a *= 2) ? 0.5 * a * a * a * a * a: 0.5 * ((a -= 2) * a * a * a * a + 2)
  11785. }
  11786. },
  11787. Sinusoidal: {
  11788. In: function(a) {
  11789. return 1 - Math.cos(a * Math.PI / 2)
  11790. },
  11791. Out: function(a) {
  11792. return Math.sin(a * Math.PI / 2)
  11793. },
  11794. InOut: function(a) {
  11795. return 0.5 * (1 - Math.cos(Math.PI * a))
  11796. }
  11797. },
  11798. Exponential: {
  11799. In: function(a) {
  11800. return 0 === a ? 0 : Math.pow(1024, a - 1)
  11801. },
  11802. Out: function(a) {
  11803. return 1 === a ? 1 : 1 - Math.pow(2, -10 * a)
  11804. },
  11805. InOut: function(a) {
  11806. return 0 === a ? 0 : 1 === a ? 1 : 1 > (a *= 2) ? 0.5 * Math.pow(1024, a - 1) : 0.5 * ( - Math.pow(2, -10 * (a - 1)) + 2)
  11807. }
  11808. },
  11809. Circular: {
  11810. In: function(a) {
  11811. return 1 - Math.sqrt(1 - a * a)
  11812. },
  11813. Out: function(a) {
  11814. return Math.sqrt(1 - --a * a)
  11815. },
  11816. InOut: function(a) {
  11817. return 1 > (a *= 2) ? -0.5 * (Math.sqrt(1 - a * a) - 1) : 0.5 * (Math.sqrt(1 - (a -= 2) * a) + 1)
  11818. }
  11819. },
  11820. Elastic: {
  11821. In: function(a) {
  11822. var f, h = 0.1;
  11823. if (0 === a) return 0;
  11824. if (1 === a) return 1; ! h || 1 > h ? (h = 1, f = 0.1) : f = 0.4 * Math.asin(1 / h) / (2 * Math.PI);
  11825. return - (h * Math.pow(2, 10 * (a -= 1)) * Math.sin(2 * (a - f) * Math.PI / 0.4))
  11826. },
  11827. Out: function(a) {
  11828. var f, h = 0.1;
  11829. if (0 === a) return 0;
  11830. if (1 === a) return 1; ! h || 1 > h ? (h = 1, f = 0.1) : f = 0.4 * Math.asin(1 / h) / (2 * Math.PI);
  11831. return h * Math.pow(2, -10 * a) * Math.sin(2 * (a - f) * Math.PI / 0.4) + 1
  11832. },
  11833. InOut: function(a) {
  11834. var f, h = 0.1;
  11835. if (0 === a) return 0;
  11836. if (1 === a) return 1; ! h || 1 > h ? (h = 1, f = 0.1) : f = 0.4 * Math.asin(1 / h) / (2 * Math.PI);
  11837. return 1 > (a *= 2) ? -0.5 * h * Math.pow(2, 10 * (a -= 1)) * Math.sin(2 * (a - f) * Math.PI / 0.4) : h * Math.pow(2, -10 * (a -= 1)) * Math.sin(2 * (a - f) * Math.PI / 0.4) * 0.5 + 1
  11838. }
  11839. },
  11840. Back: {
  11841. In: function(a) {
  11842. return a * a * (2.70158 * a - 1.70158)
  11843. },
  11844. Out: function(a) {
  11845. return--a * a * (2.70158 * a + 1.70158) + 1
  11846. },
  11847. InOut: function(a) {
  11848. return 1 > (a *= 2) ? 0.5 * a * a * (3.5949095 * a - 2.5949095) : 0.5 * ((a -= 2) * a * (3.5949095 * a + 2.5949095) + 2)
  11849. }
  11850. },
  11851. Bounce: {
  11852. In: function(a) {
  11853. return 1 - ENEA.Tweener.Easing.Bounce.Out(1 - a)
  11854. },
  11855. Out: function(a) {
  11856. return a < 1 / 2.75 ? 7.5625 * a * a: a < 2 / 2.75 ? 7.5625 * (a -= 1.5 / 2.75) * a + 0.75 : a < 2.5 / 2.75 ? 7.5625 * (a -= 2.25 / 2.75) * a + 0.9375 : 7.5625 * (a -= 2.625 / 2.75) * a + 0.984375
  11857. },
  11858. InOut: function(a) {
  11859. return 0.5 > a ? 0.5 * ENEA.Tweener.Easing.Bounce.In(2 * a) : 0.5 * ENEA.Tweener.Easing.Bounce.Out(2 * a - 1) + 0.5
  11860. }
  11861. }
  11862. };
  11863. ENEA.Tweener.Interpolation = {
  11864. Linear: function(a, f) {
  11865. var h = a.length - 1,
  11866. n = h * f,
  11867. p = Math.floor(n),
  11868. b = ENEA.Tweener.Interpolation.Utils.Linear;
  11869. return 0 > f ? b(a[0], a[1], n) : 1 < f ? b(a[h], a[h - 1], h - n) : b(a[p], a[p + 1 > h ? h: p + 1], n - p)
  11870. },
  11871. Bezier: function(a, f) {
  11872. var h = 0,
  11873. n = a.length - 1,
  11874. p = Math.pow,
  11875. b = ENEA.Tweener.Interpolation.Utils.Bernstein,
  11876. d;
  11877. for (d = 0; d <= n; d++) h += p(1 - f, n - d) * p(f, d) * a[d] * b(n, d);
  11878. return h
  11879. },
  11880. CatmullRom: function(a, f) {
  11881. var h = a.length - 1,
  11882. n = h * f,
  11883. p = Math.floor(n),
  11884. b = ENEA.Tweener.Interpolation.Utils.CatmullRom;
  11885. return a[0] === a[h] ? (0 > f && (p = Math.floor(n = h * (1 + f))), b(a[(p - 1 + h) % h], a[p], a[(p + 1) % h], a[(p + 2) % h], n - p)) : 0 > f ? a[0] - (b(a[0], a[0], a[1], a[1], -n) - a[0]) : 1 < f ? a[h] - (b(a[h], a[h], a[h - 1], a[h - 1], n - h) - a[h]) : b(a[p ? p - 1 : 0], a[p], a[h < p + 1 ? h: p + 1], a[h < p + 2 ? h: p + 2], n - p)
  11886. },
  11887. Utils: {
  11888. Linear: function(a, f, h) {
  11889. return (f - a) * h + a
  11890. },
  11891. Bernstein: function(a, f) {
  11892. var h = ENEA.Tweener.Interpolation.Utils.Factorial;
  11893. return h(a) / h(f) / h(a - f)
  11894. },
  11895. Factorial: function() {
  11896. var a = [1];
  11897. return function(f) {
  11898. var h = 1,
  11899. n;
  11900. if (a[f]) return a[f];
  11901. for (n = f; 1 < n; n--) h *= n;
  11902. return a[f] = h
  11903. }
  11904. } (),
  11905. CatmullRom: function(a, f, h, n, p) {
  11906. a = 0.5 * (h - a);
  11907. n = 0.5 * (n - f);
  11908. var b = p * p;
  11909. return (2 * f - 2 * h + a + n) * p * b + ( - 3 * f + 3 * h - 2 * a - n) * b + a * p + f
  11910. }
  11911. }
  11912. };
  11913. "undefined" !== typeof module && module.exports && (module.exports = ENEA.Tweener); (function() {
  11914. var a;
  11915. ENEA.viewporter = {
  11916. forceDetection: !1,
  11917. disableLegacyAndroid: !0,
  11918. ACTIVE: function() {
  11919. return ENEA.viewporter.disableLegacyAndroid && /android 2/i.test(navigator.userAgent) || /ipad/i.test(navigator.userAgent) ? !1 : /webos/i.test(navigator.userAgent) || "ontouchstart" in window ? !0 : !1
  11920. },
  11921. READY: !1,
  11922. isLandscape: function() {
  11923. return 90 === window.orientation || -90 === window.orientation
  11924. },
  11925. ready: function(a) {
  11926. window.addEventListener("viewportready", a, !1)
  11927. },
  11928. change: function(a) {
  11929. window.addEventListener("viewportchange", a, !1)
  11930. },
  11931. refresh: function() {
  11932. a && a.prepareVisualViewport()
  11933. },
  11934. preventPageScroll: function() {
  11935. document.body.addEventListener("touchmove",
  11936. function(a) {
  11937. a.preventDefault()
  11938. },
  11939. !1);
  11940. document.body.addEventListener("touchstart",
  11941. function() {
  11942. a.prepareVisualViewport()
  11943. },
  11944. !1)
  11945. }
  11946. };
  11947. ENEA.viewporter.ACTIVE = ENEA.viewporter.ACTIVE();
  11948. if (ENEA.viewporter.ACTIVE) {
  11949. var f = function() {
  11950. var a = this;
  11951. this.IS_ANDROID = /Android/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent);
  11952. var f = function() {
  11953. a.prepareVisualViewport();
  11954. var f = window.orientation;
  11955. window.addEventListener("orientationchange",
  11956. function() {
  11957. window.orientation !== f && (a.prepareVisualViewport(), f = window.orientation)
  11958. },
  11959. !1)
  11960. };
  11961. "loading" === document.readyState ? document.addEventListener("DOMContentLoaded",
  11962. function() {
  11963. f()
  11964. },
  11965. !1) : f()
  11966. };
  11967. f.prototype = {
  11968. getProfile: function() {
  11969. if (ENEA.viewporter.forceDetection) return null;
  11970. for (var a in ENEA.viewporter.profiles) if ((new RegExp(a)).test(navigator.userAgent)) return ENEA.viewporter.profiles[a];
  11971. return null
  11972. },
  11973. postProcess: function() {
  11974. ENEA.viewporter.READY = !0;
  11975. this.triggerWindowEvent(this._firstUpdateExecuted ? "viewportchange": "viewportready");
  11976. this._firstUpdateExecuted = !0
  11977. },
  11978. prepareVisualViewport: function() {
  11979. var a = this;
  11980. if (navigator.standalone) return this.postProcess();
  11981. document.documentElement.style.minHeight = "5000px";
  11982. var f = window.innerHeight,
  11983. p = this.getProfile(),
  11984. b = ENEA.viewporter.isLandscape() ? "landscape": "portrait";
  11985. window.scrollTo(0, a.IS_ANDROID ? 1 : 0);
  11986. var d = 40,
  11987. c = window.setInterval(function() {
  11988. window.scrollTo(0, a.IS_ANDROID ? 1 : 0);
  11989. d--;
  11990. if ((a.IS_ANDROID ? p && window.innerHeight === p[b] : window.innerHeight > f) || 0 > d) document.documentElement.style.minHeight = window.innerHeight + "px",
  11991. document.getElementById("viewporter").style.position = "relative",
  11992. document.getElementById("viewporter").style.height = window.innerHeight + "px",
  11993. clearInterval(c),
  11994. a.postProcess()
  11995. },
  11996. 10)
  11997. },
  11998. triggerWindowEvent: function(a) {
  11999. var f = document.createEvent("Event");
  12000. f.initEvent(a, !1, !1);
  12001. window.dispatchEvent(f)
  12002. }
  12003. };
  12004. a = new f
  12005. }
  12006. })();
  12007. ENEA.viewporter.profiles = {
  12008. "iPhone|iPod": {
  12009. ppi: function() {
  12010. return 2 <= window.devicePixelRatio ? 326 : 163
  12011. },
  12012. width: function(a, f) {
  12013. return a * window.devicePixelRatio
  12014. },
  12015. height: function(a, f) {
  12016. return f * window.devicePixelRatio
  12017. },
  12018. chromePrescale: function(a, f, h) {
  12019. return 2 <= window.devicePixelRatio ? (navigator.standalone ? 0 : ENEA.viewporter.isLandscape() ? 100 : 124) * h + 2 : (navigator.standalone ? 0 : ENEA.viewporter.isLandscape() ? 50 : 62) * h + 2
  12020. }
  12021. },
  12022. iPad: {
  12023. ppi: 132,
  12024. chrome: function(a, f) {
  12025. return navigator.standalone ? 0 : /OS 5_/.test(navigator.userAgent) ? 96 : 78
  12026. }
  12027. },
  12028. "GT-I9000|GT-I9100|Nexus S": {
  12029. ppi: function() {
  12030. if (/GT-I9000/.test(navigator.userAgent) || /GT-I9100/.test(navigator.userAgent)) return 239.3;
  12031. if (/Nexus S/.test(navigator.userAgent)) return 239
  12032. },
  12033. width: 800,
  12034. height: 480,
  12035. chrome: 38
  12036. },
  12037. MZ601: {
  12038. ppi: 160,
  12039. portrait: {
  12040. width: function(a, f) {
  12041. return f
  12042. },
  12043. height: function(a, f) {
  12044. return a
  12045. }
  12046. },
  12047. chrome: 152,
  12048. inverseLandscape: !0
  12049. },
  12050. "GT-P1000": {
  12051. width: 1024,
  12052. height: 600,
  12053. portrait: {
  12054. chrome: 38
  12055. }
  12056. },
  12057. "Desire_A8181|DesireHD_A9191": {
  12058. width: 800,
  12059. height: 480
  12060. },
  12061. TF101: {
  12062. ppi: 160,
  12063. portrait: {
  12064. width: function(a, f) {
  12065. return f
  12066. },
  12067. height: function(a, f) {
  12068. return a
  12069. }
  12070. },
  12071. chrome: 103,
  12072. inverseLandscape: !0
  12073. },
  12074. A500: {
  12075. portrait: {
  12076. width: function(a, f) {
  12077. return f
  12078. },
  12079. height: function(a, f) {
  12080. return a
  12081. }
  12082. },
  12083. inverseLandscape: !0
  12084. }
  12085. }; (function() {
  12086. var a = a || {};
  12087. a.FADETIME = 250;
  12088. a._isKik = !1;
  12089. a._isNuggeta = !1;
  12090. a.Music = null;
  12091. a._musicMuted = !1;
  12092. a.Sounds = null;
  12093. a._soundsMuted = !1;
  12094. a._isAudioUnlocked = !1;
  12095. a.achieved = null;
  12096. a.game = null;
  12097. a._tutorialHeight = 50;
  12098. a._tutorialIsRunning = !1;
  12099. ENEA.Storage.id = "ninja.enea.sk";
  12100. ENEA._isHD = !1;
  12101. a.InitGame = function() {
  12102. this.gameParams = {
  12103. width: ENEA._isHD ? 1248 : 624,
  12104. height: ENEA._isHD ? 2080 : 1040,
  12105. background: 0,
  12106. keepAspectRatio: !1,
  12107. forcePortrait: !0
  12108. };
  12109. this.start();
  12110. this.checkMusic();
  12111. this.checkAchievements();
  12112. new a.Layers(a.game);
  12113. this.preloader()
  12114. };
  12115. a.InitGame.prototype = {
  12116. checkAchievements: function() {
  12117. a.game.achievements = new a.ReadAchievements;
  12118. a.achieved = a.game.achievements.read()
  12119. },
  12120. start: function() {
  12121. a.game = new ENEA.Game(this.gameParams, "FOTN-game-container");
  12122. ENEA._isDesktop || this.handleViewporter();
  12123. a.game.setContextSmoothing(!0);
  12124. a.game.render();
  12125. ENEA._isDesktop && PIXI.canUseNewCanvasBlendModes() && (a.CANBLEND = !0);
  12126. a.game.resolution = ENEA._isHD ? "hd": "sd"
  12127. },
  12128. checkMusic: function() {
  12129. ENEA.Storage.has("music") || ENEA.Storage.set("music", 0);
  12130. a._musicMuted = !!parseInt(ENEA.Storage.get("music"));
  12131. ENEA.Storage.has("sounds") || ENEA.Storage.set("sounds", 0);
  12132. a._soundsMuted = !!parseInt(ENEA.Storage.get("sounds"))
  12133. },
  12134. handleViewporter: function() {
  12135. document.getElementById("lock").style.display = "block";
  12136. window.addEventListener("viewportready",
  12137. function() {
  12138. ENEA.hideAddressBar()
  12139. },
  12140. !1)
  12141. },
  12142. preloader: function() {
  12143. var f = this;
  12144. this.loaderFiles = {
  12145. preloader: "media/" + a.game.resolution + "/preloader.png",
  12146. preloader_desc: "media/" + a.game.resolution + "/preloader.json"
  12147. };
  12148. this.loader = new ENEA.Preloader;
  12149. for (var h in this.loaderFiles) this.loader.add(this.loaderFiles[h]);
  12150. this.loader.onComplete = function() {
  12151. f.drawLoader(a.game); (new a.Loader(a.game)).onComplete = f.prepareGame.bind(f)
  12152. };
  12153. this.loader.start()
  12154. },
  12155. drawLoader: function(f) {
  12156. f.loaderBG = PIXI.Texture.fromFrame("loadingbar_bg.png");
  12157. f.loaderFG = PIXI.Texture.fromFrame("loadingbar.png");
  12158. f.loaderImage = PIXI.Texture.fromFrame("loadingtitle.png");
  12159. f.loaderWhite = PIXI.Texture.fromFrame("loadingwhite.png");
  12160. f.loaderLogo = PIXI.Texture.fromFrame("loadinglogo.png");
  12161. f.loaderNinja = PIXI.Texture.fromFrame("loadingninja.png");
  12162. f.loaderContainer.addChild(new ENEA.Sprite({
  12163. texture: f.loaderWhite,
  12164. anchorXY: 0.5,
  12165. scaleXY: 20,
  12166. x: f.centerX,
  12167. y: f.centerY
  12168. }));
  12169. f.loaderContainer.addChild(new ENEA.Sprite({
  12170. texture: f.loaderLogo,
  12171. anchorXY: 0.5,
  12172. x: f.centerX,
  12173. y: f.relY(0.25)
  12174. }));
  12175. f.loaderNinjaSprite = (new ENEA.Sprite({
  12176. texture: f.loaderNinja,
  12177. anchorXY: 0.5,
  12178. x: f.centerX,
  12179. y: f.relY(0.6)
  12180. })).addTo(f.loaderContainer);
  12181. f.loaderLoadingSprite = (new ENEA.Sprite({
  12182. texture: f.loaderImage,
  12183. anchorXY: 0.5,
  12184. x: f.centerX,
  12185. y: f.relY(0.855)
  12186. })).addTo(f.loaderContainer);
  12187. f.loaderBgSprite = (new ENEA.Sprite({
  12188. texture: f.loaderBG,
  12189. anchorXY: 0.5,
  12190. x: f.centerX,
  12191. y: f.relY(0.9)
  12192. })).addTo(f.loaderContainer);
  12193. f.loaderFgSprite = (new ENEA.Sprite({
  12194. texture: f.loaderFG,
  12195. anchorX: 0,
  12196. anchorY: 0.5,
  12197. x: f.centerX - f.loaderFG.width / 2,
  12198. y: f.relY(0.9)
  12199. })).addTo(f.loaderContainer);
  12200. ENEA._isDesktop && (f.loaderYes = PIXI.Texture.fromFrame("loadingyes.png"), f.loaderNo = PIXI.Texture.fromFrame("loadingno.png"), f.loaderSounds = PIXI.Texture.fromFrame("loadingsounds.png"), f.loaderSoundsSprite = (new ENEA.Sprite({
  12201. texture: f.loaderSounds,
  12202. anchorX: 0.5,
  12203. anchorY: 0.5,
  12204. visible: !1,
  12205. x: f.centerX,
  12206. y: f.relY(0.55)
  12207. })).addTo(f.loaderContainer), f.loaderYesSprite = (new ENEA.Sprite({
  12208. texture: f.loaderYes,
  12209. anchorX: 0.5,
  12210. anchorY: 0.5,
  12211. visible: !1,
  12212. x: f.centerX - f.relX(0.13),
  12213. y: f.relY(0.65)
  12214. })).addTo(f.loaderContainer), f.loaderYesSprite.click = f.loaderYesSprite.tap = function() {
  12215. a._musicMuted = !1;
  12216. a._soundsMuted = !1;
  12217. ENEA.Storage.set("music", a._musicMuted ? 1 : 0);
  12218. ENEA.Storage.set("sounds", a._soundsMuted ? 1 : 0);
  12219. this.answer && this.answer.call()
  12220. },
  12221. f.loaderNoSprite = (new ENEA.Sprite({
  12222. texture: f.loaderNo,
  12223. anchorX: 0.5,
  12224. anchorY: 0.5,
  12225. visible: !1,
  12226. x: f.centerX + f.relX(0.13),
  12227. y: f.relY(0.65)
  12228. })).addTo(f.loaderContainer), f.loaderNoSprite.click = f.loaderNoSprite.tap = function() {
  12229. a._musicMuted = !0;
  12230. a._soundsMuted = !0;
  12231. ENEA.Storage.set("music", a._musicMuted ? 1 : 0);
  12232. ENEA.Storage.set("sounds", a._soundsMuted ? 1 : 0);
  12233. this.answer && this.answer.call()
  12234. })
  12235. },
  12236. prepareGame: function() {
  12237. a.game.bitmapFont = ENEA._isHD ? {
  12238. font: "176px sauna",
  12239. align: "center"
  12240. }: {
  12241. font: "88px sauna",
  12242. align: "center"
  12243. };
  12244. a.game.Camera = new a.Camera;
  12245. new a.DrawGame(a.game, a.game.gameScreen);
  12246. ENEA._isDesktop && new a.DrawSettings(a.game, a.game.settings);
  12247. if (1 == parseInt(ENEA.Storage.get("tutorial")) || parseInt(ENEA.Storage.get("best")) < a._tutorialHeight) a.game.tutorialContainer = new ENEA.Container,
  12248. a.game.tutorialContainer.visible = !1,
  12249. a.game.stage.addChild(a.game.tutorialContainer),
  12250. a.game.tutorial = new a.DrawTutorial(a.game, a.game.tutorialContainer);
  12251. a.game.unlocked = new a.DrawAchievementUnlocked(a.game, a.game.achievementContainer);
  12252. new a.DrawGameOver(a.game, a.game.gameOverScreen);
  12253. new a.DrawMenu(a.game, a.game.menuScreen);
  12254. new a.MenuIN(a.game, a.game.menuScreen)
  12255. }
  12256. };
  12257. a.showButtonsState = function(f) {
  12258. this.game.buttonsContainer.position.y = 0;
  12259. switch (f) {
  12260. case "menu":
  12261. this.game.buttonsContainer.visible = !0;
  12262. this.game.buttonsContainer.bottomButtons.x = 0;
  12263. this.game.button_restart.applyParams({
  12264. visible: !1,
  12265. responsive: !1
  12266. });
  12267. this.game.button_start.applyParams({
  12268. visible: !0,
  12269. responsive: !0
  12270. });
  12271. this.game.button_achievements.applyParams({
  12272. visible: !0,
  12273. responsive: !0
  12274. });
  12275. this.game.button_leaderboard.applyParams({
  12276. visible: a._isNuggeta ? !0 : !1,
  12277. responsive: a._isNuggeta ? !0 : !1
  12278. });
  12279. this.game.button_moregames.applyParams({
  12280. visible: !0,
  12281. responsive: !0
  12282. });
  12283. this.game.button_kik.applyParams({
  12284. visible: a._isKik ? !0 : !1,
  12285. responsive: a._isKik ? !0 : !1
  12286. });
  12287. this.game.button_facebook.applyParams({
  12288. visible: !0,
  12289. responsive: !0
  12290. });
  12291. this.game.button_twitter.applyParams({
  12292. visible: !0,
  12293. responsive: !0
  12294. });
  12295. this.game.button_home.applyParams({
  12296. visible: !1,
  12297. responsive: !1
  12298. });
  12299. break;
  12300. case "achievements":
  12301. this.game.buttonsContainer.bottomButtons.x = 0;
  12302. this.game.buttonsContainer.visible = !0;
  12303. this.game.button_restart.applyParams({
  12304. visible: !1,
  12305. responsive: !1
  12306. });
  12307. this.game.button_start.applyParams({
  12308. visible: !1,
  12309. responsive: !1
  12310. });
  12311. this.game.button_achievements.applyParams({
  12312. visible: !1,
  12313. responsive: !1
  12314. });
  12315. this.game.button_leaderboard.applyParams({
  12316. visible: !1,
  12317. responsive: !1
  12318. });
  12319. this.game.button_moregames.applyParams({
  12320. visible: !0,
  12321. responsive: !0
  12322. });
  12323. this.game.button_kik.applyParams({
  12324. visible: a._isKik ? !0 : !1,
  12325. responsive: a._isKik ? !0 : !1
  12326. });
  12327. this.game.button_facebook.applyParams({
  12328. visible: !0,
  12329. responsive: !0
  12330. });
  12331. this.game.button_twitter.applyParams({
  12332. visible: !0,
  12333. responsive: !0
  12334. });
  12335. this.game.button_home.applyParams({
  12336. visible: !1,
  12337. responsive: !1
  12338. });
  12339. break;
  12340. case "leaderboards":
  12341. this.game.buttonsContainer.bottomButtons.x = 0;
  12342. this.game.buttonsContainer.visible = !0;
  12343. this.game.button_restart.applyParams({
  12344. visible: !1,
  12345. responsive: !1
  12346. });
  12347. this.game.button_start.applyParams({
  12348. visible: !1,
  12349. responsive: !1
  12350. });
  12351. this.game.button_achievements.applyParams({
  12352. visible: !1,
  12353. responsive: !1
  12354. });
  12355. this.game.button_leaderboard.applyParams({
  12356. visible: !1,
  12357. responsive: !1
  12358. });
  12359. this.game.button_moregames.applyParams({
  12360. visible: !0,
  12361. responsive: !0
  12362. });
  12363. this.game.button_kik.applyParams({
  12364. visible: a._isKik ? !0 : !1,
  12365. responsive: a._isKik ? !0 : !1
  12366. });
  12367. this.game.button_facebook.applyParams({
  12368. visible: !0,
  12369. responsive: !0
  12370. });
  12371. this.game.button_twitter.applyParams({
  12372. visible: !0,
  12373. responsive: !0
  12374. });
  12375. this.game.button_home.applyParams({
  12376. visible: !1,
  12377. responsive: !1
  12378. });
  12379. break;
  12380. case "game":
  12381. this.game.buttonsContainer.bottomButtons.x = 0;
  12382. this.game.buttonsContainer.visible = !1;
  12383. this.game.button_restart.applyParams({
  12384. visible: !1,
  12385. responsive: !1
  12386. });
  12387. this.game.button_start.applyParams({
  12388. visible: !1,
  12389. responsive: !1
  12390. });
  12391. this.game.button_achievements.applyParams({
  12392. visible: !1,
  12393. responsive: !1
  12394. });
  12395. this.game.button_leaderboard.applyParams({
  12396. visible: !1,
  12397. responsive: !1
  12398. });
  12399. this.game.button_moregames.applyParams({
  12400. visible: !1,
  12401. responsive: !1
  12402. });
  12403. this.game.button_kik.applyParams({
  12404. visible: !1,
  12405. responsive: !1
  12406. });
  12407. this.game.button_facebook.applyParams({
  12408. visible: !1,
  12409. responsive: !1
  12410. });
  12411. this.game.button_twitter.applyParams({
  12412. visible: !1,
  12413. responsive: !1
  12414. });
  12415. this.game.button_home.applyParams({
  12416. visible: !1,
  12417. responsive: !1
  12418. });
  12419. break;
  12420. case "over":
  12421. this.game.buttonsContainer.bottomButtons.x = 0,
  12422. this.game.buttonsContainer.visible = !0,
  12423. this.game.button_restart.applyParams({
  12424. visible: !0,
  12425. responsive: !0
  12426. }),
  12427. this.game.button_start.applyParams({
  12428. visible: !1,
  12429. responsive: !1
  12430. }),
  12431. this.game.button_achievements.applyParams({
  12432. visible: !1,
  12433. responsive: !1
  12434. }),
  12435. this.game.button_leaderboard.applyParams({
  12436. visible: !1,
  12437. responsive: !1
  12438. }),
  12439. this.game.button_moregames.applyParams({
  12440. visible: !0,
  12441. responsive: !0
  12442. }),
  12443. this.game.button_kik.applyParams({
  12444. visible: a._isKik ? !0 : !1,
  12445. responsive: a._isKik ? !0 : !1
  12446. }),
  12447. this.game.button_facebook.applyParams({
  12448. visible: !0,
  12449. responsive: !0
  12450. }),
  12451. this.game.button_twitter.applyParams({
  12452. visible: !0,
  12453. responsive: !0
  12454. }),
  12455. this.game.button_home.applyParams({
  12456. visible: !0,
  12457. responsive: !0
  12458. })
  12459. }
  12460. };
  12461. window.onload = function() {
  12462. new a.InitGame
  12463. };
  12464. window.addEventListener("touchstart",
  12465. function() {
  12466. this.removeEventListener("touchstart", arguments.callee, !1);
  12467. try {
  12468. window.AudioContext = window.AudioContext || window.webkitAudioContext;
  12469. var f = new AudioContext,
  12470. h = f.createBuffer(1, 1, 22050),
  12471. n = f.createBufferSource();
  12472. n.buffer = h;
  12473. n.connect(f.destination);
  12474. n.noteOn(0);
  12475. setTimeout(function() {
  12476. if (n.playbackState === n.PLAYING_STATE || n.playbackState === n.FINISHED_STATE) a._isAudioUnlocked = !0
  12477. },
  12478. 500)
  12479. } catch(p) {
  12480. console.log("Web Audio API is not supported")
  12481. }
  12482. },
  12483. !1);
  12484. "undefined" !== typeof exports ? ("undefined" !== typeof module && module.exports && (exports = module.exports = a), exports.FOTN = a) : this.FOTN = a
  12485. }).call(this);
  12486. FOTN.Achievements = function(a, f) {
  12487. var h = this;
  12488. this.game = a;
  12489. this.layer = f;
  12490. this.currentPage = 0;
  12491. this.maxItems = 7;
  12492. this.titleTop = a.relY(0.055);
  12493. this.itemsTop = a.relY(0.15);
  12494. this.spacing = this.game.relY(0.103);
  12495. this.layer.removeAllChildren();
  12496. this.bgLayer = new FOTN.BGScroller(this.game);
  12497. this.layer.addChild(this.bgLayer);
  12498. this.drawTitle();
  12499. this.drawItems();
  12500. this.drawButtons();
  12501. this.drawShine();
  12502. this.fadeIN();
  12503. this.game.addUpdate("scrollBG",
  12504. function() {
  12505. h.bgLayer.layerCamera.y -= 0.005;
  12506. h.bgLayer.updatePosition();
  12507. h.layer.shine.rotation += 0.005
  12508. })
  12509. };
  12510. FOTN.Achievements.prototype = {
  12511. drawTitle: function() {
  12512. this.titleSprite = new PIXI.Text("Achievements", {
  12513. font: (ENEA._isHD ? 100 : 50) + "px Sauna-BlackItalic",
  12514. fill: "#FFFFFF",
  12515. align: "center"
  12516. });
  12517. this.titleSprite.applyParams({
  12518. x: this.game.centerX - this.titleSprite.width / 2,
  12519. y: this.titleTop - this.titleSprite.height / 2
  12520. }).addTo(this.layer)
  12521. },
  12522. doSeppuku: function() {
  12523. this.destroyItems();
  12524. this.titleSprite.destroy(!0)
  12525. },
  12526. destroyItems: function() {
  12527. if (this.itemsContainer instanceof ENEA.Container) {
  12528. for (; this.itemsContainer.children.length;) this.itemsContainer.children[0].doSeppuku && this.itemsContainer.children[0].doSeppuku(),
  12529. this.itemsContainer.removeChild(this.itemsContainer.children[0]);
  12530. this.itemsContainer.destroy()
  12531. }
  12532. },
  12533. getPercent: function(a) {
  12534. var f = 0;
  12535. 4 <= a && 8 >= a && (f = parseInt(ENEA.Storage.get("longrunner")) / FOTN._desired[a]);
  12536. 12 <= a && 14 >= a && (f = parseInt(ENEA.Storage.get("longslider")) / FOTN._desired[a]);
  12537. 15 <= a && 17 >= a && (f = parseInt(ENEA.Storage.get("reincarnation")) / FOTN._desired[a]);
  12538. 18 <= a && 20 >= a && (f = parseInt(FOTN.achieved[a]) / FOTN._desired[a]);
  12539. return f
  12540. },
  12541. drawItems: function() {
  12542. this.destroyItems();
  12543. this.itemsContainer = new ENEA.Container;
  12544. this.layer.addChild(this.itemsContainer);
  12545. for (var a = this.currentPage * this.maxItems,
  12546. f = 0; f < this.maxItems && a < FOTN._achievements.data.length;) {
  12547. var h = new FOTN.AchievementsItem(this.game, [this.game.textures[FOTN._achievements.data[a].locked], this.game.textures[FOTN._achievements.data[a].unlocked]], FOTN._achievements.data[a].name, FOTN._achievements.data[a].description, FOTN.achieved[a] == FOTN.game.achievements.done ? !1 : !0, this.getPercent(a));
  12548. h.x = this.game.centerX;
  12549. h.y = this.itemsTop + this.spacing * f;
  12550. this.itemsContainer.addChild(h);
  12551. a++;
  12552. f++
  12553. }
  12554. },
  12555. drawButtons: function() {
  12556. var a = this,
  12557. f = this.game.relY(0.855),
  12558. h = this.game.relX(0.228);
  12559. this.game.button_downArrow.applyParams({
  12560. x: a.game.centerX - h,
  12561. y: f,
  12562. visible: !0,
  12563. onClick: function() {
  12564. a.currentPage++;
  12565. a.currentPage * a.maxItems >= FOTN._achievements.data.length ? a.currentPage--:a.drawItems()
  12566. }
  12567. }).addTo(this.layer);
  12568. this.game.button_upArrow.applyParams({
  12569. x: a.game.centerX,
  12570. y: f,
  12571. visible: !0,
  12572. onClick: function() {
  12573. a.currentPage--;
  12574. 0 > a.currentPage ? a.currentPage++:a.drawItems()
  12575. }
  12576. }).addTo(this.layer);
  12577. this.game.button_homeSmall.applyParams({
  12578. x: this.game.centerX + h,
  12579. y: f,
  12580. visible: !0,
  12581. onClick: function() {
  12582. a.doSeppuku();
  12583. a.game.removeAllUpdates();
  12584. ENEA.Tweener.removeAll();
  12585. a.game.achievementsScreen.visible = !1;
  12586. a.game.leaderboardsScreen.visible = !1;
  12587. a.game.gameOverScreen.visible = !1;
  12588. a.game.gameScreen.visible = !1;
  12589. ENEA._isDesktop && (a.game.settings.visible = !1);
  12590. FOTN.showButtonsState("menu");
  12591. a.game.buttonsContainer.visible = !1;
  12592. new FOTN.MenuIN(FOTN.game, FOTN.game.menuScreen)
  12593. }
  12594. }).addTo(this.layer);
  12595. this.game.button_homeSmall.callforward = function() {}
  12596. },
  12597. fadeIN: function(a) {
  12598. var f = this;
  12599. ENEA.fadeElement(this.layer, 0, 1, FOTN.FADETIME,
  12600. function() {
  12601. ENEA._isDesktop && (f.game.settings.visible = !0);
  12602. f.layer.visible = !0;
  12603. FOTN.showButtonsState("achievements")
  12604. },
  12605. a)
  12606. },
  12607. drawShine: function() {
  12608. this.layer.shine = (new ENEA.Sprite({
  12609. texture: this.game.textures.shine,
  12610. anchorXY: 0.5,
  12611. scaleXY: 2,
  12612. x: this.game.centerX,
  12613. y: this.game.relY( - 0.05)
  12614. })).addTo(this.layer)
  12615. }
  12616. };
  12617. FOTN.AchievementsItem = function(a, f, h, n, p, b) {
  12618. this.game = a;
  12619. this._isLocked = p || !1;
  12620. this.pictures = f;
  12621. this.percent = void 0 === b ? 0 : b;
  12622. this.text = h;
  12623. this.description = n;
  12624. this.positions = {
  12625. pictureX: this.game.relX( - 0.241),
  12626. pictureY: this.game.relY(0),
  12627. textX: this.game.relX( - 0.152),
  12628. textY: this.game.relY( - 0.014),
  12629. descX: this.game.relX( - 0.152),
  12630. descY: this.game.relY(0.018)
  12631. };
  12632. ENEA.Container.call(this);
  12633. this.drawBackground();
  12634. this.drawPictures();
  12635. this.drawText();
  12636. this.drawDescription()
  12637. };
  12638. FOTN.AchievementsItem.prototype = Object.create(ENEA.Container.prototype);
  12639. FOTN.AchievementsItem.prototype.constructor = FOTN.AchievementsItem;
  12640. FOTN.AchievementsItem.prototype.drawBackground = function() {
  12641. this.bgSprite = (new ENEA.Sprite({
  12642. texture: this.game.textures.itemBg,
  12643. anchorX: 0.5,
  12644. anchorY: 0.5
  12645. })).addTo(this)
  12646. };
  12647. FOTN.AchievementsItem.prototype.doSeppuku = function() {
  12648. this.textSprite.destroy(!0);
  12649. this.descriptionSprite.destroy(!0);
  12650. null !== this.tmpTexture && this.tmpTexture.destroy(!0)
  12651. };
  12652. FOTN.AchievementsItem.prototype.drawPictures = function() {
  12653. this.pic1Sprite = (new ENEA.Sprite({
  12654. texture: this.pictures[0],
  12655. x: this.positions.pictureX,
  12656. y: this.positions.pictureY,
  12657. anchorX: 0.5,
  12658. anchorY: 0.5
  12659. })).addTo(this);
  12660. this.tmpTexture = null;
  12661. if (this._isLocked) {
  12662. var a = Math.floor(this.percent * this.pictures[1].height);
  12663. if (0 !== a) {
  12664. var f = {
  12665. id: "eneaDefaultCanvas",
  12666. width: this.pictures[1].width,
  12667. height: this.pictures[1].height,
  12668. border: "1px solid",
  12669. display: "inline"
  12670. },
  12671. h = new ENEA.createCanvas(f);
  12672. h.context.drawImage(this.pictures[1].baseTexture.source, this.pictures[1].crop.x, this.pictures[1].crop.y + f.height - a, this.pictures[1].crop.width, a, 0, f.height - a, this.pictures[1].crop.width, a);
  12673. this.tmpTexture = h.getTexture();
  12674. h.destroy()
  12675. }
  12676. }
  12677. this.pic2Sprite = (new ENEA.Sprite({
  12678. texture: null == this.tmpTexture ? this.pictures[1] : this.tmpTexture,
  12679. x: this.positions.pictureX,
  12680. y: this.positions.pictureY,
  12681. visible: null == this.tmpTexture ? !1 : !0,
  12682. anchorX: 0.5,
  12683. anchorY: 0.5
  12684. })).addTo(this);
  12685. this.locked = this._isLocked
  12686. };
  12687. FOTN.AchievementsItem.prototype.drawText = function() {
  12688. this.textSprite = new PIXI.Text(this.text, {
  12689. font: (ENEA._isHD ? 76 : 38) + "px Sauna-BlackItalic",
  12690. fill: "#FFFFFF",
  12691. align: "center"
  12692. });
  12693. this.textSprite.applyParams({
  12694. x: this.positions.textX,
  12695. y: this.positions.textY - this.textSprite.height / 2
  12696. }).addTo(this)
  12697. };
  12698. FOTN.AchievementsItem.prototype.drawDescription = function() {
  12699. this.descriptionSprite = new PIXI.Text(this.description, {
  12700. font: (ENEA._isHD ? 50 : 25) + "px Sauna-BlackItalic",
  12701. fill: "#FFFFFF",
  12702. align: "center"
  12703. });
  12704. this.descriptionSprite.applyParams({
  12705. x: this.positions.descX,
  12706. y: this.positions.descY - this.descriptionSprite.height / 2
  12707. }).addTo(this)
  12708. };
  12709. Object.defineProperty(FOTN.AchievementsItem.prototype, "locked", {
  12710. get: function() {
  12711. return this._isLocked
  12712. },
  12713. set: function(a) { (this._isLocked = a) ? this.pic1Sprite.visible = !0 : (this.pic1Sprite.visible = !1, this.pic2Sprite.visible = !0)
  12714. }
  12715. });
  12716. FOTN.BGScroller = function(a) {
  12717. this.game = a;
  12718. this.layerCamera = new PIXI.Point(0, 0);
  12719. this.bgPattern = [0, 0, 0, 0, 0, 0];
  12720. this.bgPatternLength = this.bgPattern.length;
  12721. this.leftBorder = this.game.relX(0.11);
  12722. this.rightBorder = this.game.relX(0.89);
  12723. this.textures = [this.game.textures.bg1, this.game.textures.bg2, this.game.textures.bg3];
  12724. this.stageHeight = 20;
  12725. this.tileHeight = this.stageHeight / 4;
  12726. this.meter = this.game.height / this.stageHeight;
  12727. this.bgOffset = Math.floor(this.meter * this.tileHeight);
  12728. PIXI.DisplayObjectContainer.call(this);
  12729. this.createPool();
  12730. this.resetAll()
  12731. };
  12732. FOTN.BGScroller.prototype = Object.create(PIXI.DisplayObjectContainer.prototype);
  12733. FOTN.BGScroller.prototype.constructor = FOTN.BGScroller;
  12734. FOTN.BGScroller.prototype.resetAll = function() {
  12735. this.repeat = this.y = this.x = 0;
  12736. this.updatePosition()
  12737. };
  12738. FOTN.BGScroller.prototype.createPool = function() {
  12739. this.maxObjects = 5;
  12740. this._poolBG = [];
  12741. this._poolLS = [];
  12742. this._poolRS = [];
  12743. for (var a = 0; a < this.maxObjects; a++) {
  12744. var f = new PIXI.Sprite(this.textures[0]);
  12745. f.anchorX = 0.5;
  12746. f.anchorY = 1;
  12747. f.x = this.game.centerX;
  12748. this.addChild(f);
  12749. this._poolBG.push(f)
  12750. }
  12751. for (a = 0; a < this.maxObjects; a++) f = new PIXI.Sprite(this.game.textures.sideLeft),
  12752. f.anchorX = 0,
  12753. f.anchorY = 1,
  12754. f.x = 0,
  12755. this.addChild(f),
  12756. this._poolLS.push(f);
  12757. for (a = 0; a < this.maxObjects; a++) f = new PIXI.Sprite(this.game.textures.sideRight),
  12758. f.anchorX = 1,
  12759. f.anchorY = 1,
  12760. f.x = this.game.width,
  12761. this.addChild(f),
  12762. this._poolRS.push(f)
  12763. };
  12764. FOTN.BGScroller.prototype.updatePosition = function() {
  12765. this.position.y = this.game.height - this.meter * this.layerCamera.y;
  12766. for (var a, f = ~~ (this.position.y / this.bgOffset), h = ~~ (this.game.height - Math.abs(f * this.bgOffset)), n = 0; n < this.maxObjects; n++) a = this.textures[this.bgPattern[(n + f) % this.bgPatternLength]],
  12767. this._poolBG[n].texture !== a && this._poolBG[n].setTexture(a),
  12768. this._poolBG[n].position.y = h,
  12769. this._poolLS[n].position.y = h,
  12770. this._poolRS[n].position.y = h,
  12771. h -= this.bgOffset
  12772. };
  12773. FOTN.Button = function(a) {
  12774. this.textures = a;
  12775. PIXI.Sprite.call(this, this.textures[0]);
  12776. this.responsive = !0;
  12777. this.anchorXY = 0.5;
  12778. this.disabled = !1;
  12779. this._clickDelta = this._lastClickTime = this._currentClickTime = null;
  12780. this._bugTime = 400;
  12781. ENEA._isDesktop || this.tap || !this.click || (this.tap = this.click);
  12782. ENEA._isDesktop || this.touchmove || !this.mousemove || (this.touchmove = this.mousemove);
  12783. ENEA._isDesktop || this.touchstart || !this.mousedown || (this.touchstart = this.mousedown);
  12784. ENEA._isDesktop || this.touchend || !this.mouseup || (this.touchend = this.mouseup);
  12785. ENEA._isDesktop || this.touchendoutside || !this.mouseupoutside || (this.touchendoutside = this.mouseupoutside)
  12786. };
  12787. FOTN.Button.prototype = Object.create(PIXI.Sprite.prototype);
  12788. FOTN.Button.prototype.constructor = FOTN.Button;
  12789. FOTN.Button.prototype.normal = function() {
  12790. this.setTexture(this.textures[0])
  12791. };
  12792. FOTN.Button.prototype.hover = function() {
  12793. 1 < this.textures.length && this.setTexture(this.textures[1])
  12794. };
  12795. FOTN.Button.prototype.pressed = function() {
  12796. 2 < this.textures.length && this.setTexture(this.textures[2])
  12797. };
  12798. FOTN.Button.prototype.enable = function() {
  12799. this.disabled = !1;
  12800. this.normal()
  12801. };
  12802. FOTN.Button.prototype.disable = function() {
  12803. 3 < this.textures.length && (this.disabled = !0, this.setTexture(this.textures[3]))
  12804. };
  12805. FOTN.Button.prototype.mouseover = function() {
  12806. this.disabled || this.hover()
  12807. };
  12808. FOTN.Button.prototype.mouseout = function() {
  12809. this.disabled || this.normal()
  12810. };
  12811. FOTN.Button.prototype.mousedown = FOTN.Button.prototype.touchstart = function() {
  12812. this.disabled || (this._currentClickTime = Date.now(), this._clickDelta = this._currentClickTime - this._lastClickTime, this._clickDelta < this._bugTime || this.pressed(), this._lastClickTime = this._currentClickTime)
  12813. };
  12814. FOTN.Button.prototype.mouseup = FOTN.Button.prototype.touchend = function() {
  12815. this.disabled || (this.normal(), FOTN._soundsMuted || ENEA._isIE || !ENEA._isDesktop || FOTN.Sounds.play("button"), this.onClick && this.onClick.call())
  12816. };
  12817. FOTN.Button.prototype.touchendoutside = function() {
  12818. this.disabled || this.normal()
  12819. };
  12820. FOTN.Camera = function(a) {
  12821. this.game = a;
  12822. PIXI.Point.call(this, 0, 0);
  12823. this.playerOffset = 6
  12824. };
  12825. FOTN.Camera.prototype = Object.create(PIXI.Point.prototype);
  12826. FOTN.Camera.prototype.constructor = FOTN.Camera;
  12827. FOTN.DrawAchievementUnlocked = function(a, f) {
  12828. this.game = a;
  12829. this.layer = f;
  12830. this.isOut = !1;
  12831. this.init()
  12832. };
  12833. FOTN.DrawAchievementUnlocked.prototype = {
  12834. init: function() {
  12835. this.unlockedSprite = (new ENEA.Sprite({
  12836. texture: this.game.textures.ach_unlocked,
  12837. anchorX: 0.5,
  12838. anchorY: 1,
  12839. x: this.game.centerX + this.game.relX(0.07),
  12840. y: -10
  12841. })).addTo(this.layer);
  12842. this.unlockedIconSprite = (new ENEA.Sprite({
  12843. texture: this.game.textures.ach_fastRunner,
  12844. anchorX: 0.5,
  12845. anchorY: 1,
  12846. x: this.game.centerX - this.game.relX(0.18),
  12847. y: -10
  12848. })).addTo(this.layer)
  12849. },
  12850. animateOut: function() {
  12851. FOTN._soundsMuted || ENEA._isIE || !ENEA._isDesktop || FOTN.Sounds.play("achievement");
  12852. if (!this.isOut) {
  12853. var a = this,
  12854. f = {
  12855. y: -10
  12856. },
  12857. h = {
  12858. y: this.game.textures.ach_unlocked.height + this.game.relY(0.02)
  12859. },
  12860. n = (new ENEA.Tweener.Tween(f)).to(h, 200).easing(ENEA.Tweener.Easing.Cubic.Out).onStart(function() {
  12861. a.isOut = !0;
  12862. a.layer.visible = !0
  12863. }).onUpdate(function() {
  12864. a.unlockedSprite.position.y = f.y;
  12865. a.unlockedIconSprite.position.y = f.y
  12866. }),
  12867. h = (new ENEA.Tweener.Tween(f)).to(h, 3E3),
  12868. p = {
  12869. y: this.game.textures.ach_unlocked.height + this.game.relY(0.02)
  12870. }; (new ENEA.Tweener.Tween(p)).to({
  12871. y: -10
  12872. },
  12873. 200).delay(3200).easing(ENEA.Tweener.Easing.Cubic.Out).onUpdate(function() {
  12874. a.unlockedSprite.position.y = p.y;
  12875. a.unlockedIconSprite.position.y = p.y
  12876. }).onComplete(function() {
  12877. a.layer.visible = !0;
  12878. a.isOut = !1
  12879. }).start();
  12880. n.chain(h);
  12881. n.start()
  12882. }
  12883. }
  12884. };
  12885. FOTN.DrawGame = function(a, f) {
  12886. this.game = a;
  12887. this.layer = f;
  12888. this.init()
  12889. };
  12890. FOTN.DrawGame.prototype = {
  12891. init: function() {
  12892. this.layer.bgContainer = new FOTN.GameBackground(this.game);
  12893. this.layer.addChild(this.layer.bgContainer);
  12894. this.layer.shine = (new ENEA.Sprite({
  12895. texture: this.game.textures.shine,
  12896. anchorXY: 0.5,
  12897. scaleXY: 2,
  12898. x: this.game.centerX,
  12899. y: this.game.relY( - 0.05)
  12900. })).addTo(this.layer);
  12901. this.game.player = new FOTN.Player(this.game, this.layer);
  12902. this.layer.bgContainer.addChild(this.game.player);
  12903. this.drawHeightText()
  12904. },
  12905. drawHeightText: function() {
  12906. this.layer.heightText = new PIXI.BitmapText("", this.game.bitmapFont);
  12907. this.layer.heightText.x = this.game.centerX - this.layer.heightText.textWidth / 2;
  12908. this.layer.heightText.y = this.game.relY(0.15);
  12909. this.layer.addChild(this.layer.heightText)
  12910. }
  12911. };
  12912. FOTN.DrawGameOver = function(a, f) {
  12913. this.game = a;
  12914. this.layer = f;
  12915. this.init();
  12916. };
  12917. FOTN.DrawGameOver.prototype = {
  12918. init: function() {
  12919. this.game.bestScore = new PIXI.Text("最好成绩: ", {
  12920. font: (ENEA._isHD ? 40 : 40) + "px Sauna-BlackItalic",
  12921. fill: "#FFFFFF",
  12922. align: "center"
  12923. });
  12924. this.game.bestScore.applyParams({
  12925. x: this.game.centerX - this.game.bestScore.width / 2,
  12926. y: this.game.relY(0.25)
  12927. }).addTo(this.layer);
  12928. this.game.hintMainText = new PIXI.Text("Hint: ", {
  12929. font: (ENEA._isHD ? 100 : 50) + "px Sauna-BlackItalic",
  12930. fill: "#FFFFFF",
  12931. align: "center"
  12932. });
  12933. this.game.hintMainText.applyParams({
  12934. x: this.game.centerX - this.game.hintMainText.width / 2,
  12935. y: this.game.relY(0.675)
  12936. }).addTo(this.layer);
  12937. var a = FOTN._hints.data[~~ (Math.random() * (FOTN._hints.data.length - 1))];
  12938. this.game.hintText = new PIXI.Text(a, {
  12939. font: (ENEA._isHD ? 80 : 40) + "px Sauna-BlackItalic",
  12940. fill: "#FFFFFF",
  12941. align: "center"
  12942. });
  12943. this.game.hintText.applyParams({
  12944. x: this.game.centerX - this.game.hintText.width / 2,
  12945. y: this.game.relY(0.735)
  12946. }).addTo(this.layer);
  12947. this.game.button_replay.applyParams({
  12948. x: this.game.centerX,
  12949. y: this.game.relY(0.775),
  12950. visible: !1,
  12951. responsive: !1
  12952. }).addTo(this.layer)
  12953. }
  12954. };
  12955. FOTN.DrawMenu = function(a, f) {
  12956. this.game = a;
  12957. this.layer = f;
  12958. this.init()
  12959. };
  12960. FOTN.DrawMenu.prototype = {
  12961. init: function() {
  12962. var a = this;
  12963. this.layer.bg = (new ENEA.Sprite({
  12964. texture: this.game.textures.mainBg,
  12965. anchorXY: 0.5,
  12966. x: this.game.centerX,
  12967. y: this.game.centerY,
  12968. alpha: 0,
  12969. visible: !0
  12970. })).addTo(this.layer);
  12971. this.layer.shine = (new ENEA.Sprite({
  12972. texture: this.game.textures.shine,
  12973. anchorXY: 0.5,
  12974. scaleXY: 1,
  12975. x: this.game.centerX,
  12976. y: this.game.relY(0.5),
  12977. visible: !1
  12978. })).addTo(this.layer);
  12979. this.layer.stripeTop = (new ENEA.Sprite({
  12980. texture: this.game.textures.mainStripeTop,
  12981. anchorX: 0.5,
  12982. anchorY: 1,
  12983. x: this.game.centerX,
  12984. y: this.game.textures.mainStripeTop.height,
  12985. alpha: 1,
  12986. visible: !0
  12987. })).addTo(this.layer);
  12988. this.layer.stripeBottom = (new ENEA.Sprite({
  12989. texture: this.game.textures.mainStripeBottom,
  12990. anchorX: 0.5,
  12991. anchorY: 0,
  12992. x: this.game.centerX,
  12993. y: this.game.height - this.game.textures.mainStripeBottom.height,
  12994. alpha: 1,
  12995. visible: !0
  12996. })).addTo(this.layer);
  12997. this.layer.ornament = (new ENEA.Sprite({
  12998. texture: this.game.textures.mainPattern,
  12999. anchorXY: 0.5,
  13000. x: this.game.centerX,
  13001. y: this.game.centerY,
  13002. alpha: 0,
  13003. visible: !0
  13004. })).addTo(this.layer);
  13005. this.layer.ninja = (new ENEA.Sprite({
  13006. texture: this.game.textures.mainNinja,
  13007. anchorXY: 0.5,
  13008. x: this.game.centerX,
  13009. y: this.game.relY(0.535),
  13010. visible: !0
  13011. })).addTo(this.layer);
  13012. this.layer.title = (new ENEA.Sprite({
  13013. texture: this.game.textures.mainLogo,
  13014. anchorXY: 0.5,
  13015. x: this.game.centerX,
  13016. y: this.game.relY(0.127),
  13017. visible: !0
  13018. })).addTo(this.layer);
  13019. this.game.button_home.applyParams({
  13020. x: this.game.centerX + this.game.relX(0.13),
  13021. y: this.game.centerY + this.game.relY(0.005),
  13022. onClick: function() {
  13023. a.game.button_home.callforward && a.game.button_home.callforward.call();
  13024. a.game.removeAllUpdates();
  13025. ENEA.Tweener.removeAll();
  13026. a.game.achievementsScreen.visible = !1;
  13027. a.game.leaderboardsScreen.visible = !1;
  13028. a.game.gameOverScreen.visible = !1;
  13029. a.game.gameScreen.visible = !1;
  13030. ENEA._isDesktop && (a.game.settings.visible = !1);
  13031. FOTN.showButtonsState("menu");
  13032. a.game.buttonsContainer.visible = !1;
  13033. new FOTN.MenuIN(FOTN.game, FOTN.game.menuScreen)
  13034. }
  13035. }).addTo(this.game.buttonsContainer);
  13036. this.game.button_restart.applyParams({
  13037. x: this.game.centerX + this.game.relX( - 0.13),
  13038. y: this.game.centerY + this.game.relY(0.005)
  13039. }).addTo(this.game.buttonsContainer);
  13040. this.game.button_start.applyParams({
  13041. x: this.game.centerX,
  13042. y: this.game.relY(0.835),
  13043. onClick: function() {
  13044. new FOTN.MenuOUT(FOTN.game, FOTN.game.menuScreen,
  13045. function() {
  13046. new FOTN.RunGame(FOTN.game, FOTN.game.gameScreen)
  13047. })
  13048. }
  13049. }).addTo(this.game.buttonsContainer);
  13050. var f = new ENEA.Container;
  13051. this.layer.addChild(f);
  13052. this.game.button_achievements.applyParams({
  13053. x: this.game.relX(0.12),
  13054. y: this.game.relY(0.835),
  13055. onClick: function() {
  13056. new FOTN.MenuOUT(FOTN.game, FOTN.game.menuScreen,
  13057. function() {
  13058. new FOTN.Achievements(a.game, a.game.achievementsScreen)
  13059. })
  13060. }
  13061. }).addTo(f);
  13062. this.game.button_leaderboard.applyParams({
  13063. x: this.game.relX(0.88),
  13064. y: this.game.relY(0.835),
  13065. onClick: function() {
  13066. new FOTN.MenuOUT(FOTN.game, FOTN.game.menuScreen,
  13067. function() {
  13068. new FOTN.Leaderboards(a.game, a.game.leaderboardsScreen)
  13069. })
  13070. }
  13071. }).addTo(f);
  13072. this.game.buttonsContainer.bottomButtons = new ENEA.Container;
  13073. this.game.buttonsContainer.addChild(this.game.buttonsContainer.bottomButtons);
  13074. var f = this.game.relX(FOTN._isKik ? 0.305 : 0.375),
  13075. h = this.game.relY(0.943),
  13076. n = this.game.relY(0.08);
  13077. this.game.button_moregames.applyParams({
  13078. x: f,
  13079. y: h
  13080. }).addTo(this.game.buttonsContainer.bottomButtons);
  13081. this.game.button_kik.applyParams({
  13082. x: f + 1 * n,
  13083. y: h,
  13084. visible: FOTN._isKik ? !0 : !1,
  13085. onClick: function() {
  13086. console.log("menu: kik clicked")
  13087. }
  13088. }).addTo(this.game.buttonsContainer.bottomButtons);
  13089. this.game.button_facebook.applyParams({
  13090. x: f + (FOTN._isKik ? 2 : 1) * n,
  13091. y: h
  13092. }).addTo(this.game.buttonsContainer.bottomButtons);
  13093. this.game.button_twitter.applyParams({
  13094. x: f + (FOTN._isKik ? 3 : 2) * n,
  13095. y: h
  13096. }).addTo(this.game.buttonsContainer.bottomButtons);
  13097. FOTN.showButtonsState("menu");
  13098. this.game.buttonsContainer.visible = !1
  13099. }
  13100. };
  13101. FOTN.MenuIN = function(a, f) {
  13102. this.game = a;
  13103. this.layer = f;
  13104. this.preparePositions();
  13105. this.layer.visible = !0;
  13106. this.layer.responsive = !0;
  13107. this.game.eventsContainer.responsive = !1;
  13108. this.start()
  13109. };
  13110. FOTN.MenuIN.prototype = {
  13111. preparePositions: function() {
  13112. this.layer.stripeTop.y = 0;
  13113. this.layer.stripeBottom.y = this.game.height;
  13114. this.layer.ninja.x = this.game.width + this.layer.ninja.texture.width / 2;
  13115. this.layer.title.y = this.game.relY( - 0.1);
  13116. this.game.buttonsContainer.y = 0;
  13117. this.game.button_achievements.x = this.game.relX( - 0.12);
  13118. this.game.button_leaderboard.x = this.game.relX(1.12)
  13119. },
  13120. start: function() {
  13121. var a = this;
  13122. this.fadeBG([this.layer.bg, this.layer.ornament], 0, 1, 300,
  13123. function() {
  13124. a.layer.bg.visible = !0;
  13125. a.layer.ornament.visible = !0
  13126. },
  13127. function() {
  13128. a.waveNinja();
  13129. a.ninjaIN(null,
  13130. function() {
  13131. a.titleIN(null,
  13132. function() {
  13133. a.shineIN(function() {
  13134. a.layer.shine.visible = !0;
  13135. FOTN.game.achievements.compareAddict()
  13136. },
  13137. null);
  13138. a.rotateShine()
  13139. })
  13140. })
  13141. })
  13142. },
  13143. fadeBG: function(a, f, h, n, p, b) {
  13144. var d = {
  13145. alpha: f
  13146. },
  13147. c = {
  13148. alpha: h
  13149. }; (new ENEA.Tweener.Tween(d)).to(c, n).easing(ENEA.Tweener.Easing.Linear.None).onStart(function() {
  13150. p && p.call()
  13151. }).onUpdate(function() {
  13152. for (var b = 0; b < a.length; b++) a[b].alpha = ENEA.normalize(d.alpha)
  13153. }).onComplete(function() {
  13154. for (var d = 0; d < a.length; d++) a[d].alpha = c.alpha;
  13155. b && b.call()
  13156. }).start()
  13157. },
  13158. waveNinja: function() {
  13159. var a = this,
  13160. f = 0;
  13161. this.game.addUpdate("ninja",
  13162. function() {
  13163. f += 0.02;
  13164. a.layer.ninja.position.y = a.game.relativeY(0.01) * Math.sin(f) + a.game.relativeY(0.53)
  13165. })
  13166. },
  13167. ninjaIN: function(a, f) {
  13168. var h = this,
  13169. n = {
  13170. ninjaX: this.layer.ninja.x,
  13171. stripeTopY: this.layer.stripeTop.y,
  13172. stripeBottomY: this.layer.stripeBottom.y
  13173. },
  13174. p = {
  13175. ninjaX: this.game.centerX,
  13176. stripeTopY: this.game.textures.mainStripeTop.height,
  13177. stripeBottomY: this.game.height - this.game.textures.mainStripeBottom.height
  13178. }; (new ENEA.Tweener.Tween(n)).to(p, 500).easing(ENEA.Tweener.Easing.Cubic.Out).onStart(function() {
  13179. a && a.call()
  13180. }).onUpdate(function() {
  13181. h.layer.ninja.position.x = n.ninjaX;
  13182. h.layer.stripeTop.position.y = n.stripeTopY;
  13183. h.layer.stripeBottom.position.y = n.stripeBottomY
  13184. }).onComplete(function() {
  13185. f && f.call()
  13186. }).start()
  13187. },
  13188. titleIN: function(a, f) {
  13189. var h = this,
  13190. n = {
  13191. titleY: this.layer.title.y,
  13192. allButtonsY: this.game.buttonsContainer.y + this.game.relY(0.22),
  13193. aX: this.game.button_achievements.x,
  13194. lX: this.game.button_leaderboard.x
  13195. },
  13196. p = {
  13197. titleY: this.game.relY(0.127),
  13198. aX: this.game.relX(0.12),
  13199. lX: this.game.relX(0.88),
  13200. allButtonsY: 0
  13201. }; (new ENEA.Tweener.Tween(n)).to(p, 200).easing(ENEA.Tweener.Easing.Cubic.Out).onStart(function() {
  13202. h.game.buttonsContainer.visible = !0;
  13203. a && a.call()
  13204. }).onUpdate(function() {
  13205. h.layer.title.position.y = n.titleY;
  13206. h.game.buttonsContainer.position.y = n.allButtonsY;
  13207. h.game.button_achievements.position.x = n.aX;
  13208. h.game.button_leaderboard.position.x = n.lX
  13209. }).onComplete(function() {
  13210. f && f.call()
  13211. }).start()
  13212. },
  13213. rotateShine: function(a, f) {
  13214. var h = this;
  13215. this.game.addUpdate("shine",
  13216. function() {
  13217. h.layer.shine.rotation += 0.005
  13218. })
  13219. },
  13220. shineIN: function(a, f) {
  13221. var h = this,
  13222. n = {
  13223. shineA: 0,
  13224. shineS: 0.1
  13225. }; (new ENEA.Tweener.Tween(n)).to({
  13226. shineA: 1,
  13227. shineS: 4
  13228. },
  13229. 1E3).easing(ENEA.Tweener.Easing.Back.Out).onStart(function() {
  13230. a && a.call()
  13231. }).onUpdate(function() {
  13232. h.layer.shine.alpha = ENEA.normalize(n.shineA);
  13233. h.layer.shine.scale.x = n.shineS;
  13234. h.layer.shine.scale.y = n.shineS
  13235. }).onComplete(function() {
  13236. f && f.call()
  13237. }).start()
  13238. }
  13239. };
  13240. FOTN.MenuOUT = function(a, f, h) {
  13241. this.game = a;
  13242. this.layer = f;
  13243. this.callback = h;
  13244. this.start()
  13245. };
  13246. FOTN.MenuOUT.prototype = {
  13247. start: function() {
  13248. var a = this;
  13249. a.titleOUT(null,
  13250. function() {
  13251. a.ninjaOUT(null,
  13252. function() {
  13253. a.shineOUT();
  13254. a.fadeBG([a.layer.bg, a.layer.ornament], 1, 0, 300, null,
  13255. function() {
  13256. a.layer.visible = !1;
  13257. a.game.removeAllUpdates();
  13258. a.callback && a.callback.call()
  13259. })
  13260. })
  13261. })
  13262. },
  13263. fadeBG: function(a, f, h, n, p, b) {
  13264. var d = {
  13265. alpha: f
  13266. },
  13267. c = {
  13268. alpha: h
  13269. }; (new ENEA.Tweener.Tween(d)).to(c, n).easing(ENEA.Tweener.Easing.Linear.None).onStart(function() {
  13270. p && p.call()
  13271. }).onUpdate(function() {
  13272. for (var b = 0; b < a.length; b++) a[b].alpha = ENEA.normalize(d.alpha)
  13273. }).onComplete(function() {
  13274. for (var d = 0; d < a.length; d++) a[d].alpha = c.alpha;
  13275. b && b.call()
  13276. }).start()
  13277. },
  13278. titleOUT: function(a, f) {
  13279. var h = this,
  13280. n = {
  13281. titleY: this.layer.title.y,
  13282. allButtonsY: this.game.buttonsContainer.y,
  13283. aX: this.game.button_achievements.x,
  13284. lX: this.game.button_leaderboard.x,
  13285. stripeTopY: this.layer.stripeTop.y,
  13286. stripeBottomY: this.game.height
  13287. },
  13288. p = {
  13289. titleY: this.game.relY( - 0.1),
  13290. allButtonsY: this.game.relY(0.23),
  13291. aX: this.game.relX( - 0.12),
  13292. lX: this.game.relX(1.12),
  13293. stripeTopY: 0,
  13294. stripeBottomY: this.game.height
  13295. }; (new ENEA.Tweener.Tween(n)).to(p, 200).easing(ENEA.Tweener.Easing.Cubic.Out).onStart(function() {
  13296. a && a.call()
  13297. }).onUpdate(function() {
  13298. h.layer.title.position.y = n.titleY;
  13299. h.game.buttonsContainer.position.y = n.allButtonsY;
  13300. h.game.button_achievements.position.x = n.aX;
  13301. h.game.button_leaderboard.position.x = n.lX;
  13302. h.layer.stripeTop.position.y = n.stripeTopY;
  13303. h.layer.stripeBottom.position.y = n.stripeBottomY
  13304. }).onComplete(function() {
  13305. f && f.call()
  13306. }).start()
  13307. },
  13308. ninjaOUT: function(a, f) {
  13309. var h = this,
  13310. n = {
  13311. ninjaX: this.layer.ninja.x
  13312. },
  13313. p = {
  13314. ninjaX: 0 - this.layer.ninja.texture.width / 2
  13315. }; (new ENEA.Tweener.Tween(n)).to(p, 500).easing(ENEA.Tweener.Easing.Back.In).onStart(function() {
  13316. a && a.call()
  13317. }).onUpdate(function() {
  13318. h.layer.ninja.position.x = n.ninjaX
  13319. }).onComplete(function() {
  13320. f && f.call()
  13321. }).start()
  13322. },
  13323. shineOUT: function(a, f) {
  13324. var h = this,
  13325. n = {
  13326. shineA: 0,
  13327. shineS: 4
  13328. }; (new ENEA.Tweener.Tween(n)).to({
  13329. shineA: 1,
  13330. shineS: 0.1
  13331. },
  13332. 300).easing(ENEA.Tweener.Easing.Back.Out).onStart(function() {
  13333. a && a.call()
  13334. }).onUpdate(function() {
  13335. h.layer.shine.alpha = ENEA.normalize(n.shineA);
  13336. h.layer.shine.scale.x = n.shineS;
  13337. h.layer.shine.scale.y = n.shineS
  13338. }).onComplete(function() {
  13339. f && f.call()
  13340. }).start()
  13341. }
  13342. };
  13343. FOTN.DrawSettings = function(a, f) {
  13344. this.game = a;
  13345. this.layer = f;
  13346. this.offsets = {
  13347. x: this.game.relX(0.11),
  13348. y1: this.game.relY(0.071),
  13349. y2: this.game.relY(0.171),
  13350. y3: this.game.relY(0.26)
  13351. };
  13352. this.init();
  13353. this.closed = !0
  13354. };
  13355. FOTN.DrawSettings.prototype = {
  13356. init: function() {
  13357. var a = this;
  13358. this.game.button_soundON.applyParams({
  13359. x: this.game.width - this.offsets.x,
  13360. y: this.offsets.y1,
  13361. visible: !0,
  13362. onClick: function() {
  13363. FOTN._soundsMuted = !FOTN._soundsMuted;
  13364. ENEA.Storage.set("sounds", FOTN._soundsMuted ? 1 : 0);
  13365. a.refreshButtons()
  13366. }
  13367. }).addTo(this.layer);
  13368. this.game.button_soundOFF.applyParams({
  13369. x: this.game.width - this.offsets.x,
  13370. y: this.offsets.y1,
  13371. visible: !0,
  13372. onClick: function() {
  13373. FOTN._soundsMuted = !FOTN._soundsMuted;
  13374. ENEA.Storage.set("sounds", FOTN._soundsMuted ? 1 : 0);
  13375. a.refreshButtons()
  13376. }
  13377. }).addTo(this.layer);
  13378. this.game.button_musicON.applyParams({
  13379. x: this.game.width - this.offsets.x,
  13380. y: this.offsets.y1,
  13381. visible: !0,
  13382. onClick: function() {
  13383. FOTN._musicMuted = !FOTN._musicMuted;
  13384. FOTN._musicMuted ? FOTN.Music.stop() : FOTN.Music.play();
  13385. ENEA.Storage.set("music", FOTN._musicMuted ? 1 : 0);
  13386. a.refreshButtons()
  13387. }
  13388. }).addTo(this.layer);
  13389. this.game.button_musicOFF.applyParams({
  13390. x: this.game.width - this.offsets.x,
  13391. y: this.offsets.y1,
  13392. visible: !0,
  13393. onClick: function() {
  13394. FOTN._musicMuted = !FOTN._musicMuted;
  13395. FOTN._musicMuted ? FOTN.Music.stop() : FOTN.Music.play();
  13396. ENEA.Storage.set("music", FOTN._musicMuted ? 1 : 0);
  13397. a.refreshButtons()
  13398. }
  13399. }).addTo(this.layer);
  13400. this.refreshButtons();
  13401. this.checkClosed();
  13402. this.game.button_settings.applyParams({
  13403. x: this.game.width - this.offsets.x,
  13404. y: this.offsets.y1,
  13405. visible: !0,
  13406. onClick: function() {
  13407. a.closed && a.refreshButtons();
  13408. a.animateSettings(function() {
  13409. a.checkClosed();
  13410. a.closed = !a.closed
  13411. })
  13412. }
  13413. }).addTo(this.layer)
  13414. },
  13415. checkClosed: function() {
  13416. this.closed || (this.game.button_soundON.visible = !1, this.game.button_soundOFF.visible = !1, this.game.button_musicON.visible = !1, this.game.button_musicOFF.visible = !1, this.game.button_soundON.y = this.offsets.y1, this.game.button_soundOFF.y = this.offsets.y1, this.game.button_musicON.y = this.offsets.y1, this.game.button_musicOFF.y = this.offsets.y1)
  13417. },
  13418. refreshButtons: function() {
  13419. FOTN._soundsMuted ? (this.game.button_soundON.visible = !1, this.game.button_soundOFF.visible = !0) : (this.game.button_soundON.visible = !0, this.game.button_soundOFF.visible = !1);
  13420. FOTN._musicMuted ? (this.game.button_musicON.visible = !1, this.game.button_musicOFF.visible = !0) : (this.game.button_musicON.visible = !0, this.game.button_musicOFF.visible = !1)
  13421. },
  13422. animateSettings: function(a) {
  13423. var f = this,
  13424. h = {
  13425. ty2: f.closed ? f.offsets.y1: f.offsets.y2,
  13426. ty3: f.closed ? f.offsets.y1: f.offsets.y3
  13427. },
  13428. n = {
  13429. ty2: f.closed ? f.offsets.y2: f.offsets.y1,
  13430. ty3: f.closed ? f.offsets.y3: f.offsets.y1
  13431. }; (new ENEA.Tweener.Tween(h)).to(n, 400).easing(ENEA.Tweener.Easing.Cubic.Out).onUpdate(function() {
  13432. f.game.button_musicON.position.y = h.ty2;
  13433. f.game.button_musicOFF.position.y = h.ty2;
  13434. f.game.button_soundON.position.y = h.ty3;
  13435. f.game.button_soundOFF.position.y = h.ty3
  13436. }).onComplete(function() {
  13437. a && a.call()
  13438. }).start()
  13439. }
  13440. };
  13441. FOTN.DrawTutorial = function(a, f) {
  13442. this.game = a;
  13443. this.layer = f;
  13444. this.draw()
  13445. };
  13446. FOTN.DrawTutorial.prototype = {
  13447. draw: function() {
  13448. this.phoneSprite = (new ENEA.Sprite({
  13449. texture: this.game.textures.tutorial_phone,
  13450. x: this.game.centerX,
  13451. y: this.game.relY(0.4),
  13452. anchorX: 0.5,
  13453. anchorY: 0.5
  13454. })).addTo(this.layer);
  13455. this.ninjaSprite = (new ENEA.Sprite({
  13456. texture: this.game.textures.tutorial_ninja,
  13457. x: this.game.centerX,
  13458. y: this.phoneSprite.y + this.game.relY(0.07),
  13459. anchorX: 0.5,
  13460. anchorY: 0.5
  13461. })).addTo(this.layer);
  13462. this.handSprite = (new ENEA.Sprite({
  13463. texture: this.game.textures.tutorial_hand,
  13464. x: 2 * this.game.centerX + this.game.relX(0.05),
  13465. y: this.phoneSprite.y + this.game.relY(0.06),
  13466. anchorX: 0.234,
  13467. anchorY: 0.037
  13468. })).addTo(this.layer);
  13469. this.bubbleSprite = (new ENEA.Sprite({
  13470. texture: this.game.textures.tutorial_click,
  13471. x: this.handSprite.x,
  13472. y: this.handSprite.y,
  13473. visible: !1,
  13474. anchorX: 0.5,
  13475. anchorY: 0.5
  13476. })).addTo(this.layer);
  13477. this.goSprite = (new ENEA.Sprite({
  13478. texture: this.game.textures.tutorial_go,
  13479. x: this.game.centerX,
  13480. y: this.game.centerY - this.game.relY(0.1),
  13481. visible: !1,
  13482. anchorX: 0.5,
  13483. anchorY: 0.5
  13484. })).addTo(this.layer)
  13485. },
  13486. runTutorial: function(a) {
  13487. var f = this;
  13488. this.rungame = a;
  13489. this.game.eventsContainer.responsive = !1;
  13490. this.game.tutorialContainer.visible = !0;
  13491. this.game.tutorialContainer.alpha = 1;
  13492. this.goSprite.visible = !1;
  13493. this.ninjaSprite.x = this.game.centerX;
  13494. this.handSprite.visible = !1;
  13495. this.game.gameScreen.heightText.visible = !1;
  13496. FOTN._tutorialIsRunning = !0;
  13497. a = this.blink();
  13498. var h = this.handIN(),
  13499. n = this.handClick(),
  13500. p = this.firstJump(),
  13501. b = this.handClick(),
  13502. d = this.jumpRight(),
  13503. c = this.slide(),
  13504. e = this.jumpLeft(),
  13505. g = this.handClick(),
  13506. r = this.slide(0.04, 800),
  13507. k = this.fadeOUT(800);
  13508. a.onComplete(function() {
  13509. h.start()
  13510. });
  13511. h.onComplete(function() {
  13512. n.start()
  13513. });
  13514. n.onComplete(function() {
  13515. p.start()
  13516. });
  13517. p.onComplete(function() {
  13518. b.start()
  13519. });
  13520. b.onComplete(function() {
  13521. d.start()
  13522. });
  13523. d.onComplete(function() {
  13524. c.start()
  13525. });
  13526. c.onComplete(function() {
  13527. g.start()
  13528. });
  13529. g.onYoyo(function() {
  13530. e.start()
  13531. });
  13532. e.onComplete(function() {
  13533. r.start();
  13534. k.start()
  13535. });
  13536. k.onComplete(function() {
  13537. f.game.tutorialContainer.visible = !1;
  13538. f.game.eventsContainer.responsive = !0;
  13539. ENEA.Storage.set("tutorial", 0)
  13540. });
  13541. a.start()
  13542. },
  13543. blink: function() {
  13544. _self = this;
  13545. var a = {
  13546. a: 1
  13547. };
  13548. _self.ninjaSprite.y = this.phoneSprite.y + this.game.relY(0.07);
  13549. return (new ENEA.Tweener.Tween(a)).to({
  13550. a: 0
  13551. },
  13552. 250).repeat(5).yoyo(!0).easing(ENEA.Tweener.Easing.Cubic.InOut).onStart(function() {}).onUpdate(function() {
  13553. _self.game.player.alpha = a.a;
  13554. _self.ninjaSprite.alpha = a.a
  13555. })
  13556. },
  13557. handIN: function() {
  13558. _self = this;
  13559. var a = {
  13560. x: 2 * this.game.centerX + this.game.relX(0.05),
  13561. a: 0
  13562. },
  13563. f = {
  13564. x: this.game.centerX + this.game.relX(0.05),
  13565. a: 1
  13566. };
  13567. return (new ENEA.Tweener.Tween(a)).to(f, 500).easing(ENEA.Tweener.Easing.Cubic.InOut).onStart(function() {
  13568. _self.handSprite.visible = !0
  13569. }).onUpdate(function() {
  13570. _self.handSprite.x = a.x;
  13571. _self.handSprite.alpha = a.a;
  13572. _self.bubbleSprite.x = a.x
  13573. })
  13574. },
  13575. handClick: function() {
  13576. _self = this;
  13577. var a = {
  13578. s: 1,
  13579. bs: 1.5,
  13580. ba: 0
  13581. };
  13582. return (new ENEA.Tweener.Tween(a)).to({
  13583. s: 0.95,
  13584. bs: 1,
  13585. ba: 1
  13586. },
  13587. 200).repeat(1).yoyo(!0).easing(ENEA.Tweener.Easing.Cubic.InOut).onStart(function() {}).onYoyo(function() {
  13588. _self.bubbleSprite.visible = !0
  13589. }).onUpdate(function() {
  13590. _self.handSprite.scale.x = a.s;
  13591. _self.handSprite.scale.y = a.s;
  13592. _self.bubbleSprite.scale.x = a.bs;
  13593. _self.bubbleSprite.scale.y = a.bs;
  13594. _self.bubbleSprite.alpha = a.ba
  13595. })
  13596. },
  13597. firstJump: function() {
  13598. _self = this;
  13599. var a = {
  13600. x: this.game.centerX,
  13601. y: _self.ninjaSprite.position.y
  13602. },
  13603. f = {
  13604. x: this.game.centerX - this.game.relX(0.075),
  13605. y: _self.ninjaSprite.position.y - this.game.relY(0.025)
  13606. };
  13607. return (new ENEA.Tweener.Tween(a)).to(f, 200).easing(ENEA.Tweener.Easing.Cubic.InOut).onStart(function() {
  13608. _self.rungame.doFirstJump()
  13609. }).onUpdate(function() {
  13610. _self.ninjaSprite.position.x = a.x;
  13611. _self.ninjaSprite.position.y = a.y
  13612. })
  13613. },
  13614. jumpRight: function() {
  13615. _self = this;
  13616. var a = {
  13617. x: _self.ninjaSprite.position.x - this.game.relX(0.075),
  13618. y: _self.ninjaSprite.position.y - this.game.relY(0.025)
  13619. },
  13620. f = {
  13621. x: this.game.centerX + this.game.relX(0.075),
  13622. y: _self.ninjaSprite.position.y - this.game.relY(0.05)
  13623. };
  13624. return (new ENEA.Tweener.Tween(a)).to(f, 400).easing(ENEA.Tweener.Easing.Cubic.InOut).onStart(function() {
  13625. _self.rungame.jump(_self.game.Camera.y, _self.game.player.metresPosition.y + _self.game.player.jumpHeight - _self.game.Camera.playerOffset,
  13626. function() {
  13627. _self.game.player.checkSlide()
  13628. })
  13629. }).onUpdate(function() {
  13630. _self.ninjaSprite.position.x = a.x;
  13631. _self.ninjaSprite.position.y = a.y
  13632. })
  13633. },
  13634. jumpLeft: function() {
  13635. _self = this;
  13636. var a = {
  13637. x: _self.ninjaSprite.position.x + this.game.relX(0.075),
  13638. y: _self.ninjaSprite.position.y - this.game.relY(0.03)
  13639. },
  13640. f = {
  13641. x: this.game.centerX - this.game.relX(0.075),
  13642. y: _self.ninjaSprite.position.y - this.game.relY(0.055)
  13643. };
  13644. return (new ENEA.Tweener.Tween(a)).to(f, 400).easing(ENEA.Tweener.Easing.Cubic.InOut).onStart(function() {
  13645. _self.rungame.jump(_self.game.Camera.y, _self.game.player.metresPosition.y + _self.game.player.jumpHeight - _self.game.Camera.playerOffset,
  13646. function() {
  13647. _self.game.player.checkSlide()
  13648. })
  13649. }).onUpdate(function() {
  13650. _self.ninjaSprite.position.x = a.x;
  13651. _self.ninjaSprite.position.y = a.y
  13652. })
  13653. },
  13654. slide: function(a, f) {
  13655. _self = this;
  13656. var h = {
  13657. y: _self.ninjaSprite.position.y - this.game.relY(0.05)
  13658. },
  13659. n = {
  13660. y: _self.ninjaSprite.position.y - (void 0 === a ? this.game.relY(0.03) : this.game.relY(a))
  13661. };
  13662. return (new ENEA.Tweener.Tween(h)).to(n, void 0 === f ? 1200 : f).easing(ENEA.Tweener.Easing.Linear.None).onStart(function() {}).onUpdate(function() {
  13663. _self.ninjaSprite.position.y = h.y
  13664. })
  13665. },
  13666. fadeOUT: function(a) {
  13667. _self = this;
  13668. var f = {
  13669. a: 1,
  13670. sg: 0.5
  13671. };
  13672. return (new ENEA.Tweener.Tween(f)).to({
  13673. a: 0,
  13674. sg: 4
  13675. },
  13676. void 0 === a ? 1200 : a).easing(ENEA.Tweener.Easing.Linear.None).onStart(function() {
  13677. _self.goSprite.visible = !0;
  13678. _self.goSprite.alpha = 1
  13679. }).onUpdate(function() {
  13680. _self.game.tutorialContainer.alpha = f.a;
  13681. _self.goSprite.scaleX = f.sg;
  13682. _self.goSprite.scaleY = f.sg
  13683. })
  13684. }
  13685. };
  13686. FOTN.GameBackground = function(a) {
  13687. this.game = a;
  13688. this.bgPattern = [0, 1, 0, 0, 2, 0];
  13689. this.bgPatternLength = this.bgPattern.length;
  13690. this.leftBorder = this.game.relX(0.11);
  13691. this.rightBorder = this.game.relX(0.89);
  13692. this.disksPattern = [];
  13693. this.maxDiskPattern = 200;
  13694. this.diskCounter = 0;
  13695. this.sawSpeed = 0.08;
  13696. this.repeat = 0;
  13697. this.obstaclesDistance = 12;
  13698. this.obstaclesVariation = 10;
  13699. ENEA.SEED = 100;
  13700. for (a = 1; a < this.maxDiskPattern; a++) {
  13701. var f = a * this.obstaclesDistance + ENEA.seededRandom( - this.obstaclesVariation, this.obstaclesVariation);
  13702. this.disksPattern.push(f)
  13703. }
  13704. this.disksPattern[0] -= 3.1;
  13705. this.disksPattern[1] += 7.5;
  13706. this.textures = [this.game.textures.bg1, this.game.textures.bg2, this.game.textures.bg3];
  13707. this.stageHeight = 20;
  13708. this.tileHeight = this.stageHeight / 4;
  13709. this.groundHeight = 2.05;
  13710. this.meter = this.game.height / this.stageHeight;
  13711. this.bgOffset = Math.floor(this.meter * this.tileHeight);
  13712. PIXI.DisplayObjectContainer.call(this);
  13713. this.createPool();
  13714. this.createGroundNspikes();
  13715. this.resetAll()
  13716. };
  13717. FOTN.GameBackground.prototype = Object.create(PIXI.DisplayObjectContainer.prototype);
  13718. FOTN.GameBackground.prototype.constructor = FOTN.GameBackground;
  13719. FOTN.GameBackground.prototype.createGroundNspikes = function() {
  13720. this.groundNspikes = (new ENEA.Sprite({
  13721. texture: this.game.textures.ground,
  13722. anchorX: 0.5,
  13723. anchorY: 0.4
  13724. })).addTo(this)
  13725. };
  13726. FOTN.GameBackground.prototype.resetAll = function() {
  13727. this.repeat = this.y = this.x = 0;
  13728. this.resetDisksPool();
  13729. this.resetGroundNspikes();
  13730. this.updateGroundNspikes();
  13731. this.updatePosition()
  13732. };
  13733. FOTN.GameBackground.prototype.resetGroundNspikes = function() {
  13734. this.groundNspikes.setTexture(this.game.textures.ground);
  13735. this.groundNspikes.anchorY = 0.4;
  13736. this.groundNspikes._isGround = !0;
  13737. this.groundPosition = 0;
  13738. this.updateGroundNspikes()
  13739. };
  13740. FOTN.GameBackground.prototype.updateGroundNspikes = function() {
  13741. this.groundNspikes.position.x = this.game.centerX;
  13742. this.groundNspikes.position.y = -this.game.relY(0.06) - this.meter * this.groundPosition
  13743. };
  13744. FOTN.GameBackground.prototype.getGroundPosition = function() {
  13745. return this.groundNspikes.position.y
  13746. };
  13747. FOTN.GameBackground.prototype.setSpikes = function() {
  13748. this.groundNspikes._isGround = !1;
  13749. this.groundNspikes.visible = !0;
  13750. this.groundNspikes.anchorY = 0.2;
  13751. this.groundNspikes.setTexture(this.game.textures.spikes)
  13752. };
  13753. FOTN.GameBackground.prototype.setSpikesPosition = function(a) {
  13754. this.setSpikes();
  13755. this.groundPosition = a;
  13756. this.updateGroundNspikes()
  13757. };
  13758. FOTN.GameBackground.prototype.resetDisksPool = function() {
  13759. for (var a = this.diskCounter = 0; a < this.maxObjects; a++) this._poolDisks[a].x = 0 == this.diskCounter % 2 ? this.rightBorder: this.leftBorder,
  13760. this._poolDisks[a].y = -this.meter * this.disksPattern[this.diskCounter % this.disksPattern.length],
  13761. this._poolDisks[a].visible = !0,
  13762. this.diskCounter++
  13763. };
  13764. FOTN.GameBackground.prototype.createPool = function() {
  13765. this.maxObjects = 5;
  13766. this._poolBG = [];
  13767. this._poolDisks = [];
  13768. this._poolLS = [];
  13769. this._poolRS = [];
  13770. for (var a = 0; a < this.maxObjects; a++) {
  13771. var f = new PIXI.Sprite(this.textures[0]);
  13772. f.anchorX = 0.5;
  13773. f.anchorY = 1;
  13774. f.x = this.game.centerX;
  13775. this.addChild(f);
  13776. this._poolBG.push(f)
  13777. }
  13778. for (a = 0; a < this.maxObjects; a++) f = new PIXI.Sprite(this.game.textures.disk),
  13779. f.anchorXY = 0.5,
  13780. f.x = 0 == this.diskCounter % 2 ? this.rightBorder: this.leftBorder,
  13781. f.y = this.meter * this.disksPattern[this.diskCounter % this.disksPattern.length],
  13782. f.rotation = 2 * Math.random() * Math.PI,
  13783. f.rotSpeed = 0 == this.diskCounter % 2 ? this.sawSpeed: -this.sawSpeed,
  13784. f.collisionRadius = ENEA._isHD ? 98 : 49,
  13785. f.visible = !0,
  13786. this.diskCounter++,
  13787. this.addChild(f),
  13788. this._poolDisks.push(f);
  13789. for (a = 0; a < this.maxObjects; a++) f = new PIXI.Sprite(this.game.textures.sideLeft),
  13790. f.anchorX = 0,
  13791. f.anchorY = 1,
  13792. f.x = 0,
  13793. this.addChild(f),
  13794. this._poolLS.push(f);
  13795. for (a = 0; a < this.maxObjects; a++) f = new PIXI.Sprite(this.game.textures.sideRight),
  13796. f.anchorX = 1,
  13797. f.anchorY = 1,
  13798. f.x = this.game.width,
  13799. this.addChild(f),
  13800. this._poolRS.push(f)
  13801. };
  13802. FOTN.GameBackground.prototype.updateDisks = function() {
  13803. var a, f = !0;
  13804. 0 == this.diskCounter % 2 && (f = !1);
  13805. for (var h = 0; h < this.maxObjects; h++) this._poolDisks[h].position.y + this.position.y - this.game.textures.disk.height > this.game.height && this._poolDisks[h].visible && (this._poolDisks[h].visible = !1, a = this.getAvailableDisk(), null !== a && (a.rotation = this.disksPattern[this.diskCounter % this.disksPattern.length], a.position.x = !1 == f ? this.rightBorder: this.leftBorder, a.position.y = -this.repeat - this.meter * this.disksPattern[this.diskCounter % this.disksPattern.length], a.rotSpeed = !1 == f ? this.sawSpeed: -this.sawSpeed, a.position.visible = !0, this.diskCounter++, this.diskCounter >= this.maxDiskPattern && (this.repeat = this.meter * ~~ (this.diskCounter / (this.maxDiskPattern - 2)) * this.disksPattern[this.maxDiskPattern - 2])))
  13806. };
  13807. FOTN.GameBackground.prototype.getAvailableDisk = function() {
  13808. for (var a = 0; a < this.maxObjects; a++) if (!1 === this._poolDisks[a].visible) {
  13809. this._poolDisks[a].visible = !0;
  13810. break
  13811. }
  13812. return a >= this.maxObjects ? (console.log("Out of disk pool"), null) : this._poolDisks[a]
  13813. };
  13814. FOTN.GameBackground.prototype.updatePosition = function() {
  13815. this.position.x = this.meter * this.game.Camera.x;
  13816. this.position.y = this.game.height + this.meter * this.game.Camera.y;
  13817. for (var a, f = ~~ (this.position.y / this.bgOffset), h = ~~ (this.game.height - Math.abs(f * this.bgOffset)), n = 0; n < this.maxObjects; n++) a = this.textures[this.bgPattern[(n + f) % this.bgPatternLength]],
  13818. this._poolBG[n].texture !== a && this._poolBG[n].setTexture(a),
  13819. this._poolBG[n].position.y = h,
  13820. this._poolLS[n].position.y = h,
  13821. this._poolRS[n].position.y = h,
  13822. h -= this.bgOffset;
  13823. this.updateDisks()
  13824. };
  13825. FOTN.InitButtons = function(a) {
  13826. this.game = a;
  13827. this.init()
  13828. };
  13829. FOTN.InitButtons.prototype = {
  13830. init: function() {
  13831. this.game.button_start = new FOTN.Button([this.game.textures.button_start_normal, this.game.textures.button_start_hover, this.game.textures.button_start_pressed]);
  13832. this.game.button_start.visible = !1;
  13833. this.game.button_moregames = new FOTN.Button([this.game.textures.button_moregames_normal]);
  13834. this.game.button_moregames.visible = !1;
  13835. this.game.button_moregames.onClick = function() {
  13836. try {
  13837. parent.moregame();
  13838. } catch(e) {}
  13839. };
  13840. this.game.button_kik = new FOTN.Button([this.game.textures.button_kik_normal]);
  13841. this.game.button_kik.visible = !1;
  13842. this.game.button_facebook = new FOTN.Button([this.game.textures.button_facebook_normal]);
  13843. this.game.button_facebook.visible = !1;
  13844. this.game.button_facebook.onClick = function() {};
  13845. this.game.button_twitter = new FOTN.Button([this.game.textures.button_twitter_normal]);
  13846. this.game.button_twitter.visible = !1;
  13847. this.game.button_twitter.onClick = function() {};
  13848. this.game.button_restart = new FOTN.Button([this.game.textures.button_restart_normal, this.game.textures.button_restart_hover, this.game.textures.button_restart_pressed]);
  13849. this.game.button_restart.visible = !1;
  13850. this.game.button_home = new FOTN.Button([this.game.textures.button_home_normal, this.game.textures.button_home_hover, this.game.textures.button_home_pressed]);
  13851. this.game.button_home.visible = !1;
  13852. this.game.button_replay = new FOTN.Button([this.game.textures.button_replay_normal, this.game.textures.button_replay_hover, this.game.textures.button_replay_pressed]);
  13853. this.game.button_replay.visible = !1;
  13854. this.game.button_homeSmall = new FOTN.Button([this.game.textures.button_homeSmall_normal, this.game.textures.button_homeSmall_hover, this.game.textures.button_homeSmall_pressed]);
  13855. this.game.button_homeSmall.visible = !1;
  13856. ENEA._isDesktop && (this.game.button_settings = new FOTN.Button([this.game.textures.button_settings_normal, this.game.textures.button_settings_hover, this.game.textures.button_settings_pressed]), this.game.button_settings.visible = !1, this.game.button_musicON = new FOTN.Button([this.game.textures.button_music_normal, this.game.textures.button_music_hover, this.game.textures.button_music_pressed]), this.game.button_musicON.visible = !1, this.game.button_musicOFF = new FOTN.Button([this.game.textures.button_musicoff_normal, this.game.textures.button_musicoff_hover, this.game.textures.button_musicoff_pressed]), this.game.button_musicOFF.visible = !1, this.game.button_soundON = new FOTN.Button([this.game.textures.button_sound_normal, this.game.textures.button_sound_hover, this.game.textures.button_sound_pressed]), this.game.button_soundON.visible = !1, this.game.button_soundOFF = new FOTN.Button([this.game.textures.button_soundoff_normal, this.game.textures.button_soundoff_hover, this.game.textures.button_soundoff_pressed]), this.game.button_soundOFF.visible = !1);
  13857. this.game.button_achievements = new FOTN.Button([this.game.textures.button_achieve_normal, this.game.textures.button_achieve_hover, this.game.textures.button_achieve_pressed]);
  13858. this.game.button_achievements.visible = !1;
  13859. this.game.button_leaderboard = new FOTN.Button([this.game.textures.button_leader_normal, this.game.textures.button_leader_hover, this.game.textures.button_leader_pressed]);
  13860. this.game.button_leaderboard.visible = !1;
  13861. this.game.button_downArrow = new FOTN.Button([this.game.textures.button_downArrow_normal, this.game.textures.button_downArrow_hover, this.game.textures.button_downArrow_pressed]);
  13862. this.game.button_downArrow.visible = !1;
  13863. this.game.button_upArrow = new FOTN.Button([this.game.textures.button_upArrow_normal, this.game.textures.button_upArrow_hover, this.game.textures.button_upArrow_pressed]);
  13864. this.game.button_upArrow.visible = !1
  13865. }
  13866. };
  13867. FOTN.Layers = function(a) {
  13868. this.game = a;
  13869. this.init()
  13870. };
  13871. FOTN.Layers.prototype = {
  13872. init: function() {
  13873. this.game.loaderContainer = new ENEA.Container;
  13874. this.game.stage.addChild(this.game.loaderContainer);
  13875. this.game.menuScreen = new ENEA.Container;
  13876. this.game.menuScreen.visible = !1;
  13877. this.game.stage.addChild(this.game.menuScreen);
  13878. this.game.achievementsScreen = new ENEA.Container;
  13879. this.game.achievementsScreen.visible = !1;
  13880. this.game.stage.addChild(this.game.achievementsScreen);
  13881. this.game.leaderboardsScreen = new ENEA.Container;
  13882. this.game.leaderboardsScreen.visible = !1;
  13883. this.game.stage.addChild(this.game.leaderboardsScreen);
  13884. this.game.gameScreen = new ENEA.Container;
  13885. this.game.gameScreen.visible = !1;
  13886. this.game.stage.addChild(this.game.gameScreen);
  13887. this.game.eventsContainer = new ENEA.Container;
  13888. this.game.eventsContainer.responsive = !1;
  13889. this.game.stage.addChild(this.game.eventsContainer);
  13890. ENEA._isDesktop && (this.game.settings = new ENEA.Container, this.game.settings.visible = !1, this.game.settings.responsive = !0, this.game.stage.addChild(this.game.settings));
  13891. this.game.gameOverScreen = new ENEA.Container;
  13892. this.game.gameOverScreen.visible = !1;
  13893. this.game.gameOverScreen.responsive = !0;
  13894. this.game.stage.addChild(this.game.gameOverScreen);
  13895. this.game.buttonsContainer = new ENEA.Container;
  13896. this.game.buttonsContainer.visible = !1;
  13897. this.game.stage.addChild(this.game.buttonsContainer);
  13898. this.game.achievementContainer = new ENEA.Container;
  13899. this.game.achievementContainer.visible = !1;
  13900. this.game.stage.addChild(this.game.achievementContainer)
  13901. }
  13902. };
  13903. FOTN.Leaderboards = function(a, f) {
  13904. var h = this;
  13905. this.game = a;
  13906. this.layer = f;
  13907. this.currentPage = 0;
  13908. this.maxItems = 6;
  13909. this.titleTop = a.relY(0.055);
  13910. this.itemsTop = a.relY(0.15);
  13911. this.spacing = this.game.relY(0.103);
  13912. this.leaders = [];
  13913. this.avatars = [];
  13914. this.player = [];
  13915. this.layer.removeAllChildren();
  13916. this.bgLayer = new FOTN.BGScroller(this.game);
  13917. this.layer.addChild(this.bgLayer);
  13918. this.drawTitle();
  13919. this.getPlayer();
  13920. this.drawPlayer();
  13921. this.getLeaders(function() {
  13922. setTimeout(function() {
  13923. h.drawItems()
  13924. },
  13925. 10)
  13926. });
  13927. this.drawButtons();
  13928. this.drawShine();
  13929. this.fadeIN();
  13930. this.game.addUpdate("scrollBG",
  13931. function() {
  13932. h.bgLayer.layerCamera.y -= 0.005;
  13933. h.bgLayer.updatePosition();
  13934. h.layer.shine.rotation += 0.005
  13935. })
  13936. };
  13937. FOTN.Leaderboards.prototype = {
  13938. getPlayer: function(a) {
  13939. this.player.push({
  13940. name: "Diavolo",
  13941. score: 666,
  13942. avatar: "avatars/alpacino.jpg"
  13943. });
  13944. a && a.call()
  13945. },
  13946. getLeaders: function(a) {
  13947. this.leaders.push({
  13948. name: "Siimon",
  13949. score: 100,
  13950. avatar: "avatars/siimon.jpg"
  13951. });
  13952. this.leaders.push({
  13953. name: "John Doe",
  13954. score: 90,
  13955. avatar: "avatars/others.jpg"
  13956. });
  13957. this.leaders.push({
  13958. name: "Jane Doe",
  13959. score: 80,
  13960. avatar: "avatars/janedoe.jpg"
  13961. });
  13962. this.leaders.push({
  13963. name: "xxxx",
  13964. score: 5,
  13965. avatar: "avatars/others.jpg"
  13966. });
  13967. this.leaders.push({
  13968. name: "yyyy",
  13969. score: 4.4,
  13970. avatar: "avatars/others.jpg"
  13971. });
  13972. this.leaders.push({
  13973. name: "Mr. Z",
  13974. score: 3.5,
  13975. avatar: "avatars/others.jpg"
  13976. });
  13977. this.leaders.push({
  13978. name: "Mrs. AZ",
  13979. score: 3,
  13980. avatar: "avatars/others.jpg"
  13981. });
  13982. this.leaders.push({
  13983. name: "asdasdas",
  13984. score: 2,
  13985. avatar: "avatars/others.jpg"
  13986. });
  13987. this.leaders.push({
  13988. name: "sdfgdfgd",
  13989. score: 1,
  13990. avatar: "avatars/others.jpg"
  13991. });
  13992. a && a.call()
  13993. },
  13994. drawTitle: function() {
  13995. this.titleSprite = new PIXI.Text("Leaderboards", {
  13996. font: (ENEA._isHD ? 100 : 50) + "px Sauna-BlackItalic",
  13997. fill: "#FFFFFF",
  13998. align: "center"
  13999. });
  14000. this.titleSprite.applyParams({
  14001. x: this.game.centerX - this.titleSprite.width / 2,
  14002. y: this.titleTop - this.titleSprite.height / 2
  14003. }).addTo(this.layer)
  14004. },
  14005. doSeppuku: function() {
  14006. this.destroyItems();
  14007. this.titleSprite.destroy(!0)
  14008. },
  14009. destroyItems: function() {
  14010. if (this.itemsContainer instanceof ENEA.Container) {
  14011. for (; this.itemsContainer.children.length;) this.itemsContainer.children[0].doSeppuku && this.itemsContainer.children[0].doSeppuku(),
  14012. this.itemsContainer.removeChild(this.itemsContainer.children[0]);
  14013. this.itemsContainer.destroy()
  14014. }
  14015. },
  14016. drawItems: function() {
  14017. this.destroyItems();
  14018. this.itemsContainer = new ENEA.Container;
  14019. this.layer.addChild(this.itemsContainer);
  14020. for (var a = this.currentPage * this.maxItems,
  14021. f = 0; f < this.maxItems && a < this.leaders.length;) {
  14022. var h = new FOTN.LeaderboardsItem(this.game, a + 1, [this.leaders[a].avatar, this.game.textures.loading], this.leaders[a].name, this.leaders[a].score, !1);
  14023. h.x = this.game.centerX;
  14024. h.y = this.itemsTop + this.spacing * f;
  14025. this.itemsContainer.addChild(h);
  14026. a++;
  14027. f++
  14028. }
  14029. },
  14030. drawPlayer: function() {
  14031. var a = new FOTN.LeaderboardsItem(this.game, 666, [this.player[0].avatar, this.game.textures.loading], this.player[0].name, this.player[0].score, !1);
  14032. a.x = this.game.centerX;
  14033. a.y = this.itemsTop + this.spacing * this.maxItems + this.game.relY(0.075);
  14034. this.layer.addChild(a)
  14035. },
  14036. drawButtons: function() {
  14037. var a = this,
  14038. f = this.game.relY(0.755),
  14039. h = this.game.relX(0.228);
  14040. this.game.button_downArrow.applyParams({
  14041. x: a.game.centerX - h,
  14042. y: f,
  14043. visible: !0,
  14044. onClick: function() {
  14045. a.currentPage++;
  14046. a.currentPage * a.maxItems >= a.leaders.length ? a.currentPage--:a.drawItems()
  14047. }
  14048. }).addTo(this.layer);
  14049. this.game.button_upArrow.applyParams({
  14050. x: a.game.centerX,
  14051. y: f,
  14052. visible: !0,
  14053. onClick: function() {
  14054. a.currentPage--;
  14055. 0 > a.currentPage ? a.currentPage++:a.drawItems()
  14056. }
  14057. }).addTo(this.layer);
  14058. this.game.button_homeSmall.applyParams({
  14059. x: this.game.centerX + h,
  14060. y: f,
  14061. visible: !0,
  14062. onClick: function() {
  14063. a.doSeppuku();
  14064. a.game.removeAllUpdates();
  14065. ENEA.Tweener.removeAll();
  14066. a.game.achievementsScreen.visible = !1;
  14067. a.game.leaderboardsScreen.visible = !1;
  14068. a.game.gameOverScreen.visible = !1;
  14069. a.game.gameScreen.visible = !1;
  14070. ENEA._isDesktop && (a.game.settings.visible = !1);
  14071. FOTN.showButtonsState("menu");
  14072. a.game.buttonsContainer.visible = !1;
  14073. new FOTN.MenuIN(FOTN.game, FOTN.game.menuScreen)
  14074. }
  14075. }).addTo(this.layer)
  14076. },
  14077. fadeIN: function(a) {
  14078. var f = this;
  14079. ENEA.fadeElement(this.layer, 0, 1, FOTN.FADETIME,
  14080. function() {
  14081. ENEA._isDesktop && (f.game.settings.visible = !0);
  14082. f.layer.visible = !0;
  14083. FOTN.showButtonsState("leaderboards")
  14084. },
  14085. a)
  14086. },
  14087. drawShine: function(a) {
  14088. this.layer.shine = (new ENEA.Sprite({
  14089. texture: this.game.textures.shine,
  14090. anchorXY: 0.5,
  14091. scaleXY: 2,
  14092. x: this.game.centerX,
  14093. y: this.game.relY( - 0.05)
  14094. })).addTo(this.layer)
  14095. }
  14096. };
  14097. FOTN.LeaderboardsItem = function(a, f, h, n, p, b) {
  14098. this.game = a;
  14099. this._isLoaded = b || !1;
  14100. this.rank = f;
  14101. this.pictures = h;
  14102. this.name = n;
  14103. this.score = p;
  14104. this.avatar = null;
  14105. this.positions = {
  14106. rankX: this.game.relX( - 0.248),
  14107. rankY: this.game.relY(0),
  14108. pictureX: this.game.relX( - 0.12),
  14109. pictureY: this.game.relY(0),
  14110. textX: this.game.relX( - 0.031),
  14111. textY: this.game.relY( - 0.019),
  14112. scoreX: this.game.relX( - 0.031),
  14113. scoreY: this.game.relY(0.011)
  14114. };
  14115. ENEA.Container.call(this);
  14116. this.drawBackground();
  14117. this.drawRank();
  14118. this.drawPictures();
  14119. this.drawName();
  14120. this.drawScore()
  14121. };
  14122. FOTN.LeaderboardsItem.prototype = Object.create(ENEA.Container.prototype);
  14123. FOTN.LeaderboardsItem.prototype.constructor = FOTN.LeaderboardsItem;
  14124. FOTN.LeaderboardsItem.prototype.drawBackground = function() {
  14125. this.bgSprite = (new ENEA.Sprite({
  14126. texture: this.game.textures.itemBg,
  14127. anchorX: 0.5,
  14128. anchorY: 0.5
  14129. })).addTo(this)
  14130. };
  14131. FOTN.LeaderboardsItem.prototype.drawRank = function() {
  14132. this.rankSprite = new PIXI.Text(this.rank.toString(), {
  14133. font: (ENEA._isHD ? 80 : 40) + "px Sauna-BlackItalic",
  14134. fill: "#FFFFFF",
  14135. align: "center"
  14136. });
  14137. this.rankSprite.applyParams({
  14138. x: this.positions.rankX - this.rankSprite.width / 2,
  14139. y: this.positions.rankY - this.rankSprite.height / 2
  14140. }).addTo(this)
  14141. };
  14142. FOTN.LeaderboardsItem.prototype.drawPictures = function() {
  14143. var a = this;
  14144. this.avatarSprite = (new ENEA.Sprite({
  14145. texture: this.pictures[1],
  14146. x: this.positions.pictureX,
  14147. y: this.positions.pictureY,
  14148. anchorX: 0.5,
  14149. anchorY: 0.5
  14150. })).addTo(this);
  14151. this.avatarSprite.animID = ENEA.randomString();
  14152. this.game.addUpdate("avatarRot" + this.avatarSprite.animID,
  14153. function() {
  14154. a.avatarSprite.rotation += 0.05
  14155. });
  14156. null == this.avatar && (this.avatar = PIXI.Texture.fromImage(this.pictures[0]), this.avatar.baseTexture.hasLoaded && (this.game.removeUpdate("avatarRot" + this.avatarSprite.animID), this.avatarSprite.rotation = 0, this.avatarSprite.setTexture(this.avatar)), this.avatar.addEventListener("update", this.updateHandler.bind(this)))
  14157. };
  14158. FOTN.LeaderboardsItem.prototype.updateHandler = function(a) {
  14159. this.game.removeUpdate("avatarRot" + this.avatarSprite.animID);
  14160. this.avatarSprite.rotation = 0;
  14161. this.avatarSprite.setTexture(this.avatar);
  14162. this.avatar.removeEventListener("update", this.updateHandler)
  14163. };
  14164. FOTN.LeaderboardsItem.prototype.getAvatar = function() {
  14165. return this.avatar
  14166. };
  14167. FOTN.LeaderboardsItem.prototype.doSeppuku = function() {
  14168. this.rankSprite.destroy(!0);
  14169. this.textSprite.destroy(!0);
  14170. this.scoreSprite.destroy(!0)
  14171. };
  14172. FOTN.LeaderboardsItem.prototype.drawName = function() {
  14173. this.textSprite = new PIXI.Text(this.name, {
  14174. font: (ENEA._isHD ? 60 : 30) + "px Sauna-BlackItalic",
  14175. fill: "#FFFFFF",
  14176. align: "center"
  14177. });
  14178. this.textSprite.applyParams({
  14179. x: this.positions.textX,
  14180. y: this.positions.textY - this.textSprite.height / 2
  14181. }).addTo(this)
  14182. };
  14183. FOTN.LeaderboardsItem.prototype.drawScore = function() {
  14184. this.scoreSprite = new PIXI.Text(this.score, {
  14185. font: (ENEA._isHD ? 100 : 50) + "px Sauna-BlackItalic",
  14186. fill: "#FFFFFF",
  14187. align: "center"
  14188. });
  14189. this.scoreSprite.applyParams({
  14190. x: this.positions.scoreX,
  14191. y: this.positions.scoreY - this.scoreSprite.height / 2
  14192. }).addTo(this)
  14193. };
  14194. Object.defineProperty(FOTN.LeaderboardsItem.prototype, "loaded", {
  14195. get: function() {
  14196. return this._isLoaded
  14197. },
  14198. set: function(a) { (this._isLoaded = a) ? (this.pic1Sprite.visible = !0, this.pic2Sprite.visible = !1) : (this.pic1Sprite.visible = !1, this.pic2Sprite.visible = !0)
  14199. }
  14200. });
  14201. FOTN.Loader = function(a) {
  14202. // updateShare(0);
  14203. this.game = a;
  14204. this.resolution = this.game.resolution;
  14205. this.gameFiles = ["media/" + this.resolution + "/atlas01.png", "media/" + this.resolution + "/atlas01.json", "media/" + this.resolution + "/atlas02.png", "media/" + this.resolution + "/atlas02.json", "media/" + this.resolution + "/saunabitmap.fnt"];
  14206. if (1 == parseInt(ENEA.Storage.get("tutorial")) || parseInt(ENEA.Storage.get("best")) < FOTN._tutorialHeight) this.gameFiles.push("media/" + this.resolution + "/tutorial.png"),
  14207. this.gameFiles.push("media/" + this.resolution + "/tutorial.json");
  14208. this.init();
  14209. this.start()
  14210. };
  14211. FOTN.Loader.prototype = {
  14212. init: function() {
  14213. var a = this;
  14214. this.preloader = new ENEA.Preloader;
  14215. for (var f in this.gameFiles) this.preloader.add(this.gameFiles[f]);
  14216. this.pb = new ENEA.ProgressBar({
  14217. bitmap: this.game.loaderFG,
  14218. count: this.preloader.count + (ENEA._isDesktop ? 5 : 3)
  14219. });
  14220. this.preloader.onProgress = function() {
  14221. this.onProgress.call(a)
  14222. };
  14223. this.loadData("data/hints.js");
  14224. this.loadData("data/achievements.js");
  14225. this.loadFont("media/sauna.ttf", "Sauna-BlackItalic");
  14226. ENEA._isDesktop && (this.loadMusic(["sounds/music.m4a", "sounds/music.ogg", "sounds/music.mp3"]), this.loadSounds(["sounds/sounds.m4a", "sounds/sounds.ogg", "sounds/sounds.mp3", "sounds/sounds.wav"]));
  14227. this.pb.onComplete = function() {
  14228. new FOTN.Textures(a.game);
  14229. new FOTN.InitButtons(a.game);
  14230. ENEA._isDesktop ? a.askForSoundsFirst() : a.onLoaderComplete.call(a)
  14231. }
  14232. },
  14233. loadData: function(a) {
  14234. var f = this,
  14235. h = document.createElement("script");
  14236. h.type = "text/javascript";
  14237. h.src = a;
  14238. h.onload = function() {
  14239. f.onProgress()
  14240. };
  14241. h.onerror = function() {
  14242. console.log("Problem loading data")
  14243. };
  14244. document.getElementsByTagName("head")[0].appendChild(h)
  14245. },
  14246. loadFont: function(a, f) {
  14247. var h = this;
  14248. this.font = new Font;
  14249. this.font.src = a;
  14250. this.font.fontFamily = f;
  14251. this.font.onload = function() {
  14252. h.preloader.onProgress()
  14253. };
  14254. this.font.onerror = function(a) {
  14255. h.preloader.onProgress();
  14256. console.log("Font loading error: " + a)
  14257. }
  14258. },
  14259. loadMusic: function(a) {
  14260. var f = this;
  14261. ENEA.Storage.has("volume") || ENEA.Storage.set("volume", 0.3);
  14262. FOTN.Music = new Howl({
  14263. src: a,
  14264. loop: !0,
  14265. volume: ENEA.Storage.get("volume"),
  14266. onload: function() {
  14267. console.log("Music loaded");
  14268. f.onProgress()
  14269. },
  14270. onloaderror: function() {
  14271. console.log("Problem loading music");
  14272. f.preloader.onProgress()
  14273. }
  14274. })
  14275. },
  14276. loadSounds: function(a) {
  14277. var f = this;
  14278. FOTN.Sounds = new Howl({
  14279. src: a,
  14280. sprite: {
  14281. spikes: [500, 2E3],
  14282. jump: [3E3, 390],
  14283. button: [3990, 350],
  14284. impact: [4820, 600],
  14285. achievement: [6E3, 600]
  14286. },
  14287. onload: function() {
  14288. console.log("Sounds loaded");
  14289. f.onProgress()
  14290. },
  14291. onloaderror: function() {
  14292. console.log("Problem loading sounds");
  14293. f.preloader.onProgress()
  14294. }
  14295. })
  14296. },
  14297. onProgress: function() {
  14298. this.pb.loaded++;
  14299. this.pb.update()
  14300. },
  14301. askForSoundsFirst: function(a) {
  14302. var f = this;
  14303. this.game.loaderNinjaSprite.visible = !1;
  14304. this.game.loaderSoundsSprite.visible = !0;
  14305. this.game.loaderYesSprite.visible = !0;
  14306. this.game.loaderYesSprite.responsive = !0;
  14307. this.game.loaderNoSprite.visible = !0;
  14308. this.game.loaderNoSprite.responsive = !0;
  14309. this.game.loaderBgSprite.visible = !1;
  14310. this.game.loaderFgSprite.visible = !1;
  14311. this.game.loaderLoadingSprite.visible = !1;
  14312. this.game.loaderYesSprite.answer = this.game.loaderNoSprite.answer = function() {
  14313. FOTN._musicMuted || FOTN.Music.play();
  14314. f.onLoaderComplete.call(f)
  14315. }
  14316. },
  14317. onLoaderComplete: function() {
  14318. var a = this;
  14319. ENEA.fadeElement(this.game.loaderContainer, 1, 0, FOTN.FADETIME, null,
  14320. function() {
  14321. a.pb.destroy();
  14322. a.pb = null;
  14323. a.destroyLoaderTextures();
  14324. a.game.loaderContainer.destroy();
  14325. a.game.loaderContainer = null;
  14326. a.onComplete && a.onComplete.call()
  14327. })
  14328. },
  14329. destroyLoaderTextures: function() {
  14330. this.game.loaderFG.destroy(!0)
  14331. },
  14332. start: function() {
  14333. this.preloader.start()
  14334. }
  14335. };
  14336. FOTN.Player = function(a, f) {
  14337. this.game = a;
  14338. this.layer = f;
  14339. this._now = this._delta = null;
  14340. this._then = Date.now();
  14341. this.totalFrames = this.currentFrame = this.startFrame = null;
  14342. this.isDead = !1;
  14343. this.score = 0;
  14344. this._spikesSounds = 400;
  14345. this._timePassed = 0;
  14346. this.animationSpeed = 70;
  14347. this.jumpHeight = this.defaultJumpHeight = 7;
  14348. this.jumpHeightIncerease = 0.3;
  14349. this.jumpInterval = 200;
  14350. this._slidingDownTimer = this._slideTimer = null;
  14351. this.slideStartTime = 100;
  14352. this.slideDownDuration = 3E3;
  14353. this.sinStart = 2 * Math.PI;
  14354. this.sinEnd = Math.PI;
  14355. this.jumpCurvature = ENEA._isHD ? 220 : 110;
  14356. this._jumpStart = this.slideTween = null;
  14357. this._jumpEnd = Date.now();
  14358. this.collisionRadius = ENEA._isHD ? 80 : 40;
  14359. this._isPlaying = !1;
  14360. this.animations = {
  14361. idle: [0, 1, 2, 3, 4],
  14362. first: [5, 6, 7, 8, 9, 10, 11],
  14363. jump: [12, 13, 14, 15, 16, 17, 18, 19, 20, 21]
  14364. };
  14365. this.currentAnimation = null;
  14366. this.playerTextures = [];
  14367. this.createTextures();
  14368. this._maxPool = 5;
  14369. this._pool = [];
  14370. this._previousFrames = [];
  14371. this.createPool();
  14372. PIXI.Sprite.call(this, this.playerTextures[0]);
  14373. this.anchor.x = 0.5;
  14374. this.anchor.y = 0.5;
  14375. this.metresPosition = new PIXI.Point(0, 0);
  14376. this.reset()
  14377. };
  14378. FOTN.Player.prototype = Object.create(PIXI.Sprite.prototype);
  14379. FOTN.Player.prototype.constructor = FOTN.Player;
  14380. FOTN.Player.prototype.storeGhost = function(a) {
  14381. this._previousFrames.unshift(a)
  14382. };
  14383. FOTN.Player.prototype.showGhosts = function() {
  14384. for (var a = 0.8 / this._maxPool,
  14385. f = 0; f < this._maxPool && !(f >= this._previousFrames.length); f++) this._pool[f].position.x = this._previousFrames[f].x,
  14386. this._pool[f].position.y = this._previousFrames[f].y,
  14387. this._pool[f].rotation = this._previousFrames[f].r,
  14388. this._pool[f].setTexture(this.playerTextures[this._previousFrames[f].frame]),
  14389. this._pool[f].alpha = 0.9 - f * a,
  14390. this._pool[f].visible = !0;
  14391. f >= this._maxPool && this._previousFrames.pop()
  14392. };
  14393. FOTN.Player.prototype.clearGhosts = function(a) {
  14394. for (a = 0; a < this._maxPool; a++) this._pool[a].visible = !1,
  14395. this._pool[a].rotation = 0;
  14396. this._previousFrames = []
  14397. };
  14398. FOTN.Player.prototype.createPool = function() {
  14399. for (var a = 0; a < this._maxPool; a++) {
  14400. var f = (new ENEA.Sprite({
  14401. texture: this.playerTextures[0],
  14402. anchorXY: 0.5,
  14403. visible: !0,
  14404. alpha: 1,
  14405. x: 300,
  14406. y: 300
  14407. })).addTo(this.layer.bgContainer);
  14408. this._pool.push(f)
  14409. }
  14410. };
  14411. FOTN.Player.prototype.createTextures = function() {
  14412. this.playerImages = "ninja_idle (1).png;ninja_idle (2).png;ninja_idle (3).png;ninja_idle (4).png;ninja_idle (5).png;ninja_1stJump (1).png;ninja_1stJump (2).png;ninja_1stJump (3).png;ninja_1stJump (4).png;ninja_1stJump (5).png;ninja_1stJump (6).png;ninja_1stJump (7).png;ninja_flip (1).png;ninja_flip (2).png;ninja_flip (3).png;ninja_flip (4).png;ninja_flip (5).png;ninja_flip (6).png;ninja_flip (7).png;ninja_flip (8).png;ninja_flip (9).png;ninja_flip (10).png".split(";");
  14413. for (var a = 0; a < this.playerImages.length; a++) this.playerTextures.push(PIXI.Texture.fromFrame(this.playerImages[a]))
  14414. };
  14415. FOTN.Player.prototype.reset = function(a) {
  14416. document.getElementById('moregame').style.display = "none",
  14417. this.score = 0;
  14418. this.scale.x = -1;
  14419. this.rotation = 0;
  14420. this.clearGhosts();
  14421. this.isDead = !1;
  14422. this.metresPosition.y = 0;
  14423. this.x = this.game.centerX;
  14424. this.jumpHeight = this.defaultJumpHeight;
  14425. this.loopAnimation("idle");
  14426. ENEA.Tweener.remove(this.slideTween);
  14427. this.tacticalSlider = 0;
  14428. this.longSlider = parseInt(ENEA.Storage.get("longslider"))
  14429. };
  14430. FOTN.Player.prototype.startJump = function(a) {
  14431. clearTimeout(this._slidingDownTimer);
  14432. clearTimeout(this._slideTimer);
  14433. this._jumpStart = Date.now();
  14434. this.jumpHeight = this._jumpStart - this._jumpEnd < this.jumpInterval ? this.jumpHeight + this.jumpHeightIncerease: this.defaultJumpHeight
  14435. };
  14436. FOTN.Player.prototype.checkSlide = function(a) {
  14437. var f = this;
  14438. this._slideTimer = setTimeout(function() {
  14439. f._jumpEnd - f._jumpStart > f.slideStartTime && (clearTimeout(f._slideTimer), f._slidingDownTimer = setTimeout(function() {
  14440. FOTN._soundsMuted || ENEA._isIE || !ENEA._isDesktop || FOTN.Sounds.play("spikes");
  14441. clearTimeout(f._slidingDownTimer)
  14442. },
  14443. f._spikesSounds), f.slideDown())
  14444. },
  14445. this.slideStartTime)
  14446. };
  14447. FOTN.Player.prototype.slideDown = function(a) {
  14448. var f = this,
  14449. h = this.metresPosition.y;
  14450. this._slidingDown = !0;
  14451. this.layer.bgContainer.setSpikes();
  14452. this.tmpSlider = this.metresPosition.y;
  14453. var n = {
  14454. pY: this.metresPosition.y,
  14455. sY: h - this.game.Camera.playerOffset - 2
  14456. },
  14457. h = {
  14458. pY: this.metresPosition.y - this.game.Camera.playerOffset,
  14459. sY: h - 4
  14460. };
  14461. this.slideTween = (new ENEA.Tweener.Tween(n)).to(h, this.slideDownDuration).easing(ENEA.Tweener.Easing.Linear.None).onUpdate(function() {
  14462. f.metresPosition.y = n.pY;
  14463. f.position.y = -n.pY * f.layer.bgContainer.meter;
  14464. f.layer.bgContainer.groundPosition = n.sY;
  14465. f.layer.bgContainer.updateGroundNspikes();
  14466. f.checkCollisions()
  14467. }).onStop(function() {
  14468. f.tacticalSlider += Math.round(10 * (f.tmpSlider - n.pY)) / 10;
  14469. FOTN._tutorialIsRunning && (f.tacticalSlider = 0);
  14470. FOTN.game.achievements.compareCurrentSlide(f.tacticalSlider);
  14471. FOTN.game.achievements.compareTotalSlide(f.longSlider + f.tacticalSlider)
  14472. }).onComplete(function() {
  14473. f.slidingDown = !1;
  14474. a && a.call()
  14475. }).start()
  14476. };
  14477. FOTN.Player.prototype.endJump = function(a) {
  14478. this._jumpEnd = Date.now()
  14479. };
  14480. FOTN.Player.prototype.gotoFrame = function(a) {
  14481. this.setTexture(this.playerTextures[a])
  14482. };
  14483. FOTN.Player.prototype.startAnimation = function(a) {
  14484. this.startFrame = this.animations[a][0];
  14485. this.currentFrame = 0;
  14486. this.totalFrames = this.animations[a].length;
  14487. this._now = Date.now();
  14488. this._delta = this._now - this._then;
  14489. this._then = Date.now();
  14490. this._timePassed = 0;
  14491. this.currentAnimation = a;
  14492. this._isPlaying = !0
  14493. };
  14494. FOTN.Player.prototype.updateAnimation = function() {
  14495. this._now = Date.now();
  14496. this._delta = this._now - this._then;
  14497. this._timePassed += this._delta;
  14498. this._timePassed >= this.animationSpeed && (this.currentFrame += ~~ (this._timePassed / this.animationSpeed), this.currentFrame >= this.totalFrames && (this._loop ? this.currentFrame = 0 : (this._numLoops--, 0 >= this._numLoops ? this.stopAnimation() : this.currentFrame = 0)), this._timePassed = 0);
  14499. this._isPlaying && this.setTexture(this.playerTextures[this.animations[this.currentAnimation][this.currentFrame]]);
  14500. this._then = this._now
  14501. };
  14502. FOTN.Player.prototype.stopAnimation = function() {
  14503. this._isPlaying = !1;
  14504. this.setTexture(this.playerTextures[this.animations[this.currentAnimation][this.totalFrames - 1]]);
  14505. this.currentAnimation = null;
  14506. this._timePassed = 0;
  14507. this.game.removeUpdate(this.animID)
  14508. };
  14509. FOTN.Player.prototype.loopAnimation = function(a, f) {
  14510. var h = this;
  14511. this._isPlaying && this.stopAnimation();
  14512. f ? (this._loop = !1, this._numLoops = f) : this._loop = !0;
  14513. this.animID = "playerAnimation";
  14514. this.startAnimation(a);
  14515. this.game.addUpdate(this.animID,
  14516. function() {
  14517. h.updateAnimation()
  14518. })
  14519. };
  14520. FOTN.Player.prototype.getScore = function() {
  14521. return this.score
  14522. };
  14523. FOTN.Player.prototype.setScore = function(a) {
  14524. this.score = a
  14525. };
  14526. FOTN.Player.prototype.checkCollisions = function() {
  14527. for (var a, f, h = this.collisionRadius + this.layer.bgContainer._poolDisks[0].collisionRadius, h = h * h, n = 0; n < this.layer.bgContainer.maxObjects; n++) a = this.layer.bgContainer._poolDisks[n].position.x - this.game.player.position.x,
  14528. f = this.layer.bgContainer._poolDisks[n].position.y - this.game.player.position.y,
  14529. a = a * a + f * f,
  14530. a < h && this.onCollision && (clearTimeout(this._slidingDownTimer), clearTimeout(this._slideTimer), this.onCollision.call());
  14531. this.y + this.collisionRadius > this.layer.bgContainer.groundNspikes.position.y && this.onCollision && this.onCollision.call()
  14532. };
  14533. FOTN.Player.prototype.set = function(a) {
  14534. this.defaultJumpHeight = a
  14535. };
  14536. FOTN.Player.prototype.getScore = function() {
  14537. return FOTN._tutorialIsRunning ? 0 : this.score
  14538. };
  14539. FOTN.Player.prototype.setScore = function(a) {
  14540. this.score = a
  14541. };
  14542. FOTN.ReadAchievements = function() {
  14543. ENEA.Storage.has("tutorial") || ENEA.Storage.set("tutorial", 1);
  14544. ENEA.Storage.has("longrunner") || ENEA.Storage.set("longrunner", 0);
  14545. ENEA.Storage.has("longslider") || ENEA.Storage.set("longslider", 0);
  14546. ENEA.Storage.has("reincarnation") || ENEA.Storage.set("reincarnation", 0);
  14547. ENEA.Storage.has("first") || ENEA.Storage.set("first", this.getDate());
  14548. this.done = "OK"
  14549. };
  14550. FOTN.ReadAchievements.prototype = {
  14551. read: function() {
  14552. var a = [];
  14553. FOTN._isNuggeta || (a = this.getFromLocalStorage());
  14554. return a
  14555. },
  14556. write: function(a) {
  14557. FOTN._isNuggeta || ENEA.Storage.set("achievements", JSON.stringify(a))
  14558. },
  14559. getFromLocalStorage: function() {
  14560. var a = {
  14561. 0 : 0,
  14562. 1 : 0,
  14563. 2 : 0,
  14564. 3 : 0,
  14565. 4 : 0,
  14566. 5 : 0,
  14567. 6 : 0,
  14568. 7 : 0,
  14569. 8 : 0,
  14570. 9 : 0,
  14571. 10 : 0,
  14572. 11 : 0,
  14573. 12 : 0,
  14574. 13 : 0,
  14575. 14 : 0,
  14576. 15 : 0,
  14577. 16 : 0,
  14578. 17 : 0,
  14579. 18 : 0,
  14580. 19 : 0,
  14581. 20 : 0
  14582. };
  14583. ENEA.Storage.has("achievements") || ENEA.Storage.set("achievements", JSON.stringify(a));
  14584. return a = JSON.parse(ENEA.Storage.get("achievements"))
  14585. },
  14586. compareCurrentHeight: function(a) {
  14587. a >= FOTN._desired[0] && FOTN.achieved[0] !== this.done && (FOTN.achieved[0] = this.done, this.write(FOTN.achieved), FOTN.game.unlocked.unlockedIconSprite.setTexture(FOTN.game.textures.ach_fastRunner), this.onAchievement && this.onAchievement.call());
  14588. a >= FOTN._desired[1] && FOTN.achieved[1] !== this.done && (FOTN.achieved[1] = this.done, this.write(FOTN.achieved), FOTN.game.unlocked.unlockedIconSprite.setTexture(FOTN.game.textures.ach_fastRunner), this.onAchievement && this.onAchievement.call());
  14589. a >= FOTN._desired[2] && FOTN.achieved[2] !== this.done && (FOTN.achieved[2] = this.done, this.write(FOTN.achieved), FOTN.game.unlocked.unlockedIconSprite.setTexture(FOTN.game.textures.ach_fastRunner), this.onAchievement && this.onAchievement.call());
  14590. a >= FOTN._desired[3] && FOTN.achieved[3] !== this.done && (FOTN.achieved[3] = this.done, this.write(FOTN.achieved), FOTN.game.unlocked.unlockedIconSprite.setTexture(FOTN.game.textures.ach_fastRunner), this.onAchievement && this.onAchievement.call())
  14591. },
  14592. compareTotalHeight: function(a) {
  14593. a >= FOTN._desired[4] && FOTN.achieved[4] !== this.done && (FOTN.achieved[4] = this.done, this.write(FOTN.achieved), FOTN.game.unlocked.unlockedIconSprite.setTexture(FOTN.game.textures.ach_longRunner), this.onAchievement && this.onAchievement.call());
  14594. a >= FOTN._desired[5] && FOTN.achieved[5] !== this.done && (FOTN.achieved[5] = this.done, this.write(FOTN.achieved), FOTN.game.unlocked.unlockedIconSprite.setTexture(FOTN.game.textures.ach_longRunner), this.onAchievement && this.onAchievement.call());
  14595. a >= FOTN._desired[6] && FOTN.achieved[6] !== this.done && (FOTN.achieved[6] = this.done, this.write(FOTN.achieved), FOTN.game.unlocked.unlockedIconSprite.setTexture(FOTN.game.textures.ach_longRunner), this.onAchievement && this.onAchievement.call());
  14596. a >= FOTN._desired[7] && FOTN.achieved[7] !== this.done && (FOTN.achieved[7] = this.done, this.write(FOTN.achieved), FOTN.game.unlocked.unlockedIconSprite.setTexture(FOTN.game.textures.ach_longRunner), this.onAchievement && this.onAchievement.call());
  14597. a >= FOTN._desired[8] && FOTN.achieved[8] !== this.done && (FOTN.achieved[8] = this.done, this.write(FOTN.achieved), FOTN.game.unlocked.unlockedIconSprite.setTexture(FOTN.game.textures.ach_longRunner), this.onAchievement && this.onAchievement.call())
  14598. },
  14599. compareCurrentSlide: function(a) {
  14600. a >= FOTN._desired[9] && FOTN.achieved[9] !== this.done && (FOTN.achieved[9] = this.done, this.write(FOTN.achieved), FOTN.game.unlocked.unlockedIconSprite.setTexture(FOTN.game.textures.ach_tactical), this.onAchievement && this.onAchievement.call());
  14601. a >= FOTN._desired[10] && FOTN.achieved[10] !== this.done && (FOTN.achieved[10] = this.done, this.write(FOTN.achieved), FOTN.game.unlocked.unlockedIconSprite.setTexture(FOTN.game.textures.ach_tactical), this.onAchievement && this.onAchievement.call());
  14602. a >= FOTN._desired[11] && FOTN.achieved[11] !== this.done && (FOTN.achieved[11] = this.done, this.write(FOTN.achieved), FOTN.game.unlocked.unlockedIconSprite.setTexture(FOTN.game.textures.ach_tactical), this.onAchievement && this.onAchievement.call())
  14603. },
  14604. compareTotalSlide: function(a) {
  14605. a >= FOTN._desired[12] && FOTN.achieved[12] !== this.done && (FOTN.achieved[12] = this.done, this.write(FOTN.achieved), FOTN.game.unlocked.unlockedIconSprite.setTexture(FOTN.game.textures.ach_longSlider), this.onAchievement && this.onAchievement.call());
  14606. a >= FOTN._desired[13] && FOTN.achieved[13] !== this.done && (FOTN.achieved[13] = this.done, this.write(FOTN.achieved), FOTN.game.unlocked.unlockedIconSprite.setTexture(FOTN.game.textures.ach_longSlider), this.onAchievement && this.onAchievement.call());
  14607. a >= FOTN._desired[14] && FOTN.achieved[14] !== this.done && (FOTN.achieved[14] = this.done, this.write(FOTN.achieved), FOTN.game.unlocked.unlockedIconSprite.setTexture(FOTN.game.textures.ach_longSlider), this.onAchievement && this.onAchievement.call())
  14608. },
  14609. compareDeaths: function(a) {
  14610. a >= FOTN._desired[15] && FOTN.achieved[15] !== this.done && (FOTN.achieved[15] = this.done, this.write(FOTN.achieved), this.onAchievement && this.onAchievement.call());
  14611. a >= FOTN._desired[16] && FOTN.achieved[16] !== this.done && (FOTN.achieved[16] = this.done, this.write(FOTN.achieved), this.onAchievement && this.onAchievement.call());
  14612. a >= FOTN._desired[17] && FOTN.achieved[17] !== this.done && (FOTN.achieved[17] = this.done, this.write(FOTN.achieved), this.onAchievement && this.onAchievement.call())
  14613. },
  14614. compareAddict: function() {
  14615. var a = new Date(ENEA.Storage.get("first")),
  14616. f = new Date(this.getDate());
  14617. 0 != this.daysBetween(a, f) && (0 == this.daysBetween(a, f) - 1 ? (FOTN.achieved[18] !== this.done && (FOTN.achieved[18] += 1), FOTN.achieved[19] !== this.done && (FOTN.achieved[19] += 1), FOTN.achieved[20] !== this.done && (FOTN.achieved[20] += 1), this.write(FOTN.achieved), ENEA.Storage.set("first", this.getDate(f)), FOTN.achieved[18] >= FOTN._desired[18] && FOTN.achieved[18] !== this.done && (FOTN.achieved[18] = this.done, this.write(FOTN.achieved)), FOTN.achieved[19] >= FOTN._desired[19] && FOTN.achieved[19] !== this.done && (FOTN.achieved[19] = this.done, this.write(FOTN.achieved)), FOTN.achieved[20] >= FOTN._desired[20] && FOTN.achieved[20] !== this.done && (FOTN.achieved[20] = this.done, this.write(FOTN.achieved))) : (FOTN.achieved[18] !== this.done && (FOTN.achieved[18] = 0, this.write(FOTN.achieved), ENEA.Storage.set("first", this.getDate(f))), FOTN.achieved[19] !== this.done && (FOTN.achieved[19] = 0, this.write(FOTN.achieved), ENEA.Storage.set("first", this.getDate(f))), FOTN.achieved[20] !== this.done && (FOTN.achieved[20] = 0, this.write(FOTN.achieved), ENEA.Storage.set("first", this.getDate(f)))))
  14618. },
  14619. getDate: function(a) {
  14620. var f;
  14621. f = void 0 == a ? new Date: a;
  14622. a = f.getDate().toString();
  14623. var h = (f.getMonth() + 1).toString();
  14624. f = f.getFullYear().toString();
  14625. return (h[1] ? h: "0" + h[0]) + "/" + (a[1] ? a: "0" + a[0]) + "/" + f
  14626. },
  14627. daysBetween: function(a, f) {
  14628. var h = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate()),
  14629. n = Date.UTC(f.getFullYear(), f.getMonth(), f.getDate());
  14630. return Math.floor((n - h) / 864E5)
  14631. }
  14632. };
  14633. FOTN.RunGame = function(a, f) {
  14634. var h = this;
  14635. this.game = a;
  14636. this.layer = f;
  14637. this.maxObjects = this.layer.bgContainer.maxObjects;
  14638. this.game.removeAllUpdates();
  14639. this.playerTween = null;
  14640. this.game.player.onCollision = null;
  14641. this.game.player.onCollision = this.onCollision.bind(this);
  14642. ENEA._isDesktop && (this.game.settings.visible = !0);
  14643. this.resetGame();
  14644. FOTN.game.achievements.onAchievement = this.game.unlocked.animateOut.bind(this.game.unlocked);
  14645. this.game.gameScreen.alpha = 0;
  14646. this.game.gameScreen.visible = !0;
  14647. this.spinItAll();
  14648. this.fadeIN(function() {
  14649. h.bindControls();
  14650. h.animateSawsIN();
  14651. 1 == parseInt(ENEA.Storage.get("tutorial")) && (h.game.tutorialContainer.visible = !0, h.game.tutorial.runTutorial(h));
  14652. h.game.button_restart.onClick = function() {
  14653. h.resetGame();
  14654. h.animateSawsIN()
  14655. }
  14656. })
  14657. };
  14658. FOTN.RunGame.prototype = {
  14659. resetGame: function(a) {
  14660. this.game.Camera.x = 0;
  14661. this.game.Camera.y = 0;
  14662. this.layer.bgContainer.resetAll();
  14663. void 0 != this.playerTween && this.playerTween.stop();
  14664. this.animating = !1;
  14665. this.game.player.reset();
  14666. this.game.player.y = this.layer.bgContainer.getGroundPosition() - this.game.player.playerTextures[0].height / 2;
  14667. this.layer.heightText.setText("");
  14668. this.layer.heightText.updateTransform();
  14669. this.prepareSaws();
  14670. this._isFirstJump = !0;
  14671. this.game.gameOverScreen.visible = !1;
  14672. FOTN.showButtonsState("game");
  14673. this.longRunner = parseInt(ENEA.Storage.get("longrunner"));
  14674. 1 === parseInt(ENEA.Storage.get("tutorial")) || FOTN._tutorialIsRunning || ENEA.Storage.set("reincarnation", parseInt(ENEA.Storage.get("reincarnation")) + 1)
  14675. },
  14676. updateHeightText: function() {
  14677. this.game.player.setScore(Math.round(10 * this.game.player.metresPosition.y) / 10);
  14678. this.layer.heightText.setText(this.game.player.getScore() + " m");
  14679. this.layer.heightText.updateTransform();
  14680. this.layer.heightText.position.x = this.game.centerX - this.layer.heightText.textWidth / 2;
  14681. FOTN.game.achievements.compareCurrentHeight(this.game.player.getScore());
  14682. FOTN.game.achievements.compareTotalHeight(this.longRunner + this.game.player.getScore())
  14683. },
  14684. fadeIN: function(a) {
  14685. ENEA.fadeElement(this.game.gameScreen, 0, 1, FOTN.FADETIME, null, a)
  14686. },
  14687. prepareSaws: function() {
  14688. this.sawsOffset = 0.2;
  14689. for (var a = 0; a < this.maxObjects; a++) this.layer.bgContainer._poolDisks[a].position.x = this.game.relX(0 == a % 2 ? 0.89 + this.sawsOffset: 0.11 - this.sawsOffset)
  14690. },
  14691. animateSawsIN: function(a) {
  14692. var f = this,
  14693. h = {
  14694. x: this.sawsOffset
  14695. }; (new ENEA.Tweener.Tween(h)).to({
  14696. x: 0
  14697. },
  14698. 400).easing(ENEA.Tweener.Easing.Cubic.Out).onUpdate(function() {
  14699. for (var a = 0; a < f.maxObjects; a++) f.layer.bgContainer._poolDisks[a].position.x = f.game.relX(0 == a % 2 ? 0.89 + h.x: 0.11 - h.x)
  14700. }).onComplete(function() {
  14701. a && a.call()
  14702. }).start()
  14703. },
  14704. spinItAll: function(a) {
  14705. var f = this;
  14706. this.game.addUpdate("shineNsaws",
  14707. function() {
  14708. f.layer.shine.rotation += 0.005;
  14709. for (var a = 0; a < f.maxObjects; a++) f.layer.bgContainer._poolDisks[a].rotation += f.layer.bgContainer._poolDisks[a].rotSpeed
  14710. })
  14711. },
  14712. bindControls: function() {
  14713. var a = this;
  14714. this.game.eventsContainer.responsive = !0;
  14715. this.game.eventsContainer.hitArea = new PIXI.Rectangle(0, 0, this.game.width, this.game.height);
  14716. this.game.eventsContainer.mousedown = this.game.eventsContainer.touchstart = function() {
  14717. FOTN._tutorialIsRunning = !1;
  14718. a.layer.heightText.visible = !0;
  14719. a.animating || a.game.player.isDead || (a._isFirstJump ? (FOTN._soundsMuted || ENEA._isIE || !ENEA._isDesktop || FOTN.Sounds.play("jump"), FOTN.game.achievements.compareDeaths(parseInt(ENEA.Storage.get("reincarnation"))), a.doFirstJump()) : (a.game.player.startJump(), FOTN._soundsMuted || ENEA._isIE || !ENEA._isDesktop || FOTN.Sounds.play("jump"), a.jump(a.game.Camera.y, a.game.player.metresPosition.y + a.game.player.jumpHeight - a.game.Camera.playerOffset,
  14720. function() {
  14721. a.game.player.checkSlide()
  14722. })))
  14723. }
  14724. },
  14725. doFirstJump: function(a, f, h) {
  14726. this.animating = !0;
  14727. var n = this;
  14728. a = n.game.relX(0.05);
  14729. var p = {
  14730. f: 5,
  14731. plY: n.game.player.metresPosition.y,
  14732. x: n.game.player.x,
  14733. y: n.game.player.y
  14734. };
  14735. a = {
  14736. f: 11,
  14737. plY: n.game.player.metresPosition.y + n.game.player.jumpHeight / 2,
  14738. x: n.layer.bgContainer.leftBorder + a,
  14739. y: n.game.player.y - n.layer.bgContainer.meter * n.game.player.jumpHeight / 2
  14740. }; (new ENEA.Tweener.Tween(p)).to(a, 200).easing(ENEA.Tweener.Easing.Sinusoidal.Out).onStart(function() {
  14741. n.game.player._isPlaying && n.game.player.stopAnimation();
  14742. n.game.player.gotoFrame(5)
  14743. }).onUpdate(function() {
  14744. n.game.player.position.x = p.x;
  14745. n.game.player.position.y = p.y;
  14746. n.game.player.gotoFrame(~~p.f);
  14747. n.game.player.metresPosition.y = p.plY;
  14748. n.game.player.storeGhost({
  14749. x: n.game.player.position.x,
  14750. y: n.game.player.position.y,
  14751. r: n.game.player.rotation,
  14752. frame: ~~p.f
  14753. });
  14754. n.game.player.showGhosts()
  14755. }).onComplete(function() {
  14756. n.animating = !1;
  14757. n.game.player.clearGhosts();
  14758. n._isFirstJump = !1;
  14759. n.game.player.endJump();
  14760. h && h.call()
  14761. }).start()
  14762. },
  14763. jump: function(a, f, h) {
  14764. var n = this;
  14765. this.animating = !0;
  14766. var p = n.game.relX(0.05),
  14767. b = {
  14768. camY: a,
  14769. plY: n.game.player.metresPosition.y,
  14770. f: 12,
  14771. s: n.game.player.sinStart,
  14772. x: n.game.player.position.x < n.game.centerX ? n.layer.bgContainer.leftBorder - p: n.layer.bgContainer.rightBorder + p
  14773. };
  14774. a = {
  14775. camY: f,
  14776. plY: n.game.player.metresPosition.y + n.game.player.jumpHeight,
  14777. f: 21,
  14778. s: n.game.player.sinEnd,
  14779. x: n.game.player.position.x < n.game.centerX ? n.layer.bgContainer.rightBorder - p: n.layer.bgContainer.leftBorder + p
  14780. };
  14781. this.playerTween = (new ENEA.Tweener.Tween(b)).to(a, 400).easing(ENEA.Tweener.Easing.Sinusoidal.InOut).onStart(function() {
  14782. void 0 != n.game.player.slideTween && n.game.player.slideTween.stop()
  14783. }).onUpdate(function() {
  14784. n.game.player.metresPosition.y = b.plY;
  14785. n.game.player.position.x = b.x;
  14786. n.game.player.position.y = -n.game.player.metresPosition.y * n.layer.bgContainer.meter + n.game.player.jumpCurvature * Math.sin(b.s);
  14787. n.game.Camera.y = b.camY;
  14788. n.layer.bgContainer.updatePosition();
  14789. n.updateHeightText();
  14790. n.checkCollisions();
  14791. n.game.player.gotoFrame(~~b.f);
  14792. n.game.player.storeGhost({
  14793. x: n.game.player.position.x,
  14794. y: n.game.player.position.y,
  14795. r: n.game.player.rotation,
  14796. frame: ~~b.f
  14797. });
  14798. n.game.player.showGhosts()
  14799. }).onComplete(function() {
  14800. n.game.player.scale.x = n.game.player.position.x < n.game.centerX ? 1 : -1;
  14801. n.game.player.clearGhosts();
  14802. n.animating = !1;
  14803. n.game.player.endJump();
  14804. h && h.call()
  14805. }).start()
  14806. },
  14807. checkCollisions: function() {
  14808. for (var a, f, h = this.game.player.collisionRadius + this.layer.bgContainer._poolDisks[0].collisionRadius, h = h * h, n = 0; n < this.maxObjects; n++) if (a = this.layer.bgContainer._poolDisks[n].position.x - this.game.player.position.x, f = this.layer.bgContainer._poolDisks[n].position.y - this.game.player.position.y, a = a * a + f * f, a < h) this.onCollision()
  14809. },
  14810. onCollision: function() {
  14811. FOTN._soundsMuted || ENEA._isIE || !ENEA._isDesktop || FOTN.Sounds.play("impact");
  14812. this.game.player.isDead = !0;
  14813. this.updateGameOverScreen();
  14814. FOTN.showButtonsState("over");
  14815. this.game.button_restart.responsive = !1;
  14816. var a = this;
  14817. void 0 != this.playerTween && this.playerTween.stop();
  14818. void 0 != this.game.player.slideTween && this.game.player.slideTween.stop();
  14819. ENEA.Storage.set("longrunner", parseInt(ENEA.Storage.get("longrunner")) + this.game.player.getScore());
  14820. ENEA.Storage.set("longslider", parseInt(ENEA.Storage.get("longslider")) + this.game.player.tacticalSlider);
  14821. this.cameraShake();
  14822. this.animatePlayerFall(function() {
  14823. a.game.player.clearGhosts()
  14824. });
  14825. setTimeout(function() {
  14826. a.getHint();
  14827. a.game.gameOverScreen.visible = !0;
  14828. a.game.button_restart.responsive = !0;
  14829. ADS.showAd()
  14830. },
  14831. 50)
  14832. },
  14833. getHint: function() {
  14834. var a = this,
  14835. f, h = 0;
  14836. parseInt(ENEA.Storage.get("best")) < FOTN._tutorialHeight ? (f = FOTN._hints.data[FOTN._hints.data.length - 1], h = this.game.relY(0.07), this.game.hintMainText.visible = !1, this.game.button_replay.visible = !0, this.game.button_replay.responsive = !0, this.game.button_replay.onClick = function() {
  14837. Play68.goHome();
  14838. // a.resetGame();
  14839. a.animateSawsIN();
  14840. a.game.tutorialContainer.visible = !0;
  14841. a.game.tutorial.runTutorial(a)
  14842. }) : (f = FOTN._hints.data[~~ (Math.random() * (FOTN._hints.data.length - 1))], this.game.button_replay.visible = !1, this.game.button_replay.responsive = !1, document.getElementById('moregame').style.display = "block", this.game.player.getScore(), this.game.hintMainText.visible = !1);
  14843. this.game.hintText.setText(f);
  14844. window._Score=this.game.player.getScore();
  14845. // updateShare(this.game.player.getScore());Play68.setRankingScoreDesc(this.game.player.getScore());
  14846. this.game.hintText.updateTransform();
  14847. this.game.hintText.x = this.game.centerX - this.game.hintText.width / 2;
  14848. this.game.hintText.y = this.game.relY(0.735) - h
  14849. },
  14850. updateGameOverScreen: function() {
  14851. this.game.bestScore.setText("最好成绩: " + this.getBestScore() + " m");
  14852. this.game.bestScore.updateTransform();
  14853. this.game.bestScore.applyParams({
  14854. x: this.game.centerX - this.game.bestScore.width / 2,
  14855. y: this.game.relY(0.23)
  14856. })
  14857. },
  14858. getBestScore: function() {
  14859. ENEA.Storage.has("best") || ENEA.Storage.set("best", 0);
  14860. this.game.player.getScore() > parseInt(ENEA.Storage.get("best")) && ENEA.Storage.set("best", this.game.player.getScore());
  14861. return ENEA.Storage.get("best")
  14862. },
  14863. animatePlayerFall: function(a) {
  14864. var f = this,
  14865. h = f.game.relX(0.6),
  14866. n = {
  14867. plX: f.game.player.position.x,
  14868. plY: f.game.player.metresPosition.y,
  14869. s: f.game.player.sinStart,
  14870. r: 0
  14871. },
  14872. h = {
  14873. plX: f.game.player.position.x < f.game.centerX ? f.game.player.position.x + h: f.game.player.position.x - h,
  14874. plY: f.game.player.metresPosition.y - f.layer.bgContainer.stageHeight / 2,
  14875. s: f.game.player.sinEnd,
  14876. r: 2 * Math.PI
  14877. };
  14878. this.playerTween = (new ENEA.Tweener.Tween(n)).to(h, 1E3).easing(ENEA.Tweener.Easing.Linear.None).onUpdate(function() {
  14879. f.game.player.metresPosition.y = n.plY;
  14880. f.game.player.position.x = n.plX;
  14881. f.game.player.position.y = -f.game.player.metresPosition.y * f.layer.bgContainer.meter + 3 * f.game.player.jumpCurvature * Math.sin(n.s);
  14882. f.game.player.rotation = n.r;
  14883. f.game.player.storeGhost({
  14884. x: f.game.player.position.x,
  14885. y: f.game.player.position.y,
  14886. r: f.game.player.rotation,
  14887. frame: ~~n.f
  14888. });
  14889. f.game.player.showGhosts()
  14890. }).onComplete(function() {
  14891. f.game.player.clearGhosts();
  14892. a && a.call()
  14893. }).start()
  14894. },
  14895. cameraShake: function(a) {
  14896. var f = this,
  14897. h = ENEA._isHD ? 12 : 6,
  14898. n = this.layer.bgContainer;
  14899. this.scrollElement(n, n.position.x, n.position.x - h, 90, null,
  14900. function() {
  14901. f.scrollElement(n, n.position.x, n.position.x + 2 * h, 90, null,
  14902. function() {
  14903. f.scrollElement(n, n.position.x, n.position.x - h, 90, null,
  14904. function() {
  14905. a && a.call()
  14906. })
  14907. })
  14908. })
  14909. },
  14910. scrollElement: function(a, f, h, n, p, b) {
  14911. var d = {
  14912. x: f
  14913. };
  14914. f = {
  14915. x: h
  14916. }; (new ENEA.Tweener.Tween(d)).to(f, n).easing(ENEA.Tweener.Easing.Bounce.Out).onStart(function() {
  14917. p && p.call()
  14918. }).onUpdate(function() {
  14919. a.position.x = d.x
  14920. }).onComplete(function() {
  14921. b && b.call()
  14922. }).start()
  14923. }
  14924. };
  14925. FOTN.Textures = function(a) {
  14926. this.game = a;
  14927. this.resolution = this.game.resolution;
  14928. this.fillTextureList();
  14929. this.init()
  14930. };
  14931. FOTN.Textures.prototype = {
  14932. init: function() {
  14933. this.game.textures = [];
  14934. for (var a in this.textureList) this.game.textures[a] = PIXI.Texture.fromFrame(this.textureList[a])
  14935. },
  14936. fillTextureList: function() {
  14937. this.textureList = {
  14938. mainBg: "bg_main.jpg",
  14939. mainLogo: "main_logo.png",
  14940. mainNinja: "main_ninja.png",
  14941. mainPattern: "main_pattern.png",
  14942. mainStripeTop: "main_stripe_top.png",
  14943. mainStripeBottom: "main_stripe_bottom.png",
  14944. button_start_normal: "button_start.png",
  14945. button_start_hover: "button_start_hover.png",
  14946. button_start_pressed: "button_start_pressed.png",
  14947. button_moregames_normal: "button_white_moregames.png",
  14948. button_kik_normal: "button_white_kik.png",
  14949. button_facebook_normal: "button_white_facebook.png",
  14950. button_twitter_normal: "button_white_twitter.png",
  14951. button_achieve_normal: "achievements.png",
  14952. button_achieve_hover: "achievements_hover.png",
  14953. button_achieve_pressed: "achievements_pressed.png",
  14954. button_leader_normal: "leaderboard.png",
  14955. button_leader_hover: "leaderboard_hover.png",
  14956. button_leader_pressed: "leaderboard_pressed.png",
  14957. button_downArrow_normal: "downArrow.png",
  14958. button_downArrow_hover: "downArrow_hover.png",
  14959. button_downArrow_pressed: "downArrow_pressed.png",
  14960. button_upArrow_normal: "upArrow.png",
  14961. button_upArrow_hover: "upArrow_hover.png",
  14962. button_upArrow_pressed: "upArrow_pressed.png",
  14963. ach_unlocked: "ach_unlocked.png",
  14964. itemBg: "list_bg.png",
  14965. ach_fastRunner: "achFastRunner.png",
  14966. ach_fastRunner_locked: "achFastRunner_locked.png",
  14967. ach_longRunner: "achLongRunner.png",
  14968. ach_longRunner_locked: "achLongRunner_locked.png",
  14969. ach_longSlider: "achLongSlider.png",
  14970. ach_longSlider_locked: "achLongSlider_locked.png",
  14971. ach_ninjaAddict: "achNinjaAddict.png",
  14972. ach_ninjaAddict_locked: "achNinjaAddict_locked.png",
  14973. ach_reincarnation: "achReincarnation.png",
  14974. ach_reincarnation_locked: "achReincarnation_locked.png",
  14975. ach_tactical: "achTacticalSlider.png",
  14976. ach_tactical_locked: "achTacticalSlider_locked.png",
  14977. loading: "loading.png",
  14978. bg1: "bg1.png",
  14979. bg2: "bg2.png",
  14980. bg3: "bg3.png",
  14981. disk: "disk.png",
  14982. ground: "ground.png",
  14983. sideLeft: "side_left.png",
  14984. sideRight: "side_right.png",
  14985. shine: "shine.png",
  14986. spikes: "spikes.png",
  14987. button_restart_normal: "button_restart.png",
  14988. button_restart_hover: "button_restart_hover.png",
  14989. button_restart_pressed: "button_restart_pressed.png",
  14990. button_settings_normal: "button_settings.png",
  14991. button_settings_hover: "button_settings_hover.png",
  14992. button_settings_pressed: "button_settings_pressed.png",
  14993. button_homeSmall_normal: "button_homeSmall.png",
  14994. button_homeSmall_hover: "button_homeSmall_hover.png",
  14995. button_homeSmall_pressed: "button_homeSmall_pressed.png",
  14996. button_backSmall_normal: "button_back.png",
  14997. button_backSmall_hover: "button_back_hover.png",
  14998. button_backSmall_pressed: "button_back_pressed.png",
  14999. button_home_normal: "button_home.png",
  15000. button_home_hover: "button_home_hover.png",
  15001. button_home_pressed: "button_home_pressed.png",
  15002. button_replay_normal: "button_replay.png",
  15003. button_replay_hover: "button_replay_hover.png",
  15004. button_replay_pressed: "button_replay_pressed.png",
  15005. button_mainmenu_normal: "button_white_mainmenu.png"
  15006. };
  15007. if (ENEA._isDesktop) {
  15008. this.desktopTextureList = {
  15009. button_music_normal: "button_music.png",
  15010. button_music_hover: "button_music_hover.png",
  15011. button_music_pressed: "button_music_pressed.png",
  15012. button_musicoff_normal: "button_musicoff.png",
  15013. button_musicoff_hover: "button_musicoff_hover.png",
  15014. button_musicoff_pressed: "button_musicoff_pressed.png",
  15015. button_sound_normal: "button_sound.png",
  15016. button_sound_hover: "button_sound_hover.png",
  15017. button_sound_pressed: "button_sound_pressed.png",
  15018. button_soundoff_normal: "button_soundoff.png",
  15019. button_soundoff_hover: "button_soundoff_hover.png",
  15020. button_soundoff_pressed: "button_soundoff_pressed.png"
  15021. };
  15022. for (var a in this.desktopTextureList) this.textureList[a] = this.desktopTextureList[a]
  15023. }
  15024. if (1 == parseInt(ENEA.Storage.get("tutorial")) || parseInt(ENEA.Storage.get("best")) < FOTN._tutorialHeight) for (a in this.tutorialTextureList = {
  15025. tutorial_click: "tutorial_clickBubble.png",
  15026. tutorial_go: "tutorial_go.png",
  15027. tutorial_hand: "tutorial_hand.png",
  15028. tutorial_ninja: "tutorial_ninja.png",
  15029. tutorial_phone: "tutorial_phone.png"
  15030. },
  15031. this.tutorialTextureList) this.textureList[a] = this.tutorialTextureList[a]
  15032. }
  15033. };