react.js 584 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541
  1. /**
  2. * React v0.13.1
  3. */
  4. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
  5. /**
  6. * Copyright 2013-2015, Facebook, Inc.
  7. * All rights reserved.
  8. *
  9. * This source code is licensed under the BSD-style license found in the
  10. * LICENSE file in the root directory of this source tree. An additional grant
  11. * of patent rights can be found in the PATENTS file in the same directory.
  12. *
  13. * @providesModule React
  14. */
  15. /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
  16. 'use strict';
  17. var EventPluginUtils = _dereq_(19);
  18. var ReactChildren = _dereq_(32);
  19. var ReactComponent = _dereq_(34);
  20. var ReactClass = _dereq_(33);
  21. var ReactContext = _dereq_(38);
  22. var ReactCurrentOwner = _dereq_(39);
  23. var ReactElement = _dereq_(57);
  24. var ReactElementValidator = _dereq_(58);
  25. var ReactDOM = _dereq_(40);
  26. var ReactDOMTextComponent = _dereq_(51);
  27. var ReactDefaultInjection = _dereq_(54);
  28. var ReactInstanceHandles = _dereq_(66);
  29. var ReactMount = _dereq_(70);
  30. var ReactPerf = _dereq_(75);
  31. var ReactPropTypes = _dereq_(78);
  32. var ReactReconciler = _dereq_(81);
  33. var ReactServerRendering = _dereq_(84);
  34. var assign = _dereq_(27);
  35. var findDOMNode = _dereq_(117);
  36. var onlyChild = _dereq_(144);
  37. ReactDefaultInjection.inject();
  38. var createElement = ReactElement.createElement;
  39. var createFactory = ReactElement.createFactory;
  40. var cloneElement = ReactElement.cloneElement;
  41. if ("production" !== "development") {
  42. createElement = ReactElementValidator.createElement;
  43. createFactory = ReactElementValidator.createFactory;
  44. cloneElement = ReactElementValidator.cloneElement;
  45. }
  46. var render = ReactPerf.measure('React', 'render', ReactMount.render);
  47. var React = {
  48. Children: {
  49. map: ReactChildren.map,
  50. forEach: ReactChildren.forEach,
  51. count: ReactChildren.count,
  52. only: onlyChild
  53. },
  54. Component: ReactComponent,
  55. DOM: ReactDOM,
  56. PropTypes: ReactPropTypes,
  57. initializeTouchEvents: function(shouldUseTouch) {
  58. EventPluginUtils.useTouchEvents = shouldUseTouch;
  59. },
  60. createClass: ReactClass.createClass,
  61. createElement: createElement,
  62. cloneElement: cloneElement,
  63. createFactory: createFactory,
  64. createMixin: function(mixin) {
  65. // Currently a noop. Will be used to validate and trace mixins.
  66. return mixin;
  67. },
  68. constructAndRenderComponent: ReactMount.constructAndRenderComponent,
  69. constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
  70. findDOMNode: findDOMNode,
  71. render: render,
  72. renderToString: ReactServerRendering.renderToString,
  73. renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
  74. unmountComponentAtNode: ReactMount.unmountComponentAtNode,
  75. isValidElement: ReactElement.isValidElement,
  76. withContext: ReactContext.withContext,
  77. // Hook for JSX spread, don't use this for anything else.
  78. __spread: assign
  79. };
  80. // Inject the runtime into a devtools global hook regardless of browser.
  81. // Allows for debugging when the hook is injected on the page.
  82. if (
  83. typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
  84. typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
  85. __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
  86. CurrentOwner: ReactCurrentOwner,
  87. InstanceHandles: ReactInstanceHandles,
  88. Mount: ReactMount,
  89. Reconciler: ReactReconciler,
  90. TextComponent: ReactDOMTextComponent
  91. });
  92. }
  93. if ("production" !== "development") {
  94. var ExecutionEnvironment = _dereq_(21);
  95. if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
  96. // If we're in Chrome, look for the devtools marker and provide a download
  97. // link if not installed.
  98. if (navigator.userAgent.indexOf('Chrome') > -1) {
  99. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
  100. console.debug(
  101. 'Download the React DevTools for a better development experience: ' +
  102. 'http://fb.me/react-devtools'
  103. );
  104. }
  105. }
  106. var expectedFeatures = [
  107. // shims
  108. Array.isArray,
  109. Array.prototype.every,
  110. Array.prototype.forEach,
  111. Array.prototype.indexOf,
  112. Array.prototype.map,
  113. Date.now,
  114. Function.prototype.bind,
  115. Object.keys,
  116. String.prototype.split,
  117. String.prototype.trim,
  118. // shams
  119. Object.create,
  120. Object.freeze
  121. ];
  122. for (var i = 0; i < expectedFeatures.length; i++) {
  123. if (!expectedFeatures[i]) {
  124. console.error(
  125. 'One or more ES5 shim/shams expected by React are not available: ' +
  126. 'http://fb.me/react-warning-polyfills'
  127. );
  128. break;
  129. }
  130. }
  131. }
  132. }
  133. React.version = '0.13.1';
  134. module.exports = React;
  135. },{"117":117,"144":144,"19":19,"21":21,"27":27,"32":32,"33":33,"34":34,"38":38,"39":39,"40":40,"51":51,"54":54,"57":57,"58":58,"66":66,"70":70,"75":75,"78":78,"81":81,"84":84}],2:[function(_dereq_,module,exports){
  136. /**
  137. * Copyright 2013-2015, Facebook, Inc.
  138. * All rights reserved.
  139. *
  140. * This source code is licensed under the BSD-style license found in the
  141. * LICENSE file in the root directory of this source tree. An additional grant
  142. * of patent rights can be found in the PATENTS file in the same directory.
  143. *
  144. * @providesModule AutoFocusMixin
  145. * @typechecks static-only
  146. */
  147. 'use strict';
  148. var focusNode = _dereq_(119);
  149. var AutoFocusMixin = {
  150. componentDidMount: function() {
  151. if (this.props.autoFocus) {
  152. focusNode(this.getDOMNode());
  153. }
  154. }
  155. };
  156. module.exports = AutoFocusMixin;
  157. },{"119":119}],3:[function(_dereq_,module,exports){
  158. /**
  159. * Copyright 2013-2015 Facebook, Inc.
  160. * All rights reserved.
  161. *
  162. * This source code is licensed under the BSD-style license found in the
  163. * LICENSE file in the root directory of this source tree. An additional grant
  164. * of patent rights can be found in the PATENTS file in the same directory.
  165. *
  166. * @providesModule BeforeInputEventPlugin
  167. * @typechecks static-only
  168. */
  169. 'use strict';
  170. var EventConstants = _dereq_(15);
  171. var EventPropagators = _dereq_(20);
  172. var ExecutionEnvironment = _dereq_(21);
  173. var FallbackCompositionState = _dereq_(22);
  174. var SyntheticCompositionEvent = _dereq_(93);
  175. var SyntheticInputEvent = _dereq_(97);
  176. var keyOf = _dereq_(141);
  177. var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
  178. var START_KEYCODE = 229;
  179. var canUseCompositionEvent = (
  180. ExecutionEnvironment.canUseDOM &&
  181. 'CompositionEvent' in window
  182. );
  183. var documentMode = null;
  184. if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
  185. documentMode = document.documentMode;
  186. }
  187. // Webkit offers a very useful `textInput` event that can be used to
  188. // directly represent `beforeInput`. The IE `textinput` event is not as
  189. // useful, so we don't use it.
  190. var canUseTextInputEvent = (
  191. ExecutionEnvironment.canUseDOM &&
  192. 'TextEvent' in window &&
  193. !documentMode &&
  194. !isPresto()
  195. );
  196. // In IE9+, we have access to composition events, but the data supplied
  197. // by the native compositionend event may be incorrect. Japanese ideographic
  198. // spaces, for instance (\u3000) are not recorded correctly.
  199. var useFallbackCompositionData = (
  200. ExecutionEnvironment.canUseDOM &&
  201. (
  202. (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11)
  203. )
  204. );
  205. /**
  206. * Opera <= 12 includes TextEvent in window, but does not fire
  207. * text input events. Rely on keypress instead.
  208. */
  209. function isPresto() {
  210. var opera = window.opera;
  211. return (
  212. typeof opera === 'object' &&
  213. typeof opera.version === 'function' &&
  214. parseInt(opera.version(), 10) <= 12
  215. );
  216. }
  217. var SPACEBAR_CODE = 32;
  218. var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
  219. var topLevelTypes = EventConstants.topLevelTypes;
  220. // Events and their corresponding property names.
  221. var eventTypes = {
  222. beforeInput: {
  223. phasedRegistrationNames: {
  224. bubbled: keyOf({onBeforeInput: null}),
  225. captured: keyOf({onBeforeInputCapture: null})
  226. },
  227. dependencies: [
  228. topLevelTypes.topCompositionEnd,
  229. topLevelTypes.topKeyPress,
  230. topLevelTypes.topTextInput,
  231. topLevelTypes.topPaste
  232. ]
  233. },
  234. compositionEnd: {
  235. phasedRegistrationNames: {
  236. bubbled: keyOf({onCompositionEnd: null}),
  237. captured: keyOf({onCompositionEndCapture: null})
  238. },
  239. dependencies: [
  240. topLevelTypes.topBlur,
  241. topLevelTypes.topCompositionEnd,
  242. topLevelTypes.topKeyDown,
  243. topLevelTypes.topKeyPress,
  244. topLevelTypes.topKeyUp,
  245. topLevelTypes.topMouseDown
  246. ]
  247. },
  248. compositionStart: {
  249. phasedRegistrationNames: {
  250. bubbled: keyOf({onCompositionStart: null}),
  251. captured: keyOf({onCompositionStartCapture: null})
  252. },
  253. dependencies: [
  254. topLevelTypes.topBlur,
  255. topLevelTypes.topCompositionStart,
  256. topLevelTypes.topKeyDown,
  257. topLevelTypes.topKeyPress,
  258. topLevelTypes.topKeyUp,
  259. topLevelTypes.topMouseDown
  260. ]
  261. },
  262. compositionUpdate: {
  263. phasedRegistrationNames: {
  264. bubbled: keyOf({onCompositionUpdate: null}),
  265. captured: keyOf({onCompositionUpdateCapture: null})
  266. },
  267. dependencies: [
  268. topLevelTypes.topBlur,
  269. topLevelTypes.topCompositionUpdate,
  270. topLevelTypes.topKeyDown,
  271. topLevelTypes.topKeyPress,
  272. topLevelTypes.topKeyUp,
  273. topLevelTypes.topMouseDown
  274. ]
  275. }
  276. };
  277. // Track whether we've ever handled a keypress on the space key.
  278. var hasSpaceKeypress = false;
  279. /**
  280. * Return whether a native keypress event is assumed to be a command.
  281. * This is required because Firefox fires `keypress` events for key commands
  282. * (cut, copy, select-all, etc.) even though no character is inserted.
  283. */
  284. function isKeypressCommand(nativeEvent) {
  285. return (
  286. (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
  287. // ctrlKey && altKey is equivalent to AltGr, and is not a command.
  288. !(nativeEvent.ctrlKey && nativeEvent.altKey)
  289. );
  290. }
  291. /**
  292. * Translate native top level events into event types.
  293. *
  294. * @param {string} topLevelType
  295. * @return {object}
  296. */
  297. function getCompositionEventType(topLevelType) {
  298. switch (topLevelType) {
  299. case topLevelTypes.topCompositionStart:
  300. return eventTypes.compositionStart;
  301. case topLevelTypes.topCompositionEnd:
  302. return eventTypes.compositionEnd;
  303. case topLevelTypes.topCompositionUpdate:
  304. return eventTypes.compositionUpdate;
  305. }
  306. }
  307. /**
  308. * Does our fallback best-guess model think this event signifies that
  309. * composition has begun?
  310. *
  311. * @param {string} topLevelType
  312. * @param {object} nativeEvent
  313. * @return {boolean}
  314. */
  315. function isFallbackCompositionStart(topLevelType, nativeEvent) {
  316. return (
  317. topLevelType === topLevelTypes.topKeyDown &&
  318. nativeEvent.keyCode === START_KEYCODE
  319. );
  320. }
  321. /**
  322. * Does our fallback mode think that this event is the end of composition?
  323. *
  324. * @param {string} topLevelType
  325. * @param {object} nativeEvent
  326. * @return {boolean}
  327. */
  328. function isFallbackCompositionEnd(topLevelType, nativeEvent) {
  329. switch (topLevelType) {
  330. case topLevelTypes.topKeyUp:
  331. // Command keys insert or clear IME input.
  332. return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);
  333. case topLevelTypes.topKeyDown:
  334. // Expect IME keyCode on each keydown. If we get any other
  335. // code we must have exited earlier.
  336. return (nativeEvent.keyCode !== START_KEYCODE);
  337. case topLevelTypes.topKeyPress:
  338. case topLevelTypes.topMouseDown:
  339. case topLevelTypes.topBlur:
  340. // Events are not possible without cancelling IME.
  341. return true;
  342. default:
  343. return false;
  344. }
  345. }
  346. /**
  347. * Google Input Tools provides composition data via a CustomEvent,
  348. * with the `data` property populated in the `detail` object. If this
  349. * is available on the event object, use it. If not, this is a plain
  350. * composition event and we have nothing special to extract.
  351. *
  352. * @param {object} nativeEvent
  353. * @return {?string}
  354. */
  355. function getDataFromCustomEvent(nativeEvent) {
  356. var detail = nativeEvent.detail;
  357. if (typeof detail === 'object' && 'data' in detail) {
  358. return detail.data;
  359. }
  360. return null;
  361. }
  362. // Track the current IME composition fallback object, if any.
  363. var currentComposition = null;
  364. /**
  365. * @param {string} topLevelType Record from `EventConstants`.
  366. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  367. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  368. * @param {object} nativeEvent Native browser event.
  369. * @return {?object} A SyntheticCompositionEvent.
  370. */
  371. function extractCompositionEvent(
  372. topLevelType,
  373. topLevelTarget,
  374. topLevelTargetID,
  375. nativeEvent
  376. ) {
  377. var eventType;
  378. var fallbackData;
  379. if (canUseCompositionEvent) {
  380. eventType = getCompositionEventType(topLevelType);
  381. } else if (!currentComposition) {
  382. if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
  383. eventType = eventTypes.compositionStart;
  384. }
  385. } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  386. eventType = eventTypes.compositionEnd;
  387. }
  388. if (!eventType) {
  389. return null;
  390. }
  391. if (useFallbackCompositionData) {
  392. // The current composition is stored statically and must not be
  393. // overwritten while composition continues.
  394. if (!currentComposition && eventType === eventTypes.compositionStart) {
  395. currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
  396. } else if (eventType === eventTypes.compositionEnd) {
  397. if (currentComposition) {
  398. fallbackData = currentComposition.getData();
  399. }
  400. }
  401. }
  402. var event = SyntheticCompositionEvent.getPooled(
  403. eventType,
  404. topLevelTargetID,
  405. nativeEvent
  406. );
  407. if (fallbackData) {
  408. // Inject data generated from fallback path into the synthetic event.
  409. // This matches the property of native CompositionEventInterface.
  410. event.data = fallbackData;
  411. } else {
  412. var customData = getDataFromCustomEvent(nativeEvent);
  413. if (customData !== null) {
  414. event.data = customData;
  415. }
  416. }
  417. EventPropagators.accumulateTwoPhaseDispatches(event);
  418. return event;
  419. }
  420. /**
  421. * @param {string} topLevelType Record from `EventConstants`.
  422. * @param {object} nativeEvent Native browser event.
  423. * @return {?string} The string corresponding to this `beforeInput` event.
  424. */
  425. function getNativeBeforeInputChars(topLevelType, nativeEvent) {
  426. switch (topLevelType) {
  427. case topLevelTypes.topCompositionEnd:
  428. return getDataFromCustomEvent(nativeEvent);
  429. case topLevelTypes.topKeyPress:
  430. /**
  431. * If native `textInput` events are available, our goal is to make
  432. * use of them. However, there is a special case: the spacebar key.
  433. * In Webkit, preventing default on a spacebar `textInput` event
  434. * cancels character insertion, but it *also* causes the browser
  435. * to fall back to its default spacebar behavior of scrolling the
  436. * page.
  437. *
  438. * Tracking at:
  439. * https://code.google.com/p/chromium/issues/detail?id=355103
  440. *
  441. * To avoid this issue, use the keypress event as if no `textInput`
  442. * event is available.
  443. */
  444. var which = nativeEvent.which;
  445. if (which !== SPACEBAR_CODE) {
  446. return null;
  447. }
  448. hasSpaceKeypress = true;
  449. return SPACEBAR_CHAR;
  450. case topLevelTypes.topTextInput:
  451. // Record the characters to be added to the DOM.
  452. var chars = nativeEvent.data;
  453. // If it's a spacebar character, assume that we have already handled
  454. // it at the keypress level and bail immediately. Android Chrome
  455. // doesn't give us keycodes, so we need to blacklist it.
  456. if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
  457. return null;
  458. }
  459. return chars;
  460. default:
  461. // For other native event types, do nothing.
  462. return null;
  463. }
  464. }
  465. /**
  466. * For browsers that do not provide the `textInput` event, extract the
  467. * appropriate string to use for SyntheticInputEvent.
  468. *
  469. * @param {string} topLevelType Record from `EventConstants`.
  470. * @param {object} nativeEvent Native browser event.
  471. * @return {?string} The fallback string for this `beforeInput` event.
  472. */
  473. function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
  474. // If we are currently composing (IME) and using a fallback to do so,
  475. // try to extract the composed characters from the fallback object.
  476. if (currentComposition) {
  477. if (
  478. topLevelType === topLevelTypes.topCompositionEnd ||
  479. isFallbackCompositionEnd(topLevelType, nativeEvent)
  480. ) {
  481. var chars = currentComposition.getData();
  482. FallbackCompositionState.release(currentComposition);
  483. currentComposition = null;
  484. return chars;
  485. }
  486. return null;
  487. }
  488. switch (topLevelType) {
  489. case topLevelTypes.topPaste:
  490. // If a paste event occurs after a keypress, throw out the input
  491. // chars. Paste events should not lead to BeforeInput events.
  492. return null;
  493. case topLevelTypes.topKeyPress:
  494. /**
  495. * As of v27, Firefox may fire keypress events even when no character
  496. * will be inserted. A few possibilities:
  497. *
  498. * - `which` is `0`. Arrow keys, Esc key, etc.
  499. *
  500. * - `which` is the pressed key code, but no char is available.
  501. * Ex: 'AltGr + d` in Polish. There is no modified character for
  502. * this key combination and no character is inserted into the
  503. * document, but FF fires the keypress for char code `100` anyway.
  504. * No `input` event will occur.
  505. *
  506. * - `which` is the pressed key code, but a command combination is
  507. * being used. Ex: `Cmd+C`. No character is inserted, and no
  508. * `input` event will occur.
  509. */
  510. if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
  511. return String.fromCharCode(nativeEvent.which);
  512. }
  513. return null;
  514. case topLevelTypes.topCompositionEnd:
  515. return useFallbackCompositionData ? null : nativeEvent.data;
  516. default:
  517. return null;
  518. }
  519. }
  520. /**
  521. * Extract a SyntheticInputEvent for `beforeInput`, based on either native
  522. * `textInput` or fallback behavior.
  523. *
  524. * @param {string} topLevelType Record from `EventConstants`.
  525. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  526. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  527. * @param {object} nativeEvent Native browser event.
  528. * @return {?object} A SyntheticInputEvent.
  529. */
  530. function extractBeforeInputEvent(
  531. topLevelType,
  532. topLevelTarget,
  533. topLevelTargetID,
  534. nativeEvent
  535. ) {
  536. var chars;
  537. if (canUseTextInputEvent) {
  538. chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
  539. } else {
  540. chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
  541. }
  542. // If no characters are being inserted, no BeforeInput event should
  543. // be fired.
  544. if (!chars) {
  545. return null;
  546. }
  547. var event = SyntheticInputEvent.getPooled(
  548. eventTypes.beforeInput,
  549. topLevelTargetID,
  550. nativeEvent
  551. );
  552. event.data = chars;
  553. EventPropagators.accumulateTwoPhaseDispatches(event);
  554. return event;
  555. }
  556. /**
  557. * Create an `onBeforeInput` event to match
  558. * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
  559. *
  560. * This event plugin is based on the native `textInput` event
  561. * available in Chrome, Safari, Opera, and IE. This event fires after
  562. * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
  563. *
  564. * `beforeInput` is spec'd but not implemented in any browsers, and
  565. * the `input` event does not provide any useful information about what has
  566. * actually been added, contrary to the spec. Thus, `textInput` is the best
  567. * available event to identify the characters that have actually been inserted
  568. * into the target node.
  569. *
  570. * This plugin is also responsible for emitting `composition` events, thus
  571. * allowing us to share composition fallback code for both `beforeInput` and
  572. * `composition` event types.
  573. */
  574. var BeforeInputEventPlugin = {
  575. eventTypes: eventTypes,
  576. /**
  577. * @param {string} topLevelType Record from `EventConstants`.
  578. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  579. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  580. * @param {object} nativeEvent Native browser event.
  581. * @return {*} An accumulation of synthetic events.
  582. * @see {EventPluginHub.extractEvents}
  583. */
  584. extractEvents: function(
  585. topLevelType,
  586. topLevelTarget,
  587. topLevelTargetID,
  588. nativeEvent
  589. ) {
  590. return [
  591. extractCompositionEvent(
  592. topLevelType,
  593. topLevelTarget,
  594. topLevelTargetID,
  595. nativeEvent
  596. ),
  597. extractBeforeInputEvent(
  598. topLevelType,
  599. topLevelTarget,
  600. topLevelTargetID,
  601. nativeEvent
  602. )
  603. ];
  604. }
  605. };
  606. module.exports = BeforeInputEventPlugin;
  607. },{"141":141,"15":15,"20":20,"21":21,"22":22,"93":93,"97":97}],4:[function(_dereq_,module,exports){
  608. /**
  609. * Copyright 2013-2015, Facebook, Inc.
  610. * All rights reserved.
  611. *
  612. * This source code is licensed under the BSD-style license found in the
  613. * LICENSE file in the root directory of this source tree. An additional grant
  614. * of patent rights can be found in the PATENTS file in the same directory.
  615. *
  616. * @providesModule CSSProperty
  617. */
  618. 'use strict';
  619. /**
  620. * CSS properties which accept numbers but are not in units of "px".
  621. */
  622. var isUnitlessNumber = {
  623. boxFlex: true,
  624. boxFlexGroup: true,
  625. columnCount: true,
  626. flex: true,
  627. flexGrow: true,
  628. flexShrink: true,
  629. fontWeight: true,
  630. lineClamp: true,
  631. lineHeight: true,
  632. opacity: true,
  633. order: true,
  634. orphans: true,
  635. widows: true,
  636. zIndex: true,
  637. zoom: true,
  638. // SVG-related properties
  639. fillOpacity: true,
  640. strokeOpacity: true
  641. };
  642. /**
  643. * @param {string} prefix vendor-specific prefix, eg: Webkit
  644. * @param {string} key style name, eg: transitionDuration
  645. * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
  646. * WebkitTransitionDuration
  647. */
  648. function prefixKey(prefix, key) {
  649. return prefix + key.charAt(0).toUpperCase() + key.substring(1);
  650. }
  651. /**
  652. * Support style names that may come passed in prefixed by adding permutations
  653. * of vendor prefixes.
  654. */
  655. var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
  656. // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
  657. // infinite loop, because it iterates over the newly added props too.
  658. Object.keys(isUnitlessNumber).forEach(function(prop) {
  659. prefixes.forEach(function(prefix) {
  660. isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
  661. });
  662. });
  663. /**
  664. * Most style properties can be unset by doing .style[prop] = '' but IE8
  665. * doesn't like doing that with shorthand properties so for the properties that
  666. * IE8 breaks on, which are listed here, we instead unset each of the
  667. * individual properties. See http://bugs.jquery.com/ticket/12385.
  668. * The 4-value 'clock' properties like margin, padding, border-width seem to
  669. * behave without any problems. Curiously, list-style works too without any
  670. * special prodding.
  671. */
  672. var shorthandPropertyExpansions = {
  673. background: {
  674. backgroundImage: true,
  675. backgroundPosition: true,
  676. backgroundRepeat: true,
  677. backgroundColor: true
  678. },
  679. border: {
  680. borderWidth: true,
  681. borderStyle: true,
  682. borderColor: true
  683. },
  684. borderBottom: {
  685. borderBottomWidth: true,
  686. borderBottomStyle: true,
  687. borderBottomColor: true
  688. },
  689. borderLeft: {
  690. borderLeftWidth: true,
  691. borderLeftStyle: true,
  692. borderLeftColor: true
  693. },
  694. borderRight: {
  695. borderRightWidth: true,
  696. borderRightStyle: true,
  697. borderRightColor: true
  698. },
  699. borderTop: {
  700. borderTopWidth: true,
  701. borderTopStyle: true,
  702. borderTopColor: true
  703. },
  704. font: {
  705. fontStyle: true,
  706. fontVariant: true,
  707. fontWeight: true,
  708. fontSize: true,
  709. lineHeight: true,
  710. fontFamily: true
  711. }
  712. };
  713. var CSSProperty = {
  714. isUnitlessNumber: isUnitlessNumber,
  715. shorthandPropertyExpansions: shorthandPropertyExpansions
  716. };
  717. module.exports = CSSProperty;
  718. },{}],5:[function(_dereq_,module,exports){
  719. /**
  720. * Copyright 2013-2015, Facebook, Inc.
  721. * All rights reserved.
  722. *
  723. * This source code is licensed under the BSD-style license found in the
  724. * LICENSE file in the root directory of this source tree. An additional grant
  725. * of patent rights can be found in the PATENTS file in the same directory.
  726. *
  727. * @providesModule CSSPropertyOperations
  728. * @typechecks static-only
  729. */
  730. 'use strict';
  731. var CSSProperty = _dereq_(4);
  732. var ExecutionEnvironment = _dereq_(21);
  733. var camelizeStyleName = _dereq_(108);
  734. var dangerousStyleValue = _dereq_(113);
  735. var hyphenateStyleName = _dereq_(133);
  736. var memoizeStringOnly = _dereq_(143);
  737. var warning = _dereq_(154);
  738. var processStyleName = memoizeStringOnly(function(styleName) {
  739. return hyphenateStyleName(styleName);
  740. });
  741. var styleFloatAccessor = 'cssFloat';
  742. if (ExecutionEnvironment.canUseDOM) {
  743. // IE8 only supports accessing cssFloat (standard) as styleFloat
  744. if (document.documentElement.style.cssFloat === undefined) {
  745. styleFloatAccessor = 'styleFloat';
  746. }
  747. }
  748. if ("production" !== "development") {
  749. // 'msTransform' is correct, but the other prefixes should be capitalized
  750. var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
  751. // style values shouldn't contain a semicolon
  752. var badStyleValueWithSemicolonPattern = /;\s*$/;
  753. var warnedStyleNames = {};
  754. var warnedStyleValues = {};
  755. var warnHyphenatedStyleName = function(name) {
  756. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  757. return;
  758. }
  759. warnedStyleNames[name] = true;
  760. ("production" !== "development" ? warning(
  761. false,
  762. 'Unsupported style property %s. Did you mean %s?',
  763. name,
  764. camelizeStyleName(name)
  765. ) : null);
  766. };
  767. var warnBadVendoredStyleName = function(name) {
  768. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  769. return;
  770. }
  771. warnedStyleNames[name] = true;
  772. ("production" !== "development" ? warning(
  773. false,
  774. 'Unsupported vendor-prefixed style property %s. Did you mean %s?',
  775. name,
  776. name.charAt(0).toUpperCase() + name.slice(1)
  777. ) : null);
  778. };
  779. var warnStyleValueWithSemicolon = function(name, value) {
  780. if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
  781. return;
  782. }
  783. warnedStyleValues[value] = true;
  784. ("production" !== "development" ? warning(
  785. false,
  786. 'Style property values shouldn\'t contain a semicolon. ' +
  787. 'Try "%s: %s" instead.',
  788. name,
  789. value.replace(badStyleValueWithSemicolonPattern, '')
  790. ) : null);
  791. };
  792. /**
  793. * @param {string} name
  794. * @param {*} value
  795. */
  796. var warnValidStyle = function(name, value) {
  797. if (name.indexOf('-') > -1) {
  798. warnHyphenatedStyleName(name);
  799. } else if (badVendoredStyleNamePattern.test(name)) {
  800. warnBadVendoredStyleName(name);
  801. } else if (badStyleValueWithSemicolonPattern.test(value)) {
  802. warnStyleValueWithSemicolon(name, value);
  803. }
  804. };
  805. }
  806. /**
  807. * Operations for dealing with CSS properties.
  808. */
  809. var CSSPropertyOperations = {
  810. /**
  811. * Serializes a mapping of style properties for use as inline styles:
  812. *
  813. * > createMarkupForStyles({width: '200px', height: 0})
  814. * "width:200px;height:0;"
  815. *
  816. * Undefined values are ignored so that declarative programming is easier.
  817. * The result should be HTML-escaped before insertion into the DOM.
  818. *
  819. * @param {object} styles
  820. * @return {?string}
  821. */
  822. createMarkupForStyles: function(styles) {
  823. var serialized = '';
  824. for (var styleName in styles) {
  825. if (!styles.hasOwnProperty(styleName)) {
  826. continue;
  827. }
  828. var styleValue = styles[styleName];
  829. if ("production" !== "development") {
  830. warnValidStyle(styleName, styleValue);
  831. }
  832. if (styleValue != null) {
  833. serialized += processStyleName(styleName) + ':';
  834. serialized += dangerousStyleValue(styleName, styleValue) + ';';
  835. }
  836. }
  837. return serialized || null;
  838. },
  839. /**
  840. * Sets the value for multiple styles on a node. If a value is specified as
  841. * '' (empty string), the corresponding style property will be unset.
  842. *
  843. * @param {DOMElement} node
  844. * @param {object} styles
  845. */
  846. setValueForStyles: function(node, styles) {
  847. var style = node.style;
  848. for (var styleName in styles) {
  849. if (!styles.hasOwnProperty(styleName)) {
  850. continue;
  851. }
  852. if ("production" !== "development") {
  853. warnValidStyle(styleName, styles[styleName]);
  854. }
  855. var styleValue = dangerousStyleValue(styleName, styles[styleName]);
  856. if (styleName === 'float') {
  857. styleName = styleFloatAccessor;
  858. }
  859. if (styleValue) {
  860. style[styleName] = styleValue;
  861. } else {
  862. var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
  863. if (expansion) {
  864. // Shorthand property that IE8 won't like unsetting, so unset each
  865. // component to placate it
  866. for (var individualStyleName in expansion) {
  867. style[individualStyleName] = '';
  868. }
  869. } else {
  870. style[styleName] = '';
  871. }
  872. }
  873. }
  874. }
  875. };
  876. module.exports = CSSPropertyOperations;
  877. },{"108":108,"113":113,"133":133,"143":143,"154":154,"21":21,"4":4}],6:[function(_dereq_,module,exports){
  878. /**
  879. * Copyright 2013-2015, Facebook, Inc.
  880. * All rights reserved.
  881. *
  882. * This source code is licensed under the BSD-style license found in the
  883. * LICENSE file in the root directory of this source tree. An additional grant
  884. * of patent rights can be found in the PATENTS file in the same directory.
  885. *
  886. * @providesModule CallbackQueue
  887. */
  888. 'use strict';
  889. var PooledClass = _dereq_(28);
  890. var assign = _dereq_(27);
  891. var invariant = _dereq_(135);
  892. /**
  893. * A specialized pseudo-event module to help keep track of components waiting to
  894. * be notified when their DOM representations are available for use.
  895. *
  896. * This implements `PooledClass`, so you should never need to instantiate this.
  897. * Instead, use `CallbackQueue.getPooled()`.
  898. *
  899. * @class ReactMountReady
  900. * @implements PooledClass
  901. * @internal
  902. */
  903. function CallbackQueue() {
  904. this._callbacks = null;
  905. this._contexts = null;
  906. }
  907. assign(CallbackQueue.prototype, {
  908. /**
  909. * Enqueues a callback to be invoked when `notifyAll` is invoked.
  910. *
  911. * @param {function} callback Invoked when `notifyAll` is invoked.
  912. * @param {?object} context Context to call `callback` with.
  913. * @internal
  914. */
  915. enqueue: function(callback, context) {
  916. this._callbacks = this._callbacks || [];
  917. this._contexts = this._contexts || [];
  918. this._callbacks.push(callback);
  919. this._contexts.push(context);
  920. },
  921. /**
  922. * Invokes all enqueued callbacks and clears the queue. This is invoked after
  923. * the DOM representation of a component has been created or updated.
  924. *
  925. * @internal
  926. */
  927. notifyAll: function() {
  928. var callbacks = this._callbacks;
  929. var contexts = this._contexts;
  930. if (callbacks) {
  931. ("production" !== "development" ? invariant(
  932. callbacks.length === contexts.length,
  933. 'Mismatched list of contexts in callback queue'
  934. ) : invariant(callbacks.length === contexts.length));
  935. this._callbacks = null;
  936. this._contexts = null;
  937. for (var i = 0, l = callbacks.length; i < l; i++) {
  938. callbacks[i].call(contexts[i]);
  939. }
  940. callbacks.length = 0;
  941. contexts.length = 0;
  942. }
  943. },
  944. /**
  945. * Resets the internal queue.
  946. *
  947. * @internal
  948. */
  949. reset: function() {
  950. this._callbacks = null;
  951. this._contexts = null;
  952. },
  953. /**
  954. * `PooledClass` looks for this.
  955. */
  956. destructor: function() {
  957. this.reset();
  958. }
  959. });
  960. PooledClass.addPoolingTo(CallbackQueue);
  961. module.exports = CallbackQueue;
  962. },{"135":135,"27":27,"28":28}],7:[function(_dereq_,module,exports){
  963. /**
  964. * Copyright 2013-2015, Facebook, Inc.
  965. * All rights reserved.
  966. *
  967. * This source code is licensed under the BSD-style license found in the
  968. * LICENSE file in the root directory of this source tree. An additional grant
  969. * of patent rights can be found in the PATENTS file in the same directory.
  970. *
  971. * @providesModule ChangeEventPlugin
  972. */
  973. 'use strict';
  974. var EventConstants = _dereq_(15);
  975. var EventPluginHub = _dereq_(17);
  976. var EventPropagators = _dereq_(20);
  977. var ExecutionEnvironment = _dereq_(21);
  978. var ReactUpdates = _dereq_(87);
  979. var SyntheticEvent = _dereq_(95);
  980. var isEventSupported = _dereq_(136);
  981. var isTextInputElement = _dereq_(138);
  982. var keyOf = _dereq_(141);
  983. var topLevelTypes = EventConstants.topLevelTypes;
  984. var eventTypes = {
  985. change: {
  986. phasedRegistrationNames: {
  987. bubbled: keyOf({onChange: null}),
  988. captured: keyOf({onChangeCapture: null})
  989. },
  990. dependencies: [
  991. topLevelTypes.topBlur,
  992. topLevelTypes.topChange,
  993. topLevelTypes.topClick,
  994. topLevelTypes.topFocus,
  995. topLevelTypes.topInput,
  996. topLevelTypes.topKeyDown,
  997. topLevelTypes.topKeyUp,
  998. topLevelTypes.topSelectionChange
  999. ]
  1000. }
  1001. };
  1002. /**
  1003. * For IE shims
  1004. */
  1005. var activeElement = null;
  1006. var activeElementID = null;
  1007. var activeElementValue = null;
  1008. var activeElementValueProp = null;
  1009. /**
  1010. * SECTION: handle `change` event
  1011. */
  1012. function shouldUseChangeEvent(elem) {
  1013. return (
  1014. elem.nodeName === 'SELECT' ||
  1015. (elem.nodeName === 'INPUT' && elem.type === 'file')
  1016. );
  1017. }
  1018. var doesChangeEventBubble = false;
  1019. if (ExecutionEnvironment.canUseDOM) {
  1020. // See `handleChange` comment below
  1021. doesChangeEventBubble = isEventSupported('change') && (
  1022. (!('documentMode' in document) || document.documentMode > 8)
  1023. );
  1024. }
  1025. function manualDispatchChangeEvent(nativeEvent) {
  1026. var event = SyntheticEvent.getPooled(
  1027. eventTypes.change,
  1028. activeElementID,
  1029. nativeEvent
  1030. );
  1031. EventPropagators.accumulateTwoPhaseDispatches(event);
  1032. // If change and propertychange bubbled, we'd just bind to it like all the
  1033. // other events and have it go through ReactBrowserEventEmitter. Since it
  1034. // doesn't, we manually listen for the events and so we have to enqueue and
  1035. // process the abstract event manually.
  1036. //
  1037. // Batching is necessary here in order to ensure that all event handlers run
  1038. // before the next rerender (including event handlers attached to ancestor
  1039. // elements instead of directly on the input). Without this, controlled
  1040. // components don't work properly in conjunction with event bubbling because
  1041. // the component is rerendered and the value reverted before all the event
  1042. // handlers can run. See https://github.com/facebook/react/issues/708.
  1043. ReactUpdates.batchedUpdates(runEventInBatch, event);
  1044. }
  1045. function runEventInBatch(event) {
  1046. EventPluginHub.enqueueEvents(event);
  1047. EventPluginHub.processEventQueue();
  1048. }
  1049. function startWatchingForChangeEventIE8(target, targetID) {
  1050. activeElement = target;
  1051. activeElementID = targetID;
  1052. activeElement.attachEvent('onchange', manualDispatchChangeEvent);
  1053. }
  1054. function stopWatchingForChangeEventIE8() {
  1055. if (!activeElement) {
  1056. return;
  1057. }
  1058. activeElement.detachEvent('onchange', manualDispatchChangeEvent);
  1059. activeElement = null;
  1060. activeElementID = null;
  1061. }
  1062. function getTargetIDForChangeEvent(
  1063. topLevelType,
  1064. topLevelTarget,
  1065. topLevelTargetID) {
  1066. if (topLevelType === topLevelTypes.topChange) {
  1067. return topLevelTargetID;
  1068. }
  1069. }
  1070. function handleEventsForChangeEventIE8(
  1071. topLevelType,
  1072. topLevelTarget,
  1073. topLevelTargetID) {
  1074. if (topLevelType === topLevelTypes.topFocus) {
  1075. // stopWatching() should be a noop here but we call it just in case we
  1076. // missed a blur event somehow.
  1077. stopWatchingForChangeEventIE8();
  1078. startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
  1079. } else if (topLevelType === topLevelTypes.topBlur) {
  1080. stopWatchingForChangeEventIE8();
  1081. }
  1082. }
  1083. /**
  1084. * SECTION: handle `input` event
  1085. */
  1086. var isInputEventSupported = false;
  1087. if (ExecutionEnvironment.canUseDOM) {
  1088. // IE9 claims to support the input event but fails to trigger it when
  1089. // deleting text, so we ignore its input events
  1090. isInputEventSupported = isEventSupported('input') && (
  1091. (!('documentMode' in document) || document.documentMode > 9)
  1092. );
  1093. }
  1094. /**
  1095. * (For old IE.) Replacement getter/setter for the `value` property that gets
  1096. * set on the active element.
  1097. */
  1098. var newValueProp = {
  1099. get: function() {
  1100. return activeElementValueProp.get.call(this);
  1101. },
  1102. set: function(val) {
  1103. // Cast to a string so we can do equality checks.
  1104. activeElementValue = '' + val;
  1105. activeElementValueProp.set.call(this, val);
  1106. }
  1107. };
  1108. /**
  1109. * (For old IE.) Starts tracking propertychange events on the passed-in element
  1110. * and override the value property so that we can distinguish user events from
  1111. * value changes in JS.
  1112. */
  1113. function startWatchingForValueChange(target, targetID) {
  1114. activeElement = target;
  1115. activeElementID = targetID;
  1116. activeElementValue = target.value;
  1117. activeElementValueProp = Object.getOwnPropertyDescriptor(
  1118. target.constructor.prototype,
  1119. 'value'
  1120. );
  1121. Object.defineProperty(activeElement, 'value', newValueProp);
  1122. activeElement.attachEvent('onpropertychange', handlePropertyChange);
  1123. }
  1124. /**
  1125. * (For old IE.) Removes the event listeners from the currently-tracked element,
  1126. * if any exists.
  1127. */
  1128. function stopWatchingForValueChange() {
  1129. if (!activeElement) {
  1130. return;
  1131. }
  1132. // delete restores the original property definition
  1133. delete activeElement.value;
  1134. activeElement.detachEvent('onpropertychange', handlePropertyChange);
  1135. activeElement = null;
  1136. activeElementID = null;
  1137. activeElementValue = null;
  1138. activeElementValueProp = null;
  1139. }
  1140. /**
  1141. * (For old IE.) Handles a propertychange event, sending a `change` event if
  1142. * the value of the active element has changed.
  1143. */
  1144. function handlePropertyChange(nativeEvent) {
  1145. if (nativeEvent.propertyName !== 'value') {
  1146. return;
  1147. }
  1148. var value = nativeEvent.srcElement.value;
  1149. if (value === activeElementValue) {
  1150. return;
  1151. }
  1152. activeElementValue = value;
  1153. manualDispatchChangeEvent(nativeEvent);
  1154. }
  1155. /**
  1156. * If a `change` event should be fired, returns the target's ID.
  1157. */
  1158. function getTargetIDForInputEvent(
  1159. topLevelType,
  1160. topLevelTarget,
  1161. topLevelTargetID) {
  1162. if (topLevelType === topLevelTypes.topInput) {
  1163. // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
  1164. // what we want so fall through here and trigger an abstract event
  1165. return topLevelTargetID;
  1166. }
  1167. }
  1168. // For IE8 and IE9.
  1169. function handleEventsForInputEventIE(
  1170. topLevelType,
  1171. topLevelTarget,
  1172. topLevelTargetID) {
  1173. if (topLevelType === topLevelTypes.topFocus) {
  1174. // In IE8, we can capture almost all .value changes by adding a
  1175. // propertychange handler and looking for events with propertyName
  1176. // equal to 'value'
  1177. // In IE9, propertychange fires for most input events but is buggy and
  1178. // doesn't fire when text is deleted, but conveniently, selectionchange
  1179. // appears to fire in all of the remaining cases so we catch those and
  1180. // forward the event if the value has changed
  1181. // In either case, we don't want to call the event handler if the value
  1182. // is changed from JS so we redefine a setter for `.value` that updates
  1183. // our activeElementValue variable, allowing us to ignore those changes
  1184. //
  1185. // stopWatching() should be a noop here but we call it just in case we
  1186. // missed a blur event somehow.
  1187. stopWatchingForValueChange();
  1188. startWatchingForValueChange(topLevelTarget, topLevelTargetID);
  1189. } else if (topLevelType === topLevelTypes.topBlur) {
  1190. stopWatchingForValueChange();
  1191. }
  1192. }
  1193. // For IE8 and IE9.
  1194. function getTargetIDForInputEventIE(
  1195. topLevelType,
  1196. topLevelTarget,
  1197. topLevelTargetID) {
  1198. if (topLevelType === topLevelTypes.topSelectionChange ||
  1199. topLevelType === topLevelTypes.topKeyUp ||
  1200. topLevelType === topLevelTypes.topKeyDown) {
  1201. // On the selectionchange event, the target is just document which isn't
  1202. // helpful for us so just check activeElement instead.
  1203. //
  1204. // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
  1205. // propertychange on the first input event after setting `value` from a
  1206. // script and fires only keydown, keypress, keyup. Catching keyup usually
  1207. // gets it and catching keydown lets us fire an event for the first
  1208. // keystroke if user does a key repeat (it'll be a little delayed: right
  1209. // before the second keystroke). Other input methods (e.g., paste) seem to
  1210. // fire selectionchange normally.
  1211. if (activeElement && activeElement.value !== activeElementValue) {
  1212. activeElementValue = activeElement.value;
  1213. return activeElementID;
  1214. }
  1215. }
  1216. }
  1217. /**
  1218. * SECTION: handle `click` event
  1219. */
  1220. function shouldUseClickEvent(elem) {
  1221. // Use the `click` event to detect changes to checkbox and radio inputs.
  1222. // This approach works across all browsers, whereas `change` does not fire
  1223. // until `blur` in IE8.
  1224. return (
  1225. elem.nodeName === 'INPUT' &&
  1226. (elem.type === 'checkbox' || elem.type === 'radio')
  1227. );
  1228. }
  1229. function getTargetIDForClickEvent(
  1230. topLevelType,
  1231. topLevelTarget,
  1232. topLevelTargetID) {
  1233. if (topLevelType === topLevelTypes.topClick) {
  1234. return topLevelTargetID;
  1235. }
  1236. }
  1237. /**
  1238. * This plugin creates an `onChange` event that normalizes change events
  1239. * across form elements. This event fires at a time when it's possible to
  1240. * change the element's value without seeing a flicker.
  1241. *
  1242. * Supported elements are:
  1243. * - input (see `isTextInputElement`)
  1244. * - textarea
  1245. * - select
  1246. */
  1247. var ChangeEventPlugin = {
  1248. eventTypes: eventTypes,
  1249. /**
  1250. * @param {string} topLevelType Record from `EventConstants`.
  1251. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  1252. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  1253. * @param {object} nativeEvent Native browser event.
  1254. * @return {*} An accumulation of synthetic events.
  1255. * @see {EventPluginHub.extractEvents}
  1256. */
  1257. extractEvents: function(
  1258. topLevelType,
  1259. topLevelTarget,
  1260. topLevelTargetID,
  1261. nativeEvent) {
  1262. var getTargetIDFunc, handleEventFunc;
  1263. if (shouldUseChangeEvent(topLevelTarget)) {
  1264. if (doesChangeEventBubble) {
  1265. getTargetIDFunc = getTargetIDForChangeEvent;
  1266. } else {
  1267. handleEventFunc = handleEventsForChangeEventIE8;
  1268. }
  1269. } else if (isTextInputElement(topLevelTarget)) {
  1270. if (isInputEventSupported) {
  1271. getTargetIDFunc = getTargetIDForInputEvent;
  1272. } else {
  1273. getTargetIDFunc = getTargetIDForInputEventIE;
  1274. handleEventFunc = handleEventsForInputEventIE;
  1275. }
  1276. } else if (shouldUseClickEvent(topLevelTarget)) {
  1277. getTargetIDFunc = getTargetIDForClickEvent;
  1278. }
  1279. if (getTargetIDFunc) {
  1280. var targetID = getTargetIDFunc(
  1281. topLevelType,
  1282. topLevelTarget,
  1283. topLevelTargetID
  1284. );
  1285. if (targetID) {
  1286. var event = SyntheticEvent.getPooled(
  1287. eventTypes.change,
  1288. targetID,
  1289. nativeEvent
  1290. );
  1291. EventPropagators.accumulateTwoPhaseDispatches(event);
  1292. return event;
  1293. }
  1294. }
  1295. if (handleEventFunc) {
  1296. handleEventFunc(
  1297. topLevelType,
  1298. topLevelTarget,
  1299. topLevelTargetID
  1300. );
  1301. }
  1302. }
  1303. };
  1304. module.exports = ChangeEventPlugin;
  1305. },{"136":136,"138":138,"141":141,"15":15,"17":17,"20":20,"21":21,"87":87,"95":95}],8:[function(_dereq_,module,exports){
  1306. /**
  1307. * Copyright 2013-2015, Facebook, Inc.
  1308. * All rights reserved.
  1309. *
  1310. * This source code is licensed under the BSD-style license found in the
  1311. * LICENSE file in the root directory of this source tree. An additional grant
  1312. * of patent rights can be found in the PATENTS file in the same directory.
  1313. *
  1314. * @providesModule ClientReactRootIndex
  1315. * @typechecks
  1316. */
  1317. 'use strict';
  1318. var nextReactRootIndex = 0;
  1319. var ClientReactRootIndex = {
  1320. createReactRootIndex: function() {
  1321. return nextReactRootIndex++;
  1322. }
  1323. };
  1324. module.exports = ClientReactRootIndex;
  1325. },{}],9:[function(_dereq_,module,exports){
  1326. /**
  1327. * Copyright 2013-2015, Facebook, Inc.
  1328. * All rights reserved.
  1329. *
  1330. * This source code is licensed under the BSD-style license found in the
  1331. * LICENSE file in the root directory of this source tree. An additional grant
  1332. * of patent rights can be found in the PATENTS file in the same directory.
  1333. *
  1334. * @providesModule DOMChildrenOperations
  1335. * @typechecks static-only
  1336. */
  1337. 'use strict';
  1338. var Danger = _dereq_(12);
  1339. var ReactMultiChildUpdateTypes = _dereq_(72);
  1340. var setTextContent = _dereq_(149);
  1341. var invariant = _dereq_(135);
  1342. /**
  1343. * Inserts `childNode` as a child of `parentNode` at the `index`.
  1344. *
  1345. * @param {DOMElement} parentNode Parent node in which to insert.
  1346. * @param {DOMElement} childNode Child node to insert.
  1347. * @param {number} index Index at which to insert the child.
  1348. * @internal
  1349. */
  1350. function insertChildAt(parentNode, childNode, index) {
  1351. // By exploiting arrays returning `undefined` for an undefined index, we can
  1352. // rely exclusively on `insertBefore(node, null)` instead of also using
  1353. // `appendChild(node)`. However, using `undefined` is not allowed by all
  1354. // browsers so we must replace it with `null`.
  1355. parentNode.insertBefore(
  1356. childNode,
  1357. parentNode.childNodes[index] || null
  1358. );
  1359. }
  1360. /**
  1361. * Operations for updating with DOM children.
  1362. */
  1363. var DOMChildrenOperations = {
  1364. dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
  1365. updateTextContent: setTextContent,
  1366. /**
  1367. * Updates a component's children by processing a series of updates. The
  1368. * update configurations are each expected to have a `parentNode` property.
  1369. *
  1370. * @param {array<object>} updates List of update configurations.
  1371. * @param {array<string>} markupList List of markup strings.
  1372. * @internal
  1373. */
  1374. processUpdates: function(updates, markupList) {
  1375. var update;
  1376. // Mapping from parent IDs to initial child orderings.
  1377. var initialChildren = null;
  1378. // List of children that will be moved or removed.
  1379. var updatedChildren = null;
  1380. for (var i = 0; i < updates.length; i++) {
  1381. update = updates[i];
  1382. if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||
  1383. update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
  1384. var updatedIndex = update.fromIndex;
  1385. var updatedChild = update.parentNode.childNodes[updatedIndex];
  1386. var parentID = update.parentID;
  1387. ("production" !== "development" ? invariant(
  1388. updatedChild,
  1389. 'processUpdates(): Unable to find child %s of element. This ' +
  1390. 'probably means the DOM was unexpectedly mutated (e.g., by the ' +
  1391. 'browser), usually due to forgetting a <tbody> when using tables, ' +
  1392. 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' +
  1393. 'in an <svg> parent. Try inspecting the child nodes of the element ' +
  1394. 'with React ID `%s`.',
  1395. updatedIndex,
  1396. parentID
  1397. ) : invariant(updatedChild));
  1398. initialChildren = initialChildren || {};
  1399. initialChildren[parentID] = initialChildren[parentID] || [];
  1400. initialChildren[parentID][updatedIndex] = updatedChild;
  1401. updatedChildren = updatedChildren || [];
  1402. updatedChildren.push(updatedChild);
  1403. }
  1404. }
  1405. var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
  1406. // Remove updated children first so that `toIndex` is consistent.
  1407. if (updatedChildren) {
  1408. for (var j = 0; j < updatedChildren.length; j++) {
  1409. updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
  1410. }
  1411. }
  1412. for (var k = 0; k < updates.length; k++) {
  1413. update = updates[k];
  1414. switch (update.type) {
  1415. case ReactMultiChildUpdateTypes.INSERT_MARKUP:
  1416. insertChildAt(
  1417. update.parentNode,
  1418. renderedMarkup[update.markupIndex],
  1419. update.toIndex
  1420. );
  1421. break;
  1422. case ReactMultiChildUpdateTypes.MOVE_EXISTING:
  1423. insertChildAt(
  1424. update.parentNode,
  1425. initialChildren[update.parentID][update.fromIndex],
  1426. update.toIndex
  1427. );
  1428. break;
  1429. case ReactMultiChildUpdateTypes.TEXT_CONTENT:
  1430. setTextContent(
  1431. update.parentNode,
  1432. update.textContent
  1433. );
  1434. break;
  1435. case ReactMultiChildUpdateTypes.REMOVE_NODE:
  1436. // Already removed by the for-loop above.
  1437. break;
  1438. }
  1439. }
  1440. }
  1441. };
  1442. module.exports = DOMChildrenOperations;
  1443. },{"12":12,"135":135,"149":149,"72":72}],10:[function(_dereq_,module,exports){
  1444. /**
  1445. * Copyright 2013-2015, Facebook, Inc.
  1446. * All rights reserved.
  1447. *
  1448. * This source code is licensed under the BSD-style license found in the
  1449. * LICENSE file in the root directory of this source tree. An additional grant
  1450. * of patent rights can be found in the PATENTS file in the same directory.
  1451. *
  1452. * @providesModule DOMProperty
  1453. * @typechecks static-only
  1454. */
  1455. /*jslint bitwise: true */
  1456. 'use strict';
  1457. var invariant = _dereq_(135);
  1458. function checkMask(value, bitmask) {
  1459. return (value & bitmask) === bitmask;
  1460. }
  1461. var DOMPropertyInjection = {
  1462. /**
  1463. * Mapping from normalized, camelcased property names to a configuration that
  1464. * specifies how the associated DOM property should be accessed or rendered.
  1465. */
  1466. MUST_USE_ATTRIBUTE: 0x1,
  1467. MUST_USE_PROPERTY: 0x2,
  1468. HAS_SIDE_EFFECTS: 0x4,
  1469. HAS_BOOLEAN_VALUE: 0x8,
  1470. HAS_NUMERIC_VALUE: 0x10,
  1471. HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
  1472. HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
  1473. /**
  1474. * Inject some specialized knowledge about the DOM. This takes a config object
  1475. * with the following properties:
  1476. *
  1477. * isCustomAttribute: function that given an attribute name will return true
  1478. * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
  1479. * attributes where it's impossible to enumerate all of the possible
  1480. * attribute names,
  1481. *
  1482. * Properties: object mapping DOM property name to one of the
  1483. * DOMPropertyInjection constants or null. If your attribute isn't in here,
  1484. * it won't get written to the DOM.
  1485. *
  1486. * DOMAttributeNames: object mapping React attribute name to the DOM
  1487. * attribute name. Attribute names not specified use the **lowercase**
  1488. * normalized name.
  1489. *
  1490. * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
  1491. * Property names not specified use the normalized name.
  1492. *
  1493. * DOMMutationMethods: Properties that require special mutation methods. If
  1494. * `value` is undefined, the mutation method should unset the property.
  1495. *
  1496. * @param {object} domPropertyConfig the config as described above.
  1497. */
  1498. injectDOMPropertyConfig: function(domPropertyConfig) {
  1499. var Properties = domPropertyConfig.Properties || {};
  1500. var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
  1501. var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
  1502. var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
  1503. if (domPropertyConfig.isCustomAttribute) {
  1504. DOMProperty._isCustomAttributeFunctions.push(
  1505. domPropertyConfig.isCustomAttribute
  1506. );
  1507. }
  1508. for (var propName in Properties) {
  1509. ("production" !== "development" ? invariant(
  1510. !DOMProperty.isStandardName.hasOwnProperty(propName),
  1511. 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' +
  1512. '\'%s\' which has already been injected. You may be accidentally ' +
  1513. 'injecting the same DOM property config twice, or you may be ' +
  1514. 'injecting two configs that have conflicting property names.',
  1515. propName
  1516. ) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName)));
  1517. DOMProperty.isStandardName[propName] = true;
  1518. var lowerCased = propName.toLowerCase();
  1519. DOMProperty.getPossibleStandardName[lowerCased] = propName;
  1520. if (DOMAttributeNames.hasOwnProperty(propName)) {
  1521. var attributeName = DOMAttributeNames[propName];
  1522. DOMProperty.getPossibleStandardName[attributeName] = propName;
  1523. DOMProperty.getAttributeName[propName] = attributeName;
  1524. } else {
  1525. DOMProperty.getAttributeName[propName] = lowerCased;
  1526. }
  1527. DOMProperty.getPropertyName[propName] =
  1528. DOMPropertyNames.hasOwnProperty(propName) ?
  1529. DOMPropertyNames[propName] :
  1530. propName;
  1531. if (DOMMutationMethods.hasOwnProperty(propName)) {
  1532. DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName];
  1533. } else {
  1534. DOMProperty.getMutationMethod[propName] = null;
  1535. }
  1536. var propConfig = Properties[propName];
  1537. DOMProperty.mustUseAttribute[propName] =
  1538. checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE);
  1539. DOMProperty.mustUseProperty[propName] =
  1540. checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY);
  1541. DOMProperty.hasSideEffects[propName] =
  1542. checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS);
  1543. DOMProperty.hasBooleanValue[propName] =
  1544. checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE);
  1545. DOMProperty.hasNumericValue[propName] =
  1546. checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE);
  1547. DOMProperty.hasPositiveNumericValue[propName] =
  1548. checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE);
  1549. DOMProperty.hasOverloadedBooleanValue[propName] =
  1550. checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE);
  1551. ("production" !== "development" ? invariant(
  1552. !DOMProperty.mustUseAttribute[propName] ||
  1553. !DOMProperty.mustUseProperty[propName],
  1554. 'DOMProperty: Cannot require using both attribute and property: %s',
  1555. propName
  1556. ) : invariant(!DOMProperty.mustUseAttribute[propName] ||
  1557. !DOMProperty.mustUseProperty[propName]));
  1558. ("production" !== "development" ? invariant(
  1559. DOMProperty.mustUseProperty[propName] ||
  1560. !DOMProperty.hasSideEffects[propName],
  1561. 'DOMProperty: Properties that have side effects must use property: %s',
  1562. propName
  1563. ) : invariant(DOMProperty.mustUseProperty[propName] ||
  1564. !DOMProperty.hasSideEffects[propName]));
  1565. ("production" !== "development" ? invariant(
  1566. !!DOMProperty.hasBooleanValue[propName] +
  1567. !!DOMProperty.hasNumericValue[propName] +
  1568. !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1,
  1569. 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +
  1570. 'numeric value, but not a combination: %s',
  1571. propName
  1572. ) : invariant(!!DOMProperty.hasBooleanValue[propName] +
  1573. !!DOMProperty.hasNumericValue[propName] +
  1574. !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1));
  1575. }
  1576. }
  1577. };
  1578. var defaultValueCache = {};
  1579. /**
  1580. * DOMProperty exports lookup objects that can be used like functions:
  1581. *
  1582. * > DOMProperty.isValid['id']
  1583. * true
  1584. * > DOMProperty.isValid['foobar']
  1585. * undefined
  1586. *
  1587. * Although this may be confusing, it performs better in general.
  1588. *
  1589. * @see http://jsperf.com/key-exists
  1590. * @see http://jsperf.com/key-missing
  1591. */
  1592. var DOMProperty = {
  1593. ID_ATTRIBUTE_NAME: 'data-reactid',
  1594. /**
  1595. * Checks whether a property name is a standard property.
  1596. * @type {Object}
  1597. */
  1598. isStandardName: {},
  1599. /**
  1600. * Mapping from lowercase property names to the properly cased version, used
  1601. * to warn in the case of missing properties.
  1602. * @type {Object}
  1603. */
  1604. getPossibleStandardName: {},
  1605. /**
  1606. * Mapping from normalized names to attribute names that differ. Attribute
  1607. * names are used when rendering markup or with `*Attribute()`.
  1608. * @type {Object}
  1609. */
  1610. getAttributeName: {},
  1611. /**
  1612. * Mapping from normalized names to properties on DOM node instances.
  1613. * (This includes properties that mutate due to external factors.)
  1614. * @type {Object}
  1615. */
  1616. getPropertyName: {},
  1617. /**
  1618. * Mapping from normalized names to mutation methods. This will only exist if
  1619. * mutation cannot be set simply by the property or `setAttribute()`.
  1620. * @type {Object}
  1621. */
  1622. getMutationMethod: {},
  1623. /**
  1624. * Whether the property must be accessed and mutated as an object property.
  1625. * @type {Object}
  1626. */
  1627. mustUseAttribute: {},
  1628. /**
  1629. * Whether the property must be accessed and mutated using `*Attribute()`.
  1630. * (This includes anything that fails `<propName> in <element>`.)
  1631. * @type {Object}
  1632. */
  1633. mustUseProperty: {},
  1634. /**
  1635. * Whether or not setting a value causes side effects such as triggering
  1636. * resources to be loaded or text selection changes. We must ensure that
  1637. * the value is only set if it has changed.
  1638. * @type {Object}
  1639. */
  1640. hasSideEffects: {},
  1641. /**
  1642. * Whether the property should be removed when set to a falsey value.
  1643. * @type {Object}
  1644. */
  1645. hasBooleanValue: {},
  1646. /**
  1647. * Whether the property must be numeric or parse as a
  1648. * numeric and should be removed when set to a falsey value.
  1649. * @type {Object}
  1650. */
  1651. hasNumericValue: {},
  1652. /**
  1653. * Whether the property must be positive numeric or parse as a positive
  1654. * numeric and should be removed when set to a falsey value.
  1655. * @type {Object}
  1656. */
  1657. hasPositiveNumericValue: {},
  1658. /**
  1659. * Whether the property can be used as a flag as well as with a value. Removed
  1660. * when strictly equal to false; present without a value when strictly equal
  1661. * to true; present with a value otherwise.
  1662. * @type {Object}
  1663. */
  1664. hasOverloadedBooleanValue: {},
  1665. /**
  1666. * All of the isCustomAttribute() functions that have been injected.
  1667. */
  1668. _isCustomAttributeFunctions: [],
  1669. /**
  1670. * Checks whether a property name is a custom attribute.
  1671. * @method
  1672. */
  1673. isCustomAttribute: function(attributeName) {
  1674. for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
  1675. var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
  1676. if (isCustomAttributeFn(attributeName)) {
  1677. return true;
  1678. }
  1679. }
  1680. return false;
  1681. },
  1682. /**
  1683. * Returns the default property value for a DOM property (i.e., not an
  1684. * attribute). Most default values are '' or false, but not all. Worse yet,
  1685. * some (in particular, `type`) vary depending on the type of element.
  1686. *
  1687. * TODO: Is it better to grab all the possible properties when creating an
  1688. * element to avoid having to create the same element twice?
  1689. */
  1690. getDefaultValueForProperty: function(nodeName, prop) {
  1691. var nodeDefaults = defaultValueCache[nodeName];
  1692. var testElement;
  1693. if (!nodeDefaults) {
  1694. defaultValueCache[nodeName] = nodeDefaults = {};
  1695. }
  1696. if (!(prop in nodeDefaults)) {
  1697. testElement = document.createElement(nodeName);
  1698. nodeDefaults[prop] = testElement[prop];
  1699. }
  1700. return nodeDefaults[prop];
  1701. },
  1702. injection: DOMPropertyInjection
  1703. };
  1704. module.exports = DOMProperty;
  1705. },{"135":135}],11:[function(_dereq_,module,exports){
  1706. /**
  1707. * Copyright 2013-2015, Facebook, Inc.
  1708. * All rights reserved.
  1709. *
  1710. * This source code is licensed under the BSD-style license found in the
  1711. * LICENSE file in the root directory of this source tree. An additional grant
  1712. * of patent rights can be found in the PATENTS file in the same directory.
  1713. *
  1714. * @providesModule DOMPropertyOperations
  1715. * @typechecks static-only
  1716. */
  1717. 'use strict';
  1718. var DOMProperty = _dereq_(10);
  1719. var quoteAttributeValueForBrowser = _dereq_(147);
  1720. var warning = _dereq_(154);
  1721. function shouldIgnoreValue(name, value) {
  1722. return value == null ||
  1723. (DOMProperty.hasBooleanValue[name] && !value) ||
  1724. (DOMProperty.hasNumericValue[name] && isNaN(value)) ||
  1725. (DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
  1726. (DOMProperty.hasOverloadedBooleanValue[name] && value === false);
  1727. }
  1728. if ("production" !== "development") {
  1729. var reactProps = {
  1730. children: true,
  1731. dangerouslySetInnerHTML: true,
  1732. key: true,
  1733. ref: true
  1734. };
  1735. var warnedProperties = {};
  1736. var warnUnknownProperty = function(name) {
  1737. if (reactProps.hasOwnProperty(name) && reactProps[name] ||
  1738. warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
  1739. return;
  1740. }
  1741. warnedProperties[name] = true;
  1742. var lowerCasedName = name.toLowerCase();
  1743. // data-* attributes should be lowercase; suggest the lowercase version
  1744. var standardName = (
  1745. DOMProperty.isCustomAttribute(lowerCasedName) ?
  1746. lowerCasedName :
  1747. DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?
  1748. DOMProperty.getPossibleStandardName[lowerCasedName] :
  1749. null
  1750. );
  1751. // For now, only warn when we have a suggested correction. This prevents
  1752. // logging too much when using transferPropsTo.
  1753. ("production" !== "development" ? warning(
  1754. standardName == null,
  1755. 'Unknown DOM property %s. Did you mean %s?',
  1756. name,
  1757. standardName
  1758. ) : null);
  1759. };
  1760. }
  1761. /**
  1762. * Operations for dealing with DOM properties.
  1763. */
  1764. var DOMPropertyOperations = {
  1765. /**
  1766. * Creates markup for the ID property.
  1767. *
  1768. * @param {string} id Unescaped ID.
  1769. * @return {string} Markup string.
  1770. */
  1771. createMarkupForID: function(id) {
  1772. return DOMProperty.ID_ATTRIBUTE_NAME + '=' +
  1773. quoteAttributeValueForBrowser(id);
  1774. },
  1775. /**
  1776. * Creates markup for a property.
  1777. *
  1778. * @param {string} name
  1779. * @param {*} value
  1780. * @return {?string} Markup string, or null if the property was invalid.
  1781. */
  1782. createMarkupForProperty: function(name, value) {
  1783. if (DOMProperty.isStandardName.hasOwnProperty(name) &&
  1784. DOMProperty.isStandardName[name]) {
  1785. if (shouldIgnoreValue(name, value)) {
  1786. return '';
  1787. }
  1788. var attributeName = DOMProperty.getAttributeName[name];
  1789. if (DOMProperty.hasBooleanValue[name] ||
  1790. (DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
  1791. return attributeName;
  1792. }
  1793. return attributeName + '=' + quoteAttributeValueForBrowser(value);
  1794. } else if (DOMProperty.isCustomAttribute(name)) {
  1795. if (value == null) {
  1796. return '';
  1797. }
  1798. return name + '=' + quoteAttributeValueForBrowser(value);
  1799. } else if ("production" !== "development") {
  1800. warnUnknownProperty(name);
  1801. }
  1802. return null;
  1803. },
  1804. /**
  1805. * Sets the value for a property on a node.
  1806. *
  1807. * @param {DOMElement} node
  1808. * @param {string} name
  1809. * @param {*} value
  1810. */
  1811. setValueForProperty: function(node, name, value) {
  1812. if (DOMProperty.isStandardName.hasOwnProperty(name) &&
  1813. DOMProperty.isStandardName[name]) {
  1814. var mutationMethod = DOMProperty.getMutationMethod[name];
  1815. if (mutationMethod) {
  1816. mutationMethod(node, value);
  1817. } else if (shouldIgnoreValue(name, value)) {
  1818. this.deleteValueForProperty(node, name);
  1819. } else if (DOMProperty.mustUseAttribute[name]) {
  1820. // `setAttribute` with objects becomes only `[object]` in IE8/9,
  1821. // ('' + value) makes it output the correct toString()-value.
  1822. node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
  1823. } else {
  1824. var propName = DOMProperty.getPropertyName[name];
  1825. // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
  1826. // property type before comparing; only `value` does and is string.
  1827. if (!DOMProperty.hasSideEffects[name] ||
  1828. ('' + node[propName]) !== ('' + value)) {
  1829. // Contrary to `setAttribute`, object properties are properly
  1830. // `toString`ed by IE8/9.
  1831. node[propName] = value;
  1832. }
  1833. }
  1834. } else if (DOMProperty.isCustomAttribute(name)) {
  1835. if (value == null) {
  1836. node.removeAttribute(name);
  1837. } else {
  1838. node.setAttribute(name, '' + value);
  1839. }
  1840. } else if ("production" !== "development") {
  1841. warnUnknownProperty(name);
  1842. }
  1843. },
  1844. /**
  1845. * Deletes the value for a property on a node.
  1846. *
  1847. * @param {DOMElement} node
  1848. * @param {string} name
  1849. */
  1850. deleteValueForProperty: function(node, name) {
  1851. if (DOMProperty.isStandardName.hasOwnProperty(name) &&
  1852. DOMProperty.isStandardName[name]) {
  1853. var mutationMethod = DOMProperty.getMutationMethod[name];
  1854. if (mutationMethod) {
  1855. mutationMethod(node, undefined);
  1856. } else if (DOMProperty.mustUseAttribute[name]) {
  1857. node.removeAttribute(DOMProperty.getAttributeName[name]);
  1858. } else {
  1859. var propName = DOMProperty.getPropertyName[name];
  1860. var defaultValue = DOMProperty.getDefaultValueForProperty(
  1861. node.nodeName,
  1862. propName
  1863. );
  1864. if (!DOMProperty.hasSideEffects[name] ||
  1865. ('' + node[propName]) !== defaultValue) {
  1866. node[propName] = defaultValue;
  1867. }
  1868. }
  1869. } else if (DOMProperty.isCustomAttribute(name)) {
  1870. node.removeAttribute(name);
  1871. } else if ("production" !== "development") {
  1872. warnUnknownProperty(name);
  1873. }
  1874. }
  1875. };
  1876. module.exports = DOMPropertyOperations;
  1877. },{"10":10,"147":147,"154":154}],12:[function(_dereq_,module,exports){
  1878. /**
  1879. * Copyright 2013-2015, Facebook, Inc.
  1880. * All rights reserved.
  1881. *
  1882. * This source code is licensed under the BSD-style license found in the
  1883. * LICENSE file in the root directory of this source tree. An additional grant
  1884. * of patent rights can be found in the PATENTS file in the same directory.
  1885. *
  1886. * @providesModule Danger
  1887. * @typechecks static-only
  1888. */
  1889. /*jslint evil: true, sub: true */
  1890. 'use strict';
  1891. var ExecutionEnvironment = _dereq_(21);
  1892. var createNodesFromMarkup = _dereq_(112);
  1893. var emptyFunction = _dereq_(114);
  1894. var getMarkupWrap = _dereq_(127);
  1895. var invariant = _dereq_(135);
  1896. var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
  1897. var RESULT_INDEX_ATTR = 'data-danger-index';
  1898. /**
  1899. * Extracts the `nodeName` from a string of markup.
  1900. *
  1901. * NOTE: Extracting the `nodeName` does not require a regular expression match
  1902. * because we make assumptions about React-generated markup (i.e. there are no
  1903. * spaces surrounding the opening tag and there is at least one attribute).
  1904. *
  1905. * @param {string} markup String of markup.
  1906. * @return {string} Node name of the supplied markup.
  1907. * @see http://jsperf.com/extract-nodename
  1908. */
  1909. function getNodeName(markup) {
  1910. return markup.substring(1, markup.indexOf(' '));
  1911. }
  1912. var Danger = {
  1913. /**
  1914. * Renders markup into an array of nodes. The markup is expected to render
  1915. * into a list of root nodes. Also, the length of `resultList` and
  1916. * `markupList` should be the same.
  1917. *
  1918. * @param {array<string>} markupList List of markup strings to render.
  1919. * @return {array<DOMElement>} List of rendered nodes.
  1920. * @internal
  1921. */
  1922. dangerouslyRenderMarkup: function(markupList) {
  1923. ("production" !== "development" ? invariant(
  1924. ExecutionEnvironment.canUseDOM,
  1925. 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' +
  1926. 'thread. Make sure `window` and `document` are available globally ' +
  1927. 'before requiring React when unit testing or use ' +
  1928. 'React.renderToString for server rendering.'
  1929. ) : invariant(ExecutionEnvironment.canUseDOM));
  1930. var nodeName;
  1931. var markupByNodeName = {};
  1932. // Group markup by `nodeName` if a wrap is necessary, else by '*'.
  1933. for (var i = 0; i < markupList.length; i++) {
  1934. ("production" !== "development" ? invariant(
  1935. markupList[i],
  1936. 'dangerouslyRenderMarkup(...): Missing markup.'
  1937. ) : invariant(markupList[i]));
  1938. nodeName = getNodeName(markupList[i]);
  1939. nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
  1940. markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
  1941. markupByNodeName[nodeName][i] = markupList[i];
  1942. }
  1943. var resultList = [];
  1944. var resultListAssignmentCount = 0;
  1945. for (nodeName in markupByNodeName) {
  1946. if (!markupByNodeName.hasOwnProperty(nodeName)) {
  1947. continue;
  1948. }
  1949. var markupListByNodeName = markupByNodeName[nodeName];
  1950. // This for-in loop skips the holes of the sparse array. The order of
  1951. // iteration should follow the order of assignment, which happens to match
  1952. // numerical index order, but we don't rely on that.
  1953. var resultIndex;
  1954. for (resultIndex in markupListByNodeName) {
  1955. if (markupListByNodeName.hasOwnProperty(resultIndex)) {
  1956. var markup = markupListByNodeName[resultIndex];
  1957. // Push the requested markup with an additional RESULT_INDEX_ATTR
  1958. // attribute. If the markup does not start with a < character, it
  1959. // will be discarded below (with an appropriate console.error).
  1960. markupListByNodeName[resultIndex] = markup.replace(
  1961. OPEN_TAG_NAME_EXP,
  1962. // This index will be parsed back out below.
  1963. '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '
  1964. );
  1965. }
  1966. }
  1967. // Render each group of markup with similar wrapping `nodeName`.
  1968. var renderNodes = createNodesFromMarkup(
  1969. markupListByNodeName.join(''),
  1970. emptyFunction // Do nothing special with <script> tags.
  1971. );
  1972. for (var j = 0; j < renderNodes.length; ++j) {
  1973. var renderNode = renderNodes[j];
  1974. if (renderNode.hasAttribute &&
  1975. renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
  1976. resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
  1977. renderNode.removeAttribute(RESULT_INDEX_ATTR);
  1978. ("production" !== "development" ? invariant(
  1979. !resultList.hasOwnProperty(resultIndex),
  1980. 'Danger: Assigning to an already-occupied result index.'
  1981. ) : invariant(!resultList.hasOwnProperty(resultIndex)));
  1982. resultList[resultIndex] = renderNode;
  1983. // This should match resultList.length and markupList.length when
  1984. // we're done.
  1985. resultListAssignmentCount += 1;
  1986. } else if ("production" !== "development") {
  1987. console.error(
  1988. 'Danger: Discarding unexpected node:',
  1989. renderNode
  1990. );
  1991. }
  1992. }
  1993. }
  1994. // Although resultList was populated out of order, it should now be a dense
  1995. // array.
  1996. ("production" !== "development" ? invariant(
  1997. resultListAssignmentCount === resultList.length,
  1998. 'Danger: Did not assign to every index of resultList.'
  1999. ) : invariant(resultListAssignmentCount === resultList.length));
  2000. ("production" !== "development" ? invariant(
  2001. resultList.length === markupList.length,
  2002. 'Danger: Expected markup to render %s nodes, but rendered %s.',
  2003. markupList.length,
  2004. resultList.length
  2005. ) : invariant(resultList.length === markupList.length));
  2006. return resultList;
  2007. },
  2008. /**
  2009. * Replaces a node with a string of markup at its current position within its
  2010. * parent. The markup must render into a single root node.
  2011. *
  2012. * @param {DOMElement} oldChild Child node to replace.
  2013. * @param {string} markup Markup to render in place of the child node.
  2014. * @internal
  2015. */
  2016. dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {
  2017. ("production" !== "development" ? invariant(
  2018. ExecutionEnvironment.canUseDOM,
  2019. 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +
  2020. 'worker thread. Make sure `window` and `document` are available ' +
  2021. 'globally before requiring React when unit testing or use ' +
  2022. 'React.renderToString for server rendering.'
  2023. ) : invariant(ExecutionEnvironment.canUseDOM));
  2024. ("production" !== "development" ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));
  2025. ("production" !== "development" ? invariant(
  2026. oldChild.tagName.toLowerCase() !== 'html',
  2027. 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' +
  2028. '<html> node. This is because browser quirks make this unreliable ' +
  2029. 'and/or slow. If you want to render to the root you must use ' +
  2030. 'server rendering. See React.renderToString().'
  2031. ) : invariant(oldChild.tagName.toLowerCase() !== 'html'));
  2032. var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
  2033. oldChild.parentNode.replaceChild(newChild, oldChild);
  2034. }
  2035. };
  2036. module.exports = Danger;
  2037. },{"112":112,"114":114,"127":127,"135":135,"21":21}],13:[function(_dereq_,module,exports){
  2038. /**
  2039. * Copyright 2013-2015, Facebook, Inc.
  2040. * All rights reserved.
  2041. *
  2042. * This source code is licensed under the BSD-style license found in the
  2043. * LICENSE file in the root directory of this source tree. An additional grant
  2044. * of patent rights can be found in the PATENTS file in the same directory.
  2045. *
  2046. * @providesModule DefaultEventPluginOrder
  2047. */
  2048. 'use strict';
  2049. var keyOf = _dereq_(141);
  2050. /**
  2051. * Module that is injectable into `EventPluginHub`, that specifies a
  2052. * deterministic ordering of `EventPlugin`s. A convenient way to reason about
  2053. * plugins, without having to package every one of them. This is better than
  2054. * having plugins be ordered in the same order that they are injected because
  2055. * that ordering would be influenced by the packaging order.
  2056. * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
  2057. * preventing default on events is convenient in `SimpleEventPlugin` handlers.
  2058. */
  2059. var DefaultEventPluginOrder = [
  2060. keyOf({ResponderEventPlugin: null}),
  2061. keyOf({SimpleEventPlugin: null}),
  2062. keyOf({TapEventPlugin: null}),
  2063. keyOf({EnterLeaveEventPlugin: null}),
  2064. keyOf({ChangeEventPlugin: null}),
  2065. keyOf({SelectEventPlugin: null}),
  2066. keyOf({BeforeInputEventPlugin: null}),
  2067. keyOf({AnalyticsEventPlugin: null}),
  2068. keyOf({MobileSafariClickEventPlugin: null})
  2069. ];
  2070. module.exports = DefaultEventPluginOrder;
  2071. },{"141":141}],14:[function(_dereq_,module,exports){
  2072. /**
  2073. * Copyright 2013-2015, Facebook, Inc.
  2074. * All rights reserved.
  2075. *
  2076. * This source code is licensed under the BSD-style license found in the
  2077. * LICENSE file in the root directory of this source tree. An additional grant
  2078. * of patent rights can be found in the PATENTS file in the same directory.
  2079. *
  2080. * @providesModule EnterLeaveEventPlugin
  2081. * @typechecks static-only
  2082. */
  2083. 'use strict';
  2084. var EventConstants = _dereq_(15);
  2085. var EventPropagators = _dereq_(20);
  2086. var SyntheticMouseEvent = _dereq_(99);
  2087. var ReactMount = _dereq_(70);
  2088. var keyOf = _dereq_(141);
  2089. var topLevelTypes = EventConstants.topLevelTypes;
  2090. var getFirstReactDOM = ReactMount.getFirstReactDOM;
  2091. var eventTypes = {
  2092. mouseEnter: {
  2093. registrationName: keyOf({onMouseEnter: null}),
  2094. dependencies: [
  2095. topLevelTypes.topMouseOut,
  2096. topLevelTypes.topMouseOver
  2097. ]
  2098. },
  2099. mouseLeave: {
  2100. registrationName: keyOf({onMouseLeave: null}),
  2101. dependencies: [
  2102. topLevelTypes.topMouseOut,
  2103. topLevelTypes.topMouseOver
  2104. ]
  2105. }
  2106. };
  2107. var extractedEvents = [null, null];
  2108. var EnterLeaveEventPlugin = {
  2109. eventTypes: eventTypes,
  2110. /**
  2111. * For almost every interaction we care about, there will be both a top-level
  2112. * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
  2113. * we do not extract duplicate events. However, moving the mouse into the
  2114. * browser from outside will not fire a `mouseout` event. In this case, we use
  2115. * the `mouseover` top-level event.
  2116. *
  2117. * @param {string} topLevelType Record from `EventConstants`.
  2118. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  2119. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  2120. * @param {object} nativeEvent Native browser event.
  2121. * @return {*} An accumulation of synthetic events.
  2122. * @see {EventPluginHub.extractEvents}
  2123. */
  2124. extractEvents: function(
  2125. topLevelType,
  2126. topLevelTarget,
  2127. topLevelTargetID,
  2128. nativeEvent) {
  2129. if (topLevelType === topLevelTypes.topMouseOver &&
  2130. (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
  2131. return null;
  2132. }
  2133. if (topLevelType !== topLevelTypes.topMouseOut &&
  2134. topLevelType !== topLevelTypes.topMouseOver) {
  2135. // Must not be a mouse in or mouse out - ignoring.
  2136. return null;
  2137. }
  2138. var win;
  2139. if (topLevelTarget.window === topLevelTarget) {
  2140. // `topLevelTarget` is probably a window object.
  2141. win = topLevelTarget;
  2142. } else {
  2143. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  2144. var doc = topLevelTarget.ownerDocument;
  2145. if (doc) {
  2146. win = doc.defaultView || doc.parentWindow;
  2147. } else {
  2148. win = window;
  2149. }
  2150. }
  2151. var from, to;
  2152. if (topLevelType === topLevelTypes.topMouseOut) {
  2153. from = topLevelTarget;
  2154. to =
  2155. getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||
  2156. win;
  2157. } else {
  2158. from = win;
  2159. to = topLevelTarget;
  2160. }
  2161. if (from === to) {
  2162. // Nothing pertains to our managed components.
  2163. return null;
  2164. }
  2165. var fromID = from ? ReactMount.getID(from) : '';
  2166. var toID = to ? ReactMount.getID(to) : '';
  2167. var leave = SyntheticMouseEvent.getPooled(
  2168. eventTypes.mouseLeave,
  2169. fromID,
  2170. nativeEvent
  2171. );
  2172. leave.type = 'mouseleave';
  2173. leave.target = from;
  2174. leave.relatedTarget = to;
  2175. var enter = SyntheticMouseEvent.getPooled(
  2176. eventTypes.mouseEnter,
  2177. toID,
  2178. nativeEvent
  2179. );
  2180. enter.type = 'mouseenter';
  2181. enter.target = to;
  2182. enter.relatedTarget = from;
  2183. EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
  2184. extractedEvents[0] = leave;
  2185. extractedEvents[1] = enter;
  2186. return extractedEvents;
  2187. }
  2188. };
  2189. module.exports = EnterLeaveEventPlugin;
  2190. },{"141":141,"15":15,"20":20,"70":70,"99":99}],15:[function(_dereq_,module,exports){
  2191. /**
  2192. * Copyright 2013-2015, Facebook, Inc.
  2193. * All rights reserved.
  2194. *
  2195. * This source code is licensed under the BSD-style license found in the
  2196. * LICENSE file in the root directory of this source tree. An additional grant
  2197. * of patent rights can be found in the PATENTS file in the same directory.
  2198. *
  2199. * @providesModule EventConstants
  2200. */
  2201. 'use strict';
  2202. var keyMirror = _dereq_(140);
  2203. var PropagationPhases = keyMirror({bubbled: null, captured: null});
  2204. /**
  2205. * Types of raw signals from the browser caught at the top level.
  2206. */
  2207. var topLevelTypes = keyMirror({
  2208. topBlur: null,
  2209. topChange: null,
  2210. topClick: null,
  2211. topCompositionEnd: null,
  2212. topCompositionStart: null,
  2213. topCompositionUpdate: null,
  2214. topContextMenu: null,
  2215. topCopy: null,
  2216. topCut: null,
  2217. topDoubleClick: null,
  2218. topDrag: null,
  2219. topDragEnd: null,
  2220. topDragEnter: null,
  2221. topDragExit: null,
  2222. topDragLeave: null,
  2223. topDragOver: null,
  2224. topDragStart: null,
  2225. topDrop: null,
  2226. topError: null,
  2227. topFocus: null,
  2228. topInput: null,
  2229. topKeyDown: null,
  2230. topKeyPress: null,
  2231. topKeyUp: null,
  2232. topLoad: null,
  2233. topMouseDown: null,
  2234. topMouseMove: null,
  2235. topMouseOut: null,
  2236. topMouseOver: null,
  2237. topMouseUp: null,
  2238. topPaste: null,
  2239. topReset: null,
  2240. topScroll: null,
  2241. topSelectionChange: null,
  2242. topSubmit: null,
  2243. topTextInput: null,
  2244. topTouchCancel: null,
  2245. topTouchEnd: null,
  2246. topTouchMove: null,
  2247. topTouchStart: null,
  2248. topWheel: null
  2249. });
  2250. var EventConstants = {
  2251. topLevelTypes: topLevelTypes,
  2252. PropagationPhases: PropagationPhases
  2253. };
  2254. module.exports = EventConstants;
  2255. },{"140":140}],16:[function(_dereq_,module,exports){
  2256. /**
  2257. * Copyright 2013-2015, Facebook, Inc.
  2258. *
  2259. * Licensed under the Apache License, Version 2.0 (the "License");
  2260. * you may not use this file except in compliance with the License.
  2261. * You may obtain a copy of the License at
  2262. *
  2263. * http://www.apache.org/licenses/LICENSE-2.0
  2264. *
  2265. * Unless required by applicable law or agreed to in writing, software
  2266. * distributed under the License is distributed on an "AS IS" BASIS,
  2267. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  2268. * See the License for the specific language governing permissions and
  2269. * limitations under the License.
  2270. *
  2271. * @providesModule EventListener
  2272. * @typechecks
  2273. */
  2274. var emptyFunction = _dereq_(114);
  2275. /**
  2276. * Upstream version of event listener. Does not take into account specific
  2277. * nature of platform.
  2278. */
  2279. var EventListener = {
  2280. /**
  2281. * Listen to DOM events during the bubble phase.
  2282. *
  2283. * @param {DOMEventTarget} target DOM element to register listener on.
  2284. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  2285. * @param {function} callback Callback function.
  2286. * @return {object} Object with a `remove` method.
  2287. */
  2288. listen: function(target, eventType, callback) {
  2289. if (target.addEventListener) {
  2290. target.addEventListener(eventType, callback, false);
  2291. return {
  2292. remove: function() {
  2293. target.removeEventListener(eventType, callback, false);
  2294. }
  2295. };
  2296. } else if (target.attachEvent) {
  2297. target.attachEvent('on' + eventType, callback);
  2298. return {
  2299. remove: function() {
  2300. target.detachEvent('on' + eventType, callback);
  2301. }
  2302. };
  2303. }
  2304. },
  2305. /**
  2306. * Listen to DOM events during the capture phase.
  2307. *
  2308. * @param {DOMEventTarget} target DOM element to register listener on.
  2309. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  2310. * @param {function} callback Callback function.
  2311. * @return {object} Object with a `remove` method.
  2312. */
  2313. capture: function(target, eventType, callback) {
  2314. if (!target.addEventListener) {
  2315. if ("production" !== "development") {
  2316. console.error(
  2317. 'Attempted to listen to events during the capture phase on a ' +
  2318. 'browser that does not support the capture phase. Your application ' +
  2319. 'will not receive some events.'
  2320. );
  2321. }
  2322. return {
  2323. remove: emptyFunction
  2324. };
  2325. } else {
  2326. target.addEventListener(eventType, callback, true);
  2327. return {
  2328. remove: function() {
  2329. target.removeEventListener(eventType, callback, true);
  2330. }
  2331. };
  2332. }
  2333. },
  2334. registerDefault: function() {}
  2335. };
  2336. module.exports = EventListener;
  2337. },{"114":114}],17:[function(_dereq_,module,exports){
  2338. /**
  2339. * Copyright 2013-2015, Facebook, Inc.
  2340. * All rights reserved.
  2341. *
  2342. * This source code is licensed under the BSD-style license found in the
  2343. * LICENSE file in the root directory of this source tree. An additional grant
  2344. * of patent rights can be found in the PATENTS file in the same directory.
  2345. *
  2346. * @providesModule EventPluginHub
  2347. */
  2348. 'use strict';
  2349. var EventPluginRegistry = _dereq_(18);
  2350. var EventPluginUtils = _dereq_(19);
  2351. var accumulateInto = _dereq_(105);
  2352. var forEachAccumulated = _dereq_(120);
  2353. var invariant = _dereq_(135);
  2354. /**
  2355. * Internal store for event listeners
  2356. */
  2357. var listenerBank = {};
  2358. /**
  2359. * Internal queue of events that have accumulated their dispatches and are
  2360. * waiting to have their dispatches executed.
  2361. */
  2362. var eventQueue = null;
  2363. /**
  2364. * Dispatches an event and releases it back into the pool, unless persistent.
  2365. *
  2366. * @param {?object} event Synthetic event to be dispatched.
  2367. * @private
  2368. */
  2369. var executeDispatchesAndRelease = function(event) {
  2370. if (event) {
  2371. var executeDispatch = EventPluginUtils.executeDispatch;
  2372. // Plugins can provide custom behavior when dispatching events.
  2373. var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
  2374. if (PluginModule && PluginModule.executeDispatch) {
  2375. executeDispatch = PluginModule.executeDispatch;
  2376. }
  2377. EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);
  2378. if (!event.isPersistent()) {
  2379. event.constructor.release(event);
  2380. }
  2381. }
  2382. };
  2383. /**
  2384. * - `InstanceHandle`: [required] Module that performs logical traversals of DOM
  2385. * hierarchy given ids of the logical DOM elements involved.
  2386. */
  2387. var InstanceHandle = null;
  2388. function validateInstanceHandle() {
  2389. var valid =
  2390. InstanceHandle &&
  2391. InstanceHandle.traverseTwoPhase &&
  2392. InstanceHandle.traverseEnterLeave;
  2393. ("production" !== "development" ? invariant(
  2394. valid,
  2395. 'InstanceHandle not injected before use!'
  2396. ) : invariant(valid));
  2397. }
  2398. /**
  2399. * This is a unified interface for event plugins to be installed and configured.
  2400. *
  2401. * Event plugins can implement the following properties:
  2402. *
  2403. * `extractEvents` {function(string, DOMEventTarget, string, object): *}
  2404. * Required. When a top-level event is fired, this method is expected to
  2405. * extract synthetic events that will in turn be queued and dispatched.
  2406. *
  2407. * `eventTypes` {object}
  2408. * Optional, plugins that fire events must publish a mapping of registration
  2409. * names that are used to register listeners. Values of this mapping must
  2410. * be objects that contain `registrationName` or `phasedRegistrationNames`.
  2411. *
  2412. * `executeDispatch` {function(object, function, string)}
  2413. * Optional, allows plugins to override how an event gets dispatched. By
  2414. * default, the listener is simply invoked.
  2415. *
  2416. * Each plugin that is injected into `EventsPluginHub` is immediately operable.
  2417. *
  2418. * @public
  2419. */
  2420. var EventPluginHub = {
  2421. /**
  2422. * Methods for injecting dependencies.
  2423. */
  2424. injection: {
  2425. /**
  2426. * @param {object} InjectedMount
  2427. * @public
  2428. */
  2429. injectMount: EventPluginUtils.injection.injectMount,
  2430. /**
  2431. * @param {object} InjectedInstanceHandle
  2432. * @public
  2433. */
  2434. injectInstanceHandle: function(InjectedInstanceHandle) {
  2435. InstanceHandle = InjectedInstanceHandle;
  2436. if ("production" !== "development") {
  2437. validateInstanceHandle();
  2438. }
  2439. },
  2440. getInstanceHandle: function() {
  2441. if ("production" !== "development") {
  2442. validateInstanceHandle();
  2443. }
  2444. return InstanceHandle;
  2445. },
  2446. /**
  2447. * @param {array} InjectedEventPluginOrder
  2448. * @public
  2449. */
  2450. injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
  2451. /**
  2452. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2453. */
  2454. injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
  2455. },
  2456. eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
  2457. registrationNameModules: EventPluginRegistry.registrationNameModules,
  2458. /**
  2459. * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
  2460. *
  2461. * @param {string} id ID of the DOM element.
  2462. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2463. * @param {?function} listener The callback to store.
  2464. */
  2465. putListener: function(id, registrationName, listener) {
  2466. ("production" !== "development" ? invariant(
  2467. !listener || typeof listener === 'function',
  2468. 'Expected %s listener to be a function, instead got type %s',
  2469. registrationName, typeof listener
  2470. ) : invariant(!listener || typeof listener === 'function'));
  2471. var bankForRegistrationName =
  2472. listenerBank[registrationName] || (listenerBank[registrationName] = {});
  2473. bankForRegistrationName[id] = listener;
  2474. },
  2475. /**
  2476. * @param {string} id ID of the DOM element.
  2477. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2478. * @return {?function} The stored callback.
  2479. */
  2480. getListener: function(id, registrationName) {
  2481. var bankForRegistrationName = listenerBank[registrationName];
  2482. return bankForRegistrationName && bankForRegistrationName[id];
  2483. },
  2484. /**
  2485. * Deletes a listener from the registration bank.
  2486. *
  2487. * @param {string} id ID of the DOM element.
  2488. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2489. */
  2490. deleteListener: function(id, registrationName) {
  2491. var bankForRegistrationName = listenerBank[registrationName];
  2492. if (bankForRegistrationName) {
  2493. delete bankForRegistrationName[id];
  2494. }
  2495. },
  2496. /**
  2497. * Deletes all listeners for the DOM element with the supplied ID.
  2498. *
  2499. * @param {string} id ID of the DOM element.
  2500. */
  2501. deleteAllListeners: function(id) {
  2502. for (var registrationName in listenerBank) {
  2503. delete listenerBank[registrationName][id];
  2504. }
  2505. },
  2506. /**
  2507. * Allows registered plugins an opportunity to extract events from top-level
  2508. * native browser events.
  2509. *
  2510. * @param {string} topLevelType Record from `EventConstants`.
  2511. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  2512. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  2513. * @param {object} nativeEvent Native browser event.
  2514. * @return {*} An accumulation of synthetic events.
  2515. * @internal
  2516. */
  2517. extractEvents: function(
  2518. topLevelType,
  2519. topLevelTarget,
  2520. topLevelTargetID,
  2521. nativeEvent) {
  2522. var events;
  2523. var plugins = EventPluginRegistry.plugins;
  2524. for (var i = 0, l = plugins.length; i < l; i++) {
  2525. // Not every plugin in the ordering may be loaded at runtime.
  2526. var possiblePlugin = plugins[i];
  2527. if (possiblePlugin) {
  2528. var extractedEvents = possiblePlugin.extractEvents(
  2529. topLevelType,
  2530. topLevelTarget,
  2531. topLevelTargetID,
  2532. nativeEvent
  2533. );
  2534. if (extractedEvents) {
  2535. events = accumulateInto(events, extractedEvents);
  2536. }
  2537. }
  2538. }
  2539. return events;
  2540. },
  2541. /**
  2542. * Enqueues a synthetic event that should be dispatched when
  2543. * `processEventQueue` is invoked.
  2544. *
  2545. * @param {*} events An accumulation of synthetic events.
  2546. * @internal
  2547. */
  2548. enqueueEvents: function(events) {
  2549. if (events) {
  2550. eventQueue = accumulateInto(eventQueue, events);
  2551. }
  2552. },
  2553. /**
  2554. * Dispatches all synthetic events on the event queue.
  2555. *
  2556. * @internal
  2557. */
  2558. processEventQueue: function() {
  2559. // Set `eventQueue` to null before processing it so that we can tell if more
  2560. // events get enqueued while processing.
  2561. var processingEventQueue = eventQueue;
  2562. eventQueue = null;
  2563. forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);
  2564. ("production" !== "development" ? invariant(
  2565. !eventQueue,
  2566. 'processEventQueue(): Additional events were enqueued while processing ' +
  2567. 'an event queue. Support for this has not yet been implemented.'
  2568. ) : invariant(!eventQueue));
  2569. },
  2570. /**
  2571. * These are needed for tests only. Do not use!
  2572. */
  2573. __purge: function() {
  2574. listenerBank = {};
  2575. },
  2576. __getListenerBank: function() {
  2577. return listenerBank;
  2578. }
  2579. };
  2580. module.exports = EventPluginHub;
  2581. },{"105":105,"120":120,"135":135,"18":18,"19":19}],18:[function(_dereq_,module,exports){
  2582. /**
  2583. * Copyright 2013-2015, Facebook, Inc.
  2584. * All rights reserved.
  2585. *
  2586. * This source code is licensed under the BSD-style license found in the
  2587. * LICENSE file in the root directory of this source tree. An additional grant
  2588. * of patent rights can be found in the PATENTS file in the same directory.
  2589. *
  2590. * @providesModule EventPluginRegistry
  2591. * @typechecks static-only
  2592. */
  2593. 'use strict';
  2594. var invariant = _dereq_(135);
  2595. /**
  2596. * Injectable ordering of event plugins.
  2597. */
  2598. var EventPluginOrder = null;
  2599. /**
  2600. * Injectable mapping from names to event plugin modules.
  2601. */
  2602. var namesToPlugins = {};
  2603. /**
  2604. * Recomputes the plugin list using the injected plugins and plugin ordering.
  2605. *
  2606. * @private
  2607. */
  2608. function recomputePluginOrdering() {
  2609. if (!EventPluginOrder) {
  2610. // Wait until an `EventPluginOrder` is injected.
  2611. return;
  2612. }
  2613. for (var pluginName in namesToPlugins) {
  2614. var PluginModule = namesToPlugins[pluginName];
  2615. var pluginIndex = EventPluginOrder.indexOf(pluginName);
  2616. ("production" !== "development" ? invariant(
  2617. pluginIndex > -1,
  2618. 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +
  2619. 'the plugin ordering, `%s`.',
  2620. pluginName
  2621. ) : invariant(pluginIndex > -1));
  2622. if (EventPluginRegistry.plugins[pluginIndex]) {
  2623. continue;
  2624. }
  2625. ("production" !== "development" ? invariant(
  2626. PluginModule.extractEvents,
  2627. 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +
  2628. 'method, but `%s` does not.',
  2629. pluginName
  2630. ) : invariant(PluginModule.extractEvents));
  2631. EventPluginRegistry.plugins[pluginIndex] = PluginModule;
  2632. var publishedEvents = PluginModule.eventTypes;
  2633. for (var eventName in publishedEvents) {
  2634. ("production" !== "development" ? invariant(
  2635. publishEventForPlugin(
  2636. publishedEvents[eventName],
  2637. PluginModule,
  2638. eventName
  2639. ),
  2640. 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',
  2641. eventName,
  2642. pluginName
  2643. ) : invariant(publishEventForPlugin(
  2644. publishedEvents[eventName],
  2645. PluginModule,
  2646. eventName
  2647. )));
  2648. }
  2649. }
  2650. }
  2651. /**
  2652. * Publishes an event so that it can be dispatched by the supplied plugin.
  2653. *
  2654. * @param {object} dispatchConfig Dispatch configuration for the event.
  2655. * @param {object} PluginModule Plugin publishing the event.
  2656. * @return {boolean} True if the event was successfully published.
  2657. * @private
  2658. */
  2659. function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
  2660. ("production" !== "development" ? invariant(
  2661. !EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName),
  2662. 'EventPluginHub: More than one plugin attempted to publish the same ' +
  2663. 'event name, `%s`.',
  2664. eventName
  2665. ) : invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName)));
  2666. EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
  2667. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  2668. if (phasedRegistrationNames) {
  2669. for (var phaseName in phasedRegistrationNames) {
  2670. if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
  2671. var phasedRegistrationName = phasedRegistrationNames[phaseName];
  2672. publishRegistrationName(
  2673. phasedRegistrationName,
  2674. PluginModule,
  2675. eventName
  2676. );
  2677. }
  2678. }
  2679. return true;
  2680. } else if (dispatchConfig.registrationName) {
  2681. publishRegistrationName(
  2682. dispatchConfig.registrationName,
  2683. PluginModule,
  2684. eventName
  2685. );
  2686. return true;
  2687. }
  2688. return false;
  2689. }
  2690. /**
  2691. * Publishes a registration name that is used to identify dispatched events and
  2692. * can be used with `EventPluginHub.putListener` to register listeners.
  2693. *
  2694. * @param {string} registrationName Registration name to add.
  2695. * @param {object} PluginModule Plugin publishing the event.
  2696. * @private
  2697. */
  2698. function publishRegistrationName(registrationName, PluginModule, eventName) {
  2699. ("production" !== "development" ? invariant(
  2700. !EventPluginRegistry.registrationNameModules[registrationName],
  2701. 'EventPluginHub: More than one plugin attempted to publish the same ' +
  2702. 'registration name, `%s`.',
  2703. registrationName
  2704. ) : invariant(!EventPluginRegistry.registrationNameModules[registrationName]));
  2705. EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
  2706. EventPluginRegistry.registrationNameDependencies[registrationName] =
  2707. PluginModule.eventTypes[eventName].dependencies;
  2708. }
  2709. /**
  2710. * Registers plugins so that they can extract and dispatch events.
  2711. *
  2712. * @see {EventPluginHub}
  2713. */
  2714. var EventPluginRegistry = {
  2715. /**
  2716. * Ordered list of injected plugins.
  2717. */
  2718. plugins: [],
  2719. /**
  2720. * Mapping from event name to dispatch config
  2721. */
  2722. eventNameDispatchConfigs: {},
  2723. /**
  2724. * Mapping from registration name to plugin module
  2725. */
  2726. registrationNameModules: {},
  2727. /**
  2728. * Mapping from registration name to event name
  2729. */
  2730. registrationNameDependencies: {},
  2731. /**
  2732. * Injects an ordering of plugins (by plugin name). This allows the ordering
  2733. * to be decoupled from injection of the actual plugins so that ordering is
  2734. * always deterministic regardless of packaging, on-the-fly injection, etc.
  2735. *
  2736. * @param {array} InjectedEventPluginOrder
  2737. * @internal
  2738. * @see {EventPluginHub.injection.injectEventPluginOrder}
  2739. */
  2740. injectEventPluginOrder: function(InjectedEventPluginOrder) {
  2741. ("production" !== "development" ? invariant(
  2742. !EventPluginOrder,
  2743. 'EventPluginRegistry: Cannot inject event plugin ordering more than ' +
  2744. 'once. You are likely trying to load more than one copy of React.'
  2745. ) : invariant(!EventPluginOrder));
  2746. // Clone the ordering so it cannot be dynamically mutated.
  2747. EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
  2748. recomputePluginOrdering();
  2749. },
  2750. /**
  2751. * Injects plugins to be used by `EventPluginHub`. The plugin names must be
  2752. * in the ordering injected by `injectEventPluginOrder`.
  2753. *
  2754. * Plugins can be injected as part of page initialization or on-the-fly.
  2755. *
  2756. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2757. * @internal
  2758. * @see {EventPluginHub.injection.injectEventPluginsByName}
  2759. */
  2760. injectEventPluginsByName: function(injectedNamesToPlugins) {
  2761. var isOrderingDirty = false;
  2762. for (var pluginName in injectedNamesToPlugins) {
  2763. if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
  2764. continue;
  2765. }
  2766. var PluginModule = injectedNamesToPlugins[pluginName];
  2767. if (!namesToPlugins.hasOwnProperty(pluginName) ||
  2768. namesToPlugins[pluginName] !== PluginModule) {
  2769. ("production" !== "development" ? invariant(
  2770. !namesToPlugins[pluginName],
  2771. 'EventPluginRegistry: Cannot inject two different event plugins ' +
  2772. 'using the same name, `%s`.',
  2773. pluginName
  2774. ) : invariant(!namesToPlugins[pluginName]));
  2775. namesToPlugins[pluginName] = PluginModule;
  2776. isOrderingDirty = true;
  2777. }
  2778. }
  2779. if (isOrderingDirty) {
  2780. recomputePluginOrdering();
  2781. }
  2782. },
  2783. /**
  2784. * Looks up the plugin for the supplied event.
  2785. *
  2786. * @param {object} event A synthetic event.
  2787. * @return {?object} The plugin that created the supplied event.
  2788. * @internal
  2789. */
  2790. getPluginModuleForEvent: function(event) {
  2791. var dispatchConfig = event.dispatchConfig;
  2792. if (dispatchConfig.registrationName) {
  2793. return EventPluginRegistry.registrationNameModules[
  2794. dispatchConfig.registrationName
  2795. ] || null;
  2796. }
  2797. for (var phase in dispatchConfig.phasedRegistrationNames) {
  2798. if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
  2799. continue;
  2800. }
  2801. var PluginModule = EventPluginRegistry.registrationNameModules[
  2802. dispatchConfig.phasedRegistrationNames[phase]
  2803. ];
  2804. if (PluginModule) {
  2805. return PluginModule;
  2806. }
  2807. }
  2808. return null;
  2809. },
  2810. /**
  2811. * Exposed for unit testing.
  2812. * @private
  2813. */
  2814. _resetEventPlugins: function() {
  2815. EventPluginOrder = null;
  2816. for (var pluginName in namesToPlugins) {
  2817. if (namesToPlugins.hasOwnProperty(pluginName)) {
  2818. delete namesToPlugins[pluginName];
  2819. }
  2820. }
  2821. EventPluginRegistry.plugins.length = 0;
  2822. var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
  2823. for (var eventName in eventNameDispatchConfigs) {
  2824. if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
  2825. delete eventNameDispatchConfigs[eventName];
  2826. }
  2827. }
  2828. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  2829. for (var registrationName in registrationNameModules) {
  2830. if (registrationNameModules.hasOwnProperty(registrationName)) {
  2831. delete registrationNameModules[registrationName];
  2832. }
  2833. }
  2834. }
  2835. };
  2836. module.exports = EventPluginRegistry;
  2837. },{"135":135}],19:[function(_dereq_,module,exports){
  2838. /**
  2839. * Copyright 2013-2015, Facebook, Inc.
  2840. * All rights reserved.
  2841. *
  2842. * This source code is licensed under the BSD-style license found in the
  2843. * LICENSE file in the root directory of this source tree. An additional grant
  2844. * of patent rights can be found in the PATENTS file in the same directory.
  2845. *
  2846. * @providesModule EventPluginUtils
  2847. */
  2848. 'use strict';
  2849. var EventConstants = _dereq_(15);
  2850. var invariant = _dereq_(135);
  2851. /**
  2852. * Injected dependencies:
  2853. */
  2854. /**
  2855. * - `Mount`: [required] Module that can convert between React dom IDs and
  2856. * actual node references.
  2857. */
  2858. var injection = {
  2859. Mount: null,
  2860. injectMount: function(InjectedMount) {
  2861. injection.Mount = InjectedMount;
  2862. if ("production" !== "development") {
  2863. ("production" !== "development" ? invariant(
  2864. InjectedMount && InjectedMount.getNode,
  2865. 'EventPluginUtils.injection.injectMount(...): Injected Mount module ' +
  2866. 'is missing getNode.'
  2867. ) : invariant(InjectedMount && InjectedMount.getNode));
  2868. }
  2869. }
  2870. };
  2871. var topLevelTypes = EventConstants.topLevelTypes;
  2872. function isEndish(topLevelType) {
  2873. return topLevelType === topLevelTypes.topMouseUp ||
  2874. topLevelType === topLevelTypes.topTouchEnd ||
  2875. topLevelType === topLevelTypes.topTouchCancel;
  2876. }
  2877. function isMoveish(topLevelType) {
  2878. return topLevelType === topLevelTypes.topMouseMove ||
  2879. topLevelType === topLevelTypes.topTouchMove;
  2880. }
  2881. function isStartish(topLevelType) {
  2882. return topLevelType === topLevelTypes.topMouseDown ||
  2883. topLevelType === topLevelTypes.topTouchStart;
  2884. }
  2885. var validateEventDispatches;
  2886. if ("production" !== "development") {
  2887. validateEventDispatches = function(event) {
  2888. var dispatchListeners = event._dispatchListeners;
  2889. var dispatchIDs = event._dispatchIDs;
  2890. var listenersIsArr = Array.isArray(dispatchListeners);
  2891. var idsIsArr = Array.isArray(dispatchIDs);
  2892. var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
  2893. var listenersLen = listenersIsArr ?
  2894. dispatchListeners.length :
  2895. dispatchListeners ? 1 : 0;
  2896. ("production" !== "development" ? invariant(
  2897. idsIsArr === listenersIsArr && IDsLen === listenersLen,
  2898. 'EventPluginUtils: Invalid `event`.'
  2899. ) : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen));
  2900. };
  2901. }
  2902. /**
  2903. * Invokes `cb(event, listener, id)`. Avoids using call if no scope is
  2904. * provided. The `(listener,id)` pair effectively forms the "dispatch" but are
  2905. * kept separate to conserve memory.
  2906. */
  2907. function forEachEventDispatch(event, cb) {
  2908. var dispatchListeners = event._dispatchListeners;
  2909. var dispatchIDs = event._dispatchIDs;
  2910. if ("production" !== "development") {
  2911. validateEventDispatches(event);
  2912. }
  2913. if (Array.isArray(dispatchListeners)) {
  2914. for (var i = 0; i < dispatchListeners.length; i++) {
  2915. if (event.isPropagationStopped()) {
  2916. break;
  2917. }
  2918. // Listeners and IDs are two parallel arrays that are always in sync.
  2919. cb(event, dispatchListeners[i], dispatchIDs[i]);
  2920. }
  2921. } else if (dispatchListeners) {
  2922. cb(event, dispatchListeners, dispatchIDs);
  2923. }
  2924. }
  2925. /**
  2926. * Default implementation of PluginModule.executeDispatch().
  2927. * @param {SyntheticEvent} SyntheticEvent to handle
  2928. * @param {function} Application-level callback
  2929. * @param {string} domID DOM id to pass to the callback.
  2930. */
  2931. function executeDispatch(event, listener, domID) {
  2932. event.currentTarget = injection.Mount.getNode(domID);
  2933. var returnValue = listener(event, domID);
  2934. event.currentTarget = null;
  2935. return returnValue;
  2936. }
  2937. /**
  2938. * Standard/simple iteration through an event's collected dispatches.
  2939. */
  2940. function executeDispatchesInOrder(event, cb) {
  2941. forEachEventDispatch(event, cb);
  2942. event._dispatchListeners = null;
  2943. event._dispatchIDs = null;
  2944. }
  2945. /**
  2946. * Standard/simple iteration through an event's collected dispatches, but stops
  2947. * at the first dispatch execution returning true, and returns that id.
  2948. *
  2949. * @return id of the first dispatch execution who's listener returns true, or
  2950. * null if no listener returned true.
  2951. */
  2952. function executeDispatchesInOrderStopAtTrueImpl(event) {
  2953. var dispatchListeners = event._dispatchListeners;
  2954. var dispatchIDs = event._dispatchIDs;
  2955. if ("production" !== "development") {
  2956. validateEventDispatches(event);
  2957. }
  2958. if (Array.isArray(dispatchListeners)) {
  2959. for (var i = 0; i < dispatchListeners.length; i++) {
  2960. if (event.isPropagationStopped()) {
  2961. break;
  2962. }
  2963. // Listeners and IDs are two parallel arrays that are always in sync.
  2964. if (dispatchListeners[i](event, dispatchIDs[i])) {
  2965. return dispatchIDs[i];
  2966. }
  2967. }
  2968. } else if (dispatchListeners) {
  2969. if (dispatchListeners(event, dispatchIDs)) {
  2970. return dispatchIDs;
  2971. }
  2972. }
  2973. return null;
  2974. }
  2975. /**
  2976. * @see executeDispatchesInOrderStopAtTrueImpl
  2977. */
  2978. function executeDispatchesInOrderStopAtTrue(event) {
  2979. var ret = executeDispatchesInOrderStopAtTrueImpl(event);
  2980. event._dispatchIDs = null;
  2981. event._dispatchListeners = null;
  2982. return ret;
  2983. }
  2984. /**
  2985. * Execution of a "direct" dispatch - there must be at most one dispatch
  2986. * accumulated on the event or it is considered an error. It doesn't really make
  2987. * sense for an event with multiple dispatches (bubbled) to keep track of the
  2988. * return values at each dispatch execution, but it does tend to make sense when
  2989. * dealing with "direct" dispatches.
  2990. *
  2991. * @return The return value of executing the single dispatch.
  2992. */
  2993. function executeDirectDispatch(event) {
  2994. if ("production" !== "development") {
  2995. validateEventDispatches(event);
  2996. }
  2997. var dispatchListener = event._dispatchListeners;
  2998. var dispatchID = event._dispatchIDs;
  2999. ("production" !== "development" ? invariant(
  3000. !Array.isArray(dispatchListener),
  3001. 'executeDirectDispatch(...): Invalid `event`.'
  3002. ) : invariant(!Array.isArray(dispatchListener)));
  3003. var res = dispatchListener ?
  3004. dispatchListener(event, dispatchID) :
  3005. null;
  3006. event._dispatchListeners = null;
  3007. event._dispatchIDs = null;
  3008. return res;
  3009. }
  3010. /**
  3011. * @param {SyntheticEvent} event
  3012. * @return {bool} True iff number of dispatches accumulated is greater than 0.
  3013. */
  3014. function hasDispatches(event) {
  3015. return !!event._dispatchListeners;
  3016. }
  3017. /**
  3018. * General utilities that are useful in creating custom Event Plugins.
  3019. */
  3020. var EventPluginUtils = {
  3021. isEndish: isEndish,
  3022. isMoveish: isMoveish,
  3023. isStartish: isStartish,
  3024. executeDirectDispatch: executeDirectDispatch,
  3025. executeDispatch: executeDispatch,
  3026. executeDispatchesInOrder: executeDispatchesInOrder,
  3027. executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
  3028. hasDispatches: hasDispatches,
  3029. injection: injection,
  3030. useTouchEvents: false
  3031. };
  3032. module.exports = EventPluginUtils;
  3033. },{"135":135,"15":15}],20:[function(_dereq_,module,exports){
  3034. /**
  3035. * Copyright 2013-2015, Facebook, Inc.
  3036. * All rights reserved.
  3037. *
  3038. * This source code is licensed under the BSD-style license found in the
  3039. * LICENSE file in the root directory of this source tree. An additional grant
  3040. * of patent rights can be found in the PATENTS file in the same directory.
  3041. *
  3042. * @providesModule EventPropagators
  3043. */
  3044. 'use strict';
  3045. var EventConstants = _dereq_(15);
  3046. var EventPluginHub = _dereq_(17);
  3047. var accumulateInto = _dereq_(105);
  3048. var forEachAccumulated = _dereq_(120);
  3049. var PropagationPhases = EventConstants.PropagationPhases;
  3050. var getListener = EventPluginHub.getListener;
  3051. /**
  3052. * Some event types have a notion of different registration names for different
  3053. * "phases" of propagation. This finds listeners by a given phase.
  3054. */
  3055. function listenerAtPhase(id, event, propagationPhase) {
  3056. var registrationName =
  3057. event.dispatchConfig.phasedRegistrationNames[propagationPhase];
  3058. return getListener(id, registrationName);
  3059. }
  3060. /**
  3061. * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
  3062. * here, allows us to not have to bind or create functions for each event.
  3063. * Mutating the event's members allows us to not have to create a wrapping
  3064. * "dispatch" object that pairs the event with the listener.
  3065. */
  3066. function accumulateDirectionalDispatches(domID, upwards, event) {
  3067. if ("production" !== "development") {
  3068. if (!domID) {
  3069. throw new Error('Dispatching id must not be null');
  3070. }
  3071. }
  3072. var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
  3073. var listener = listenerAtPhase(domID, event, phase);
  3074. if (listener) {
  3075. event._dispatchListeners =
  3076. accumulateInto(event._dispatchListeners, listener);
  3077. event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
  3078. }
  3079. }
  3080. /**
  3081. * Collect dispatches (must be entirely collected before dispatching - see unit
  3082. * tests). Lazily allocate the array to conserve memory. We must loop through
  3083. * each event and perform the traversal for each one. We can not perform a
  3084. * single traversal for the entire collection of events because each event may
  3085. * have a different target.
  3086. */
  3087. function accumulateTwoPhaseDispatchesSingle(event) {
  3088. if (event && event.dispatchConfig.phasedRegistrationNames) {
  3089. EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(
  3090. event.dispatchMarker,
  3091. accumulateDirectionalDispatches,
  3092. event
  3093. );
  3094. }
  3095. }
  3096. /**
  3097. * Accumulates without regard to direction, does not look for phased
  3098. * registration names. Same as `accumulateDirectDispatchesSingle` but without
  3099. * requiring that the `dispatchMarker` be the same as the dispatched ID.
  3100. */
  3101. function accumulateDispatches(id, ignoredDirection, event) {
  3102. if (event && event.dispatchConfig.registrationName) {
  3103. var registrationName = event.dispatchConfig.registrationName;
  3104. var listener = getListener(id, registrationName);
  3105. if (listener) {
  3106. event._dispatchListeners =
  3107. accumulateInto(event._dispatchListeners, listener);
  3108. event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
  3109. }
  3110. }
  3111. }
  3112. /**
  3113. * Accumulates dispatches on an `SyntheticEvent`, but only for the
  3114. * `dispatchMarker`.
  3115. * @param {SyntheticEvent} event
  3116. */
  3117. function accumulateDirectDispatchesSingle(event) {
  3118. if (event && event.dispatchConfig.registrationName) {
  3119. accumulateDispatches(event.dispatchMarker, null, event);
  3120. }
  3121. }
  3122. function accumulateTwoPhaseDispatches(events) {
  3123. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
  3124. }
  3125. function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
  3126. EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(
  3127. fromID,
  3128. toID,
  3129. accumulateDispatches,
  3130. leave,
  3131. enter
  3132. );
  3133. }
  3134. function accumulateDirectDispatches(events) {
  3135. forEachAccumulated(events, accumulateDirectDispatchesSingle);
  3136. }
  3137. /**
  3138. * A small set of propagation patterns, each of which will accept a small amount
  3139. * of information, and generate a set of "dispatch ready event objects" - which
  3140. * are sets of events that have already been annotated with a set of dispatched
  3141. * listener functions/ids. The API is designed this way to discourage these
  3142. * propagation strategies from actually executing the dispatches, since we
  3143. * always want to collect the entire set of dispatches before executing event a
  3144. * single one.
  3145. *
  3146. * @constructor EventPropagators
  3147. */
  3148. var EventPropagators = {
  3149. accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
  3150. accumulateDirectDispatches: accumulateDirectDispatches,
  3151. accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
  3152. };
  3153. module.exports = EventPropagators;
  3154. },{"105":105,"120":120,"15":15,"17":17}],21:[function(_dereq_,module,exports){
  3155. /**
  3156. * Copyright 2013-2015, Facebook, Inc.
  3157. * All rights reserved.
  3158. *
  3159. * This source code is licensed under the BSD-style license found in the
  3160. * LICENSE file in the root directory of this source tree. An additional grant
  3161. * of patent rights can be found in the PATENTS file in the same directory.
  3162. *
  3163. * @providesModule ExecutionEnvironment
  3164. */
  3165. /*jslint evil: true */
  3166. "use strict";
  3167. var canUseDOM = !!(
  3168. (typeof window !== 'undefined' &&
  3169. window.document && window.document.createElement)
  3170. );
  3171. /**
  3172. * Simple, lightweight module assisting with the detection and context of
  3173. * Worker. Helps avoid circular dependencies and allows code to reason about
  3174. * whether or not they are in a Worker, even if they never include the main
  3175. * `ReactWorker` dependency.
  3176. */
  3177. var ExecutionEnvironment = {
  3178. canUseDOM: canUseDOM,
  3179. canUseWorkers: typeof Worker !== 'undefined',
  3180. canUseEventListeners:
  3181. canUseDOM && !!(window.addEventListener || window.attachEvent),
  3182. canUseViewport: canUseDOM && !!window.screen,
  3183. isInWorker: !canUseDOM // For now, this is true - might change in the future.
  3184. };
  3185. module.exports = ExecutionEnvironment;
  3186. },{}],22:[function(_dereq_,module,exports){
  3187. /**
  3188. * Copyright 2013-2015, Facebook, Inc.
  3189. * All rights reserved.
  3190. *
  3191. * This source code is licensed under the BSD-style license found in the
  3192. * LICENSE file in the root directory of this source tree. An additional grant
  3193. * of patent rights can be found in the PATENTS file in the same directory.
  3194. *
  3195. * @providesModule FallbackCompositionState
  3196. * @typechecks static-only
  3197. */
  3198. 'use strict';
  3199. var PooledClass = _dereq_(28);
  3200. var assign = _dereq_(27);
  3201. var getTextContentAccessor = _dereq_(130);
  3202. /**
  3203. * This helper class stores information about text content of a target node,
  3204. * allowing comparison of content before and after a given event.
  3205. *
  3206. * Identify the node where selection currently begins, then observe
  3207. * both its text content and its current position in the DOM. Since the
  3208. * browser may natively replace the target node during composition, we can
  3209. * use its position to find its replacement.
  3210. *
  3211. * @param {DOMEventTarget} root
  3212. */
  3213. function FallbackCompositionState(root) {
  3214. this._root = root;
  3215. this._startText = this.getText();
  3216. this._fallbackText = null;
  3217. }
  3218. assign(FallbackCompositionState.prototype, {
  3219. /**
  3220. * Get current text of input.
  3221. *
  3222. * @return {string}
  3223. */
  3224. getText: function() {
  3225. if ('value' in this._root) {
  3226. return this._root.value;
  3227. }
  3228. return this._root[getTextContentAccessor()];
  3229. },
  3230. /**
  3231. * Determine the differing substring between the initially stored
  3232. * text content and the current content.
  3233. *
  3234. * @return {string}
  3235. */
  3236. getData: function() {
  3237. if (this._fallbackText) {
  3238. return this._fallbackText;
  3239. }
  3240. var start;
  3241. var startValue = this._startText;
  3242. var startLength = startValue.length;
  3243. var end;
  3244. var endValue = this.getText();
  3245. var endLength = endValue.length;
  3246. for (start = 0; start < startLength; start++) {
  3247. if (startValue[start] !== endValue[start]) {
  3248. break;
  3249. }
  3250. }
  3251. var minEnd = startLength - start;
  3252. for (end = 1; end <= minEnd; end++) {
  3253. if (startValue[startLength - end] !== endValue[endLength - end]) {
  3254. break;
  3255. }
  3256. }
  3257. var sliceTail = end > 1 ? 1 - end : undefined;
  3258. this._fallbackText = endValue.slice(start, sliceTail);
  3259. return this._fallbackText;
  3260. }
  3261. });
  3262. PooledClass.addPoolingTo(FallbackCompositionState);
  3263. module.exports = FallbackCompositionState;
  3264. },{"130":130,"27":27,"28":28}],23:[function(_dereq_,module,exports){
  3265. /**
  3266. * Copyright 2013-2015, Facebook, Inc.
  3267. * All rights reserved.
  3268. *
  3269. * This source code is licensed under the BSD-style license found in the
  3270. * LICENSE file in the root directory of this source tree. An additional grant
  3271. * of patent rights can be found in the PATENTS file in the same directory.
  3272. *
  3273. * @providesModule HTMLDOMPropertyConfig
  3274. */
  3275. /*jslint bitwise: true*/
  3276. 'use strict';
  3277. var DOMProperty = _dereq_(10);
  3278. var ExecutionEnvironment = _dereq_(21);
  3279. var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
  3280. var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
  3281. var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
  3282. var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
  3283. var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
  3284. var HAS_POSITIVE_NUMERIC_VALUE =
  3285. DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
  3286. var HAS_OVERLOADED_BOOLEAN_VALUE =
  3287. DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
  3288. var hasSVG;
  3289. if (ExecutionEnvironment.canUseDOM) {
  3290. var implementation = document.implementation;
  3291. hasSVG = (
  3292. implementation &&
  3293. implementation.hasFeature &&
  3294. implementation.hasFeature(
  3295. 'http://www.w3.org/TR/SVG11/feature#BasicStructure',
  3296. '1.1'
  3297. )
  3298. );
  3299. }
  3300. var HTMLDOMPropertyConfig = {
  3301. isCustomAttribute: RegExp.prototype.test.bind(
  3302. /^(data|aria)-[a-z_][a-z\d_.\-]*$/
  3303. ),
  3304. Properties: {
  3305. /**
  3306. * Standard Properties
  3307. */
  3308. accept: null,
  3309. acceptCharset: null,
  3310. accessKey: null,
  3311. action: null,
  3312. allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3313. allowTransparency: MUST_USE_ATTRIBUTE,
  3314. alt: null,
  3315. async: HAS_BOOLEAN_VALUE,
  3316. autoComplete: null,
  3317. // autoFocus is polyfilled/normalized by AutoFocusMixin
  3318. // autoFocus: HAS_BOOLEAN_VALUE,
  3319. autoPlay: HAS_BOOLEAN_VALUE,
  3320. cellPadding: null,
  3321. cellSpacing: null,
  3322. charSet: MUST_USE_ATTRIBUTE,
  3323. checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3324. classID: MUST_USE_ATTRIBUTE,
  3325. // To set className on SVG elements, it's necessary to use .setAttribute;
  3326. // this works on HTML elements too in all browsers except IE8. Conveniently,
  3327. // IE8 doesn't support SVG and so we can simply use the attribute in
  3328. // browsers that support SVG and the property in browsers that don't,
  3329. // regardless of whether the element is HTML or SVG.
  3330. className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
  3331. cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
  3332. colSpan: null,
  3333. content: null,
  3334. contentEditable: null,
  3335. contextMenu: MUST_USE_ATTRIBUTE,
  3336. controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3337. coords: null,
  3338. crossOrigin: null,
  3339. data: null, // For `<object />` acts as `src`.
  3340. dateTime: MUST_USE_ATTRIBUTE,
  3341. defer: HAS_BOOLEAN_VALUE,
  3342. dir: null,
  3343. disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3344. download: HAS_OVERLOADED_BOOLEAN_VALUE,
  3345. draggable: null,
  3346. encType: null,
  3347. form: MUST_USE_ATTRIBUTE,
  3348. formAction: MUST_USE_ATTRIBUTE,
  3349. formEncType: MUST_USE_ATTRIBUTE,
  3350. formMethod: MUST_USE_ATTRIBUTE,
  3351. formNoValidate: HAS_BOOLEAN_VALUE,
  3352. formTarget: MUST_USE_ATTRIBUTE,
  3353. frameBorder: MUST_USE_ATTRIBUTE,
  3354. headers: null,
  3355. height: MUST_USE_ATTRIBUTE,
  3356. hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3357. href: null,
  3358. hrefLang: null,
  3359. htmlFor: null,
  3360. httpEquiv: null,
  3361. icon: null,
  3362. id: MUST_USE_PROPERTY,
  3363. label: null,
  3364. lang: null,
  3365. list: MUST_USE_ATTRIBUTE,
  3366. loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3367. manifest: MUST_USE_ATTRIBUTE,
  3368. marginHeight: null,
  3369. marginWidth: null,
  3370. max: null,
  3371. maxLength: MUST_USE_ATTRIBUTE,
  3372. media: MUST_USE_ATTRIBUTE,
  3373. mediaGroup: null,
  3374. method: null,
  3375. min: null,
  3376. multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3377. muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3378. name: null,
  3379. noValidate: HAS_BOOLEAN_VALUE,
  3380. open: HAS_BOOLEAN_VALUE,
  3381. pattern: null,
  3382. placeholder: null,
  3383. poster: null,
  3384. preload: null,
  3385. radioGroup: null,
  3386. readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3387. rel: null,
  3388. required: HAS_BOOLEAN_VALUE,
  3389. role: MUST_USE_ATTRIBUTE,
  3390. rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
  3391. rowSpan: null,
  3392. sandbox: null,
  3393. scope: null,
  3394. scrolling: null,
  3395. seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3396. selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3397. shape: null,
  3398. size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
  3399. sizes: MUST_USE_ATTRIBUTE,
  3400. span: HAS_POSITIVE_NUMERIC_VALUE,
  3401. spellCheck: null,
  3402. src: null,
  3403. srcDoc: MUST_USE_PROPERTY,
  3404. srcSet: MUST_USE_ATTRIBUTE,
  3405. start: HAS_NUMERIC_VALUE,
  3406. step: null,
  3407. style: null,
  3408. tabIndex: null,
  3409. target: null,
  3410. title: null,
  3411. type: null,
  3412. useMap: null,
  3413. value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
  3414. width: MUST_USE_ATTRIBUTE,
  3415. wmode: MUST_USE_ATTRIBUTE,
  3416. /**
  3417. * Non-standard Properties
  3418. */
  3419. // autoCapitalize and autoCorrect are supported in Mobile Safari for
  3420. // keyboard hints.
  3421. autoCapitalize: null,
  3422. autoCorrect: null,
  3423. // itemProp, itemScope, itemType are for
  3424. // Microdata support. See http://schema.org/docs/gs.html
  3425. itemProp: MUST_USE_ATTRIBUTE,
  3426. itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3427. itemType: MUST_USE_ATTRIBUTE,
  3428. // itemID and itemRef are for Microdata support as well but
  3429. // only specified in the the WHATWG spec document. See
  3430. // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
  3431. itemID: MUST_USE_ATTRIBUTE,
  3432. itemRef: MUST_USE_ATTRIBUTE,
  3433. // property is supported for OpenGraph in meta tags.
  3434. property: null
  3435. },
  3436. DOMAttributeNames: {
  3437. acceptCharset: 'accept-charset',
  3438. className: 'class',
  3439. htmlFor: 'for',
  3440. httpEquiv: 'http-equiv'
  3441. },
  3442. DOMPropertyNames: {
  3443. autoCapitalize: 'autocapitalize',
  3444. autoComplete: 'autocomplete',
  3445. autoCorrect: 'autocorrect',
  3446. autoFocus: 'autofocus',
  3447. autoPlay: 'autoplay',
  3448. // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
  3449. // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
  3450. encType: 'encoding',
  3451. hrefLang: 'hreflang',
  3452. radioGroup: 'radiogroup',
  3453. spellCheck: 'spellcheck',
  3454. srcDoc: 'srcdoc',
  3455. srcSet: 'srcset'
  3456. }
  3457. };
  3458. module.exports = HTMLDOMPropertyConfig;
  3459. },{"10":10,"21":21}],24:[function(_dereq_,module,exports){
  3460. /**
  3461. * Copyright 2013-2015, Facebook, Inc.
  3462. * All rights reserved.
  3463. *
  3464. * This source code is licensed under the BSD-style license found in the
  3465. * LICENSE file in the root directory of this source tree. An additional grant
  3466. * of patent rights can be found in the PATENTS file in the same directory.
  3467. *
  3468. * @providesModule LinkedValueUtils
  3469. * @typechecks static-only
  3470. */
  3471. 'use strict';
  3472. var ReactPropTypes = _dereq_(78);
  3473. var invariant = _dereq_(135);
  3474. var hasReadOnlyValue = {
  3475. 'button': true,
  3476. 'checkbox': true,
  3477. 'image': true,
  3478. 'hidden': true,
  3479. 'radio': true,
  3480. 'reset': true,
  3481. 'submit': true
  3482. };
  3483. function _assertSingleLink(input) {
  3484. ("production" !== "development" ? invariant(
  3485. input.props.checkedLink == null || input.props.valueLink == null,
  3486. 'Cannot provide a checkedLink and a valueLink. If you want to use ' +
  3487. 'checkedLink, you probably don\'t want to use valueLink and vice versa.'
  3488. ) : invariant(input.props.checkedLink == null || input.props.valueLink == null));
  3489. }
  3490. function _assertValueLink(input) {
  3491. _assertSingleLink(input);
  3492. ("production" !== "development" ? invariant(
  3493. input.props.value == null && input.props.onChange == null,
  3494. 'Cannot provide a valueLink and a value or onChange event. If you want ' +
  3495. 'to use value or onChange, you probably don\'t want to use valueLink.'
  3496. ) : invariant(input.props.value == null && input.props.onChange == null));
  3497. }
  3498. function _assertCheckedLink(input) {
  3499. _assertSingleLink(input);
  3500. ("production" !== "development" ? invariant(
  3501. input.props.checked == null && input.props.onChange == null,
  3502. 'Cannot provide a checkedLink and a checked property or onChange event. ' +
  3503. 'If you want to use checked or onChange, you probably don\'t want to ' +
  3504. 'use checkedLink'
  3505. ) : invariant(input.props.checked == null && input.props.onChange == null));
  3506. }
  3507. /**
  3508. * @param {SyntheticEvent} e change event to handle
  3509. */
  3510. function _handleLinkedValueChange(e) {
  3511. /*jshint validthis:true */
  3512. this.props.valueLink.requestChange(e.target.value);
  3513. }
  3514. /**
  3515. * @param {SyntheticEvent} e change event to handle
  3516. */
  3517. function _handleLinkedCheckChange(e) {
  3518. /*jshint validthis:true */
  3519. this.props.checkedLink.requestChange(e.target.checked);
  3520. }
  3521. /**
  3522. * Provide a linked `value` attribute for controlled forms. You should not use
  3523. * this outside of the ReactDOM controlled form components.
  3524. */
  3525. var LinkedValueUtils = {
  3526. Mixin: {
  3527. propTypes: {
  3528. value: function(props, propName, componentName) {
  3529. if (!props[propName] ||
  3530. hasReadOnlyValue[props.type] ||
  3531. props.onChange ||
  3532. props.readOnly ||
  3533. props.disabled) {
  3534. return null;
  3535. }
  3536. return new Error(
  3537. 'You provided a `value` prop to a form field without an ' +
  3538. '`onChange` handler. This will render a read-only field. If ' +
  3539. 'the field should be mutable use `defaultValue`. Otherwise, ' +
  3540. 'set either `onChange` or `readOnly`.'
  3541. );
  3542. },
  3543. checked: function(props, propName, componentName) {
  3544. if (!props[propName] ||
  3545. props.onChange ||
  3546. props.readOnly ||
  3547. props.disabled) {
  3548. return null;
  3549. }
  3550. return new Error(
  3551. 'You provided a `checked` prop to a form field without an ' +
  3552. '`onChange` handler. This will render a read-only field. If ' +
  3553. 'the field should be mutable use `defaultChecked`. Otherwise, ' +
  3554. 'set either `onChange` or `readOnly`.'
  3555. );
  3556. },
  3557. onChange: ReactPropTypes.func
  3558. }
  3559. },
  3560. /**
  3561. * @param {ReactComponent} input Form component
  3562. * @return {*} current value of the input either from value prop or link.
  3563. */
  3564. getValue: function(input) {
  3565. if (input.props.valueLink) {
  3566. _assertValueLink(input);
  3567. return input.props.valueLink.value;
  3568. }
  3569. return input.props.value;
  3570. },
  3571. /**
  3572. * @param {ReactComponent} input Form component
  3573. * @return {*} current checked status of the input either from checked prop
  3574. * or link.
  3575. */
  3576. getChecked: function(input) {
  3577. if (input.props.checkedLink) {
  3578. _assertCheckedLink(input);
  3579. return input.props.checkedLink.value;
  3580. }
  3581. return input.props.checked;
  3582. },
  3583. /**
  3584. * @param {ReactComponent} input Form component
  3585. * @return {function} change callback either from onChange prop or link.
  3586. */
  3587. getOnChange: function(input) {
  3588. if (input.props.valueLink) {
  3589. _assertValueLink(input);
  3590. return _handleLinkedValueChange;
  3591. } else if (input.props.checkedLink) {
  3592. _assertCheckedLink(input);
  3593. return _handleLinkedCheckChange;
  3594. }
  3595. return input.props.onChange;
  3596. }
  3597. };
  3598. module.exports = LinkedValueUtils;
  3599. },{"135":135,"78":78}],25:[function(_dereq_,module,exports){
  3600. /**
  3601. * Copyright 2014-2015, Facebook, Inc.
  3602. * All rights reserved.
  3603. *
  3604. * This source code is licensed under the BSD-style license found in the
  3605. * LICENSE file in the root directory of this source tree. An additional grant
  3606. * of patent rights can be found in the PATENTS file in the same directory.
  3607. *
  3608. * @providesModule LocalEventTrapMixin
  3609. */
  3610. 'use strict';
  3611. var ReactBrowserEventEmitter = _dereq_(30);
  3612. var accumulateInto = _dereq_(105);
  3613. var forEachAccumulated = _dereq_(120);
  3614. var invariant = _dereq_(135);
  3615. function remove(event) {
  3616. event.remove();
  3617. }
  3618. var LocalEventTrapMixin = {
  3619. trapBubbledEvent:function(topLevelType, handlerBaseName) {
  3620. ("production" !== "development" ? invariant(this.isMounted(), 'Must be mounted to trap events') : invariant(this.isMounted()));
  3621. // If a component renders to null or if another component fatals and causes
  3622. // the state of the tree to be corrupted, `node` here can be null.
  3623. var node = this.getDOMNode();
  3624. ("production" !== "development" ? invariant(
  3625. node,
  3626. 'LocalEventTrapMixin.trapBubbledEvent(...): Requires node to be rendered.'
  3627. ) : invariant(node));
  3628. var listener = ReactBrowserEventEmitter.trapBubbledEvent(
  3629. topLevelType,
  3630. handlerBaseName,
  3631. node
  3632. );
  3633. this._localEventListeners =
  3634. accumulateInto(this._localEventListeners, listener);
  3635. },
  3636. // trapCapturedEvent would look nearly identical. We don't implement that
  3637. // method because it isn't currently needed.
  3638. componentWillUnmount:function() {
  3639. if (this._localEventListeners) {
  3640. forEachAccumulated(this._localEventListeners, remove);
  3641. }
  3642. }
  3643. };
  3644. module.exports = LocalEventTrapMixin;
  3645. },{"105":105,"120":120,"135":135,"30":30}],26:[function(_dereq_,module,exports){
  3646. /**
  3647. * Copyright 2013-2015, Facebook, Inc.
  3648. * All rights reserved.
  3649. *
  3650. * This source code is licensed under the BSD-style license found in the
  3651. * LICENSE file in the root directory of this source tree. An additional grant
  3652. * of patent rights can be found in the PATENTS file in the same directory.
  3653. *
  3654. * @providesModule MobileSafariClickEventPlugin
  3655. * @typechecks static-only
  3656. */
  3657. 'use strict';
  3658. var EventConstants = _dereq_(15);
  3659. var emptyFunction = _dereq_(114);
  3660. var topLevelTypes = EventConstants.topLevelTypes;
  3661. /**
  3662. * Mobile Safari does not fire properly bubble click events on non-interactive
  3663. * elements, which means delegated click listeners do not fire. The workaround
  3664. * for this bug involves attaching an empty click listener on the target node.
  3665. *
  3666. * This particular plugin works around the bug by attaching an empty click
  3667. * listener on `touchstart` (which does fire on every element).
  3668. */
  3669. var MobileSafariClickEventPlugin = {
  3670. eventTypes: null,
  3671. /**
  3672. * @param {string} topLevelType Record from `EventConstants`.
  3673. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  3674. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  3675. * @param {object} nativeEvent Native browser event.
  3676. * @return {*} An accumulation of synthetic events.
  3677. * @see {EventPluginHub.extractEvents}
  3678. */
  3679. extractEvents: function(
  3680. topLevelType,
  3681. topLevelTarget,
  3682. topLevelTargetID,
  3683. nativeEvent) {
  3684. if (topLevelType === topLevelTypes.topTouchStart) {
  3685. var target = nativeEvent.target;
  3686. if (target && !target.onclick) {
  3687. target.onclick = emptyFunction;
  3688. }
  3689. }
  3690. }
  3691. };
  3692. module.exports = MobileSafariClickEventPlugin;
  3693. },{"114":114,"15":15}],27:[function(_dereq_,module,exports){
  3694. /**
  3695. * Copyright 2014-2015, Facebook, Inc.
  3696. * All rights reserved.
  3697. *
  3698. * This source code is licensed under the BSD-style license found in the
  3699. * LICENSE file in the root directory of this source tree. An additional grant
  3700. * of patent rights can be found in the PATENTS file in the same directory.
  3701. *
  3702. * @providesModule Object.assign
  3703. */
  3704. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
  3705. 'use strict';
  3706. function assign(target, sources) {
  3707. if (target == null) {
  3708. throw new TypeError('Object.assign target cannot be null or undefined');
  3709. }
  3710. var to = Object(target);
  3711. var hasOwnProperty = Object.prototype.hasOwnProperty;
  3712. for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
  3713. var nextSource = arguments[nextIndex];
  3714. if (nextSource == null) {
  3715. continue;
  3716. }
  3717. var from = Object(nextSource);
  3718. // We don't currently support accessors nor proxies. Therefore this
  3719. // copy cannot throw. If we ever supported this then we must handle
  3720. // exceptions and side-effects. We don't support symbols so they won't
  3721. // be transferred.
  3722. for (var key in from) {
  3723. if (hasOwnProperty.call(from, key)) {
  3724. to[key] = from[key];
  3725. }
  3726. }
  3727. }
  3728. return to;
  3729. }
  3730. module.exports = assign;
  3731. },{}],28:[function(_dereq_,module,exports){
  3732. /**
  3733. * Copyright 2013-2015, Facebook, Inc.
  3734. * All rights reserved.
  3735. *
  3736. * This source code is licensed under the BSD-style license found in the
  3737. * LICENSE file in the root directory of this source tree. An additional grant
  3738. * of patent rights can be found in the PATENTS file in the same directory.
  3739. *
  3740. * @providesModule PooledClass
  3741. */
  3742. 'use strict';
  3743. var invariant = _dereq_(135);
  3744. /**
  3745. * Static poolers. Several custom versions for each potential number of
  3746. * arguments. A completely generic pooler is easy to implement, but would
  3747. * require accessing the `arguments` object. In each of these, `this` refers to
  3748. * the Class itself, not an instance. If any others are needed, simply add them
  3749. * here, or in their own files.
  3750. */
  3751. var oneArgumentPooler = function(copyFieldsFrom) {
  3752. var Klass = this;
  3753. if (Klass.instancePool.length) {
  3754. var instance = Klass.instancePool.pop();
  3755. Klass.call(instance, copyFieldsFrom);
  3756. return instance;
  3757. } else {
  3758. return new Klass(copyFieldsFrom);
  3759. }
  3760. };
  3761. var twoArgumentPooler = function(a1, a2) {
  3762. var Klass = this;
  3763. if (Klass.instancePool.length) {
  3764. var instance = Klass.instancePool.pop();
  3765. Klass.call(instance, a1, a2);
  3766. return instance;
  3767. } else {
  3768. return new Klass(a1, a2);
  3769. }
  3770. };
  3771. var threeArgumentPooler = function(a1, a2, a3) {
  3772. var Klass = this;
  3773. if (Klass.instancePool.length) {
  3774. var instance = Klass.instancePool.pop();
  3775. Klass.call(instance, a1, a2, a3);
  3776. return instance;
  3777. } else {
  3778. return new Klass(a1, a2, a3);
  3779. }
  3780. };
  3781. var fiveArgumentPooler = function(a1, a2, a3, a4, a5) {
  3782. var Klass = this;
  3783. if (Klass.instancePool.length) {
  3784. var instance = Klass.instancePool.pop();
  3785. Klass.call(instance, a1, a2, a3, a4, a5);
  3786. return instance;
  3787. } else {
  3788. return new Klass(a1, a2, a3, a4, a5);
  3789. }
  3790. };
  3791. var standardReleaser = function(instance) {
  3792. var Klass = this;
  3793. ("production" !== "development" ? invariant(
  3794. instance instanceof Klass,
  3795. 'Trying to release an instance into a pool of a different type.'
  3796. ) : invariant(instance instanceof Klass));
  3797. if (instance.destructor) {
  3798. instance.destructor();
  3799. }
  3800. if (Klass.instancePool.length < Klass.poolSize) {
  3801. Klass.instancePool.push(instance);
  3802. }
  3803. };
  3804. var DEFAULT_POOL_SIZE = 10;
  3805. var DEFAULT_POOLER = oneArgumentPooler;
  3806. /**
  3807. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  3808. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  3809. * you give this may have a `poolSize` property, and will look for a
  3810. * prototypical `destructor` on instances (optional).
  3811. *
  3812. * @param {Function} CopyConstructor Constructor that can be used to reset.
  3813. * @param {Function} pooler Customizable pooler.
  3814. */
  3815. var addPoolingTo = function(CopyConstructor, pooler) {
  3816. var NewKlass = CopyConstructor;
  3817. NewKlass.instancePool = [];
  3818. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  3819. if (!NewKlass.poolSize) {
  3820. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  3821. }
  3822. NewKlass.release = standardReleaser;
  3823. return NewKlass;
  3824. };
  3825. var PooledClass = {
  3826. addPoolingTo: addPoolingTo,
  3827. oneArgumentPooler: oneArgumentPooler,
  3828. twoArgumentPooler: twoArgumentPooler,
  3829. threeArgumentPooler: threeArgumentPooler,
  3830. fiveArgumentPooler: fiveArgumentPooler
  3831. };
  3832. module.exports = PooledClass;
  3833. },{"135":135}],29:[function(_dereq_,module,exports){
  3834. /**
  3835. * Copyright 2013-2015, Facebook, Inc.
  3836. * All rights reserved.
  3837. *
  3838. * This source code is licensed under the BSD-style license found in the
  3839. * LICENSE file in the root directory of this source tree. An additional grant
  3840. * of patent rights can be found in the PATENTS file in the same directory.
  3841. *
  3842. * @providesModule ReactBrowserComponentMixin
  3843. */
  3844. 'use strict';
  3845. var findDOMNode = _dereq_(117);
  3846. var ReactBrowserComponentMixin = {
  3847. /**
  3848. * Returns the DOM node rendered by this component.
  3849. *
  3850. * @return {DOMElement} The root node of this component.
  3851. * @final
  3852. * @protected
  3853. */
  3854. getDOMNode: function() {
  3855. return findDOMNode(this);
  3856. }
  3857. };
  3858. module.exports = ReactBrowserComponentMixin;
  3859. },{"117":117}],30:[function(_dereq_,module,exports){
  3860. /**
  3861. * Copyright 2013-2015, Facebook, Inc.
  3862. * All rights reserved.
  3863. *
  3864. * This source code is licensed under the BSD-style license found in the
  3865. * LICENSE file in the root directory of this source tree. An additional grant
  3866. * of patent rights can be found in the PATENTS file in the same directory.
  3867. *
  3868. * @providesModule ReactBrowserEventEmitter
  3869. * @typechecks static-only
  3870. */
  3871. 'use strict';
  3872. var EventConstants = _dereq_(15);
  3873. var EventPluginHub = _dereq_(17);
  3874. var EventPluginRegistry = _dereq_(18);
  3875. var ReactEventEmitterMixin = _dereq_(61);
  3876. var ViewportMetrics = _dereq_(104);
  3877. var assign = _dereq_(27);
  3878. var isEventSupported = _dereq_(136);
  3879. /**
  3880. * Summary of `ReactBrowserEventEmitter` event handling:
  3881. *
  3882. * - Top-level delegation is used to trap most native browser events. This
  3883. * may only occur in the main thread and is the responsibility of
  3884. * ReactEventListener, which is injected and can therefore support pluggable
  3885. * event sources. This is the only work that occurs in the main thread.
  3886. *
  3887. * - We normalize and de-duplicate events to account for browser quirks. This
  3888. * may be done in the worker thread.
  3889. *
  3890. * - Forward these native events (with the associated top-level type used to
  3891. * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
  3892. * to extract any synthetic events.
  3893. *
  3894. * - The `EventPluginHub` will then process each event by annotating them with
  3895. * "dispatches", a sequence of listeners and IDs that care about that event.
  3896. *
  3897. * - The `EventPluginHub` then dispatches the events.
  3898. *
  3899. * Overview of React and the event system:
  3900. *
  3901. * +------------+ .
  3902. * | DOM | .
  3903. * +------------+ .
  3904. * | .
  3905. * v .
  3906. * +------------+ .
  3907. * | ReactEvent | .
  3908. * | Listener | .
  3909. * +------------+ . +-----------+
  3910. * | . +--------+|SimpleEvent|
  3911. * | . | |Plugin |
  3912. * +-----|------+ . v +-----------+
  3913. * | | | . +--------------+ +------------+
  3914. * | +-----------.--->|EventPluginHub| | Event |
  3915. * | | . | | +-----------+ | Propagators|
  3916. * | ReactEvent | . | | |TapEvent | |------------|
  3917. * | Emitter | . | |<---+|Plugin | |other plugin|
  3918. * | | . | | +-----------+ | utilities |
  3919. * | +-----------.--->| | +------------+
  3920. * | | | . +--------------+
  3921. * +-----|------+ . ^ +-----------+
  3922. * | . | |Enter/Leave|
  3923. * + . +-------+|Plugin |
  3924. * +-------------+ . +-----------+
  3925. * | application | .
  3926. * |-------------| .
  3927. * | | .
  3928. * | | .
  3929. * +-------------+ .
  3930. * .
  3931. * React Core . General Purpose Event Plugin System
  3932. */
  3933. var alreadyListeningTo = {};
  3934. var isMonitoringScrollValue = false;
  3935. var reactTopListenersCounter = 0;
  3936. // For events like 'submit' which don't consistently bubble (which we trap at a
  3937. // lower node than `document`), binding at `document` would cause duplicate
  3938. // events so we don't include them here
  3939. var topEventMapping = {
  3940. topBlur: 'blur',
  3941. topChange: 'change',
  3942. topClick: 'click',
  3943. topCompositionEnd: 'compositionend',
  3944. topCompositionStart: 'compositionstart',
  3945. topCompositionUpdate: 'compositionupdate',
  3946. topContextMenu: 'contextmenu',
  3947. topCopy: 'copy',
  3948. topCut: 'cut',
  3949. topDoubleClick: 'dblclick',
  3950. topDrag: 'drag',
  3951. topDragEnd: 'dragend',
  3952. topDragEnter: 'dragenter',
  3953. topDragExit: 'dragexit',
  3954. topDragLeave: 'dragleave',
  3955. topDragOver: 'dragover',
  3956. topDragStart: 'dragstart',
  3957. topDrop: 'drop',
  3958. topFocus: 'focus',
  3959. topInput: 'input',
  3960. topKeyDown: 'keydown',
  3961. topKeyPress: 'keypress',
  3962. topKeyUp: 'keyup',
  3963. topMouseDown: 'mousedown',
  3964. topMouseMove: 'mousemove',
  3965. topMouseOut: 'mouseout',
  3966. topMouseOver: 'mouseover',
  3967. topMouseUp: 'mouseup',
  3968. topPaste: 'paste',
  3969. topScroll: 'scroll',
  3970. topSelectionChange: 'selectionchange',
  3971. topTextInput: 'textInput',
  3972. topTouchCancel: 'touchcancel',
  3973. topTouchEnd: 'touchend',
  3974. topTouchMove: 'touchmove',
  3975. topTouchStart: 'touchstart',
  3976. topWheel: 'wheel'
  3977. };
  3978. /**
  3979. * To ensure no conflicts with other potential React instances on the page
  3980. */
  3981. var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
  3982. function getListeningForDocument(mountAt) {
  3983. // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
  3984. // directly.
  3985. if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
  3986. mountAt[topListenersIDKey] = reactTopListenersCounter++;
  3987. alreadyListeningTo[mountAt[topListenersIDKey]] = {};
  3988. }
  3989. return alreadyListeningTo[mountAt[topListenersIDKey]];
  3990. }
  3991. /**
  3992. * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
  3993. * example:
  3994. *
  3995. * ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction);
  3996. *
  3997. * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
  3998. *
  3999. * @internal
  4000. */
  4001. var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
  4002. /**
  4003. * Injectable event backend
  4004. */
  4005. ReactEventListener: null,
  4006. injection: {
  4007. /**
  4008. * @param {object} ReactEventListener
  4009. */
  4010. injectReactEventListener: function(ReactEventListener) {
  4011. ReactEventListener.setHandleTopLevel(
  4012. ReactBrowserEventEmitter.handleTopLevel
  4013. );
  4014. ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
  4015. }
  4016. },
  4017. /**
  4018. * Sets whether or not any created callbacks should be enabled.
  4019. *
  4020. * @param {boolean} enabled True if callbacks should be enabled.
  4021. */
  4022. setEnabled: function(enabled) {
  4023. if (ReactBrowserEventEmitter.ReactEventListener) {
  4024. ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
  4025. }
  4026. },
  4027. /**
  4028. * @return {boolean} True if callbacks are enabled.
  4029. */
  4030. isEnabled: function() {
  4031. return !!(
  4032. (ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled())
  4033. );
  4034. },
  4035. /**
  4036. * We listen for bubbled touch events on the document object.
  4037. *
  4038. * Firefox v8.01 (and possibly others) exhibited strange behavior when
  4039. * mounting `onmousemove` events at some node that was not the document
  4040. * element. The symptoms were that if your mouse is not moving over something
  4041. * contained within that mount point (for example on the background) the
  4042. * top-level listeners for `onmousemove` won't be called. However, if you
  4043. * register the `mousemove` on the document object, then it will of course
  4044. * catch all `mousemove`s. This along with iOS quirks, justifies restricting
  4045. * top-level listeners to the document object only, at least for these
  4046. * movement types of events and possibly all events.
  4047. *
  4048. * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  4049. *
  4050. * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
  4051. * they bubble to document.
  4052. *
  4053. * @param {string} registrationName Name of listener (e.g. `onClick`).
  4054. * @param {object} contentDocumentHandle Document which owns the container
  4055. */
  4056. listenTo: function(registrationName, contentDocumentHandle) {
  4057. var mountAt = contentDocumentHandle;
  4058. var isListening = getListeningForDocument(mountAt);
  4059. var dependencies = EventPluginRegistry.
  4060. registrationNameDependencies[registrationName];
  4061. var topLevelTypes = EventConstants.topLevelTypes;
  4062. for (var i = 0, l = dependencies.length; i < l; i++) {
  4063. var dependency = dependencies[i];
  4064. if (!(
  4065. (isListening.hasOwnProperty(dependency) && isListening[dependency])
  4066. )) {
  4067. if (dependency === topLevelTypes.topWheel) {
  4068. if (isEventSupported('wheel')) {
  4069. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4070. topLevelTypes.topWheel,
  4071. 'wheel',
  4072. mountAt
  4073. );
  4074. } else if (isEventSupported('mousewheel')) {
  4075. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4076. topLevelTypes.topWheel,
  4077. 'mousewheel',
  4078. mountAt
  4079. );
  4080. } else {
  4081. // Firefox needs to capture a different mouse scroll event.
  4082. // @see http://www.quirksmode.org/dom/events/tests/scroll.html
  4083. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4084. topLevelTypes.topWheel,
  4085. 'DOMMouseScroll',
  4086. mountAt
  4087. );
  4088. }
  4089. } else if (dependency === topLevelTypes.topScroll) {
  4090. if (isEventSupported('scroll', true)) {
  4091. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
  4092. topLevelTypes.topScroll,
  4093. 'scroll',
  4094. mountAt
  4095. );
  4096. } else {
  4097. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4098. topLevelTypes.topScroll,
  4099. 'scroll',
  4100. ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE
  4101. );
  4102. }
  4103. } else if (dependency === topLevelTypes.topFocus ||
  4104. dependency === topLevelTypes.topBlur) {
  4105. if (isEventSupported('focus', true)) {
  4106. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
  4107. topLevelTypes.topFocus,
  4108. 'focus',
  4109. mountAt
  4110. );
  4111. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
  4112. topLevelTypes.topBlur,
  4113. 'blur',
  4114. mountAt
  4115. );
  4116. } else if (isEventSupported('focusin')) {
  4117. // IE has `focusin` and `focusout` events which bubble.
  4118. // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
  4119. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4120. topLevelTypes.topFocus,
  4121. 'focusin',
  4122. mountAt
  4123. );
  4124. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4125. topLevelTypes.topBlur,
  4126. 'focusout',
  4127. mountAt
  4128. );
  4129. }
  4130. // to make sure blur and focus event listeners are only attached once
  4131. isListening[topLevelTypes.topBlur] = true;
  4132. isListening[topLevelTypes.topFocus] = true;
  4133. } else if (topEventMapping.hasOwnProperty(dependency)) {
  4134. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4135. dependency,
  4136. topEventMapping[dependency],
  4137. mountAt
  4138. );
  4139. }
  4140. isListening[dependency] = true;
  4141. }
  4142. }
  4143. },
  4144. trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
  4145. return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4146. topLevelType,
  4147. handlerBaseName,
  4148. handle
  4149. );
  4150. },
  4151. trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
  4152. return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
  4153. topLevelType,
  4154. handlerBaseName,
  4155. handle
  4156. );
  4157. },
  4158. /**
  4159. * Listens to window scroll and resize events. We cache scroll values so that
  4160. * application code can access them without triggering reflows.
  4161. *
  4162. * NOTE: Scroll events do not bubble.
  4163. *
  4164. * @see http://www.quirksmode.org/dom/events/scroll.html
  4165. */
  4166. ensureScrollValueMonitoring: function() {
  4167. if (!isMonitoringScrollValue) {
  4168. var refresh = ViewportMetrics.refreshScrollValues;
  4169. ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
  4170. isMonitoringScrollValue = true;
  4171. }
  4172. },
  4173. eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
  4174. registrationNameModules: EventPluginHub.registrationNameModules,
  4175. putListener: EventPluginHub.putListener,
  4176. getListener: EventPluginHub.getListener,
  4177. deleteListener: EventPluginHub.deleteListener,
  4178. deleteAllListeners: EventPluginHub.deleteAllListeners
  4179. });
  4180. module.exports = ReactBrowserEventEmitter;
  4181. },{"104":104,"136":136,"15":15,"17":17,"18":18,"27":27,"61":61}],31:[function(_dereq_,module,exports){
  4182. /**
  4183. * Copyright 2014-2015, Facebook, Inc.
  4184. * All rights reserved.
  4185. *
  4186. * This source code is licensed under the BSD-style license found in the
  4187. * LICENSE file in the root directory of this source tree. An additional grant
  4188. * of patent rights can be found in the PATENTS file in the same directory.
  4189. *
  4190. * @providesModule ReactChildReconciler
  4191. * @typechecks static-only
  4192. */
  4193. 'use strict';
  4194. var ReactReconciler = _dereq_(81);
  4195. var flattenChildren = _dereq_(118);
  4196. var instantiateReactComponent = _dereq_(134);
  4197. var shouldUpdateReactComponent = _dereq_(151);
  4198. /**
  4199. * ReactChildReconciler provides helpers for initializing or updating a set of
  4200. * children. Its output is suitable for passing it onto ReactMultiChild which
  4201. * does diffed reordering and insertion.
  4202. */
  4203. var ReactChildReconciler = {
  4204. /**
  4205. * Generates a "mount image" for each of the supplied children. In the case
  4206. * of `ReactDOMComponent`, a mount image is a string of markup.
  4207. *
  4208. * @param {?object} nestedChildNodes Nested child maps.
  4209. * @return {?object} A set of child instances.
  4210. * @internal
  4211. */
  4212. instantiateChildren: function(nestedChildNodes, transaction, context) {
  4213. var children = flattenChildren(nestedChildNodes);
  4214. for (var name in children) {
  4215. if (children.hasOwnProperty(name)) {
  4216. var child = children[name];
  4217. // The rendered children must be turned into instances as they're
  4218. // mounted.
  4219. var childInstance = instantiateReactComponent(child, null);
  4220. children[name] = childInstance;
  4221. }
  4222. }
  4223. return children;
  4224. },
  4225. /**
  4226. * Updates the rendered children and returns a new set of children.
  4227. *
  4228. * @param {?object} prevChildren Previously initialized set of children.
  4229. * @param {?object} nextNestedChildNodes Nested child maps.
  4230. * @param {ReactReconcileTransaction} transaction
  4231. * @param {object} context
  4232. * @return {?object} A new set of child instances.
  4233. * @internal
  4234. */
  4235. updateChildren: function(
  4236. prevChildren,
  4237. nextNestedChildNodes,
  4238. transaction,
  4239. context) {
  4240. // We currently don't have a way to track moves here but if we use iterators
  4241. // instead of for..in we can zip the iterators and check if an item has
  4242. // moved.
  4243. // TODO: If nothing has changed, return the prevChildren object so that we
  4244. // can quickly bailout if nothing has changed.
  4245. var nextChildren = flattenChildren(nextNestedChildNodes);
  4246. if (!nextChildren && !prevChildren) {
  4247. return null;
  4248. }
  4249. var name;
  4250. for (name in nextChildren) {
  4251. if (!nextChildren.hasOwnProperty(name)) {
  4252. continue;
  4253. }
  4254. var prevChild = prevChildren && prevChildren[name];
  4255. var prevElement = prevChild && prevChild._currentElement;
  4256. var nextElement = nextChildren[name];
  4257. if (shouldUpdateReactComponent(prevElement, nextElement)) {
  4258. ReactReconciler.receiveComponent(
  4259. prevChild, nextElement, transaction, context
  4260. );
  4261. nextChildren[name] = prevChild;
  4262. } else {
  4263. if (prevChild) {
  4264. ReactReconciler.unmountComponent(prevChild, name);
  4265. }
  4266. // The child must be instantiated before it's mounted.
  4267. var nextChildInstance = instantiateReactComponent(
  4268. nextElement,
  4269. null
  4270. );
  4271. nextChildren[name] = nextChildInstance;
  4272. }
  4273. }
  4274. // Unmount children that are no longer present.
  4275. for (name in prevChildren) {
  4276. if (prevChildren.hasOwnProperty(name) &&
  4277. !(nextChildren && nextChildren.hasOwnProperty(name))) {
  4278. ReactReconciler.unmountComponent(prevChildren[name]);
  4279. }
  4280. }
  4281. return nextChildren;
  4282. },
  4283. /**
  4284. * Unmounts all rendered children. This should be used to clean up children
  4285. * when this component is unmounted.
  4286. *
  4287. * @param {?object} renderedChildren Previously initialized set of children.
  4288. * @internal
  4289. */
  4290. unmountChildren: function(renderedChildren) {
  4291. for (var name in renderedChildren) {
  4292. var renderedChild = renderedChildren[name];
  4293. ReactReconciler.unmountComponent(renderedChild);
  4294. }
  4295. }
  4296. };
  4297. module.exports = ReactChildReconciler;
  4298. },{"118":118,"134":134,"151":151,"81":81}],32:[function(_dereq_,module,exports){
  4299. /**
  4300. * Copyright 2013-2015, Facebook, Inc.
  4301. * All rights reserved.
  4302. *
  4303. * This source code is licensed under the BSD-style license found in the
  4304. * LICENSE file in the root directory of this source tree. An additional grant
  4305. * of patent rights can be found in the PATENTS file in the same directory.
  4306. *
  4307. * @providesModule ReactChildren
  4308. */
  4309. 'use strict';
  4310. var PooledClass = _dereq_(28);
  4311. var ReactFragment = _dereq_(63);
  4312. var traverseAllChildren = _dereq_(153);
  4313. var warning = _dereq_(154);
  4314. var twoArgumentPooler = PooledClass.twoArgumentPooler;
  4315. var threeArgumentPooler = PooledClass.threeArgumentPooler;
  4316. /**
  4317. * PooledClass representing the bookkeeping associated with performing a child
  4318. * traversal. Allows avoiding binding callbacks.
  4319. *
  4320. * @constructor ForEachBookKeeping
  4321. * @param {!function} forEachFunction Function to perform traversal with.
  4322. * @param {?*} forEachContext Context to perform context with.
  4323. */
  4324. function ForEachBookKeeping(forEachFunction, forEachContext) {
  4325. this.forEachFunction = forEachFunction;
  4326. this.forEachContext = forEachContext;
  4327. }
  4328. PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
  4329. function forEachSingleChild(traverseContext, child, name, i) {
  4330. var forEachBookKeeping = traverseContext;
  4331. forEachBookKeeping.forEachFunction.call(
  4332. forEachBookKeeping.forEachContext, child, i);
  4333. }
  4334. /**
  4335. * Iterates through children that are typically specified as `props.children`.
  4336. *
  4337. * The provided forEachFunc(child, index) will be called for each
  4338. * leaf child.
  4339. *
  4340. * @param {?*} children Children tree container.
  4341. * @param {function(*, int)} forEachFunc.
  4342. * @param {*} forEachContext Context for forEachContext.
  4343. */
  4344. function forEachChildren(children, forEachFunc, forEachContext) {
  4345. if (children == null) {
  4346. return children;
  4347. }
  4348. var traverseContext =
  4349. ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
  4350. traverseAllChildren(children, forEachSingleChild, traverseContext);
  4351. ForEachBookKeeping.release(traverseContext);
  4352. }
  4353. /**
  4354. * PooledClass representing the bookkeeping associated with performing a child
  4355. * mapping. Allows avoiding binding callbacks.
  4356. *
  4357. * @constructor MapBookKeeping
  4358. * @param {!*} mapResult Object containing the ordered map of results.
  4359. * @param {!function} mapFunction Function to perform mapping with.
  4360. * @param {?*} mapContext Context to perform mapping with.
  4361. */
  4362. function MapBookKeeping(mapResult, mapFunction, mapContext) {
  4363. this.mapResult = mapResult;
  4364. this.mapFunction = mapFunction;
  4365. this.mapContext = mapContext;
  4366. }
  4367. PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);
  4368. function mapSingleChildIntoContext(traverseContext, child, name, i) {
  4369. var mapBookKeeping = traverseContext;
  4370. var mapResult = mapBookKeeping.mapResult;
  4371. var keyUnique = !mapResult.hasOwnProperty(name);
  4372. if ("production" !== "development") {
  4373. ("production" !== "development" ? warning(
  4374. keyUnique,
  4375. 'ReactChildren.map(...): Encountered two children with the same key, ' +
  4376. '`%s`. Child keys must be unique; when two children share a key, only ' +
  4377. 'the first child will be used.',
  4378. name
  4379. ) : null);
  4380. }
  4381. if (keyUnique) {
  4382. var mappedChild =
  4383. mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i);
  4384. mapResult[name] = mappedChild;
  4385. }
  4386. }
  4387. /**
  4388. * Maps children that are typically specified as `props.children`.
  4389. *
  4390. * The provided mapFunction(child, key, index) will be called for each
  4391. * leaf child.
  4392. *
  4393. * TODO: This may likely break any calls to `ReactChildren.map` that were
  4394. * previously relying on the fact that we guarded against null children.
  4395. *
  4396. * @param {?*} children Children tree container.
  4397. * @param {function(*, int)} mapFunction.
  4398. * @param {*} mapContext Context for mapFunction.
  4399. * @return {object} Object containing the ordered map of results.
  4400. */
  4401. function mapChildren(children, func, context) {
  4402. if (children == null) {
  4403. return children;
  4404. }
  4405. var mapResult = {};
  4406. var traverseContext = MapBookKeeping.getPooled(mapResult, func, context);
  4407. traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
  4408. MapBookKeeping.release(traverseContext);
  4409. return ReactFragment.create(mapResult);
  4410. }
  4411. function forEachSingleChildDummy(traverseContext, child, name, i) {
  4412. return null;
  4413. }
  4414. /**
  4415. * Count the number of children that are typically specified as
  4416. * `props.children`.
  4417. *
  4418. * @param {?*} children Children tree container.
  4419. * @return {number} The number of children.
  4420. */
  4421. function countChildren(children, context) {
  4422. return traverseAllChildren(children, forEachSingleChildDummy, null);
  4423. }
  4424. var ReactChildren = {
  4425. forEach: forEachChildren,
  4426. map: mapChildren,
  4427. count: countChildren
  4428. };
  4429. module.exports = ReactChildren;
  4430. },{"153":153,"154":154,"28":28,"63":63}],33:[function(_dereq_,module,exports){
  4431. /**
  4432. * Copyright 2013-2015, Facebook, Inc.
  4433. * All rights reserved.
  4434. *
  4435. * This source code is licensed under the BSD-style license found in the
  4436. * LICENSE file in the root directory of this source tree. An additional grant
  4437. * of patent rights can be found in the PATENTS file in the same directory.
  4438. *
  4439. * @providesModule ReactClass
  4440. */
  4441. 'use strict';
  4442. var ReactComponent = _dereq_(34);
  4443. var ReactCurrentOwner = _dereq_(39);
  4444. var ReactElement = _dereq_(57);
  4445. var ReactErrorUtils = _dereq_(60);
  4446. var ReactInstanceMap = _dereq_(67);
  4447. var ReactLifeCycle = _dereq_(68);
  4448. var ReactPropTypeLocations = _dereq_(77);
  4449. var ReactPropTypeLocationNames = _dereq_(76);
  4450. var ReactUpdateQueue = _dereq_(86);
  4451. var assign = _dereq_(27);
  4452. var invariant = _dereq_(135);
  4453. var keyMirror = _dereq_(140);
  4454. var keyOf = _dereq_(141);
  4455. var warning = _dereq_(154);
  4456. var MIXINS_KEY = keyOf({mixins: null});
  4457. /**
  4458. * Policies that describe methods in `ReactClassInterface`.
  4459. */
  4460. var SpecPolicy = keyMirror({
  4461. /**
  4462. * These methods may be defined only once by the class specification or mixin.
  4463. */
  4464. DEFINE_ONCE: null,
  4465. /**
  4466. * These methods may be defined by both the class specification and mixins.
  4467. * Subsequent definitions will be chained. These methods must return void.
  4468. */
  4469. DEFINE_MANY: null,
  4470. /**
  4471. * These methods are overriding the base class.
  4472. */
  4473. OVERRIDE_BASE: null,
  4474. /**
  4475. * These methods are similar to DEFINE_MANY, except we assume they return
  4476. * objects. We try to merge the keys of the return values of all the mixed in
  4477. * functions. If there is a key conflict we throw.
  4478. */
  4479. DEFINE_MANY_MERGED: null
  4480. });
  4481. var injectedMixins = [];
  4482. /**
  4483. * Composite components are higher-level components that compose other composite
  4484. * or native components.
  4485. *
  4486. * To create a new type of `ReactClass`, pass a specification of
  4487. * your new class to `React.createClass`. The only requirement of your class
  4488. * specification is that you implement a `render` method.
  4489. *
  4490. * var MyComponent = React.createClass({
  4491. * render: function() {
  4492. * return <div>Hello World</div>;
  4493. * }
  4494. * });
  4495. *
  4496. * The class specification supports a specific protocol of methods that have
  4497. * special meaning (e.g. `render`). See `ReactClassInterface` for
  4498. * more the comprehensive protocol. Any other properties and methods in the
  4499. * class specification will available on the prototype.
  4500. *
  4501. * @interface ReactClassInterface
  4502. * @internal
  4503. */
  4504. var ReactClassInterface = {
  4505. /**
  4506. * An array of Mixin objects to include when defining your component.
  4507. *
  4508. * @type {array}
  4509. * @optional
  4510. */
  4511. mixins: SpecPolicy.DEFINE_MANY,
  4512. /**
  4513. * An object containing properties and methods that should be defined on
  4514. * the component's constructor instead of its prototype (static methods).
  4515. *
  4516. * @type {object}
  4517. * @optional
  4518. */
  4519. statics: SpecPolicy.DEFINE_MANY,
  4520. /**
  4521. * Definition of prop types for this component.
  4522. *
  4523. * @type {object}
  4524. * @optional
  4525. */
  4526. propTypes: SpecPolicy.DEFINE_MANY,
  4527. /**
  4528. * Definition of context types for this component.
  4529. *
  4530. * @type {object}
  4531. * @optional
  4532. */
  4533. contextTypes: SpecPolicy.DEFINE_MANY,
  4534. /**
  4535. * Definition of context types this component sets for its children.
  4536. *
  4537. * @type {object}
  4538. * @optional
  4539. */
  4540. childContextTypes: SpecPolicy.DEFINE_MANY,
  4541. // ==== Definition methods ====
  4542. /**
  4543. * Invoked when the component is mounted. Values in the mapping will be set on
  4544. * `this.props` if that prop is not specified (i.e. using an `in` check).
  4545. *
  4546. * This method is invoked before `getInitialState` and therefore cannot rely
  4547. * on `this.state` or use `this.setState`.
  4548. *
  4549. * @return {object}
  4550. * @optional
  4551. */
  4552. getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,
  4553. /**
  4554. * Invoked once before the component is mounted. The return value will be used
  4555. * as the initial value of `this.state`.
  4556. *
  4557. * getInitialState: function() {
  4558. * return {
  4559. * isOn: false,
  4560. * fooBaz: new BazFoo()
  4561. * }
  4562. * }
  4563. *
  4564. * @return {object}
  4565. * @optional
  4566. */
  4567. getInitialState: SpecPolicy.DEFINE_MANY_MERGED,
  4568. /**
  4569. * @return {object}
  4570. * @optional
  4571. */
  4572. getChildContext: SpecPolicy.DEFINE_MANY_MERGED,
  4573. /**
  4574. * Uses props from `this.props` and state from `this.state` to render the
  4575. * structure of the component.
  4576. *
  4577. * No guarantees are made about when or how often this method is invoked, so
  4578. * it must not have side effects.
  4579. *
  4580. * render: function() {
  4581. * var name = this.props.name;
  4582. * return <div>Hello, {name}!</div>;
  4583. * }
  4584. *
  4585. * @return {ReactComponent}
  4586. * @nosideeffects
  4587. * @required
  4588. */
  4589. render: SpecPolicy.DEFINE_ONCE,
  4590. // ==== Delegate methods ====
  4591. /**
  4592. * Invoked when the component is initially created and about to be mounted.
  4593. * This may have side effects, but any external subscriptions or data created
  4594. * by this method must be cleaned up in `componentWillUnmount`.
  4595. *
  4596. * @optional
  4597. */
  4598. componentWillMount: SpecPolicy.DEFINE_MANY,
  4599. /**
  4600. * Invoked when the component has been mounted and has a DOM representation.
  4601. * However, there is no guarantee that the DOM node is in the document.
  4602. *
  4603. * Use this as an opportunity to operate on the DOM when the component has
  4604. * been mounted (initialized and rendered) for the first time.
  4605. *
  4606. * @param {DOMElement} rootNode DOM element representing the component.
  4607. * @optional
  4608. */
  4609. componentDidMount: SpecPolicy.DEFINE_MANY,
  4610. /**
  4611. * Invoked before the component receives new props.
  4612. *
  4613. * Use this as an opportunity to react to a prop transition by updating the
  4614. * state using `this.setState`. Current props are accessed via `this.props`.
  4615. *
  4616. * componentWillReceiveProps: function(nextProps, nextContext) {
  4617. * this.setState({
  4618. * likesIncreasing: nextProps.likeCount > this.props.likeCount
  4619. * });
  4620. * }
  4621. *
  4622. * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
  4623. * transition may cause a state change, but the opposite is not true. If you
  4624. * need it, you are probably looking for `componentWillUpdate`.
  4625. *
  4626. * @param {object} nextProps
  4627. * @optional
  4628. */
  4629. componentWillReceiveProps: SpecPolicy.DEFINE_MANY,
  4630. /**
  4631. * Invoked while deciding if the component should be updated as a result of
  4632. * receiving new props, state and/or context.
  4633. *
  4634. * Use this as an opportunity to `return false` when you're certain that the
  4635. * transition to the new props/state/context will not require a component
  4636. * update.
  4637. *
  4638. * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
  4639. * return !equal(nextProps, this.props) ||
  4640. * !equal(nextState, this.state) ||
  4641. * !equal(nextContext, this.context);
  4642. * }
  4643. *
  4644. * @param {object} nextProps
  4645. * @param {?object} nextState
  4646. * @param {?object} nextContext
  4647. * @return {boolean} True if the component should update.
  4648. * @optional
  4649. */
  4650. shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,
  4651. /**
  4652. * Invoked when the component is about to update due to a transition from
  4653. * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
  4654. * and `nextContext`.
  4655. *
  4656. * Use this as an opportunity to perform preparation before an update occurs.
  4657. *
  4658. * NOTE: You **cannot** use `this.setState()` in this method.
  4659. *
  4660. * @param {object} nextProps
  4661. * @param {?object} nextState
  4662. * @param {?object} nextContext
  4663. * @param {ReactReconcileTransaction} transaction
  4664. * @optional
  4665. */
  4666. componentWillUpdate: SpecPolicy.DEFINE_MANY,
  4667. /**
  4668. * Invoked when the component's DOM representation has been updated.
  4669. *
  4670. * Use this as an opportunity to operate on the DOM when the component has
  4671. * been updated.
  4672. *
  4673. * @param {object} prevProps
  4674. * @param {?object} prevState
  4675. * @param {?object} prevContext
  4676. * @param {DOMElement} rootNode DOM element representing the component.
  4677. * @optional
  4678. */
  4679. componentDidUpdate: SpecPolicy.DEFINE_MANY,
  4680. /**
  4681. * Invoked when the component is about to be removed from its parent and have
  4682. * its DOM representation destroyed.
  4683. *
  4684. * Use this as an opportunity to deallocate any external resources.
  4685. *
  4686. * NOTE: There is no `componentDidUnmount` since your component will have been
  4687. * destroyed by that point.
  4688. *
  4689. * @optional
  4690. */
  4691. componentWillUnmount: SpecPolicy.DEFINE_MANY,
  4692. // ==== Advanced methods ====
  4693. /**
  4694. * Updates the component's currently mounted DOM representation.
  4695. *
  4696. * By default, this implements React's rendering and reconciliation algorithm.
  4697. * Sophisticated clients may wish to override this.
  4698. *
  4699. * @param {ReactReconcileTransaction} transaction
  4700. * @internal
  4701. * @overridable
  4702. */
  4703. updateComponent: SpecPolicy.OVERRIDE_BASE
  4704. };
  4705. /**
  4706. * Mapping from class specification keys to special processing functions.
  4707. *
  4708. * Although these are declared like instance properties in the specification
  4709. * when defining classes using `React.createClass`, they are actually static
  4710. * and are accessible on the constructor instead of the prototype. Despite
  4711. * being static, they must be defined outside of the "statics" key under
  4712. * which all other static methods are defined.
  4713. */
  4714. var RESERVED_SPEC_KEYS = {
  4715. displayName: function(Constructor, displayName) {
  4716. Constructor.displayName = displayName;
  4717. },
  4718. mixins: function(Constructor, mixins) {
  4719. if (mixins) {
  4720. for (var i = 0; i < mixins.length; i++) {
  4721. mixSpecIntoComponent(Constructor, mixins[i]);
  4722. }
  4723. }
  4724. },
  4725. childContextTypes: function(Constructor, childContextTypes) {
  4726. if ("production" !== "development") {
  4727. validateTypeDef(
  4728. Constructor,
  4729. childContextTypes,
  4730. ReactPropTypeLocations.childContext
  4731. );
  4732. }
  4733. Constructor.childContextTypes = assign(
  4734. {},
  4735. Constructor.childContextTypes,
  4736. childContextTypes
  4737. );
  4738. },
  4739. contextTypes: function(Constructor, contextTypes) {
  4740. if ("production" !== "development") {
  4741. validateTypeDef(
  4742. Constructor,
  4743. contextTypes,
  4744. ReactPropTypeLocations.context
  4745. );
  4746. }
  4747. Constructor.contextTypes = assign(
  4748. {},
  4749. Constructor.contextTypes,
  4750. contextTypes
  4751. );
  4752. },
  4753. /**
  4754. * Special case getDefaultProps which should move into statics but requires
  4755. * automatic merging.
  4756. */
  4757. getDefaultProps: function(Constructor, getDefaultProps) {
  4758. if (Constructor.getDefaultProps) {
  4759. Constructor.getDefaultProps = createMergedResultFunction(
  4760. Constructor.getDefaultProps,
  4761. getDefaultProps
  4762. );
  4763. } else {
  4764. Constructor.getDefaultProps = getDefaultProps;
  4765. }
  4766. },
  4767. propTypes: function(Constructor, propTypes) {
  4768. if ("production" !== "development") {
  4769. validateTypeDef(
  4770. Constructor,
  4771. propTypes,
  4772. ReactPropTypeLocations.prop
  4773. );
  4774. }
  4775. Constructor.propTypes = assign(
  4776. {},
  4777. Constructor.propTypes,
  4778. propTypes
  4779. );
  4780. },
  4781. statics: function(Constructor, statics) {
  4782. mixStaticSpecIntoComponent(Constructor, statics);
  4783. }
  4784. };
  4785. function validateTypeDef(Constructor, typeDef, location) {
  4786. for (var propName in typeDef) {
  4787. if (typeDef.hasOwnProperty(propName)) {
  4788. // use a warning instead of an invariant so components
  4789. // don't show up in prod but not in __DEV__
  4790. ("production" !== "development" ? warning(
  4791. typeof typeDef[propName] === 'function',
  4792. '%s: %s type `%s` is invalid; it must be a function, usually from ' +
  4793. 'React.PropTypes.',
  4794. Constructor.displayName || 'ReactClass',
  4795. ReactPropTypeLocationNames[location],
  4796. propName
  4797. ) : null);
  4798. }
  4799. }
  4800. }
  4801. function validateMethodOverride(proto, name) {
  4802. var specPolicy = ReactClassInterface.hasOwnProperty(name) ?
  4803. ReactClassInterface[name] :
  4804. null;
  4805. // Disallow overriding of base class methods unless explicitly allowed.
  4806. if (ReactClassMixin.hasOwnProperty(name)) {
  4807. ("production" !== "development" ? invariant(
  4808. specPolicy === SpecPolicy.OVERRIDE_BASE,
  4809. 'ReactClassInterface: You are attempting to override ' +
  4810. '`%s` from your class specification. Ensure that your method names ' +
  4811. 'do not overlap with React methods.',
  4812. name
  4813. ) : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE));
  4814. }
  4815. // Disallow defining methods more than once unless explicitly allowed.
  4816. if (proto.hasOwnProperty(name)) {
  4817. ("production" !== "development" ? invariant(
  4818. specPolicy === SpecPolicy.DEFINE_MANY ||
  4819. specPolicy === SpecPolicy.DEFINE_MANY_MERGED,
  4820. 'ReactClassInterface: You are attempting to define ' +
  4821. '`%s` on your component more than once. This conflict may be due ' +
  4822. 'to a mixin.',
  4823. name
  4824. ) : invariant(specPolicy === SpecPolicy.DEFINE_MANY ||
  4825. specPolicy === SpecPolicy.DEFINE_MANY_MERGED));
  4826. }
  4827. }
  4828. /**
  4829. * Mixin helper which handles policy validation and reserved
  4830. * specification keys when building React classses.
  4831. */
  4832. function mixSpecIntoComponent(Constructor, spec) {
  4833. if (!spec) {
  4834. return;
  4835. }
  4836. ("production" !== "development" ? invariant(
  4837. typeof spec !== 'function',
  4838. 'ReactClass: You\'re attempting to ' +
  4839. 'use a component class as a mixin. Instead, just use a regular object.'
  4840. ) : invariant(typeof spec !== 'function'));
  4841. ("production" !== "development" ? invariant(
  4842. !ReactElement.isValidElement(spec),
  4843. 'ReactClass: You\'re attempting to ' +
  4844. 'use a component as a mixin. Instead, just use a regular object.'
  4845. ) : invariant(!ReactElement.isValidElement(spec)));
  4846. var proto = Constructor.prototype;
  4847. // By handling mixins before any other properties, we ensure the same
  4848. // chaining order is applied to methods with DEFINE_MANY policy, whether
  4849. // mixins are listed before or after these methods in the spec.
  4850. if (spec.hasOwnProperty(MIXINS_KEY)) {
  4851. RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
  4852. }
  4853. for (var name in spec) {
  4854. if (!spec.hasOwnProperty(name)) {
  4855. continue;
  4856. }
  4857. if (name === MIXINS_KEY) {
  4858. // We have already handled mixins in a special case above
  4859. continue;
  4860. }
  4861. var property = spec[name];
  4862. validateMethodOverride(proto, name);
  4863. if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
  4864. RESERVED_SPEC_KEYS[name](Constructor, property);
  4865. } else {
  4866. // Setup methods on prototype:
  4867. // The following member methods should not be automatically bound:
  4868. // 1. Expected ReactClass methods (in the "interface").
  4869. // 2. Overridden methods (that were mixed in).
  4870. var isReactClassMethod =
  4871. ReactClassInterface.hasOwnProperty(name);
  4872. var isAlreadyDefined = proto.hasOwnProperty(name);
  4873. var markedDontBind = property && property.__reactDontBind;
  4874. var isFunction = typeof property === 'function';
  4875. var shouldAutoBind =
  4876. isFunction &&
  4877. !isReactClassMethod &&
  4878. !isAlreadyDefined &&
  4879. !markedDontBind;
  4880. if (shouldAutoBind) {
  4881. if (!proto.__reactAutoBindMap) {
  4882. proto.__reactAutoBindMap = {};
  4883. }
  4884. proto.__reactAutoBindMap[name] = property;
  4885. proto[name] = property;
  4886. } else {
  4887. if (isAlreadyDefined) {
  4888. var specPolicy = ReactClassInterface[name];
  4889. // These cases should already be caught by validateMethodOverride
  4890. ("production" !== "development" ? invariant(
  4891. isReactClassMethod && (
  4892. (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
  4893. ),
  4894. 'ReactClass: Unexpected spec policy %s for key %s ' +
  4895. 'when mixing in component specs.',
  4896. specPolicy,
  4897. name
  4898. ) : invariant(isReactClassMethod && (
  4899. (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
  4900. )));
  4901. // For methods which are defined more than once, call the existing
  4902. // methods before calling the new property, merging if appropriate.
  4903. if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {
  4904. proto[name] = createMergedResultFunction(proto[name], property);
  4905. } else if (specPolicy === SpecPolicy.DEFINE_MANY) {
  4906. proto[name] = createChainedFunction(proto[name], property);
  4907. }
  4908. } else {
  4909. proto[name] = property;
  4910. if ("production" !== "development") {
  4911. // Add verbose displayName to the function, which helps when looking
  4912. // at profiling tools.
  4913. if (typeof property === 'function' && spec.displayName) {
  4914. proto[name].displayName = spec.displayName + '_' + name;
  4915. }
  4916. }
  4917. }
  4918. }
  4919. }
  4920. }
  4921. }
  4922. function mixStaticSpecIntoComponent(Constructor, statics) {
  4923. if (!statics) {
  4924. return;
  4925. }
  4926. for (var name in statics) {
  4927. var property = statics[name];
  4928. if (!statics.hasOwnProperty(name)) {
  4929. continue;
  4930. }
  4931. var isReserved = name in RESERVED_SPEC_KEYS;
  4932. ("production" !== "development" ? invariant(
  4933. !isReserved,
  4934. 'ReactClass: You are attempting to define a reserved ' +
  4935. 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' +
  4936. 'as an instance property instead; it will still be accessible on the ' +
  4937. 'constructor.',
  4938. name
  4939. ) : invariant(!isReserved));
  4940. var isInherited = name in Constructor;
  4941. ("production" !== "development" ? invariant(
  4942. !isInherited,
  4943. 'ReactClass: You are attempting to define ' +
  4944. '`%s` on your component more than once. This conflict may be ' +
  4945. 'due to a mixin.',
  4946. name
  4947. ) : invariant(!isInherited));
  4948. Constructor[name] = property;
  4949. }
  4950. }
  4951. /**
  4952. * Merge two objects, but throw if both contain the same key.
  4953. *
  4954. * @param {object} one The first object, which is mutated.
  4955. * @param {object} two The second object
  4956. * @return {object} one after it has been mutated to contain everything in two.
  4957. */
  4958. function mergeIntoWithNoDuplicateKeys(one, two) {
  4959. ("production" !== "development" ? invariant(
  4960. one && two && typeof one === 'object' && typeof two === 'object',
  4961. 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'
  4962. ) : invariant(one && two && typeof one === 'object' && typeof two === 'object'));
  4963. for (var key in two) {
  4964. if (two.hasOwnProperty(key)) {
  4965. ("production" !== "development" ? invariant(
  4966. one[key] === undefined,
  4967. 'mergeIntoWithNoDuplicateKeys(): ' +
  4968. 'Tried to merge two objects with the same key: `%s`. This conflict ' +
  4969. 'may be due to a mixin; in particular, this may be caused by two ' +
  4970. 'getInitialState() or getDefaultProps() methods returning objects ' +
  4971. 'with clashing keys.',
  4972. key
  4973. ) : invariant(one[key] === undefined));
  4974. one[key] = two[key];
  4975. }
  4976. }
  4977. return one;
  4978. }
  4979. /**
  4980. * Creates a function that invokes two functions and merges their return values.
  4981. *
  4982. * @param {function} one Function to invoke first.
  4983. * @param {function} two Function to invoke second.
  4984. * @return {function} Function that invokes the two argument functions.
  4985. * @private
  4986. */
  4987. function createMergedResultFunction(one, two) {
  4988. return function mergedResult() {
  4989. var a = one.apply(this, arguments);
  4990. var b = two.apply(this, arguments);
  4991. if (a == null) {
  4992. return b;
  4993. } else if (b == null) {
  4994. return a;
  4995. }
  4996. var c = {};
  4997. mergeIntoWithNoDuplicateKeys(c, a);
  4998. mergeIntoWithNoDuplicateKeys(c, b);
  4999. return c;
  5000. };
  5001. }
  5002. /**
  5003. * Creates a function that invokes two functions and ignores their return vales.
  5004. *
  5005. * @param {function} one Function to invoke first.
  5006. * @param {function} two Function to invoke second.
  5007. * @return {function} Function that invokes the two argument functions.
  5008. * @private
  5009. */
  5010. function createChainedFunction(one, two) {
  5011. return function chainedFunction() {
  5012. one.apply(this, arguments);
  5013. two.apply(this, arguments);
  5014. };
  5015. }
  5016. /**
  5017. * Binds a method to the component.
  5018. *
  5019. * @param {object} component Component whose method is going to be bound.
  5020. * @param {function} method Method to be bound.
  5021. * @return {function} The bound method.
  5022. */
  5023. function bindAutoBindMethod(component, method) {
  5024. var boundMethod = method.bind(component);
  5025. if ("production" !== "development") {
  5026. boundMethod.__reactBoundContext = component;
  5027. boundMethod.__reactBoundMethod = method;
  5028. boundMethod.__reactBoundArguments = null;
  5029. var componentName = component.constructor.displayName;
  5030. var _bind = boundMethod.bind;
  5031. /* eslint-disable block-scoped-var, no-undef */
  5032. boundMethod.bind = function(newThis ) {for (var args=[],$__0=1,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
  5033. // User is trying to bind() an autobound method; we effectively will
  5034. // ignore the value of "this" that the user is trying to use, so
  5035. // let's warn.
  5036. if (newThis !== component && newThis !== null) {
  5037. ("production" !== "development" ? warning(
  5038. false,
  5039. 'bind(): React component methods may only be bound to the ' +
  5040. 'component instance. See %s',
  5041. componentName
  5042. ) : null);
  5043. } else if (!args.length) {
  5044. ("production" !== "development" ? warning(
  5045. false,
  5046. 'bind(): You are binding a component method to the component. ' +
  5047. 'React does this for you automatically in a high-performance ' +
  5048. 'way, so you can safely remove this call. See %s',
  5049. componentName
  5050. ) : null);
  5051. return boundMethod;
  5052. }
  5053. var reboundMethod = _bind.apply(boundMethod, arguments);
  5054. reboundMethod.__reactBoundContext = component;
  5055. reboundMethod.__reactBoundMethod = method;
  5056. reboundMethod.__reactBoundArguments = args;
  5057. return reboundMethod;
  5058. /* eslint-enable */
  5059. };
  5060. }
  5061. return boundMethod;
  5062. }
  5063. /**
  5064. * Binds all auto-bound methods in a component.
  5065. *
  5066. * @param {object} component Component whose method is going to be bound.
  5067. */
  5068. function bindAutoBindMethods(component) {
  5069. for (var autoBindKey in component.__reactAutoBindMap) {
  5070. if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
  5071. var method = component.__reactAutoBindMap[autoBindKey];
  5072. component[autoBindKey] = bindAutoBindMethod(
  5073. component,
  5074. ReactErrorUtils.guard(
  5075. method,
  5076. component.constructor.displayName + '.' + autoBindKey
  5077. )
  5078. );
  5079. }
  5080. }
  5081. }
  5082. var typeDeprecationDescriptor = {
  5083. enumerable: false,
  5084. get: function() {
  5085. var displayName = this.displayName || this.name || 'Component';
  5086. ("production" !== "development" ? warning(
  5087. false,
  5088. '%s.type is deprecated. Use %s directly to access the class.',
  5089. displayName,
  5090. displayName
  5091. ) : null);
  5092. Object.defineProperty(this, 'type', {
  5093. value: this
  5094. });
  5095. return this;
  5096. }
  5097. };
  5098. /**
  5099. * Add more to the ReactClass base class. These are all legacy features and
  5100. * therefore not already part of the modern ReactComponent.
  5101. */
  5102. var ReactClassMixin = {
  5103. /**
  5104. * TODO: This will be deprecated because state should always keep a consistent
  5105. * type signature and the only use case for this, is to avoid that.
  5106. */
  5107. replaceState: function(newState, callback) {
  5108. ReactUpdateQueue.enqueueReplaceState(this, newState);
  5109. if (callback) {
  5110. ReactUpdateQueue.enqueueCallback(this, callback);
  5111. }
  5112. },
  5113. /**
  5114. * Checks whether or not this composite component is mounted.
  5115. * @return {boolean} True if mounted, false otherwise.
  5116. * @protected
  5117. * @final
  5118. */
  5119. isMounted: function() {
  5120. if ("production" !== "development") {
  5121. var owner = ReactCurrentOwner.current;
  5122. if (owner !== null) {
  5123. ("production" !== "development" ? warning(
  5124. owner._warnedAboutRefsInRender,
  5125. '%s is accessing isMounted inside its render() function. ' +
  5126. 'render() should be a pure function of props and state. It should ' +
  5127. 'never access something that requires stale data from the previous ' +
  5128. 'render, such as refs. Move this logic to componentDidMount and ' +
  5129. 'componentDidUpdate instead.',
  5130. owner.getName() || 'A component'
  5131. ) : null);
  5132. owner._warnedAboutRefsInRender = true;
  5133. }
  5134. }
  5135. var internalInstance = ReactInstanceMap.get(this);
  5136. return (
  5137. internalInstance &&
  5138. internalInstance !== ReactLifeCycle.currentlyMountingInstance
  5139. );
  5140. },
  5141. /**
  5142. * Sets a subset of the props.
  5143. *
  5144. * @param {object} partialProps Subset of the next props.
  5145. * @param {?function} callback Called after props are updated.
  5146. * @final
  5147. * @public
  5148. * @deprecated
  5149. */
  5150. setProps: function(partialProps, callback) {
  5151. ReactUpdateQueue.enqueueSetProps(this, partialProps);
  5152. if (callback) {
  5153. ReactUpdateQueue.enqueueCallback(this, callback);
  5154. }
  5155. },
  5156. /**
  5157. * Replace all the props.
  5158. *
  5159. * @param {object} newProps Subset of the next props.
  5160. * @param {?function} callback Called after props are updated.
  5161. * @final
  5162. * @public
  5163. * @deprecated
  5164. */
  5165. replaceProps: function(newProps, callback) {
  5166. ReactUpdateQueue.enqueueReplaceProps(this, newProps);
  5167. if (callback) {
  5168. ReactUpdateQueue.enqueueCallback(this, callback);
  5169. }
  5170. }
  5171. };
  5172. var ReactClassComponent = function() {};
  5173. assign(
  5174. ReactClassComponent.prototype,
  5175. ReactComponent.prototype,
  5176. ReactClassMixin
  5177. );
  5178. /**
  5179. * Module for creating composite components.
  5180. *
  5181. * @class ReactClass
  5182. */
  5183. var ReactClass = {
  5184. /**
  5185. * Creates a composite component class given a class specification.
  5186. *
  5187. * @param {object} spec Class specification (which must define `render`).
  5188. * @return {function} Component constructor function.
  5189. * @public
  5190. */
  5191. createClass: function(spec) {
  5192. var Constructor = function(props, context) {
  5193. // This constructor is overridden by mocks. The argument is used
  5194. // by mocks to assert on what gets mounted.
  5195. if ("production" !== "development") {
  5196. ("production" !== "development" ? warning(
  5197. this instanceof Constructor,
  5198. 'Something is calling a React component directly. Use a factory or ' +
  5199. 'JSX instead. See: http://fb.me/react-legacyfactory'
  5200. ) : null);
  5201. }
  5202. // Wire up auto-binding
  5203. if (this.__reactAutoBindMap) {
  5204. bindAutoBindMethods(this);
  5205. }
  5206. this.props = props;
  5207. this.context = context;
  5208. this.state = null;
  5209. // ReactClasses doesn't have constructors. Instead, they use the
  5210. // getInitialState and componentWillMount methods for initialization.
  5211. var initialState = this.getInitialState ? this.getInitialState() : null;
  5212. if ("production" !== "development") {
  5213. // We allow auto-mocks to proceed as if they're returning null.
  5214. if (typeof initialState === 'undefined' &&
  5215. this.getInitialState._isMockFunction) {
  5216. // This is probably bad practice. Consider warning here and
  5217. // deprecating this convenience.
  5218. initialState = null;
  5219. }
  5220. }
  5221. ("production" !== "development" ? invariant(
  5222. typeof initialState === 'object' && !Array.isArray(initialState),
  5223. '%s.getInitialState(): must return an object or null',
  5224. Constructor.displayName || 'ReactCompositeComponent'
  5225. ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
  5226. this.state = initialState;
  5227. };
  5228. Constructor.prototype = new ReactClassComponent();
  5229. Constructor.prototype.constructor = Constructor;
  5230. injectedMixins.forEach(
  5231. mixSpecIntoComponent.bind(null, Constructor)
  5232. );
  5233. mixSpecIntoComponent(Constructor, spec);
  5234. // Initialize the defaultProps property after all mixins have been merged
  5235. if (Constructor.getDefaultProps) {
  5236. Constructor.defaultProps = Constructor.getDefaultProps();
  5237. }
  5238. if ("production" !== "development") {
  5239. // This is a tag to indicate that the use of these method names is ok,
  5240. // since it's used with createClass. If it's not, then it's likely a
  5241. // mistake so we'll warn you to use the static property, property
  5242. // initializer or constructor respectively.
  5243. if (Constructor.getDefaultProps) {
  5244. Constructor.getDefaultProps.isReactClassApproved = {};
  5245. }
  5246. if (Constructor.prototype.getInitialState) {
  5247. Constructor.prototype.getInitialState.isReactClassApproved = {};
  5248. }
  5249. }
  5250. ("production" !== "development" ? invariant(
  5251. Constructor.prototype.render,
  5252. 'createClass(...): Class specification must implement a `render` method.'
  5253. ) : invariant(Constructor.prototype.render));
  5254. if ("production" !== "development") {
  5255. ("production" !== "development" ? warning(
  5256. !Constructor.prototype.componentShouldUpdate,
  5257. '%s has a method called ' +
  5258. 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
  5259. 'The name is phrased as a question because the function is ' +
  5260. 'expected to return a value.',
  5261. spec.displayName || 'A component'
  5262. ) : null);
  5263. }
  5264. // Reduce time spent doing lookups by setting these on the prototype.
  5265. for (var methodName in ReactClassInterface) {
  5266. if (!Constructor.prototype[methodName]) {
  5267. Constructor.prototype[methodName] = null;
  5268. }
  5269. }
  5270. // Legacy hook
  5271. Constructor.type = Constructor;
  5272. if ("production" !== "development") {
  5273. try {
  5274. Object.defineProperty(Constructor, 'type', typeDeprecationDescriptor);
  5275. } catch (x) {
  5276. // IE will fail on defineProperty (es5-shim/sham too)
  5277. }
  5278. }
  5279. return Constructor;
  5280. },
  5281. injection: {
  5282. injectMixin: function(mixin) {
  5283. injectedMixins.push(mixin);
  5284. }
  5285. }
  5286. };
  5287. module.exports = ReactClass;
  5288. },{"135":135,"140":140,"141":141,"154":154,"27":27,"34":34,"39":39,"57":57,"60":60,"67":67,"68":68,"76":76,"77":77,"86":86}],34:[function(_dereq_,module,exports){
  5289. /**
  5290. * Copyright 2013-2015, Facebook, Inc.
  5291. * All rights reserved.
  5292. *
  5293. * This source code is licensed under the BSD-style license found in the
  5294. * LICENSE file in the root directory of this source tree. An additional grant
  5295. * of patent rights can be found in the PATENTS file in the same directory.
  5296. *
  5297. * @providesModule ReactComponent
  5298. */
  5299. 'use strict';
  5300. var ReactUpdateQueue = _dereq_(86);
  5301. var invariant = _dereq_(135);
  5302. var warning = _dereq_(154);
  5303. /**
  5304. * Base class helpers for the updating state of a component.
  5305. */
  5306. function ReactComponent(props, context) {
  5307. this.props = props;
  5308. this.context = context;
  5309. }
  5310. /**
  5311. * Sets a subset of the state. Always use this to mutate
  5312. * state. You should treat `this.state` as immutable.
  5313. *
  5314. * There is no guarantee that `this.state` will be immediately updated, so
  5315. * accessing `this.state` after calling this method may return the old value.
  5316. *
  5317. * There is no guarantee that calls to `setState` will run synchronously,
  5318. * as they may eventually be batched together. You can provide an optional
  5319. * callback that will be executed when the call to setState is actually
  5320. * completed.
  5321. *
  5322. * When a function is provided to setState, it will be called at some point in
  5323. * the future (not synchronously). It will be called with the up to date
  5324. * component arguments (state, props, context). These values can be different
  5325. * from this.* because your function may be called after receiveProps but before
  5326. * shouldComponentUpdate, and this new state, props, and context will not yet be
  5327. * assigned to this.
  5328. *
  5329. * @param {object|function} partialState Next partial state or function to
  5330. * produce next partial state to be merged with current state.
  5331. * @param {?function} callback Called after state is updated.
  5332. * @final
  5333. * @protected
  5334. */
  5335. ReactComponent.prototype.setState = function(partialState, callback) {
  5336. ("production" !== "development" ? invariant(
  5337. typeof partialState === 'object' ||
  5338. typeof partialState === 'function' ||
  5339. partialState == null,
  5340. 'setState(...): takes an object of state variables to update or a ' +
  5341. 'function which returns an object of state variables.'
  5342. ) : invariant(typeof partialState === 'object' ||
  5343. typeof partialState === 'function' ||
  5344. partialState == null));
  5345. if ("production" !== "development") {
  5346. ("production" !== "development" ? warning(
  5347. partialState != null,
  5348. 'setState(...): You passed an undefined or null state object; ' +
  5349. 'instead, use forceUpdate().'
  5350. ) : null);
  5351. }
  5352. ReactUpdateQueue.enqueueSetState(this, partialState);
  5353. if (callback) {
  5354. ReactUpdateQueue.enqueueCallback(this, callback);
  5355. }
  5356. };
  5357. /**
  5358. * Forces an update. This should only be invoked when it is known with
  5359. * certainty that we are **not** in a DOM transaction.
  5360. *
  5361. * You may want to call this when you know that some deeper aspect of the
  5362. * component's state has changed but `setState` was not called.
  5363. *
  5364. * This will not invoke `shouldComponentUpdate`, but it will invoke
  5365. * `componentWillUpdate` and `componentDidUpdate`.
  5366. *
  5367. * @param {?function} callback Called after update is complete.
  5368. * @final
  5369. * @protected
  5370. */
  5371. ReactComponent.prototype.forceUpdate = function(callback) {
  5372. ReactUpdateQueue.enqueueForceUpdate(this);
  5373. if (callback) {
  5374. ReactUpdateQueue.enqueueCallback(this, callback);
  5375. }
  5376. };
  5377. /**
  5378. * Deprecated APIs. These APIs used to exist on classic React classes but since
  5379. * we would like to deprecate them, we're not going to move them over to this
  5380. * modern base class. Instead, we define a getter that warns if it's accessed.
  5381. */
  5382. if ("production" !== "development") {
  5383. var deprecatedAPIs = {
  5384. getDOMNode: 'getDOMNode',
  5385. isMounted: 'isMounted',
  5386. replaceProps: 'replaceProps',
  5387. replaceState: 'replaceState',
  5388. setProps: 'setProps'
  5389. };
  5390. var defineDeprecationWarning = function(methodName, displayName) {
  5391. try {
  5392. Object.defineProperty(ReactComponent.prototype, methodName, {
  5393. get: function() {
  5394. ("production" !== "development" ? warning(
  5395. false,
  5396. '%s(...) is deprecated in plain JavaScript React classes.',
  5397. displayName
  5398. ) : null);
  5399. return undefined;
  5400. }
  5401. });
  5402. } catch (x) {
  5403. // IE will fail on defineProperty (es5-shim/sham too)
  5404. }
  5405. };
  5406. for (var fnName in deprecatedAPIs) {
  5407. if (deprecatedAPIs.hasOwnProperty(fnName)) {
  5408. defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
  5409. }
  5410. }
  5411. }
  5412. module.exports = ReactComponent;
  5413. },{"135":135,"154":154,"86":86}],35:[function(_dereq_,module,exports){
  5414. /**
  5415. * Copyright 2013-2015, Facebook, Inc.
  5416. * All rights reserved.
  5417. *
  5418. * This source code is licensed under the BSD-style license found in the
  5419. * LICENSE file in the root directory of this source tree. An additional grant
  5420. * of patent rights can be found in the PATENTS file in the same directory.
  5421. *
  5422. * @providesModule ReactComponentBrowserEnvironment
  5423. */
  5424. /*jslint evil: true */
  5425. 'use strict';
  5426. var ReactDOMIDOperations = _dereq_(44);
  5427. var ReactMount = _dereq_(70);
  5428. /**
  5429. * Abstracts away all functionality of the reconciler that requires knowledge of
  5430. * the browser context. TODO: These callers should be refactored to avoid the
  5431. * need for this injection.
  5432. */
  5433. var ReactComponentBrowserEnvironment = {
  5434. processChildrenUpdates:
  5435. ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
  5436. replaceNodeWithMarkupByID:
  5437. ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
  5438. /**
  5439. * If a particular environment requires that some resources be cleaned up,
  5440. * specify this in the injected Mixin. In the DOM, we would likely want to
  5441. * purge any cached node ID lookups.
  5442. *
  5443. * @private
  5444. */
  5445. unmountIDFromEnvironment: function(rootNodeID) {
  5446. ReactMount.purgeID(rootNodeID);
  5447. }
  5448. };
  5449. module.exports = ReactComponentBrowserEnvironment;
  5450. },{"44":44,"70":70}],36:[function(_dereq_,module,exports){
  5451. /**
  5452. * Copyright 2014-2015, Facebook, Inc.
  5453. * All rights reserved.
  5454. *
  5455. * This source code is licensed under the BSD-style license found in the
  5456. * LICENSE file in the root directory of this source tree. An additional grant
  5457. * of patent rights can be found in the PATENTS file in the same directory.
  5458. *
  5459. * @providesModule ReactComponentEnvironment
  5460. */
  5461. 'use strict';
  5462. var invariant = _dereq_(135);
  5463. var injected = false;
  5464. var ReactComponentEnvironment = {
  5465. /**
  5466. * Optionally injectable environment dependent cleanup hook. (server vs.
  5467. * browser etc). Example: A browser system caches DOM nodes based on component
  5468. * ID and must remove that cache entry when this instance is unmounted.
  5469. */
  5470. unmountIDFromEnvironment: null,
  5471. /**
  5472. * Optionally injectable hook for swapping out mount images in the middle of
  5473. * the tree.
  5474. */
  5475. replaceNodeWithMarkupByID: null,
  5476. /**
  5477. * Optionally injectable hook for processing a queue of child updates. Will
  5478. * later move into MultiChildComponents.
  5479. */
  5480. processChildrenUpdates: null,
  5481. injection: {
  5482. injectEnvironment: function(environment) {
  5483. ("production" !== "development" ? invariant(
  5484. !injected,
  5485. 'ReactCompositeComponent: injectEnvironment() can only be called once.'
  5486. ) : invariant(!injected));
  5487. ReactComponentEnvironment.unmountIDFromEnvironment =
  5488. environment.unmountIDFromEnvironment;
  5489. ReactComponentEnvironment.replaceNodeWithMarkupByID =
  5490. environment.replaceNodeWithMarkupByID;
  5491. ReactComponentEnvironment.processChildrenUpdates =
  5492. environment.processChildrenUpdates;
  5493. injected = true;
  5494. }
  5495. }
  5496. };
  5497. module.exports = ReactComponentEnvironment;
  5498. },{"135":135}],37:[function(_dereq_,module,exports){
  5499. /**
  5500. * Copyright 2013-2015, Facebook, Inc.
  5501. * All rights reserved.
  5502. *
  5503. * This source code is licensed under the BSD-style license found in the
  5504. * LICENSE file in the root directory of this source tree. An additional grant
  5505. * of patent rights can be found in the PATENTS file in the same directory.
  5506. *
  5507. * @providesModule ReactCompositeComponent
  5508. */
  5509. 'use strict';
  5510. var ReactComponentEnvironment = _dereq_(36);
  5511. var ReactContext = _dereq_(38);
  5512. var ReactCurrentOwner = _dereq_(39);
  5513. var ReactElement = _dereq_(57);
  5514. var ReactElementValidator = _dereq_(58);
  5515. var ReactInstanceMap = _dereq_(67);
  5516. var ReactLifeCycle = _dereq_(68);
  5517. var ReactNativeComponent = _dereq_(73);
  5518. var ReactPerf = _dereq_(75);
  5519. var ReactPropTypeLocations = _dereq_(77);
  5520. var ReactPropTypeLocationNames = _dereq_(76);
  5521. var ReactReconciler = _dereq_(81);
  5522. var ReactUpdates = _dereq_(87);
  5523. var assign = _dereq_(27);
  5524. var emptyObject = _dereq_(115);
  5525. var invariant = _dereq_(135);
  5526. var shouldUpdateReactComponent = _dereq_(151);
  5527. var warning = _dereq_(154);
  5528. function getDeclarationErrorAddendum(component) {
  5529. var owner = component._currentElement._owner || null;
  5530. if (owner) {
  5531. var name = owner.getName();
  5532. if (name) {
  5533. return ' Check the render method of `' + name + '`.';
  5534. }
  5535. }
  5536. return '';
  5537. }
  5538. /**
  5539. * ------------------ The Life-Cycle of a Composite Component ------------------
  5540. *
  5541. * - constructor: Initialization of state. The instance is now retained.
  5542. * - componentWillMount
  5543. * - render
  5544. * - [children's constructors]
  5545. * - [children's componentWillMount and render]
  5546. * - [children's componentDidMount]
  5547. * - componentDidMount
  5548. *
  5549. * Update Phases:
  5550. * - componentWillReceiveProps (only called if parent updated)
  5551. * - shouldComponentUpdate
  5552. * - componentWillUpdate
  5553. * - render
  5554. * - [children's constructors or receive props phases]
  5555. * - componentDidUpdate
  5556. *
  5557. * - componentWillUnmount
  5558. * - [children's componentWillUnmount]
  5559. * - [children destroyed]
  5560. * - (destroyed): The instance is now blank, released by React and ready for GC.
  5561. *
  5562. * -----------------------------------------------------------------------------
  5563. */
  5564. /**
  5565. * An incrementing ID assigned to each component when it is mounted. This is
  5566. * used to enforce the order in which `ReactUpdates` updates dirty components.
  5567. *
  5568. * @private
  5569. */
  5570. var nextMountID = 1;
  5571. /**
  5572. * @lends {ReactCompositeComponent.prototype}
  5573. */
  5574. var ReactCompositeComponentMixin = {
  5575. /**
  5576. * Base constructor for all composite component.
  5577. *
  5578. * @param {ReactElement} element
  5579. * @final
  5580. * @internal
  5581. */
  5582. construct: function(element) {
  5583. this._currentElement = element;
  5584. this._rootNodeID = null;
  5585. this._instance = null;
  5586. // See ReactUpdateQueue
  5587. this._pendingElement = null;
  5588. this._pendingStateQueue = null;
  5589. this._pendingReplaceState = false;
  5590. this._pendingForceUpdate = false;
  5591. this._renderedComponent = null;
  5592. this._context = null;
  5593. this._mountOrder = 0;
  5594. this._isTopLevel = false;
  5595. // See ReactUpdates and ReactUpdateQueue.
  5596. this._pendingCallbacks = null;
  5597. },
  5598. /**
  5599. * Initializes the component, renders markup, and registers event listeners.
  5600. *
  5601. * @param {string} rootID DOM ID of the root node.
  5602. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  5603. * @return {?string} Rendered markup to be inserted into the DOM.
  5604. * @final
  5605. * @internal
  5606. */
  5607. mountComponent: function(rootID, transaction, context) {
  5608. this._context = context;
  5609. this._mountOrder = nextMountID++;
  5610. this._rootNodeID = rootID;
  5611. var publicProps = this._processProps(this._currentElement.props);
  5612. var publicContext = this._processContext(this._currentElement._context);
  5613. var Component = ReactNativeComponent.getComponentClassForElement(
  5614. this._currentElement
  5615. );
  5616. // Initialize the public class
  5617. var inst = new Component(publicProps, publicContext);
  5618. if ("production" !== "development") {
  5619. // This will throw later in _renderValidatedComponent, but add an early
  5620. // warning now to help debugging
  5621. ("production" !== "development" ? warning(
  5622. inst.render != null,
  5623. '%s(...): No `render` method found on the returned component ' +
  5624. 'instance: you may have forgotten to define `render` in your ' +
  5625. 'component or you may have accidentally tried to render an element ' +
  5626. 'whose type is a function that isn\'t a React component.',
  5627. Component.displayName || Component.name || 'Component'
  5628. ) : null);
  5629. }
  5630. // These should be set up in the constructor, but as a convenience for
  5631. // simpler class abstractions, we set them up after the fact.
  5632. inst.props = publicProps;
  5633. inst.context = publicContext;
  5634. inst.refs = emptyObject;
  5635. this._instance = inst;
  5636. // Store a reference from the instance back to the internal representation
  5637. ReactInstanceMap.set(inst, this);
  5638. if ("production" !== "development") {
  5639. this._warnIfContextsDiffer(this._currentElement._context, context);
  5640. }
  5641. if ("production" !== "development") {
  5642. // Since plain JS classes are defined without any special initialization
  5643. // logic, we can not catch common errors early. Therefore, we have to
  5644. // catch them here, at initialization time, instead.
  5645. ("production" !== "development" ? warning(
  5646. !inst.getInitialState ||
  5647. inst.getInitialState.isReactClassApproved,
  5648. 'getInitialState was defined on %s, a plain JavaScript class. ' +
  5649. 'This is only supported for classes created using React.createClass. ' +
  5650. 'Did you mean to define a state property instead?',
  5651. this.getName() || 'a component'
  5652. ) : null);
  5653. ("production" !== "development" ? warning(
  5654. !inst.propTypes,
  5655. 'propTypes was defined as an instance property on %s. Use a static ' +
  5656. 'property to define propTypes instead.',
  5657. this.getName() || 'a component'
  5658. ) : null);
  5659. ("production" !== "development" ? warning(
  5660. !inst.contextTypes,
  5661. 'contextTypes was defined as an instance property on %s. Use a ' +
  5662. 'static property to define contextTypes instead.',
  5663. this.getName() || 'a component'
  5664. ) : null);
  5665. ("production" !== "development" ? warning(
  5666. typeof inst.componentShouldUpdate !== 'function',
  5667. '%s has a method called ' +
  5668. 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
  5669. 'The name is phrased as a question because the function is ' +
  5670. 'expected to return a value.',
  5671. (this.getName() || 'A component')
  5672. ) : null);
  5673. }
  5674. var initialState = inst.state;
  5675. if (initialState === undefined) {
  5676. inst.state = initialState = null;
  5677. }
  5678. ("production" !== "development" ? invariant(
  5679. typeof initialState === 'object' && !Array.isArray(initialState),
  5680. '%s.state: must be set to an object or null',
  5681. this.getName() || 'ReactCompositeComponent'
  5682. ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
  5683. this._pendingStateQueue = null;
  5684. this._pendingReplaceState = false;
  5685. this._pendingForceUpdate = false;
  5686. var renderedElement;
  5687. var previouslyMounting = ReactLifeCycle.currentlyMountingInstance;
  5688. ReactLifeCycle.currentlyMountingInstance = this;
  5689. try {
  5690. if (inst.componentWillMount) {
  5691. inst.componentWillMount();
  5692. // When mounting, calls to `setState` by `componentWillMount` will set
  5693. // `this._pendingStateQueue` without triggering a re-render.
  5694. if (this._pendingStateQueue) {
  5695. inst.state = this._processPendingState(inst.props, inst.context);
  5696. }
  5697. }
  5698. renderedElement = this._renderValidatedComponent();
  5699. } finally {
  5700. ReactLifeCycle.currentlyMountingInstance = previouslyMounting;
  5701. }
  5702. this._renderedComponent = this._instantiateReactComponent(
  5703. renderedElement,
  5704. this._currentElement.type // The wrapping type
  5705. );
  5706. var markup = ReactReconciler.mountComponent(
  5707. this._renderedComponent,
  5708. rootID,
  5709. transaction,
  5710. this._processChildContext(context)
  5711. );
  5712. if (inst.componentDidMount) {
  5713. transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
  5714. }
  5715. return markup;
  5716. },
  5717. /**
  5718. * Releases any resources allocated by `mountComponent`.
  5719. *
  5720. * @final
  5721. * @internal
  5722. */
  5723. unmountComponent: function() {
  5724. var inst = this._instance;
  5725. if (inst.componentWillUnmount) {
  5726. var previouslyUnmounting = ReactLifeCycle.currentlyUnmountingInstance;
  5727. ReactLifeCycle.currentlyUnmountingInstance = this;
  5728. try {
  5729. inst.componentWillUnmount();
  5730. } finally {
  5731. ReactLifeCycle.currentlyUnmountingInstance = previouslyUnmounting;
  5732. }
  5733. }
  5734. ReactReconciler.unmountComponent(this._renderedComponent);
  5735. this._renderedComponent = null;
  5736. // Reset pending fields
  5737. this._pendingStateQueue = null;
  5738. this._pendingReplaceState = false;
  5739. this._pendingForceUpdate = false;
  5740. this._pendingCallbacks = null;
  5741. this._pendingElement = null;
  5742. // These fields do not really need to be reset since this object is no
  5743. // longer accessible.
  5744. this._context = null;
  5745. this._rootNodeID = null;
  5746. // Delete the reference from the instance to this internal representation
  5747. // which allow the internals to be properly cleaned up even if the user
  5748. // leaks a reference to the public instance.
  5749. ReactInstanceMap.remove(inst);
  5750. // Some existing components rely on inst.props even after they've been
  5751. // destroyed (in event handlers).
  5752. // TODO: inst.props = null;
  5753. // TODO: inst.state = null;
  5754. // TODO: inst.context = null;
  5755. },
  5756. /**
  5757. * Schedule a partial update to the props. Only used for internal testing.
  5758. *
  5759. * @param {object} partialProps Subset of the next props.
  5760. * @param {?function} callback Called after props are updated.
  5761. * @final
  5762. * @internal
  5763. */
  5764. _setPropsInternal: function(partialProps, callback) {
  5765. // This is a deoptimized path. We optimize for always having an element.
  5766. // This creates an extra internal element.
  5767. var element = this._pendingElement || this._currentElement;
  5768. this._pendingElement = ReactElement.cloneAndReplaceProps(
  5769. element,
  5770. assign({}, element.props, partialProps)
  5771. );
  5772. ReactUpdates.enqueueUpdate(this, callback);
  5773. },
  5774. /**
  5775. * Filters the context object to only contain keys specified in
  5776. * `contextTypes`
  5777. *
  5778. * @param {object} context
  5779. * @return {?object}
  5780. * @private
  5781. */
  5782. _maskContext: function(context) {
  5783. var maskedContext = null;
  5784. // This really should be getting the component class for the element,
  5785. // but we know that we're not going to need it for built-ins.
  5786. if (typeof this._currentElement.type === 'string') {
  5787. return emptyObject;
  5788. }
  5789. var contextTypes = this._currentElement.type.contextTypes;
  5790. if (!contextTypes) {
  5791. return emptyObject;
  5792. }
  5793. maskedContext = {};
  5794. for (var contextName in contextTypes) {
  5795. maskedContext[contextName] = context[contextName];
  5796. }
  5797. return maskedContext;
  5798. },
  5799. /**
  5800. * Filters the context object to only contain keys specified in
  5801. * `contextTypes`, and asserts that they are valid.
  5802. *
  5803. * @param {object} context
  5804. * @return {?object}
  5805. * @private
  5806. */
  5807. _processContext: function(context) {
  5808. var maskedContext = this._maskContext(context);
  5809. if ("production" !== "development") {
  5810. var Component = ReactNativeComponent.getComponentClassForElement(
  5811. this._currentElement
  5812. );
  5813. if (Component.contextTypes) {
  5814. this._checkPropTypes(
  5815. Component.contextTypes,
  5816. maskedContext,
  5817. ReactPropTypeLocations.context
  5818. );
  5819. }
  5820. }
  5821. return maskedContext;
  5822. },
  5823. /**
  5824. * @param {object} currentContext
  5825. * @return {object}
  5826. * @private
  5827. */
  5828. _processChildContext: function(currentContext) {
  5829. var inst = this._instance;
  5830. var childContext = inst.getChildContext && inst.getChildContext();
  5831. if (childContext) {
  5832. ("production" !== "development" ? invariant(
  5833. typeof inst.constructor.childContextTypes === 'object',
  5834. '%s.getChildContext(): childContextTypes must be defined in order to ' +
  5835. 'use getChildContext().',
  5836. this.getName() || 'ReactCompositeComponent'
  5837. ) : invariant(typeof inst.constructor.childContextTypes === 'object'));
  5838. if ("production" !== "development") {
  5839. this._checkPropTypes(
  5840. inst.constructor.childContextTypes,
  5841. childContext,
  5842. ReactPropTypeLocations.childContext
  5843. );
  5844. }
  5845. for (var name in childContext) {
  5846. ("production" !== "development" ? invariant(
  5847. name in inst.constructor.childContextTypes,
  5848. '%s.getChildContext(): key "%s" is not defined in childContextTypes.',
  5849. this.getName() || 'ReactCompositeComponent',
  5850. name
  5851. ) : invariant(name in inst.constructor.childContextTypes));
  5852. }
  5853. return assign({}, currentContext, childContext);
  5854. }
  5855. return currentContext;
  5856. },
  5857. /**
  5858. * Processes props by setting default values for unspecified props and
  5859. * asserting that the props are valid. Does not mutate its argument; returns
  5860. * a new props object with defaults merged in.
  5861. *
  5862. * @param {object} newProps
  5863. * @return {object}
  5864. * @private
  5865. */
  5866. _processProps: function(newProps) {
  5867. if ("production" !== "development") {
  5868. var Component = ReactNativeComponent.getComponentClassForElement(
  5869. this._currentElement
  5870. );
  5871. if (Component.propTypes) {
  5872. this._checkPropTypes(
  5873. Component.propTypes,
  5874. newProps,
  5875. ReactPropTypeLocations.prop
  5876. );
  5877. }
  5878. }
  5879. return newProps;
  5880. },
  5881. /**
  5882. * Assert that the props are valid
  5883. *
  5884. * @param {object} propTypes Map of prop name to a ReactPropType
  5885. * @param {object} props
  5886. * @param {string} location e.g. "prop", "context", "child context"
  5887. * @private
  5888. */
  5889. _checkPropTypes: function(propTypes, props, location) {
  5890. // TODO: Stop validating prop types here and only use the element
  5891. // validation.
  5892. var componentName = this.getName();
  5893. for (var propName in propTypes) {
  5894. if (propTypes.hasOwnProperty(propName)) {
  5895. var error;
  5896. try {
  5897. // This is intentionally an invariant that gets caught. It's the same
  5898. // behavior as without this statement except with a better message.
  5899. ("production" !== "development" ? invariant(
  5900. typeof propTypes[propName] === 'function',
  5901. '%s: %s type `%s` is invalid; it must be a function, usually ' +
  5902. 'from React.PropTypes.',
  5903. componentName || 'React class',
  5904. ReactPropTypeLocationNames[location],
  5905. propName
  5906. ) : invariant(typeof propTypes[propName] === 'function'));
  5907. error = propTypes[propName](props, propName, componentName, location);
  5908. } catch (ex) {
  5909. error = ex;
  5910. }
  5911. if (error instanceof Error) {
  5912. // We may want to extend this logic for similar errors in
  5913. // React.render calls, so I'm abstracting it away into
  5914. // a function to minimize refactoring in the future
  5915. var addendum = getDeclarationErrorAddendum(this);
  5916. if (location === ReactPropTypeLocations.prop) {
  5917. // Preface gives us something to blacklist in warning module
  5918. ("production" !== "development" ? warning(
  5919. false,
  5920. 'Failed Composite propType: %s%s',
  5921. error.message,
  5922. addendum
  5923. ) : null);
  5924. } else {
  5925. ("production" !== "development" ? warning(
  5926. false,
  5927. 'Failed Context Types: %s%s',
  5928. error.message,
  5929. addendum
  5930. ) : null);
  5931. }
  5932. }
  5933. }
  5934. }
  5935. },
  5936. receiveComponent: function(nextElement, transaction, nextContext) {
  5937. var prevElement = this._currentElement;
  5938. var prevContext = this._context;
  5939. this._pendingElement = null;
  5940. this.updateComponent(
  5941. transaction,
  5942. prevElement,
  5943. nextElement,
  5944. prevContext,
  5945. nextContext
  5946. );
  5947. },
  5948. /**
  5949. * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
  5950. * is set, update the component.
  5951. *
  5952. * @param {ReactReconcileTransaction} transaction
  5953. * @internal
  5954. */
  5955. performUpdateIfNecessary: function(transaction) {
  5956. if (this._pendingElement != null) {
  5957. ReactReconciler.receiveComponent(
  5958. this,
  5959. this._pendingElement || this._currentElement,
  5960. transaction,
  5961. this._context
  5962. );
  5963. }
  5964. if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
  5965. if ("production" !== "development") {
  5966. ReactElementValidator.checkAndWarnForMutatedProps(
  5967. this._currentElement
  5968. );
  5969. }
  5970. this.updateComponent(
  5971. transaction,
  5972. this._currentElement,
  5973. this._currentElement,
  5974. this._context,
  5975. this._context
  5976. );
  5977. }
  5978. },
  5979. /**
  5980. * Compare two contexts, warning if they are different
  5981. * TODO: Remove this check when owner-context is removed
  5982. */
  5983. _warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) {
  5984. ownerBasedContext = this._maskContext(ownerBasedContext);
  5985. parentBasedContext = this._maskContext(parentBasedContext);
  5986. var parentKeys = Object.keys(parentBasedContext).sort();
  5987. var displayName = this.getName() || 'ReactCompositeComponent';
  5988. for (var i = 0; i < parentKeys.length; i++) {
  5989. var key = parentKeys[i];
  5990. ("production" !== "development" ? warning(
  5991. ownerBasedContext[key] === parentBasedContext[key],
  5992. 'owner-based and parent-based contexts differ ' +
  5993. '(values: `%s` vs `%s`) for key (%s) while mounting %s ' +
  5994. '(see: http://fb.me/react-context-by-parent)',
  5995. ownerBasedContext[key],
  5996. parentBasedContext[key],
  5997. key,
  5998. displayName
  5999. ) : null);
  6000. }
  6001. },
  6002. /**
  6003. * Perform an update to a mounted component. The componentWillReceiveProps and
  6004. * shouldComponentUpdate methods are called, then (assuming the update isn't
  6005. * skipped) the remaining update lifecycle methods are called and the DOM
  6006. * representation is updated.
  6007. *
  6008. * By default, this implements React's rendering and reconciliation algorithm.
  6009. * Sophisticated clients may wish to override this.
  6010. *
  6011. * @param {ReactReconcileTransaction} transaction
  6012. * @param {ReactElement} prevParentElement
  6013. * @param {ReactElement} nextParentElement
  6014. * @internal
  6015. * @overridable
  6016. */
  6017. updateComponent: function(
  6018. transaction,
  6019. prevParentElement,
  6020. nextParentElement,
  6021. prevUnmaskedContext,
  6022. nextUnmaskedContext
  6023. ) {
  6024. var inst = this._instance;
  6025. var nextContext = inst.context;
  6026. var nextProps = inst.props;
  6027. // Distinguish between a props update versus a simple state update
  6028. if (prevParentElement !== nextParentElement) {
  6029. nextContext = this._processContext(nextParentElement._context);
  6030. nextProps = this._processProps(nextParentElement.props);
  6031. if ("production" !== "development") {
  6032. if (nextUnmaskedContext != null) {
  6033. this._warnIfContextsDiffer(
  6034. nextParentElement._context,
  6035. nextUnmaskedContext
  6036. );
  6037. }
  6038. }
  6039. // An update here will schedule an update but immediately set
  6040. // _pendingStateQueue which will ensure that any state updates gets
  6041. // immediately reconciled instead of waiting for the next batch.
  6042. if (inst.componentWillReceiveProps) {
  6043. inst.componentWillReceiveProps(nextProps, nextContext);
  6044. }
  6045. }
  6046. var nextState = this._processPendingState(nextProps, nextContext);
  6047. var shouldUpdate =
  6048. this._pendingForceUpdate ||
  6049. !inst.shouldComponentUpdate ||
  6050. inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  6051. if ("production" !== "development") {
  6052. ("production" !== "development" ? warning(
  6053. typeof shouldUpdate !== 'undefined',
  6054. '%s.shouldComponentUpdate(): Returned undefined instead of a ' +
  6055. 'boolean value. Make sure to return true or false.',
  6056. this.getName() || 'ReactCompositeComponent'
  6057. ) : null);
  6058. }
  6059. if (shouldUpdate) {
  6060. this._pendingForceUpdate = false;
  6061. // Will set `this.props`, `this.state` and `this.context`.
  6062. this._performComponentUpdate(
  6063. nextParentElement,
  6064. nextProps,
  6065. nextState,
  6066. nextContext,
  6067. transaction,
  6068. nextUnmaskedContext
  6069. );
  6070. } else {
  6071. // If it's determined that a component should not update, we still want
  6072. // to set props and state but we shortcut the rest of the update.
  6073. this._currentElement = nextParentElement;
  6074. this._context = nextUnmaskedContext;
  6075. inst.props = nextProps;
  6076. inst.state = nextState;
  6077. inst.context = nextContext;
  6078. }
  6079. },
  6080. _processPendingState: function(props, context) {
  6081. var inst = this._instance;
  6082. var queue = this._pendingStateQueue;
  6083. var replace = this._pendingReplaceState;
  6084. this._pendingReplaceState = false;
  6085. this._pendingStateQueue = null;
  6086. if (!queue) {
  6087. return inst.state;
  6088. }
  6089. var nextState = assign({}, replace ? queue[0] : inst.state);
  6090. for (var i = replace ? 1 : 0; i < queue.length; i++) {
  6091. var partial = queue[i];
  6092. assign(
  6093. nextState,
  6094. typeof partial === 'function' ?
  6095. partial.call(inst, nextState, props, context) :
  6096. partial
  6097. );
  6098. }
  6099. return nextState;
  6100. },
  6101. /**
  6102. * Merges new props and state, notifies delegate methods of update and
  6103. * performs update.
  6104. *
  6105. * @param {ReactElement} nextElement Next element
  6106. * @param {object} nextProps Next public object to set as properties.
  6107. * @param {?object} nextState Next object to set as state.
  6108. * @param {?object} nextContext Next public object to set as context.
  6109. * @param {ReactReconcileTransaction} transaction
  6110. * @param {?object} unmaskedContext
  6111. * @private
  6112. */
  6113. _performComponentUpdate: function(
  6114. nextElement,
  6115. nextProps,
  6116. nextState,
  6117. nextContext,
  6118. transaction,
  6119. unmaskedContext
  6120. ) {
  6121. var inst = this._instance;
  6122. var prevProps = inst.props;
  6123. var prevState = inst.state;
  6124. var prevContext = inst.context;
  6125. if (inst.componentWillUpdate) {
  6126. inst.componentWillUpdate(nextProps, nextState, nextContext);
  6127. }
  6128. this._currentElement = nextElement;
  6129. this._context = unmaskedContext;
  6130. inst.props = nextProps;
  6131. inst.state = nextState;
  6132. inst.context = nextContext;
  6133. this._updateRenderedComponent(transaction, unmaskedContext);
  6134. if (inst.componentDidUpdate) {
  6135. transaction.getReactMountReady().enqueue(
  6136. inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext),
  6137. inst
  6138. );
  6139. }
  6140. },
  6141. /**
  6142. * Call the component's `render` method and update the DOM accordingly.
  6143. *
  6144. * @param {ReactReconcileTransaction} transaction
  6145. * @internal
  6146. */
  6147. _updateRenderedComponent: function(transaction, context) {
  6148. var prevComponentInstance = this._renderedComponent;
  6149. var prevRenderedElement = prevComponentInstance._currentElement;
  6150. var nextRenderedElement = this._renderValidatedComponent();
  6151. if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
  6152. ReactReconciler.receiveComponent(
  6153. prevComponentInstance,
  6154. nextRenderedElement,
  6155. transaction,
  6156. this._processChildContext(context)
  6157. );
  6158. } else {
  6159. // These two IDs are actually the same! But nothing should rely on that.
  6160. var thisID = this._rootNodeID;
  6161. var prevComponentID = prevComponentInstance._rootNodeID;
  6162. ReactReconciler.unmountComponent(prevComponentInstance);
  6163. this._renderedComponent = this._instantiateReactComponent(
  6164. nextRenderedElement,
  6165. this._currentElement.type
  6166. );
  6167. var nextMarkup = ReactReconciler.mountComponent(
  6168. this._renderedComponent,
  6169. thisID,
  6170. transaction,
  6171. context
  6172. );
  6173. this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
  6174. }
  6175. },
  6176. /**
  6177. * @protected
  6178. */
  6179. _replaceNodeWithMarkupByID: function(prevComponentID, nextMarkup) {
  6180. ReactComponentEnvironment.replaceNodeWithMarkupByID(
  6181. prevComponentID,
  6182. nextMarkup
  6183. );
  6184. },
  6185. /**
  6186. * @protected
  6187. */
  6188. _renderValidatedComponentWithoutOwnerOrContext: function() {
  6189. var inst = this._instance;
  6190. var renderedComponent = inst.render();
  6191. if ("production" !== "development") {
  6192. // We allow auto-mocks to proceed as if they're returning null.
  6193. if (typeof renderedComponent === 'undefined' &&
  6194. inst.render._isMockFunction) {
  6195. // This is probably bad practice. Consider warning here and
  6196. // deprecating this convenience.
  6197. renderedComponent = null;
  6198. }
  6199. }
  6200. return renderedComponent;
  6201. },
  6202. /**
  6203. * @private
  6204. */
  6205. _renderValidatedComponent: function() {
  6206. var renderedComponent;
  6207. var previousContext = ReactContext.current;
  6208. ReactContext.current = this._processChildContext(
  6209. this._currentElement._context
  6210. );
  6211. ReactCurrentOwner.current = this;
  6212. try {
  6213. renderedComponent =
  6214. this._renderValidatedComponentWithoutOwnerOrContext();
  6215. } finally {
  6216. ReactContext.current = previousContext;
  6217. ReactCurrentOwner.current = null;
  6218. }
  6219. ("production" !== "development" ? invariant(
  6220. // TODO: An `isValidNode` function would probably be more appropriate
  6221. renderedComponent === null || renderedComponent === false ||
  6222. ReactElement.isValidElement(renderedComponent),
  6223. '%s.render(): A valid ReactComponent must be returned. You may have ' +
  6224. 'returned undefined, an array or some other invalid object.',
  6225. this.getName() || 'ReactCompositeComponent'
  6226. ) : invariant(// TODO: An `isValidNode` function would probably be more appropriate
  6227. renderedComponent === null || renderedComponent === false ||
  6228. ReactElement.isValidElement(renderedComponent)));
  6229. return renderedComponent;
  6230. },
  6231. /**
  6232. * Lazily allocates the refs object and stores `component` as `ref`.
  6233. *
  6234. * @param {string} ref Reference name.
  6235. * @param {component} component Component to store as `ref`.
  6236. * @final
  6237. * @private
  6238. */
  6239. attachRef: function(ref, component) {
  6240. var inst = this.getPublicInstance();
  6241. var refs = inst.refs === emptyObject ? (inst.refs = {}) : inst.refs;
  6242. refs[ref] = component.getPublicInstance();
  6243. },
  6244. /**
  6245. * Detaches a reference name.
  6246. *
  6247. * @param {string} ref Name to dereference.
  6248. * @final
  6249. * @private
  6250. */
  6251. detachRef: function(ref) {
  6252. var refs = this.getPublicInstance().refs;
  6253. delete refs[ref];
  6254. },
  6255. /**
  6256. * Get a text description of the component that can be used to identify it
  6257. * in error messages.
  6258. * @return {string} The name or null.
  6259. * @internal
  6260. */
  6261. getName: function() {
  6262. var type = this._currentElement.type;
  6263. var constructor = this._instance && this._instance.constructor;
  6264. return (
  6265. type.displayName || (constructor && constructor.displayName) ||
  6266. type.name || (constructor && constructor.name) ||
  6267. null
  6268. );
  6269. },
  6270. /**
  6271. * Get the publicly accessible representation of this component - i.e. what
  6272. * is exposed by refs and returned by React.render. Can be null for stateless
  6273. * components.
  6274. *
  6275. * @return {ReactComponent} the public component instance.
  6276. * @internal
  6277. */
  6278. getPublicInstance: function() {
  6279. return this._instance;
  6280. },
  6281. // Stub
  6282. _instantiateReactComponent: null
  6283. };
  6284. ReactPerf.measureMethods(
  6285. ReactCompositeComponentMixin,
  6286. 'ReactCompositeComponent',
  6287. {
  6288. mountComponent: 'mountComponent',
  6289. updateComponent: 'updateComponent',
  6290. _renderValidatedComponent: '_renderValidatedComponent'
  6291. }
  6292. );
  6293. var ReactCompositeComponent = {
  6294. Mixin: ReactCompositeComponentMixin
  6295. };
  6296. module.exports = ReactCompositeComponent;
  6297. },{"115":115,"135":135,"151":151,"154":154,"27":27,"36":36,"38":38,"39":39,"57":57,"58":58,"67":67,"68":68,"73":73,"75":75,"76":76,"77":77,"81":81,"87":87}],38:[function(_dereq_,module,exports){
  6298. /**
  6299. * Copyright 2013-2015, Facebook, Inc.
  6300. * All rights reserved.
  6301. *
  6302. * This source code is licensed under the BSD-style license found in the
  6303. * LICENSE file in the root directory of this source tree. An additional grant
  6304. * of patent rights can be found in the PATENTS file in the same directory.
  6305. *
  6306. * @providesModule ReactContext
  6307. */
  6308. 'use strict';
  6309. var assign = _dereq_(27);
  6310. var emptyObject = _dereq_(115);
  6311. var warning = _dereq_(154);
  6312. var didWarn = false;
  6313. /**
  6314. * Keeps track of the current context.
  6315. *
  6316. * The context is automatically passed down the component ownership hierarchy
  6317. * and is accessible via `this.context` on ReactCompositeComponents.
  6318. */
  6319. var ReactContext = {
  6320. /**
  6321. * @internal
  6322. * @type {object}
  6323. */
  6324. current: emptyObject,
  6325. /**
  6326. * Temporarily extends the current context while executing scopedCallback.
  6327. *
  6328. * A typical use case might look like
  6329. *
  6330. * render: function() {
  6331. * var children = ReactContext.withContext({foo: 'foo'}, () => (
  6332. *
  6333. * ));
  6334. * return <div>{children}</div>;
  6335. * }
  6336. *
  6337. * @param {object} newContext New context to merge into the existing context
  6338. * @param {function} scopedCallback Callback to run with the new context
  6339. * @return {ReactComponent|array<ReactComponent>}
  6340. */
  6341. withContext: function(newContext, scopedCallback) {
  6342. if ("production" !== "development") {
  6343. ("production" !== "development" ? warning(
  6344. didWarn,
  6345. 'withContext is deprecated and will be removed in a future version. ' +
  6346. 'Use a wrapper component with getChildContext instead.'
  6347. ) : null);
  6348. didWarn = true;
  6349. }
  6350. var result;
  6351. var previousContext = ReactContext.current;
  6352. ReactContext.current = assign({}, previousContext, newContext);
  6353. try {
  6354. result = scopedCallback();
  6355. } finally {
  6356. ReactContext.current = previousContext;
  6357. }
  6358. return result;
  6359. }
  6360. };
  6361. module.exports = ReactContext;
  6362. },{"115":115,"154":154,"27":27}],39:[function(_dereq_,module,exports){
  6363. /**
  6364. * Copyright 2013-2015, Facebook, Inc.
  6365. * All rights reserved.
  6366. *
  6367. * This source code is licensed under the BSD-style license found in the
  6368. * LICENSE file in the root directory of this source tree. An additional grant
  6369. * of patent rights can be found in the PATENTS file in the same directory.
  6370. *
  6371. * @providesModule ReactCurrentOwner
  6372. */
  6373. 'use strict';
  6374. /**
  6375. * Keeps track of the current owner.
  6376. *
  6377. * The current owner is the component who should own any components that are
  6378. * currently being constructed.
  6379. *
  6380. * The depth indicate how many composite components are above this render level.
  6381. */
  6382. var ReactCurrentOwner = {
  6383. /**
  6384. * @internal
  6385. * @type {ReactComponent}
  6386. */
  6387. current: null
  6388. };
  6389. module.exports = ReactCurrentOwner;
  6390. },{}],40:[function(_dereq_,module,exports){
  6391. /**
  6392. * Copyright 2013-2015, Facebook, Inc.
  6393. * All rights reserved.
  6394. *
  6395. * This source code is licensed under the BSD-style license found in the
  6396. * LICENSE file in the root directory of this source tree. An additional grant
  6397. * of patent rights can be found in the PATENTS file in the same directory.
  6398. *
  6399. * @providesModule ReactDOM
  6400. * @typechecks static-only
  6401. */
  6402. 'use strict';
  6403. var ReactElement = _dereq_(57);
  6404. var ReactElementValidator = _dereq_(58);
  6405. var mapObject = _dereq_(142);
  6406. /**
  6407. * Create a factory that creates HTML tag elements.
  6408. *
  6409. * @param {string} tag Tag name (e.g. `div`).
  6410. * @private
  6411. */
  6412. function createDOMFactory(tag) {
  6413. if ("production" !== "development") {
  6414. return ReactElementValidator.createFactory(tag);
  6415. }
  6416. return ReactElement.createFactory(tag);
  6417. }
  6418. /**
  6419. * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
  6420. * This is also accessible via `React.DOM`.
  6421. *
  6422. * @public
  6423. */
  6424. var ReactDOM = mapObject({
  6425. a: 'a',
  6426. abbr: 'abbr',
  6427. address: 'address',
  6428. area: 'area',
  6429. article: 'article',
  6430. aside: 'aside',
  6431. audio: 'audio',
  6432. b: 'b',
  6433. base: 'base',
  6434. bdi: 'bdi',
  6435. bdo: 'bdo',
  6436. big: 'big',
  6437. blockquote: 'blockquote',
  6438. body: 'body',
  6439. br: 'br',
  6440. button: 'button',
  6441. canvas: 'canvas',
  6442. caption: 'caption',
  6443. cite: 'cite',
  6444. code: 'code',
  6445. col: 'col',
  6446. colgroup: 'colgroup',
  6447. data: 'data',
  6448. datalist: 'datalist',
  6449. dd: 'dd',
  6450. del: 'del',
  6451. details: 'details',
  6452. dfn: 'dfn',
  6453. dialog: 'dialog',
  6454. div: 'div',
  6455. dl: 'dl',
  6456. dt: 'dt',
  6457. em: 'em',
  6458. embed: 'embed',
  6459. fieldset: 'fieldset',
  6460. figcaption: 'figcaption',
  6461. figure: 'figure',
  6462. footer: 'footer',
  6463. form: 'form',
  6464. h1: 'h1',
  6465. h2: 'h2',
  6466. h3: 'h3',
  6467. h4: 'h4',
  6468. h5: 'h5',
  6469. h6: 'h6',
  6470. head: 'head',
  6471. header: 'header',
  6472. hr: 'hr',
  6473. html: 'html',
  6474. i: 'i',
  6475. iframe: 'iframe',
  6476. img: 'img',
  6477. input: 'input',
  6478. ins: 'ins',
  6479. kbd: 'kbd',
  6480. keygen: 'keygen',
  6481. label: 'label',
  6482. legend: 'legend',
  6483. li: 'li',
  6484. link: 'link',
  6485. main: 'main',
  6486. map: 'map',
  6487. mark: 'mark',
  6488. menu: 'menu',
  6489. menuitem: 'menuitem',
  6490. meta: 'meta',
  6491. meter: 'meter',
  6492. nav: 'nav',
  6493. noscript: 'noscript',
  6494. object: 'object',
  6495. ol: 'ol',
  6496. optgroup: 'optgroup',
  6497. option: 'option',
  6498. output: 'output',
  6499. p: 'p',
  6500. param: 'param',
  6501. picture: 'picture',
  6502. pre: 'pre',
  6503. progress: 'progress',
  6504. q: 'q',
  6505. rp: 'rp',
  6506. rt: 'rt',
  6507. ruby: 'ruby',
  6508. s: 's',
  6509. samp: 'samp',
  6510. script: 'script',
  6511. section: 'section',
  6512. select: 'select',
  6513. small: 'small',
  6514. source: 'source',
  6515. span: 'span',
  6516. strong: 'strong',
  6517. style: 'style',
  6518. sub: 'sub',
  6519. summary: 'summary',
  6520. sup: 'sup',
  6521. table: 'table',
  6522. tbody: 'tbody',
  6523. td: 'td',
  6524. textarea: 'textarea',
  6525. tfoot: 'tfoot',
  6526. th: 'th',
  6527. thead: 'thead',
  6528. time: 'time',
  6529. title: 'title',
  6530. tr: 'tr',
  6531. track: 'track',
  6532. u: 'u',
  6533. ul: 'ul',
  6534. 'var': 'var',
  6535. video: 'video',
  6536. wbr: 'wbr',
  6537. // SVG
  6538. circle: 'circle',
  6539. defs: 'defs',
  6540. ellipse: 'ellipse',
  6541. g: 'g',
  6542. line: 'line',
  6543. linearGradient: 'linearGradient',
  6544. mask: 'mask',
  6545. path: 'path',
  6546. pattern: 'pattern',
  6547. polygon: 'polygon',
  6548. polyline: 'polyline',
  6549. radialGradient: 'radialGradient',
  6550. rect: 'rect',
  6551. stop: 'stop',
  6552. svg: 'svg',
  6553. text: 'text',
  6554. tspan: 'tspan'
  6555. }, createDOMFactory);
  6556. module.exports = ReactDOM;
  6557. },{"142":142,"57":57,"58":58}],41:[function(_dereq_,module,exports){
  6558. /**
  6559. * Copyright 2013-2015, Facebook, Inc.
  6560. * All rights reserved.
  6561. *
  6562. * This source code is licensed under the BSD-style license found in the
  6563. * LICENSE file in the root directory of this source tree. An additional grant
  6564. * of patent rights can be found in the PATENTS file in the same directory.
  6565. *
  6566. * @providesModule ReactDOMButton
  6567. */
  6568. 'use strict';
  6569. var AutoFocusMixin = _dereq_(2);
  6570. var ReactBrowserComponentMixin = _dereq_(29);
  6571. var ReactClass = _dereq_(33);
  6572. var ReactElement = _dereq_(57);
  6573. var keyMirror = _dereq_(140);
  6574. var button = ReactElement.createFactory('button');
  6575. var mouseListenerNames = keyMirror({
  6576. onClick: true,
  6577. onDoubleClick: true,
  6578. onMouseDown: true,
  6579. onMouseMove: true,
  6580. onMouseUp: true,
  6581. onClickCapture: true,
  6582. onDoubleClickCapture: true,
  6583. onMouseDownCapture: true,
  6584. onMouseMoveCapture: true,
  6585. onMouseUpCapture: true
  6586. });
  6587. /**
  6588. * Implements a <button> native component that does not receive mouse events
  6589. * when `disabled` is set.
  6590. */
  6591. var ReactDOMButton = ReactClass.createClass({
  6592. displayName: 'ReactDOMButton',
  6593. tagName: 'BUTTON',
  6594. mixins: [AutoFocusMixin, ReactBrowserComponentMixin],
  6595. render: function() {
  6596. var props = {};
  6597. // Copy the props; except the mouse listeners if we're disabled
  6598. for (var key in this.props) {
  6599. if (this.props.hasOwnProperty(key) &&
  6600. (!this.props.disabled || !mouseListenerNames[key])) {
  6601. props[key] = this.props[key];
  6602. }
  6603. }
  6604. return button(props, this.props.children);
  6605. }
  6606. });
  6607. module.exports = ReactDOMButton;
  6608. },{"140":140,"2":2,"29":29,"33":33,"57":57}],42:[function(_dereq_,module,exports){
  6609. /**
  6610. * Copyright 2013-2015, Facebook, Inc.
  6611. * All rights reserved.
  6612. *
  6613. * This source code is licensed under the BSD-style license found in the
  6614. * LICENSE file in the root directory of this source tree. An additional grant
  6615. * of patent rights can be found in the PATENTS file in the same directory.
  6616. *
  6617. * @providesModule ReactDOMComponent
  6618. * @typechecks static-only
  6619. */
  6620. /* global hasOwnProperty:true */
  6621. 'use strict';
  6622. var CSSPropertyOperations = _dereq_(5);
  6623. var DOMProperty = _dereq_(10);
  6624. var DOMPropertyOperations = _dereq_(11);
  6625. var ReactBrowserEventEmitter = _dereq_(30);
  6626. var ReactComponentBrowserEnvironment =
  6627. _dereq_(35);
  6628. var ReactMount = _dereq_(70);
  6629. var ReactMultiChild = _dereq_(71);
  6630. var ReactPerf = _dereq_(75);
  6631. var assign = _dereq_(27);
  6632. var escapeTextContentForBrowser = _dereq_(116);
  6633. var invariant = _dereq_(135);
  6634. var isEventSupported = _dereq_(136);
  6635. var keyOf = _dereq_(141);
  6636. var warning = _dereq_(154);
  6637. var deleteListener = ReactBrowserEventEmitter.deleteListener;
  6638. var listenTo = ReactBrowserEventEmitter.listenTo;
  6639. var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
  6640. // For quickly matching children type, to test if can be treated as content.
  6641. var CONTENT_TYPES = {'string': true, 'number': true};
  6642. var STYLE = keyOf({style: null});
  6643. var ELEMENT_NODE_TYPE = 1;
  6644. /**
  6645. * Optionally injectable operations for mutating the DOM
  6646. */
  6647. var BackendIDOperations = null;
  6648. /**
  6649. * @param {?object} props
  6650. */
  6651. function assertValidProps(props) {
  6652. if (!props) {
  6653. return;
  6654. }
  6655. // Note the use of `==` which checks for null or undefined.
  6656. if (props.dangerouslySetInnerHTML != null) {
  6657. ("production" !== "development" ? invariant(
  6658. props.children == null,
  6659. 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
  6660. ) : invariant(props.children == null));
  6661. ("production" !== "development" ? invariant(
  6662. props.dangerouslySetInnerHTML.__html != null,
  6663. '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
  6664. 'Please visit http://fb.me/react-invariant-dangerously-set-inner-html ' +
  6665. 'for more information.'
  6666. ) : invariant(props.dangerouslySetInnerHTML.__html != null));
  6667. }
  6668. if ("production" !== "development") {
  6669. ("production" !== "development" ? warning(
  6670. props.innerHTML == null,
  6671. 'Directly setting property `innerHTML` is not permitted. ' +
  6672. 'For more information, lookup documentation on `dangerouslySetInnerHTML`.'
  6673. ) : null);
  6674. ("production" !== "development" ? warning(
  6675. !props.contentEditable || props.children == null,
  6676. 'A component is `contentEditable` and contains `children` managed by ' +
  6677. 'React. It is now your responsibility to guarantee that none of ' +
  6678. 'those nodes are unexpectedly modified or duplicated. This is ' +
  6679. 'probably not intentional.'
  6680. ) : null);
  6681. }
  6682. ("production" !== "development" ? invariant(
  6683. props.style == null || typeof props.style === 'object',
  6684. 'The `style` prop expects a mapping from style properties to values, ' +
  6685. 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' +
  6686. 'using JSX.'
  6687. ) : invariant(props.style == null || typeof props.style === 'object'));
  6688. }
  6689. function putListener(id, registrationName, listener, transaction) {
  6690. if ("production" !== "development") {
  6691. // IE8 has no API for event capturing and the `onScroll` event doesn't
  6692. // bubble.
  6693. ("production" !== "development" ? warning(
  6694. registrationName !== 'onScroll' || isEventSupported('scroll', true),
  6695. 'This browser doesn\'t support the `onScroll` event'
  6696. ) : null);
  6697. }
  6698. var container = ReactMount.findReactContainerForID(id);
  6699. if (container) {
  6700. var doc = container.nodeType === ELEMENT_NODE_TYPE ?
  6701. container.ownerDocument :
  6702. container;
  6703. listenTo(registrationName, doc);
  6704. }
  6705. transaction.getPutListenerQueue().enqueuePutListener(
  6706. id,
  6707. registrationName,
  6708. listener
  6709. );
  6710. }
  6711. // For HTML, certain tags should omit their close tag. We keep a whitelist for
  6712. // those special cased tags.
  6713. var omittedCloseTags = {
  6714. 'area': true,
  6715. 'base': true,
  6716. 'br': true,
  6717. 'col': true,
  6718. 'embed': true,
  6719. 'hr': true,
  6720. 'img': true,
  6721. 'input': true,
  6722. 'keygen': true,
  6723. 'link': true,
  6724. 'meta': true,
  6725. 'param': true,
  6726. 'source': true,
  6727. 'track': true,
  6728. 'wbr': true
  6729. // NOTE: menuitem's close tag should be omitted, but that causes problems.
  6730. };
  6731. // We accept any tag to be rendered but since this gets injected into abitrary
  6732. // HTML, we want to make sure that it's a safe tag.
  6733. // http://www.w3.org/TR/REC-xml/#NT-Name
  6734. var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
  6735. var validatedTagCache = {};
  6736. var hasOwnProperty = {}.hasOwnProperty;
  6737. function validateDangerousTag(tag) {
  6738. if (!hasOwnProperty.call(validatedTagCache, tag)) {
  6739. ("production" !== "development" ? invariant(VALID_TAG_REGEX.test(tag), 'Invalid tag: %s', tag) : invariant(VALID_TAG_REGEX.test(tag)));
  6740. validatedTagCache[tag] = true;
  6741. }
  6742. }
  6743. /**
  6744. * Creates a new React class that is idempotent and capable of containing other
  6745. * React components. It accepts event listeners and DOM properties that are
  6746. * valid according to `DOMProperty`.
  6747. *
  6748. * - Event listeners: `onClick`, `onMouseDown`, etc.
  6749. * - DOM properties: `className`, `name`, `title`, etc.
  6750. *
  6751. * The `style` property functions differently from the DOM API. It accepts an
  6752. * object mapping of style properties to values.
  6753. *
  6754. * @constructor ReactDOMComponent
  6755. * @extends ReactMultiChild
  6756. */
  6757. function ReactDOMComponent(tag) {
  6758. validateDangerousTag(tag);
  6759. this._tag = tag;
  6760. this._renderedChildren = null;
  6761. this._previousStyleCopy = null;
  6762. this._rootNodeID = null;
  6763. }
  6764. ReactDOMComponent.displayName = 'ReactDOMComponent';
  6765. ReactDOMComponent.Mixin = {
  6766. construct: function(element) {
  6767. this._currentElement = element;
  6768. },
  6769. /**
  6770. * Generates root tag markup then recurses. This method has side effects and
  6771. * is not idempotent.
  6772. *
  6773. * @internal
  6774. * @param {string} rootID The root DOM ID for this node.
  6775. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  6776. * @return {string} The computed markup.
  6777. */
  6778. mountComponent: function(rootID, transaction, context) {
  6779. this._rootNodeID = rootID;
  6780. assertValidProps(this._currentElement.props);
  6781. var closeTag = omittedCloseTags[this._tag] ? '' : '</' + this._tag + '>';
  6782. return (
  6783. this._createOpenTagMarkupAndPutListeners(transaction) +
  6784. this._createContentMarkup(transaction, context) +
  6785. closeTag
  6786. );
  6787. },
  6788. /**
  6789. * Creates markup for the open tag and all attributes.
  6790. *
  6791. * This method has side effects because events get registered.
  6792. *
  6793. * Iterating over object properties is faster than iterating over arrays.
  6794. * @see http://jsperf.com/obj-vs-arr-iteration
  6795. *
  6796. * @private
  6797. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  6798. * @return {string} Markup of opening tag.
  6799. */
  6800. _createOpenTagMarkupAndPutListeners: function(transaction) {
  6801. var props = this._currentElement.props;
  6802. var ret = '<' + this._tag;
  6803. for (var propKey in props) {
  6804. if (!props.hasOwnProperty(propKey)) {
  6805. continue;
  6806. }
  6807. var propValue = props[propKey];
  6808. if (propValue == null) {
  6809. continue;
  6810. }
  6811. if (registrationNameModules.hasOwnProperty(propKey)) {
  6812. putListener(this._rootNodeID, propKey, propValue, transaction);
  6813. } else {
  6814. if (propKey === STYLE) {
  6815. if (propValue) {
  6816. propValue = this._previousStyleCopy = assign({}, props.style);
  6817. }
  6818. propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
  6819. }
  6820. var markup =
  6821. DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
  6822. if (markup) {
  6823. ret += ' ' + markup;
  6824. }
  6825. }
  6826. }
  6827. // For static pages, no need to put React ID and checksum. Saves lots of
  6828. // bytes.
  6829. if (transaction.renderToStaticMarkup) {
  6830. return ret + '>';
  6831. }
  6832. var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
  6833. return ret + ' ' + markupForID + '>';
  6834. },
  6835. /**
  6836. * Creates markup for the content between the tags.
  6837. *
  6838. * @private
  6839. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  6840. * @param {object} context
  6841. * @return {string} Content markup.
  6842. */
  6843. _createContentMarkup: function(transaction, context) {
  6844. var prefix = '';
  6845. if (this._tag === 'listing' ||
  6846. this._tag === 'pre' ||
  6847. this._tag === 'textarea') {
  6848. // Add an initial newline because browsers ignore the first newline in
  6849. // a <listing>, <pre>, or <textarea> as an "authoring convenience" -- see
  6850. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody.
  6851. prefix = '\n';
  6852. }
  6853. var props = this._currentElement.props;
  6854. // Intentional use of != to avoid catching zero/false.
  6855. var innerHTML = props.dangerouslySetInnerHTML;
  6856. if (innerHTML != null) {
  6857. if (innerHTML.__html != null) {
  6858. return prefix + innerHTML.__html;
  6859. }
  6860. } else {
  6861. var contentToUse =
  6862. CONTENT_TYPES[typeof props.children] ? props.children : null;
  6863. var childrenToUse = contentToUse != null ? null : props.children;
  6864. if (contentToUse != null) {
  6865. return prefix + escapeTextContentForBrowser(contentToUse);
  6866. } else if (childrenToUse != null) {
  6867. var mountImages = this.mountChildren(
  6868. childrenToUse,
  6869. transaction,
  6870. context
  6871. );
  6872. return prefix + mountImages.join('');
  6873. }
  6874. }
  6875. return prefix;
  6876. },
  6877. receiveComponent: function(nextElement, transaction, context) {
  6878. var prevElement = this._currentElement;
  6879. this._currentElement = nextElement;
  6880. this.updateComponent(transaction, prevElement, nextElement, context);
  6881. },
  6882. /**
  6883. * Updates a native DOM component after it has already been allocated and
  6884. * attached to the DOM. Reconciles the root DOM node, then recurses.
  6885. *
  6886. * @param {ReactReconcileTransaction} transaction
  6887. * @param {ReactElement} prevElement
  6888. * @param {ReactElement} nextElement
  6889. * @internal
  6890. * @overridable
  6891. */
  6892. updateComponent: function(transaction, prevElement, nextElement, context) {
  6893. assertValidProps(this._currentElement.props);
  6894. this._updateDOMProperties(prevElement.props, transaction);
  6895. this._updateDOMChildren(prevElement.props, transaction, context);
  6896. },
  6897. /**
  6898. * Reconciles the properties by detecting differences in property values and
  6899. * updating the DOM as necessary. This function is probably the single most
  6900. * critical path for performance optimization.
  6901. *
  6902. * TODO: Benchmark whether checking for changed values in memory actually
  6903. * improves performance (especially statically positioned elements).
  6904. * TODO: Benchmark the effects of putting this at the top since 99% of props
  6905. * do not change for a given reconciliation.
  6906. * TODO: Benchmark areas that can be improved with caching.
  6907. *
  6908. * @private
  6909. * @param {object} lastProps
  6910. * @param {ReactReconcileTransaction} transaction
  6911. */
  6912. _updateDOMProperties: function(lastProps, transaction) {
  6913. var nextProps = this._currentElement.props;
  6914. var propKey;
  6915. var styleName;
  6916. var styleUpdates;
  6917. for (propKey in lastProps) {
  6918. if (nextProps.hasOwnProperty(propKey) ||
  6919. !lastProps.hasOwnProperty(propKey)) {
  6920. continue;
  6921. }
  6922. if (propKey === STYLE) {
  6923. var lastStyle = this._previousStyleCopy;
  6924. for (styleName in lastStyle) {
  6925. if (lastStyle.hasOwnProperty(styleName)) {
  6926. styleUpdates = styleUpdates || {};
  6927. styleUpdates[styleName] = '';
  6928. }
  6929. }
  6930. this._previousStyleCopy = null;
  6931. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  6932. deleteListener(this._rootNodeID, propKey);
  6933. } else if (
  6934. DOMProperty.isStandardName[propKey] ||
  6935. DOMProperty.isCustomAttribute(propKey)) {
  6936. BackendIDOperations.deletePropertyByID(
  6937. this._rootNodeID,
  6938. propKey
  6939. );
  6940. }
  6941. }
  6942. for (propKey in nextProps) {
  6943. var nextProp = nextProps[propKey];
  6944. var lastProp = propKey === STYLE ?
  6945. this._previousStyleCopy :
  6946. lastProps[propKey];
  6947. if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
  6948. continue;
  6949. }
  6950. if (propKey === STYLE) {
  6951. if (nextProp) {
  6952. nextProp = this._previousStyleCopy = assign({}, nextProp);
  6953. }
  6954. if (lastProp) {
  6955. // Unset styles on `lastProp` but not on `nextProp`.
  6956. for (styleName in lastProp) {
  6957. if (lastProp.hasOwnProperty(styleName) &&
  6958. (!nextProp || !nextProp.hasOwnProperty(styleName))) {
  6959. styleUpdates = styleUpdates || {};
  6960. styleUpdates[styleName] = '';
  6961. }
  6962. }
  6963. // Update styles that changed since `lastProp`.
  6964. for (styleName in nextProp) {
  6965. if (nextProp.hasOwnProperty(styleName) &&
  6966. lastProp[styleName] !== nextProp[styleName]) {
  6967. styleUpdates = styleUpdates || {};
  6968. styleUpdates[styleName] = nextProp[styleName];
  6969. }
  6970. }
  6971. } else {
  6972. // Relies on `updateStylesByID` not mutating `styleUpdates`.
  6973. styleUpdates = nextProp;
  6974. }
  6975. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  6976. putListener(this._rootNodeID, propKey, nextProp, transaction);
  6977. } else if (
  6978. DOMProperty.isStandardName[propKey] ||
  6979. DOMProperty.isCustomAttribute(propKey)) {
  6980. BackendIDOperations.updatePropertyByID(
  6981. this._rootNodeID,
  6982. propKey,
  6983. nextProp
  6984. );
  6985. }
  6986. }
  6987. if (styleUpdates) {
  6988. BackendIDOperations.updateStylesByID(
  6989. this._rootNodeID,
  6990. styleUpdates
  6991. );
  6992. }
  6993. },
  6994. /**
  6995. * Reconciles the children with the various properties that affect the
  6996. * children content.
  6997. *
  6998. * @param {object} lastProps
  6999. * @param {ReactReconcileTransaction} transaction
  7000. */
  7001. _updateDOMChildren: function(lastProps, transaction, context) {
  7002. var nextProps = this._currentElement.props;
  7003. var lastContent =
  7004. CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
  7005. var nextContent =
  7006. CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
  7007. var lastHtml =
  7008. lastProps.dangerouslySetInnerHTML &&
  7009. lastProps.dangerouslySetInnerHTML.__html;
  7010. var nextHtml =
  7011. nextProps.dangerouslySetInnerHTML &&
  7012. nextProps.dangerouslySetInnerHTML.__html;
  7013. // Note the use of `!=` which checks for null or undefined.
  7014. var lastChildren = lastContent != null ? null : lastProps.children;
  7015. var nextChildren = nextContent != null ? null : nextProps.children;
  7016. // If we're switching from children to content/html or vice versa, remove
  7017. // the old content
  7018. var lastHasContentOrHtml = lastContent != null || lastHtml != null;
  7019. var nextHasContentOrHtml = nextContent != null || nextHtml != null;
  7020. if (lastChildren != null && nextChildren == null) {
  7021. this.updateChildren(null, transaction, context);
  7022. } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
  7023. this.updateTextContent('');
  7024. }
  7025. if (nextContent != null) {
  7026. if (lastContent !== nextContent) {
  7027. this.updateTextContent('' + nextContent);
  7028. }
  7029. } else if (nextHtml != null) {
  7030. if (lastHtml !== nextHtml) {
  7031. BackendIDOperations.updateInnerHTMLByID(
  7032. this._rootNodeID,
  7033. nextHtml
  7034. );
  7035. }
  7036. } else if (nextChildren != null) {
  7037. this.updateChildren(nextChildren, transaction, context);
  7038. }
  7039. },
  7040. /**
  7041. * Destroys all event registrations for this instance. Does not remove from
  7042. * the DOM. That must be done by the parent.
  7043. *
  7044. * @internal
  7045. */
  7046. unmountComponent: function() {
  7047. this.unmountChildren();
  7048. ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
  7049. ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
  7050. this._rootNodeID = null;
  7051. }
  7052. };
  7053. ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', {
  7054. mountComponent: 'mountComponent',
  7055. updateComponent: 'updateComponent'
  7056. });
  7057. assign(
  7058. ReactDOMComponent.prototype,
  7059. ReactDOMComponent.Mixin,
  7060. ReactMultiChild.Mixin
  7061. );
  7062. ReactDOMComponent.injection = {
  7063. injectIDOperations: function(IDOperations) {
  7064. ReactDOMComponent.BackendIDOperations = BackendIDOperations = IDOperations;
  7065. }
  7066. };
  7067. module.exports = ReactDOMComponent;
  7068. },{"10":10,"11":11,"116":116,"135":135,"136":136,"141":141,"154":154,"27":27,"30":30,"35":35,"5":5,"70":70,"71":71,"75":75}],43:[function(_dereq_,module,exports){
  7069. /**
  7070. * Copyright 2013-2015, Facebook, Inc.
  7071. * All rights reserved.
  7072. *
  7073. * This source code is licensed under the BSD-style license found in the
  7074. * LICENSE file in the root directory of this source tree. An additional grant
  7075. * of patent rights can be found in the PATENTS file in the same directory.
  7076. *
  7077. * @providesModule ReactDOMForm
  7078. */
  7079. 'use strict';
  7080. var EventConstants = _dereq_(15);
  7081. var LocalEventTrapMixin = _dereq_(25);
  7082. var ReactBrowserComponentMixin = _dereq_(29);
  7083. var ReactClass = _dereq_(33);
  7084. var ReactElement = _dereq_(57);
  7085. var form = ReactElement.createFactory('form');
  7086. /**
  7087. * Since onSubmit doesn't bubble OR capture on the top level in IE8, we need
  7088. * to capture it on the <form> element itself. There are lots of hacks we could
  7089. * do to accomplish this, but the most reliable is to make <form> a
  7090. * composite component and use `componentDidMount` to attach the event handlers.
  7091. */
  7092. var ReactDOMForm = ReactClass.createClass({
  7093. displayName: 'ReactDOMForm',
  7094. tagName: 'FORM',
  7095. mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
  7096. render: function() {
  7097. // TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
  7098. // `jshint` fails to parse JSX so in order for linting to work in the open
  7099. // source repo, we need to just use `ReactDOM.form`.
  7100. return form(this.props);
  7101. },
  7102. componentDidMount: function() {
  7103. this.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset');
  7104. this.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit');
  7105. }
  7106. });
  7107. module.exports = ReactDOMForm;
  7108. },{"15":15,"25":25,"29":29,"33":33,"57":57}],44:[function(_dereq_,module,exports){
  7109. /**
  7110. * Copyright 2013-2015, Facebook, Inc.
  7111. * All rights reserved.
  7112. *
  7113. * This source code is licensed under the BSD-style license found in the
  7114. * LICENSE file in the root directory of this source tree. An additional grant
  7115. * of patent rights can be found in the PATENTS file in the same directory.
  7116. *
  7117. * @providesModule ReactDOMIDOperations
  7118. * @typechecks static-only
  7119. */
  7120. /*jslint evil: true */
  7121. 'use strict';
  7122. var CSSPropertyOperations = _dereq_(5);
  7123. var DOMChildrenOperations = _dereq_(9);
  7124. var DOMPropertyOperations = _dereq_(11);
  7125. var ReactMount = _dereq_(70);
  7126. var ReactPerf = _dereq_(75);
  7127. var invariant = _dereq_(135);
  7128. var setInnerHTML = _dereq_(148);
  7129. /**
  7130. * Errors for properties that should not be updated with `updatePropertyById()`.
  7131. *
  7132. * @type {object}
  7133. * @private
  7134. */
  7135. var INVALID_PROPERTY_ERRORS = {
  7136. dangerouslySetInnerHTML:
  7137. '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
  7138. style: '`style` must be set using `updateStylesByID()`.'
  7139. };
  7140. /**
  7141. * Operations used to process updates to DOM nodes. This is made injectable via
  7142. * `ReactDOMComponent.BackendIDOperations`.
  7143. */
  7144. var ReactDOMIDOperations = {
  7145. /**
  7146. * Updates a DOM node with new property values. This should only be used to
  7147. * update DOM properties in `DOMProperty`.
  7148. *
  7149. * @param {string} id ID of the node to update.
  7150. * @param {string} name A valid property name, see `DOMProperty`.
  7151. * @param {*} value New value of the property.
  7152. * @internal
  7153. */
  7154. updatePropertyByID: function(id, name, value) {
  7155. var node = ReactMount.getNode(id);
  7156. ("production" !== "development" ? invariant(
  7157. !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
  7158. 'updatePropertyByID(...): %s',
  7159. INVALID_PROPERTY_ERRORS[name]
  7160. ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
  7161. // If we're updating to null or undefined, we should remove the property
  7162. // from the DOM node instead of inadvertantly setting to a string. This
  7163. // brings us in line with the same behavior we have on initial render.
  7164. if (value != null) {
  7165. DOMPropertyOperations.setValueForProperty(node, name, value);
  7166. } else {
  7167. DOMPropertyOperations.deleteValueForProperty(node, name);
  7168. }
  7169. },
  7170. /**
  7171. * Updates a DOM node to remove a property. This should only be used to remove
  7172. * DOM properties in `DOMProperty`.
  7173. *
  7174. * @param {string} id ID of the node to update.
  7175. * @param {string} name A property name to remove, see `DOMProperty`.
  7176. * @internal
  7177. */
  7178. deletePropertyByID: function(id, name, value) {
  7179. var node = ReactMount.getNode(id);
  7180. ("production" !== "development" ? invariant(
  7181. !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
  7182. 'updatePropertyByID(...): %s',
  7183. INVALID_PROPERTY_ERRORS[name]
  7184. ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
  7185. DOMPropertyOperations.deleteValueForProperty(node, name, value);
  7186. },
  7187. /**
  7188. * Updates a DOM node with new style values. If a value is specified as '',
  7189. * the corresponding style property will be unset.
  7190. *
  7191. * @param {string} id ID of the node to update.
  7192. * @param {object} styles Mapping from styles to values.
  7193. * @internal
  7194. */
  7195. updateStylesByID: function(id, styles) {
  7196. var node = ReactMount.getNode(id);
  7197. CSSPropertyOperations.setValueForStyles(node, styles);
  7198. },
  7199. /**
  7200. * Updates a DOM node's innerHTML.
  7201. *
  7202. * @param {string} id ID of the node to update.
  7203. * @param {string} html An HTML string.
  7204. * @internal
  7205. */
  7206. updateInnerHTMLByID: function(id, html) {
  7207. var node = ReactMount.getNode(id);
  7208. setInnerHTML(node, html);
  7209. },
  7210. /**
  7211. * Updates a DOM node's text content set by `props.content`.
  7212. *
  7213. * @param {string} id ID of the node to update.
  7214. * @param {string} content Text content.
  7215. * @internal
  7216. */
  7217. updateTextContentByID: function(id, content) {
  7218. var node = ReactMount.getNode(id);
  7219. DOMChildrenOperations.updateTextContent(node, content);
  7220. },
  7221. /**
  7222. * Replaces a DOM node that exists in the document with markup.
  7223. *
  7224. * @param {string} id ID of child to be replaced.
  7225. * @param {string} markup Dangerous markup to inject in place of child.
  7226. * @internal
  7227. * @see {Danger.dangerouslyReplaceNodeWithMarkup}
  7228. */
  7229. dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {
  7230. var node = ReactMount.getNode(id);
  7231. DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
  7232. },
  7233. /**
  7234. * Updates a component's children by processing a series of updates.
  7235. *
  7236. * @param {array<object>} updates List of update configurations.
  7237. * @param {array<string>} markup List of markup strings.
  7238. * @internal
  7239. */
  7240. dangerouslyProcessChildrenUpdates: function(updates, markup) {
  7241. for (var i = 0; i < updates.length; i++) {
  7242. updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
  7243. }
  7244. DOMChildrenOperations.processUpdates(updates, markup);
  7245. }
  7246. };
  7247. ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
  7248. updatePropertyByID: 'updatePropertyByID',
  7249. deletePropertyByID: 'deletePropertyByID',
  7250. updateStylesByID: 'updateStylesByID',
  7251. updateInnerHTMLByID: 'updateInnerHTMLByID',
  7252. updateTextContentByID: 'updateTextContentByID',
  7253. dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
  7254. dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
  7255. });
  7256. module.exports = ReactDOMIDOperations;
  7257. },{"11":11,"135":135,"148":148,"5":5,"70":70,"75":75,"9":9}],45:[function(_dereq_,module,exports){
  7258. /**
  7259. * Copyright 2013-2015, Facebook, Inc.
  7260. * All rights reserved.
  7261. *
  7262. * This source code is licensed under the BSD-style license found in the
  7263. * LICENSE file in the root directory of this source tree. An additional grant
  7264. * of patent rights can be found in the PATENTS file in the same directory.
  7265. *
  7266. * @providesModule ReactDOMIframe
  7267. */
  7268. 'use strict';
  7269. var EventConstants = _dereq_(15);
  7270. var LocalEventTrapMixin = _dereq_(25);
  7271. var ReactBrowserComponentMixin = _dereq_(29);
  7272. var ReactClass = _dereq_(33);
  7273. var ReactElement = _dereq_(57);
  7274. var iframe = ReactElement.createFactory('iframe');
  7275. /**
  7276. * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
  7277. * capture it on the <iframe> element itself. There are lots of hacks we could
  7278. * do to accomplish this, but the most reliable is to make <iframe> a composite
  7279. * component and use `componentDidMount` to attach the event handlers.
  7280. */
  7281. var ReactDOMIframe = ReactClass.createClass({
  7282. displayName: 'ReactDOMIframe',
  7283. tagName: 'IFRAME',
  7284. mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
  7285. render: function() {
  7286. return iframe(this.props);
  7287. },
  7288. componentDidMount: function() {
  7289. this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
  7290. }
  7291. });
  7292. module.exports = ReactDOMIframe;
  7293. },{"15":15,"25":25,"29":29,"33":33,"57":57}],46:[function(_dereq_,module,exports){
  7294. /**
  7295. * Copyright 2013-2015, Facebook, Inc.
  7296. * All rights reserved.
  7297. *
  7298. * This source code is licensed under the BSD-style license found in the
  7299. * LICENSE file in the root directory of this source tree. An additional grant
  7300. * of patent rights can be found in the PATENTS file in the same directory.
  7301. *
  7302. * @providesModule ReactDOMImg
  7303. */
  7304. 'use strict';
  7305. var EventConstants = _dereq_(15);
  7306. var LocalEventTrapMixin = _dereq_(25);
  7307. var ReactBrowserComponentMixin = _dereq_(29);
  7308. var ReactClass = _dereq_(33);
  7309. var ReactElement = _dereq_(57);
  7310. var img = ReactElement.createFactory('img');
  7311. /**
  7312. * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
  7313. * capture it on the <img> element itself. There are lots of hacks we could do
  7314. * to accomplish this, but the most reliable is to make <img> a composite
  7315. * component and use `componentDidMount` to attach the event handlers.
  7316. */
  7317. var ReactDOMImg = ReactClass.createClass({
  7318. displayName: 'ReactDOMImg',
  7319. tagName: 'IMG',
  7320. mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
  7321. render: function() {
  7322. return img(this.props);
  7323. },
  7324. componentDidMount: function() {
  7325. this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
  7326. this.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error');
  7327. }
  7328. });
  7329. module.exports = ReactDOMImg;
  7330. },{"15":15,"25":25,"29":29,"33":33,"57":57}],47:[function(_dereq_,module,exports){
  7331. /**
  7332. * Copyright 2013-2015, Facebook, Inc.
  7333. * All rights reserved.
  7334. *
  7335. * This source code is licensed under the BSD-style license found in the
  7336. * LICENSE file in the root directory of this source tree. An additional grant
  7337. * of patent rights can be found in the PATENTS file in the same directory.
  7338. *
  7339. * @providesModule ReactDOMInput
  7340. */
  7341. 'use strict';
  7342. var AutoFocusMixin = _dereq_(2);
  7343. var DOMPropertyOperations = _dereq_(11);
  7344. var LinkedValueUtils = _dereq_(24);
  7345. var ReactBrowserComponentMixin = _dereq_(29);
  7346. var ReactClass = _dereq_(33);
  7347. var ReactElement = _dereq_(57);
  7348. var ReactMount = _dereq_(70);
  7349. var ReactUpdates = _dereq_(87);
  7350. var assign = _dereq_(27);
  7351. var invariant = _dereq_(135);
  7352. var input = ReactElement.createFactory('input');
  7353. var instancesByReactID = {};
  7354. function forceUpdateIfMounted() {
  7355. /*jshint validthis:true */
  7356. if (this.isMounted()) {
  7357. this.forceUpdate();
  7358. }
  7359. }
  7360. /**
  7361. * Implements an <input> native component that allows setting these optional
  7362. * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
  7363. *
  7364. * If `checked` or `value` are not supplied (or null/undefined), user actions
  7365. * that affect the checked state or value will trigger updates to the element.
  7366. *
  7367. * If they are supplied (and not null/undefined), the rendered element will not
  7368. * trigger updates to the element. Instead, the props must change in order for
  7369. * the rendered element to be updated.
  7370. *
  7371. * The rendered element will be initialized as unchecked (or `defaultChecked`)
  7372. * with an empty value (or `defaultValue`).
  7373. *
  7374. * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
  7375. */
  7376. var ReactDOMInput = ReactClass.createClass({
  7377. displayName: 'ReactDOMInput',
  7378. tagName: 'INPUT',
  7379. mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
  7380. getInitialState: function() {
  7381. var defaultValue = this.props.defaultValue;
  7382. return {
  7383. initialChecked: this.props.defaultChecked || false,
  7384. initialValue: defaultValue != null ? defaultValue : null
  7385. };
  7386. },
  7387. render: function() {
  7388. // Clone `this.props` so we don't mutate the input.
  7389. var props = assign({}, this.props);
  7390. props.defaultChecked = null;
  7391. props.defaultValue = null;
  7392. var value = LinkedValueUtils.getValue(this);
  7393. props.value = value != null ? value : this.state.initialValue;
  7394. var checked = LinkedValueUtils.getChecked(this);
  7395. props.checked = checked != null ? checked : this.state.initialChecked;
  7396. props.onChange = this._handleChange;
  7397. return input(props, this.props.children);
  7398. },
  7399. componentDidMount: function() {
  7400. var id = ReactMount.getID(this.getDOMNode());
  7401. instancesByReactID[id] = this;
  7402. },
  7403. componentWillUnmount: function() {
  7404. var rootNode = this.getDOMNode();
  7405. var id = ReactMount.getID(rootNode);
  7406. delete instancesByReactID[id];
  7407. },
  7408. componentDidUpdate: function(prevProps, prevState, prevContext) {
  7409. var rootNode = this.getDOMNode();
  7410. if (this.props.checked != null) {
  7411. DOMPropertyOperations.setValueForProperty(
  7412. rootNode,
  7413. 'checked',
  7414. this.props.checked || false
  7415. );
  7416. }
  7417. var value = LinkedValueUtils.getValue(this);
  7418. if (value != null) {
  7419. // Cast `value` to a string to ensure the value is set correctly. While
  7420. // browsers typically do this as necessary, jsdom doesn't.
  7421. DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
  7422. }
  7423. },
  7424. _handleChange: function(event) {
  7425. var returnValue;
  7426. var onChange = LinkedValueUtils.getOnChange(this);
  7427. if (onChange) {
  7428. returnValue = onChange.call(this, event);
  7429. }
  7430. // Here we use asap to wait until all updates have propagated, which
  7431. // is important when using controlled components within layers:
  7432. // https://github.com/facebook/react/issues/1698
  7433. ReactUpdates.asap(forceUpdateIfMounted, this);
  7434. var name = this.props.name;
  7435. if (this.props.type === 'radio' && name != null) {
  7436. var rootNode = this.getDOMNode();
  7437. var queryRoot = rootNode;
  7438. while (queryRoot.parentNode) {
  7439. queryRoot = queryRoot.parentNode;
  7440. }
  7441. // If `rootNode.form` was non-null, then we could try `form.elements`,
  7442. // but that sometimes behaves strangely in IE8. We could also try using
  7443. // `form.getElementsByName`, but that will only return direct children
  7444. // and won't include inputs that use the HTML5 `form=` attribute. Since
  7445. // the input might not even be in a form, let's just use the global
  7446. // `querySelectorAll` to ensure we don't miss anything.
  7447. var group = queryRoot.querySelectorAll(
  7448. 'input[name=' + JSON.stringify('' + name) + '][type="radio"]');
  7449. for (var i = 0, groupLen = group.length; i < groupLen; i++) {
  7450. var otherNode = group[i];
  7451. if (otherNode === rootNode ||
  7452. otherNode.form !== rootNode.form) {
  7453. continue;
  7454. }
  7455. var otherID = ReactMount.getID(otherNode);
  7456. ("production" !== "development" ? invariant(
  7457. otherID,
  7458. 'ReactDOMInput: Mixing React and non-React radio inputs with the ' +
  7459. 'same `name` is not supported.'
  7460. ) : invariant(otherID));
  7461. var otherInstance = instancesByReactID[otherID];
  7462. ("production" !== "development" ? invariant(
  7463. otherInstance,
  7464. 'ReactDOMInput: Unknown radio button ID %s.',
  7465. otherID
  7466. ) : invariant(otherInstance));
  7467. // If this is a controlled radio button group, forcing the input that
  7468. // was previously checked to update will cause it to be come re-checked
  7469. // as appropriate.
  7470. ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
  7471. }
  7472. }
  7473. return returnValue;
  7474. }
  7475. });
  7476. module.exports = ReactDOMInput;
  7477. },{"11":11,"135":135,"2":2,"24":24,"27":27,"29":29,"33":33,"57":57,"70":70,"87":87}],48:[function(_dereq_,module,exports){
  7478. /**
  7479. * Copyright 2013-2015, Facebook, Inc.
  7480. * All rights reserved.
  7481. *
  7482. * This source code is licensed under the BSD-style license found in the
  7483. * LICENSE file in the root directory of this source tree. An additional grant
  7484. * of patent rights can be found in the PATENTS file in the same directory.
  7485. *
  7486. * @providesModule ReactDOMOption
  7487. */
  7488. 'use strict';
  7489. var ReactBrowserComponentMixin = _dereq_(29);
  7490. var ReactClass = _dereq_(33);
  7491. var ReactElement = _dereq_(57);
  7492. var warning = _dereq_(154);
  7493. var option = ReactElement.createFactory('option');
  7494. /**
  7495. * Implements an <option> native component that warns when `selected` is set.
  7496. */
  7497. var ReactDOMOption = ReactClass.createClass({
  7498. displayName: 'ReactDOMOption',
  7499. tagName: 'OPTION',
  7500. mixins: [ReactBrowserComponentMixin],
  7501. componentWillMount: function() {
  7502. // TODO (yungsters): Remove support for `selected` in <option>.
  7503. if ("production" !== "development") {
  7504. ("production" !== "development" ? warning(
  7505. this.props.selected == null,
  7506. 'Use the `defaultValue` or `value` props on <select> instead of ' +
  7507. 'setting `selected` on <option>.'
  7508. ) : null);
  7509. }
  7510. },
  7511. render: function() {
  7512. return option(this.props, this.props.children);
  7513. }
  7514. });
  7515. module.exports = ReactDOMOption;
  7516. },{"154":154,"29":29,"33":33,"57":57}],49:[function(_dereq_,module,exports){
  7517. /**
  7518. * Copyright 2013-2015, Facebook, Inc.
  7519. * All rights reserved.
  7520. *
  7521. * This source code is licensed under the BSD-style license found in the
  7522. * LICENSE file in the root directory of this source tree. An additional grant
  7523. * of patent rights can be found in the PATENTS file in the same directory.
  7524. *
  7525. * @providesModule ReactDOMSelect
  7526. */
  7527. 'use strict';
  7528. var AutoFocusMixin = _dereq_(2);
  7529. var LinkedValueUtils = _dereq_(24);
  7530. var ReactBrowserComponentMixin = _dereq_(29);
  7531. var ReactClass = _dereq_(33);
  7532. var ReactElement = _dereq_(57);
  7533. var ReactUpdates = _dereq_(87);
  7534. var assign = _dereq_(27);
  7535. var select = ReactElement.createFactory('select');
  7536. function updateOptionsIfPendingUpdateAndMounted() {
  7537. /*jshint validthis:true */
  7538. if (this._pendingUpdate) {
  7539. this._pendingUpdate = false;
  7540. var value = LinkedValueUtils.getValue(this);
  7541. if (value != null && this.isMounted()) {
  7542. updateOptions(this, value);
  7543. }
  7544. }
  7545. }
  7546. /**
  7547. * Validation function for `value` and `defaultValue`.
  7548. * @private
  7549. */
  7550. function selectValueType(props, propName, componentName) {
  7551. if (props[propName] == null) {
  7552. return null;
  7553. }
  7554. if (props.multiple) {
  7555. if (!Array.isArray(props[propName])) {
  7556. return new Error(
  7557. ("The `" + propName + "` prop supplied to <select> must be an array if ") +
  7558. ("`multiple` is true.")
  7559. );
  7560. }
  7561. } else {
  7562. if (Array.isArray(props[propName])) {
  7563. return new Error(
  7564. ("The `" + propName + "` prop supplied to <select> must be a scalar ") +
  7565. ("value if `multiple` is false.")
  7566. );
  7567. }
  7568. }
  7569. }
  7570. /**
  7571. * @param {ReactComponent} component Instance of ReactDOMSelect
  7572. * @param {*} propValue A stringable (with `multiple`, a list of stringables).
  7573. * @private
  7574. */
  7575. function updateOptions(component, propValue) {
  7576. var selectedValue, i, l;
  7577. var options = component.getDOMNode().options;
  7578. if (component.props.multiple) {
  7579. selectedValue = {};
  7580. for (i = 0, l = propValue.length; i < l; i++) {
  7581. selectedValue['' + propValue[i]] = true;
  7582. }
  7583. for (i = 0, l = options.length; i < l; i++) {
  7584. var selected = selectedValue.hasOwnProperty(options[i].value);
  7585. if (options[i].selected !== selected) {
  7586. options[i].selected = selected;
  7587. }
  7588. }
  7589. } else {
  7590. // Do not set `select.value` as exact behavior isn't consistent across all
  7591. // browsers for all cases.
  7592. selectedValue = '' + propValue;
  7593. for (i = 0, l = options.length; i < l; i++) {
  7594. if (options[i].value === selectedValue) {
  7595. options[i].selected = true;
  7596. return;
  7597. }
  7598. }
  7599. if (options.length) {
  7600. options[0].selected = true;
  7601. }
  7602. }
  7603. }
  7604. /**
  7605. * Implements a <select> native component that allows optionally setting the
  7606. * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
  7607. * stringable. If `multiple` is true, the prop must be an array of stringables.
  7608. *
  7609. * If `value` is not supplied (or null/undefined), user actions that change the
  7610. * selected option will trigger updates to the rendered options.
  7611. *
  7612. * If it is supplied (and not null/undefined), the rendered options will not
  7613. * update in response to user actions. Instead, the `value` prop must change in
  7614. * order for the rendered options to update.
  7615. *
  7616. * If `defaultValue` is provided, any options with the supplied values will be
  7617. * selected.
  7618. */
  7619. var ReactDOMSelect = ReactClass.createClass({
  7620. displayName: 'ReactDOMSelect',
  7621. tagName: 'SELECT',
  7622. mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
  7623. propTypes: {
  7624. defaultValue: selectValueType,
  7625. value: selectValueType
  7626. },
  7627. render: function() {
  7628. // Clone `this.props` so we don't mutate the input.
  7629. var props = assign({}, this.props);
  7630. props.onChange = this._handleChange;
  7631. props.value = null;
  7632. return select(props, this.props.children);
  7633. },
  7634. componentWillMount: function() {
  7635. this._pendingUpdate = false;
  7636. },
  7637. componentDidMount: function() {
  7638. var value = LinkedValueUtils.getValue(this);
  7639. if (value != null) {
  7640. updateOptions(this, value);
  7641. } else if (this.props.defaultValue != null) {
  7642. updateOptions(this, this.props.defaultValue);
  7643. }
  7644. },
  7645. componentDidUpdate: function(prevProps) {
  7646. var value = LinkedValueUtils.getValue(this);
  7647. if (value != null) {
  7648. this._pendingUpdate = false;
  7649. updateOptions(this, value);
  7650. } else if (!prevProps.multiple !== !this.props.multiple) {
  7651. // For simplicity, reapply `defaultValue` if `multiple` is toggled.
  7652. if (this.props.defaultValue != null) {
  7653. updateOptions(this, this.props.defaultValue);
  7654. } else {
  7655. // Revert the select back to its default unselected state.
  7656. updateOptions(this, this.props.multiple ? [] : '');
  7657. }
  7658. }
  7659. },
  7660. _handleChange: function(event) {
  7661. var returnValue;
  7662. var onChange = LinkedValueUtils.getOnChange(this);
  7663. if (onChange) {
  7664. returnValue = onChange.call(this, event);
  7665. }
  7666. this._pendingUpdate = true;
  7667. ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
  7668. return returnValue;
  7669. }
  7670. });
  7671. module.exports = ReactDOMSelect;
  7672. },{"2":2,"24":24,"27":27,"29":29,"33":33,"57":57,"87":87}],50:[function(_dereq_,module,exports){
  7673. /**
  7674. * Copyright 2013-2015, Facebook, Inc.
  7675. * All rights reserved.
  7676. *
  7677. * This source code is licensed under the BSD-style license found in the
  7678. * LICENSE file in the root directory of this source tree. An additional grant
  7679. * of patent rights can be found in the PATENTS file in the same directory.
  7680. *
  7681. * @providesModule ReactDOMSelection
  7682. */
  7683. 'use strict';
  7684. var ExecutionEnvironment = _dereq_(21);
  7685. var getNodeForCharacterOffset = _dereq_(128);
  7686. var getTextContentAccessor = _dereq_(130);
  7687. /**
  7688. * While `isCollapsed` is available on the Selection object and `collapsed`
  7689. * is available on the Range object, IE11 sometimes gets them wrong.
  7690. * If the anchor/focus nodes and offsets are the same, the range is collapsed.
  7691. */
  7692. function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
  7693. return anchorNode === focusNode && anchorOffset === focusOffset;
  7694. }
  7695. /**
  7696. * Get the appropriate anchor and focus node/offset pairs for IE.
  7697. *
  7698. * The catch here is that IE's selection API doesn't provide information
  7699. * about whether the selection is forward or backward, so we have to
  7700. * behave as though it's always forward.
  7701. *
  7702. * IE text differs from modern selection in that it behaves as though
  7703. * block elements end with a new line. This means character offsets will
  7704. * differ between the two APIs.
  7705. *
  7706. * @param {DOMElement} node
  7707. * @return {object}
  7708. */
  7709. function getIEOffsets(node) {
  7710. var selection = document.selection;
  7711. var selectedRange = selection.createRange();
  7712. var selectedLength = selectedRange.text.length;
  7713. // Duplicate selection so we can move range without breaking user selection.
  7714. var fromStart = selectedRange.duplicate();
  7715. fromStart.moveToElementText(node);
  7716. fromStart.setEndPoint('EndToStart', selectedRange);
  7717. var startOffset = fromStart.text.length;
  7718. var endOffset = startOffset + selectedLength;
  7719. return {
  7720. start: startOffset,
  7721. end: endOffset
  7722. };
  7723. }
  7724. /**
  7725. * @param {DOMElement} node
  7726. * @return {?object}
  7727. */
  7728. function getModernOffsets(node) {
  7729. var selection = window.getSelection && window.getSelection();
  7730. if (!selection || selection.rangeCount === 0) {
  7731. return null;
  7732. }
  7733. var anchorNode = selection.anchorNode;
  7734. var anchorOffset = selection.anchorOffset;
  7735. var focusNode = selection.focusNode;
  7736. var focusOffset = selection.focusOffset;
  7737. var currentRange = selection.getRangeAt(0);
  7738. // If the node and offset values are the same, the selection is collapsed.
  7739. // `Selection.isCollapsed` is available natively, but IE sometimes gets
  7740. // this value wrong.
  7741. var isSelectionCollapsed = isCollapsed(
  7742. selection.anchorNode,
  7743. selection.anchorOffset,
  7744. selection.focusNode,
  7745. selection.focusOffset
  7746. );
  7747. var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
  7748. var tempRange = currentRange.cloneRange();
  7749. tempRange.selectNodeContents(node);
  7750. tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
  7751. var isTempRangeCollapsed = isCollapsed(
  7752. tempRange.startContainer,
  7753. tempRange.startOffset,
  7754. tempRange.endContainer,
  7755. tempRange.endOffset
  7756. );
  7757. var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
  7758. var end = start + rangeLength;
  7759. // Detect whether the selection is backward.
  7760. var detectionRange = document.createRange();
  7761. detectionRange.setStart(anchorNode, anchorOffset);
  7762. detectionRange.setEnd(focusNode, focusOffset);
  7763. var isBackward = detectionRange.collapsed;
  7764. return {
  7765. start: isBackward ? end : start,
  7766. end: isBackward ? start : end
  7767. };
  7768. }
  7769. /**
  7770. * @param {DOMElement|DOMTextNode} node
  7771. * @param {object} offsets
  7772. */
  7773. function setIEOffsets(node, offsets) {
  7774. var range = document.selection.createRange().duplicate();
  7775. var start, end;
  7776. if (typeof offsets.end === 'undefined') {
  7777. start = offsets.start;
  7778. end = start;
  7779. } else if (offsets.start > offsets.end) {
  7780. start = offsets.end;
  7781. end = offsets.start;
  7782. } else {
  7783. start = offsets.start;
  7784. end = offsets.end;
  7785. }
  7786. range.moveToElementText(node);
  7787. range.moveStart('character', start);
  7788. range.setEndPoint('EndToStart', range);
  7789. range.moveEnd('character', end - start);
  7790. range.select();
  7791. }
  7792. /**
  7793. * In modern non-IE browsers, we can support both forward and backward
  7794. * selections.
  7795. *
  7796. * Note: IE10+ supports the Selection object, but it does not support
  7797. * the `extend` method, which means that even in modern IE, it's not possible
  7798. * to programatically create a backward selection. Thus, for all IE
  7799. * versions, we use the old IE API to create our selections.
  7800. *
  7801. * @param {DOMElement|DOMTextNode} node
  7802. * @param {object} offsets
  7803. */
  7804. function setModernOffsets(node, offsets) {
  7805. if (!window.getSelection) {
  7806. return;
  7807. }
  7808. var selection = window.getSelection();
  7809. var length = node[getTextContentAccessor()].length;
  7810. var start = Math.min(offsets.start, length);
  7811. var end = typeof offsets.end === 'undefined' ?
  7812. start : Math.min(offsets.end, length);
  7813. // IE 11 uses modern selection, but doesn't support the extend method.
  7814. // Flip backward selections, so we can set with a single range.
  7815. if (!selection.extend && start > end) {
  7816. var temp = end;
  7817. end = start;
  7818. start = temp;
  7819. }
  7820. var startMarker = getNodeForCharacterOffset(node, start);
  7821. var endMarker = getNodeForCharacterOffset(node, end);
  7822. if (startMarker && endMarker) {
  7823. var range = document.createRange();
  7824. range.setStart(startMarker.node, startMarker.offset);
  7825. selection.removeAllRanges();
  7826. if (start > end) {
  7827. selection.addRange(range);
  7828. selection.extend(endMarker.node, endMarker.offset);
  7829. } else {
  7830. range.setEnd(endMarker.node, endMarker.offset);
  7831. selection.addRange(range);
  7832. }
  7833. }
  7834. }
  7835. var useIEOffsets = (
  7836. ExecutionEnvironment.canUseDOM &&
  7837. 'selection' in document &&
  7838. !('getSelection' in window)
  7839. );
  7840. var ReactDOMSelection = {
  7841. /**
  7842. * @param {DOMElement} node
  7843. */
  7844. getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
  7845. /**
  7846. * @param {DOMElement|DOMTextNode} node
  7847. * @param {object} offsets
  7848. */
  7849. setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
  7850. };
  7851. module.exports = ReactDOMSelection;
  7852. },{"128":128,"130":130,"21":21}],51:[function(_dereq_,module,exports){
  7853. /**
  7854. * Copyright 2013-2015, Facebook, Inc.
  7855. * All rights reserved.
  7856. *
  7857. * This source code is licensed under the BSD-style license found in the
  7858. * LICENSE file in the root directory of this source tree. An additional grant
  7859. * of patent rights can be found in the PATENTS file in the same directory.
  7860. *
  7861. * @providesModule ReactDOMTextComponent
  7862. * @typechecks static-only
  7863. */
  7864. 'use strict';
  7865. var DOMPropertyOperations = _dereq_(11);
  7866. var ReactComponentBrowserEnvironment =
  7867. _dereq_(35);
  7868. var ReactDOMComponent = _dereq_(42);
  7869. var assign = _dereq_(27);
  7870. var escapeTextContentForBrowser = _dereq_(116);
  7871. /**
  7872. * Text nodes violate a couple assumptions that React makes about components:
  7873. *
  7874. * - When mounting text into the DOM, adjacent text nodes are merged.
  7875. * - Text nodes cannot be assigned a React root ID.
  7876. *
  7877. * This component is used to wrap strings in elements so that they can undergo
  7878. * the same reconciliation that is applied to elements.
  7879. *
  7880. * TODO: Investigate representing React components in the DOM with text nodes.
  7881. *
  7882. * @class ReactDOMTextComponent
  7883. * @extends ReactComponent
  7884. * @internal
  7885. */
  7886. var ReactDOMTextComponent = function(props) {
  7887. // This constructor and its argument is currently used by mocks.
  7888. };
  7889. assign(ReactDOMTextComponent.prototype, {
  7890. /**
  7891. * @param {ReactText} text
  7892. * @internal
  7893. */
  7894. construct: function(text) {
  7895. // TODO: This is really a ReactText (ReactNode), not a ReactElement
  7896. this._currentElement = text;
  7897. this._stringText = '' + text;
  7898. // Properties
  7899. this._rootNodeID = null;
  7900. this._mountIndex = 0;
  7901. },
  7902. /**
  7903. * Creates the markup for this text node. This node is not intended to have
  7904. * any features besides containing text content.
  7905. *
  7906. * @param {string} rootID DOM ID of the root node.
  7907. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  7908. * @return {string} Markup for this text node.
  7909. * @internal
  7910. */
  7911. mountComponent: function(rootID, transaction, context) {
  7912. this._rootNodeID = rootID;
  7913. var escapedText = escapeTextContentForBrowser(this._stringText);
  7914. if (transaction.renderToStaticMarkup) {
  7915. // Normally we'd wrap this in a `span` for the reasons stated above, but
  7916. // since this is a situation where React won't take over (static pages),
  7917. // we can simply return the text as it is.
  7918. return escapedText;
  7919. }
  7920. return (
  7921. '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' +
  7922. escapedText +
  7923. '</span>'
  7924. );
  7925. },
  7926. /**
  7927. * Updates this component by updating the text content.
  7928. *
  7929. * @param {ReactText} nextText The next text content
  7930. * @param {ReactReconcileTransaction} transaction
  7931. * @internal
  7932. */
  7933. receiveComponent: function(nextText, transaction) {
  7934. if (nextText !== this._currentElement) {
  7935. this._currentElement = nextText;
  7936. var nextStringText = '' + nextText;
  7937. if (nextStringText !== this._stringText) {
  7938. // TODO: Save this as pending props and use performUpdateIfNecessary
  7939. // and/or updateComponent to do the actual update for consistency with
  7940. // other component types?
  7941. this._stringText = nextStringText;
  7942. ReactDOMComponent.BackendIDOperations.updateTextContentByID(
  7943. this._rootNodeID,
  7944. nextStringText
  7945. );
  7946. }
  7947. }
  7948. },
  7949. unmountComponent: function() {
  7950. ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
  7951. }
  7952. });
  7953. module.exports = ReactDOMTextComponent;
  7954. },{"11":11,"116":116,"27":27,"35":35,"42":42}],52:[function(_dereq_,module,exports){
  7955. /**
  7956. * Copyright 2013-2015, Facebook, Inc.
  7957. * All rights reserved.
  7958. *
  7959. * This source code is licensed under the BSD-style license found in the
  7960. * LICENSE file in the root directory of this source tree. An additional grant
  7961. * of patent rights can be found in the PATENTS file in the same directory.
  7962. *
  7963. * @providesModule ReactDOMTextarea
  7964. */
  7965. 'use strict';
  7966. var AutoFocusMixin = _dereq_(2);
  7967. var DOMPropertyOperations = _dereq_(11);
  7968. var LinkedValueUtils = _dereq_(24);
  7969. var ReactBrowserComponentMixin = _dereq_(29);
  7970. var ReactClass = _dereq_(33);
  7971. var ReactElement = _dereq_(57);
  7972. var ReactUpdates = _dereq_(87);
  7973. var assign = _dereq_(27);
  7974. var invariant = _dereq_(135);
  7975. var warning = _dereq_(154);
  7976. var textarea = ReactElement.createFactory('textarea');
  7977. function forceUpdateIfMounted() {
  7978. /*jshint validthis:true */
  7979. if (this.isMounted()) {
  7980. this.forceUpdate();
  7981. }
  7982. }
  7983. /**
  7984. * Implements a <textarea> native component that allows setting `value`, and
  7985. * `defaultValue`. This differs from the traditional DOM API because value is
  7986. * usually set as PCDATA children.
  7987. *
  7988. * If `value` is not supplied (or null/undefined), user actions that affect the
  7989. * value will trigger updates to the element.
  7990. *
  7991. * If `value` is supplied (and not null/undefined), the rendered element will
  7992. * not trigger updates to the element. Instead, the `value` prop must change in
  7993. * order for the rendered element to be updated.
  7994. *
  7995. * The rendered element will be initialized with an empty value, the prop
  7996. * `defaultValue` if specified, or the children content (deprecated).
  7997. */
  7998. var ReactDOMTextarea = ReactClass.createClass({
  7999. displayName: 'ReactDOMTextarea',
  8000. tagName: 'TEXTAREA',
  8001. mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
  8002. getInitialState: function() {
  8003. var defaultValue = this.props.defaultValue;
  8004. // TODO (yungsters): Remove support for children content in <textarea>.
  8005. var children = this.props.children;
  8006. if (children != null) {
  8007. if ("production" !== "development") {
  8008. ("production" !== "development" ? warning(
  8009. false,
  8010. 'Use the `defaultValue` or `value` props instead of setting ' +
  8011. 'children on <textarea>.'
  8012. ) : null);
  8013. }
  8014. ("production" !== "development" ? invariant(
  8015. defaultValue == null,
  8016. 'If you supply `defaultValue` on a <textarea>, do not pass children.'
  8017. ) : invariant(defaultValue == null));
  8018. if (Array.isArray(children)) {
  8019. ("production" !== "development" ? invariant(
  8020. children.length <= 1,
  8021. '<textarea> can only have at most one child.'
  8022. ) : invariant(children.length <= 1));
  8023. children = children[0];
  8024. }
  8025. defaultValue = '' + children;
  8026. }
  8027. if (defaultValue == null) {
  8028. defaultValue = '';
  8029. }
  8030. var value = LinkedValueUtils.getValue(this);
  8031. return {
  8032. // We save the initial value so that `ReactDOMComponent` doesn't update
  8033. // `textContent` (unnecessary since we update value).
  8034. // The initial value can be a boolean or object so that's why it's
  8035. // forced to be a string.
  8036. initialValue: '' + (value != null ? value : defaultValue)
  8037. };
  8038. },
  8039. render: function() {
  8040. // Clone `this.props` so we don't mutate the input.
  8041. var props = assign({}, this.props);
  8042. ("production" !== "development" ? invariant(
  8043. props.dangerouslySetInnerHTML == null,
  8044. '`dangerouslySetInnerHTML` does not make sense on <textarea>.'
  8045. ) : invariant(props.dangerouslySetInnerHTML == null));
  8046. props.defaultValue = null;
  8047. props.value = null;
  8048. props.onChange = this._handleChange;
  8049. // Always set children to the same thing. In IE9, the selection range will
  8050. // get reset if `textContent` is mutated.
  8051. return textarea(props, this.state.initialValue);
  8052. },
  8053. componentDidUpdate: function(prevProps, prevState, prevContext) {
  8054. var value = LinkedValueUtils.getValue(this);
  8055. if (value != null) {
  8056. var rootNode = this.getDOMNode();
  8057. // Cast `value` to a string to ensure the value is set correctly. While
  8058. // browsers typically do this as necessary, jsdom doesn't.
  8059. DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
  8060. }
  8061. },
  8062. _handleChange: function(event) {
  8063. var returnValue;
  8064. var onChange = LinkedValueUtils.getOnChange(this);
  8065. if (onChange) {
  8066. returnValue = onChange.call(this, event);
  8067. }
  8068. ReactUpdates.asap(forceUpdateIfMounted, this);
  8069. return returnValue;
  8070. }
  8071. });
  8072. module.exports = ReactDOMTextarea;
  8073. },{"11":11,"135":135,"154":154,"2":2,"24":24,"27":27,"29":29,"33":33,"57":57,"87":87}],53:[function(_dereq_,module,exports){
  8074. /**
  8075. * Copyright 2013-2015, Facebook, Inc.
  8076. * All rights reserved.
  8077. *
  8078. * This source code is licensed under the BSD-style license found in the
  8079. * LICENSE file in the root directory of this source tree. An additional grant
  8080. * of patent rights can be found in the PATENTS file in the same directory.
  8081. *
  8082. * @providesModule ReactDefaultBatchingStrategy
  8083. */
  8084. 'use strict';
  8085. var ReactUpdates = _dereq_(87);
  8086. var Transaction = _dereq_(103);
  8087. var assign = _dereq_(27);
  8088. var emptyFunction = _dereq_(114);
  8089. var RESET_BATCHED_UPDATES = {
  8090. initialize: emptyFunction,
  8091. close: function() {
  8092. ReactDefaultBatchingStrategy.isBatchingUpdates = false;
  8093. }
  8094. };
  8095. var FLUSH_BATCHED_UPDATES = {
  8096. initialize: emptyFunction,
  8097. close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
  8098. };
  8099. var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
  8100. function ReactDefaultBatchingStrategyTransaction() {
  8101. this.reinitializeTransaction();
  8102. }
  8103. assign(
  8104. ReactDefaultBatchingStrategyTransaction.prototype,
  8105. Transaction.Mixin,
  8106. {
  8107. getTransactionWrappers: function() {
  8108. return TRANSACTION_WRAPPERS;
  8109. }
  8110. }
  8111. );
  8112. var transaction = new ReactDefaultBatchingStrategyTransaction();
  8113. var ReactDefaultBatchingStrategy = {
  8114. isBatchingUpdates: false,
  8115. /**
  8116. * Call the provided function in a context within which calls to `setState`
  8117. * and friends are batched such that components aren't updated unnecessarily.
  8118. */
  8119. batchedUpdates: function(callback, a, b, c, d) {
  8120. var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
  8121. ReactDefaultBatchingStrategy.isBatchingUpdates = true;
  8122. // The code is written this way to avoid extra allocations
  8123. if (alreadyBatchingUpdates) {
  8124. callback(a, b, c, d);
  8125. } else {
  8126. transaction.perform(callback, null, a, b, c, d);
  8127. }
  8128. }
  8129. };
  8130. module.exports = ReactDefaultBatchingStrategy;
  8131. },{"103":103,"114":114,"27":27,"87":87}],54:[function(_dereq_,module,exports){
  8132. /**
  8133. * Copyright 2013-2015, Facebook, Inc.
  8134. * All rights reserved.
  8135. *
  8136. * This source code is licensed under the BSD-style license found in the
  8137. * LICENSE file in the root directory of this source tree. An additional grant
  8138. * of patent rights can be found in the PATENTS file in the same directory.
  8139. *
  8140. * @providesModule ReactDefaultInjection
  8141. */
  8142. 'use strict';
  8143. var BeforeInputEventPlugin = _dereq_(3);
  8144. var ChangeEventPlugin = _dereq_(7);
  8145. var ClientReactRootIndex = _dereq_(8);
  8146. var DefaultEventPluginOrder = _dereq_(13);
  8147. var EnterLeaveEventPlugin = _dereq_(14);
  8148. var ExecutionEnvironment = _dereq_(21);
  8149. var HTMLDOMPropertyConfig = _dereq_(23);
  8150. var MobileSafariClickEventPlugin = _dereq_(26);
  8151. var ReactBrowserComponentMixin = _dereq_(29);
  8152. var ReactClass = _dereq_(33);
  8153. var ReactComponentBrowserEnvironment =
  8154. _dereq_(35);
  8155. var ReactDefaultBatchingStrategy = _dereq_(53);
  8156. var ReactDOMComponent = _dereq_(42);
  8157. var ReactDOMButton = _dereq_(41);
  8158. var ReactDOMForm = _dereq_(43);
  8159. var ReactDOMImg = _dereq_(46);
  8160. var ReactDOMIDOperations = _dereq_(44);
  8161. var ReactDOMIframe = _dereq_(45);
  8162. var ReactDOMInput = _dereq_(47);
  8163. var ReactDOMOption = _dereq_(48);
  8164. var ReactDOMSelect = _dereq_(49);
  8165. var ReactDOMTextarea = _dereq_(52);
  8166. var ReactDOMTextComponent = _dereq_(51);
  8167. var ReactElement = _dereq_(57);
  8168. var ReactEventListener = _dereq_(62);
  8169. var ReactInjection = _dereq_(64);
  8170. var ReactInstanceHandles = _dereq_(66);
  8171. var ReactMount = _dereq_(70);
  8172. var ReactReconcileTransaction = _dereq_(80);
  8173. var SelectEventPlugin = _dereq_(89);
  8174. var ServerReactRootIndex = _dereq_(90);
  8175. var SimpleEventPlugin = _dereq_(91);
  8176. var SVGDOMPropertyConfig = _dereq_(88);
  8177. var createFullPageComponent = _dereq_(111);
  8178. function autoGenerateWrapperClass(type) {
  8179. return ReactClass.createClass({
  8180. tagName: type.toUpperCase(),
  8181. render: function() {
  8182. return new ReactElement(
  8183. type,
  8184. null,
  8185. null,
  8186. null,
  8187. null,
  8188. this.props
  8189. );
  8190. }
  8191. });
  8192. }
  8193. function inject() {
  8194. ReactInjection.EventEmitter.injectReactEventListener(
  8195. ReactEventListener
  8196. );
  8197. /**
  8198. * Inject modules for resolving DOM hierarchy and plugin ordering.
  8199. */
  8200. ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
  8201. ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
  8202. ReactInjection.EventPluginHub.injectMount(ReactMount);
  8203. /**
  8204. * Some important event plugins included by default (without having to require
  8205. * them).
  8206. */
  8207. ReactInjection.EventPluginHub.injectEventPluginsByName({
  8208. SimpleEventPlugin: SimpleEventPlugin,
  8209. EnterLeaveEventPlugin: EnterLeaveEventPlugin,
  8210. ChangeEventPlugin: ChangeEventPlugin,
  8211. MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,
  8212. SelectEventPlugin: SelectEventPlugin,
  8213. BeforeInputEventPlugin: BeforeInputEventPlugin
  8214. });
  8215. ReactInjection.NativeComponent.injectGenericComponentClass(
  8216. ReactDOMComponent
  8217. );
  8218. ReactInjection.NativeComponent.injectTextComponentClass(
  8219. ReactDOMTextComponent
  8220. );
  8221. ReactInjection.NativeComponent.injectAutoWrapper(
  8222. autoGenerateWrapperClass
  8223. );
  8224. // This needs to happen before createFullPageComponent() otherwise the mixin
  8225. // won't be included.
  8226. ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
  8227. ReactInjection.NativeComponent.injectComponentClasses({
  8228. 'button': ReactDOMButton,
  8229. 'form': ReactDOMForm,
  8230. 'iframe': ReactDOMIframe,
  8231. 'img': ReactDOMImg,
  8232. 'input': ReactDOMInput,
  8233. 'option': ReactDOMOption,
  8234. 'select': ReactDOMSelect,
  8235. 'textarea': ReactDOMTextarea,
  8236. 'html': createFullPageComponent('html'),
  8237. 'head': createFullPageComponent('head'),
  8238. 'body': createFullPageComponent('body')
  8239. });
  8240. ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
  8241. ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
  8242. ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
  8243. ReactInjection.Updates.injectReconcileTransaction(
  8244. ReactReconcileTransaction
  8245. );
  8246. ReactInjection.Updates.injectBatchingStrategy(
  8247. ReactDefaultBatchingStrategy
  8248. );
  8249. ReactInjection.RootIndex.injectCreateReactRootIndex(
  8250. ExecutionEnvironment.canUseDOM ?
  8251. ClientReactRootIndex.createReactRootIndex :
  8252. ServerReactRootIndex.createReactRootIndex
  8253. );
  8254. ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
  8255. ReactInjection.DOMComponent.injectIDOperations(ReactDOMIDOperations);
  8256. if ("production" !== "development") {
  8257. var url = (ExecutionEnvironment.canUseDOM && window.location.href) || '';
  8258. if ((/[?&]react_perf\b/).test(url)) {
  8259. var ReactDefaultPerf = _dereq_(55);
  8260. ReactDefaultPerf.start();
  8261. }
  8262. }
  8263. }
  8264. module.exports = {
  8265. inject: inject
  8266. };
  8267. },{"111":111,"13":13,"14":14,"21":21,"23":23,"26":26,"29":29,"3":3,"33":33,"35":35,"41":41,"42":42,"43":43,"44":44,"45":45,"46":46,"47":47,"48":48,"49":49,"51":51,"52":52,"53":53,"55":55,"57":57,"62":62,"64":64,"66":66,"7":7,"70":70,"8":8,"80":80,"88":88,"89":89,"90":90,"91":91}],55:[function(_dereq_,module,exports){
  8268. /**
  8269. * Copyright 2013-2015, Facebook, Inc.
  8270. * All rights reserved.
  8271. *
  8272. * This source code is licensed under the BSD-style license found in the
  8273. * LICENSE file in the root directory of this source tree. An additional grant
  8274. * of patent rights can be found in the PATENTS file in the same directory.
  8275. *
  8276. * @providesModule ReactDefaultPerf
  8277. * @typechecks static-only
  8278. */
  8279. 'use strict';
  8280. var DOMProperty = _dereq_(10);
  8281. var ReactDefaultPerfAnalysis = _dereq_(56);
  8282. var ReactMount = _dereq_(70);
  8283. var ReactPerf = _dereq_(75);
  8284. var performanceNow = _dereq_(146);
  8285. function roundFloat(val) {
  8286. return Math.floor(val * 100) / 100;
  8287. }
  8288. function addValue(obj, key, val) {
  8289. obj[key] = (obj[key] || 0) + val;
  8290. }
  8291. var ReactDefaultPerf = {
  8292. _allMeasurements: [], // last item in the list is the current one
  8293. _mountStack: [0],
  8294. _injected: false,
  8295. start: function() {
  8296. if (!ReactDefaultPerf._injected) {
  8297. ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
  8298. }
  8299. ReactDefaultPerf._allMeasurements.length = 0;
  8300. ReactPerf.enableMeasure = true;
  8301. },
  8302. stop: function() {
  8303. ReactPerf.enableMeasure = false;
  8304. },
  8305. getLastMeasurements: function() {
  8306. return ReactDefaultPerf._allMeasurements;
  8307. },
  8308. printExclusive: function(measurements) {
  8309. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8310. var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
  8311. console.table(summary.map(function(item) {
  8312. return {
  8313. 'Component class name': item.componentName,
  8314. 'Total inclusive time (ms)': roundFloat(item.inclusive),
  8315. 'Exclusive mount time (ms)': roundFloat(item.exclusive),
  8316. 'Exclusive render time (ms)': roundFloat(item.render),
  8317. 'Mount time per instance (ms)': roundFloat(item.exclusive / item.count),
  8318. 'Render time per instance (ms)': roundFloat(item.render / item.count),
  8319. 'Instances': item.count
  8320. };
  8321. }));
  8322. // TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct
  8323. // number.
  8324. },
  8325. printInclusive: function(measurements) {
  8326. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8327. var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
  8328. console.table(summary.map(function(item) {
  8329. return {
  8330. 'Owner > component': item.componentName,
  8331. 'Inclusive time (ms)': roundFloat(item.time),
  8332. 'Instances': item.count
  8333. };
  8334. }));
  8335. console.log(
  8336. 'Total time:',
  8337. ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
  8338. );
  8339. },
  8340. getMeasurementsSummaryMap: function(measurements) {
  8341. var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(
  8342. measurements,
  8343. true
  8344. );
  8345. return summary.map(function(item) {
  8346. return {
  8347. 'Owner > component': item.componentName,
  8348. 'Wasted time (ms)': item.time,
  8349. 'Instances': item.count
  8350. };
  8351. });
  8352. },
  8353. printWasted: function(measurements) {
  8354. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8355. console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
  8356. console.log(
  8357. 'Total time:',
  8358. ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
  8359. );
  8360. },
  8361. printDOM: function(measurements) {
  8362. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8363. var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
  8364. console.table(summary.map(function(item) {
  8365. var result = {};
  8366. result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
  8367. result['type'] = item.type;
  8368. result['args'] = JSON.stringify(item.args);
  8369. return result;
  8370. }));
  8371. console.log(
  8372. 'Total time:',
  8373. ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
  8374. );
  8375. },
  8376. _recordWrite: function(id, fnName, totalTime, args) {
  8377. // TODO: totalTime isn't that useful since it doesn't count paints/reflows
  8378. var writes =
  8379. ReactDefaultPerf
  8380. ._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]
  8381. .writes;
  8382. writes[id] = writes[id] || [];
  8383. writes[id].push({
  8384. type: fnName,
  8385. time: totalTime,
  8386. args: args
  8387. });
  8388. },
  8389. measure: function(moduleName, fnName, func) {
  8390. return function() {for (var args=[],$__0=0,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
  8391. var totalTime;
  8392. var rv;
  8393. var start;
  8394. if (fnName === '_renderNewRootComponent' ||
  8395. fnName === 'flushBatchedUpdates') {
  8396. // A "measurement" is a set of metrics recorded for each flush. We want
  8397. // to group the metrics for a given flush together so we can look at the
  8398. // components that rendered and the DOM operations that actually
  8399. // happened to determine the amount of "wasted work" performed.
  8400. ReactDefaultPerf._allMeasurements.push({
  8401. exclusive: {},
  8402. inclusive: {},
  8403. render: {},
  8404. counts: {},
  8405. writes: {},
  8406. displayNames: {},
  8407. totalTime: 0
  8408. });
  8409. start = performanceNow();
  8410. rv = func.apply(this, args);
  8411. ReactDefaultPerf._allMeasurements[
  8412. ReactDefaultPerf._allMeasurements.length - 1
  8413. ].totalTime = performanceNow() - start;
  8414. return rv;
  8415. } else if (fnName === '_mountImageIntoNode' ||
  8416. moduleName === 'ReactDOMIDOperations') {
  8417. start = performanceNow();
  8418. rv = func.apply(this, args);
  8419. totalTime = performanceNow() - start;
  8420. if (fnName === '_mountImageIntoNode') {
  8421. var mountID = ReactMount.getID(args[1]);
  8422. ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
  8423. } else if (fnName === 'dangerouslyProcessChildrenUpdates') {
  8424. // special format
  8425. args[0].forEach(function(update) {
  8426. var writeArgs = {};
  8427. if (update.fromIndex !== null) {
  8428. writeArgs.fromIndex = update.fromIndex;
  8429. }
  8430. if (update.toIndex !== null) {
  8431. writeArgs.toIndex = update.toIndex;
  8432. }
  8433. if (update.textContent !== null) {
  8434. writeArgs.textContent = update.textContent;
  8435. }
  8436. if (update.markupIndex !== null) {
  8437. writeArgs.markup = args[1][update.markupIndex];
  8438. }
  8439. ReactDefaultPerf._recordWrite(
  8440. update.parentID,
  8441. update.type,
  8442. totalTime,
  8443. writeArgs
  8444. );
  8445. });
  8446. } else {
  8447. // basic format
  8448. ReactDefaultPerf._recordWrite(
  8449. args[0],
  8450. fnName,
  8451. totalTime,
  8452. Array.prototype.slice.call(args, 1)
  8453. );
  8454. }
  8455. return rv;
  8456. } else if (moduleName === 'ReactCompositeComponent' && (
  8457. (// TODO: receiveComponent()?
  8458. (fnName === 'mountComponent' ||
  8459. fnName === 'updateComponent' || fnName === '_renderValidatedComponent')))) {
  8460. if (typeof this._currentElement.type === 'string') {
  8461. return func.apply(this, args);
  8462. }
  8463. var rootNodeID = fnName === 'mountComponent' ?
  8464. args[0] :
  8465. this._rootNodeID;
  8466. var isRender = fnName === '_renderValidatedComponent';
  8467. var isMount = fnName === 'mountComponent';
  8468. var mountStack = ReactDefaultPerf._mountStack;
  8469. var entry = ReactDefaultPerf._allMeasurements[
  8470. ReactDefaultPerf._allMeasurements.length - 1
  8471. ];
  8472. if (isRender) {
  8473. addValue(entry.counts, rootNodeID, 1);
  8474. } else if (isMount) {
  8475. mountStack.push(0);
  8476. }
  8477. start = performanceNow();
  8478. rv = func.apply(this, args);
  8479. totalTime = performanceNow() - start;
  8480. if (isRender) {
  8481. addValue(entry.render, rootNodeID, totalTime);
  8482. } else if (isMount) {
  8483. var subMountTime = mountStack.pop();
  8484. mountStack[mountStack.length - 1] += totalTime;
  8485. addValue(entry.exclusive, rootNodeID, totalTime - subMountTime);
  8486. addValue(entry.inclusive, rootNodeID, totalTime);
  8487. } else {
  8488. addValue(entry.inclusive, rootNodeID, totalTime);
  8489. }
  8490. entry.displayNames[rootNodeID] = {
  8491. current: this.getName(),
  8492. owner: this._currentElement._owner ?
  8493. this._currentElement._owner.getName() :
  8494. '<root>'
  8495. };
  8496. return rv;
  8497. } else {
  8498. return func.apply(this, args);
  8499. }
  8500. };
  8501. }
  8502. };
  8503. module.exports = ReactDefaultPerf;
  8504. },{"10":10,"146":146,"56":56,"70":70,"75":75}],56:[function(_dereq_,module,exports){
  8505. /**
  8506. * Copyright 2013-2015, Facebook, Inc.
  8507. * All rights reserved.
  8508. *
  8509. * This source code is licensed under the BSD-style license found in the
  8510. * LICENSE file in the root directory of this source tree. An additional grant
  8511. * of patent rights can be found in the PATENTS file in the same directory.
  8512. *
  8513. * @providesModule ReactDefaultPerfAnalysis
  8514. */
  8515. var assign = _dereq_(27);
  8516. // Don't try to save users less than 1.2ms (a number I made up)
  8517. var DONT_CARE_THRESHOLD = 1.2;
  8518. var DOM_OPERATION_TYPES = {
  8519. '_mountImageIntoNode': 'set innerHTML',
  8520. INSERT_MARKUP: 'set innerHTML',
  8521. MOVE_EXISTING: 'move',
  8522. REMOVE_NODE: 'remove',
  8523. TEXT_CONTENT: 'set textContent',
  8524. 'updatePropertyByID': 'update attribute',
  8525. 'deletePropertyByID': 'delete attribute',
  8526. 'updateStylesByID': 'update styles',
  8527. 'updateInnerHTMLByID': 'set innerHTML',
  8528. 'dangerouslyReplaceNodeWithMarkupByID': 'replace'
  8529. };
  8530. function getTotalTime(measurements) {
  8531. // TODO: return number of DOM ops? could be misleading.
  8532. // TODO: measure dropped frames after reconcile?
  8533. // TODO: log total time of each reconcile and the top-level component
  8534. // class that triggered it.
  8535. var totalTime = 0;
  8536. for (var i = 0; i < measurements.length; i++) {
  8537. var measurement = measurements[i];
  8538. totalTime += measurement.totalTime;
  8539. }
  8540. return totalTime;
  8541. }
  8542. function getDOMSummary(measurements) {
  8543. var items = [];
  8544. for (var i = 0; i < measurements.length; i++) {
  8545. var measurement = measurements[i];
  8546. var id;
  8547. for (id in measurement.writes) {
  8548. measurement.writes[id].forEach(function(write) {
  8549. items.push({
  8550. id: id,
  8551. type: DOM_OPERATION_TYPES[write.type] || write.type,
  8552. args: write.args
  8553. });
  8554. });
  8555. }
  8556. }
  8557. return items;
  8558. }
  8559. function getExclusiveSummary(measurements) {
  8560. var candidates = {};
  8561. var displayName;
  8562. for (var i = 0; i < measurements.length; i++) {
  8563. var measurement = measurements[i];
  8564. var allIDs = assign(
  8565. {},
  8566. measurement.exclusive,
  8567. measurement.inclusive
  8568. );
  8569. for (var id in allIDs) {
  8570. displayName = measurement.displayNames[id].current;
  8571. candidates[displayName] = candidates[displayName] || {
  8572. componentName: displayName,
  8573. inclusive: 0,
  8574. exclusive: 0,
  8575. render: 0,
  8576. count: 0
  8577. };
  8578. if (measurement.render[id]) {
  8579. candidates[displayName].render += measurement.render[id];
  8580. }
  8581. if (measurement.exclusive[id]) {
  8582. candidates[displayName].exclusive += measurement.exclusive[id];
  8583. }
  8584. if (measurement.inclusive[id]) {
  8585. candidates[displayName].inclusive += measurement.inclusive[id];
  8586. }
  8587. if (measurement.counts[id]) {
  8588. candidates[displayName].count += measurement.counts[id];
  8589. }
  8590. }
  8591. }
  8592. // Now make a sorted array with the results.
  8593. var arr = [];
  8594. for (displayName in candidates) {
  8595. if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {
  8596. arr.push(candidates[displayName]);
  8597. }
  8598. }
  8599. arr.sort(function(a, b) {
  8600. return b.exclusive - a.exclusive;
  8601. });
  8602. return arr;
  8603. }
  8604. function getInclusiveSummary(measurements, onlyClean) {
  8605. var candidates = {};
  8606. var inclusiveKey;
  8607. for (var i = 0; i < measurements.length; i++) {
  8608. var measurement = measurements[i];
  8609. var allIDs = assign(
  8610. {},
  8611. measurement.exclusive,
  8612. measurement.inclusive
  8613. );
  8614. var cleanComponents;
  8615. if (onlyClean) {
  8616. cleanComponents = getUnchangedComponents(measurement);
  8617. }
  8618. for (var id in allIDs) {
  8619. if (onlyClean && !cleanComponents[id]) {
  8620. continue;
  8621. }
  8622. var displayName = measurement.displayNames[id];
  8623. // Inclusive time is not useful for many components without knowing where
  8624. // they are instantiated. So we aggregate inclusive time with both the
  8625. // owner and current displayName as the key.
  8626. inclusiveKey = displayName.owner + ' > ' + displayName.current;
  8627. candidates[inclusiveKey] = candidates[inclusiveKey] || {
  8628. componentName: inclusiveKey,
  8629. time: 0,
  8630. count: 0
  8631. };
  8632. if (measurement.inclusive[id]) {
  8633. candidates[inclusiveKey].time += measurement.inclusive[id];
  8634. }
  8635. if (measurement.counts[id]) {
  8636. candidates[inclusiveKey].count += measurement.counts[id];
  8637. }
  8638. }
  8639. }
  8640. // Now make a sorted array with the results.
  8641. var arr = [];
  8642. for (inclusiveKey in candidates) {
  8643. if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {
  8644. arr.push(candidates[inclusiveKey]);
  8645. }
  8646. }
  8647. arr.sort(function(a, b) {
  8648. return b.time - a.time;
  8649. });
  8650. return arr;
  8651. }
  8652. function getUnchangedComponents(measurement) {
  8653. // For a given reconcile, look at which components did not actually
  8654. // render anything to the DOM and return a mapping of their ID to
  8655. // the amount of time it took to render the entire subtree.
  8656. var cleanComponents = {};
  8657. var dirtyLeafIDs = Object.keys(measurement.writes);
  8658. var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
  8659. for (var id in allIDs) {
  8660. var isDirty = false;
  8661. // For each component that rendered, see if a component that triggered
  8662. // a DOM op is in its subtree.
  8663. for (var i = 0; i < dirtyLeafIDs.length; i++) {
  8664. if (dirtyLeafIDs[i].indexOf(id) === 0) {
  8665. isDirty = true;
  8666. break;
  8667. }
  8668. }
  8669. if (!isDirty && measurement.counts[id] > 0) {
  8670. cleanComponents[id] = true;
  8671. }
  8672. }
  8673. return cleanComponents;
  8674. }
  8675. var ReactDefaultPerfAnalysis = {
  8676. getExclusiveSummary: getExclusiveSummary,
  8677. getInclusiveSummary: getInclusiveSummary,
  8678. getDOMSummary: getDOMSummary,
  8679. getTotalTime: getTotalTime
  8680. };
  8681. module.exports = ReactDefaultPerfAnalysis;
  8682. },{"27":27}],57:[function(_dereq_,module,exports){
  8683. /**
  8684. * Copyright 2014-2015, Facebook, Inc.
  8685. * All rights reserved.
  8686. *
  8687. * This source code is licensed under the BSD-style license found in the
  8688. * LICENSE file in the root directory of this source tree. An additional grant
  8689. * of patent rights can be found in the PATENTS file in the same directory.
  8690. *
  8691. * @providesModule ReactElement
  8692. */
  8693. 'use strict';
  8694. var ReactContext = _dereq_(38);
  8695. var ReactCurrentOwner = _dereq_(39);
  8696. var assign = _dereq_(27);
  8697. var warning = _dereq_(154);
  8698. var RESERVED_PROPS = {
  8699. key: true,
  8700. ref: true
  8701. };
  8702. /**
  8703. * Warn for mutations.
  8704. *
  8705. * @internal
  8706. * @param {object} object
  8707. * @param {string} key
  8708. */
  8709. function defineWarningProperty(object, key) {
  8710. Object.defineProperty(object, key, {
  8711. configurable: false,
  8712. enumerable: true,
  8713. get: function() {
  8714. if (!this._store) {
  8715. return null;
  8716. }
  8717. return this._store[key];
  8718. },
  8719. set: function(value) {
  8720. ("production" !== "development" ? warning(
  8721. false,
  8722. 'Don\'t set the %s property of the React element. Instead, ' +
  8723. 'specify the correct value when initially creating the element.',
  8724. key
  8725. ) : null);
  8726. this._store[key] = value;
  8727. }
  8728. });
  8729. }
  8730. /**
  8731. * This is updated to true if the membrane is successfully created.
  8732. */
  8733. var useMutationMembrane = false;
  8734. /**
  8735. * Warn for mutations.
  8736. *
  8737. * @internal
  8738. * @param {object} element
  8739. */
  8740. function defineMutationMembrane(prototype) {
  8741. try {
  8742. var pseudoFrozenProperties = {
  8743. props: true
  8744. };
  8745. for (var key in pseudoFrozenProperties) {
  8746. defineWarningProperty(prototype, key);
  8747. }
  8748. useMutationMembrane = true;
  8749. } catch (x) {
  8750. // IE will fail on defineProperty
  8751. }
  8752. }
  8753. /**
  8754. * Base constructor for all React elements. This is only used to make this
  8755. * work with a dynamic instanceof check. Nothing should live on this prototype.
  8756. *
  8757. * @param {*} type
  8758. * @param {string|object} ref
  8759. * @param {*} key
  8760. * @param {*} props
  8761. * @internal
  8762. */
  8763. var ReactElement = function(type, key, ref, owner, context, props) {
  8764. // Built-in properties that belong on the element
  8765. this.type = type;
  8766. this.key = key;
  8767. this.ref = ref;
  8768. // Record the component responsible for creating this element.
  8769. this._owner = owner;
  8770. // TODO: Deprecate withContext, and then the context becomes accessible
  8771. // through the owner.
  8772. this._context = context;
  8773. if ("production" !== "development") {
  8774. // The validation flag and props are currently mutative. We put them on
  8775. // an external backing store so that we can freeze the whole object.
  8776. // This can be replaced with a WeakMap once they are implemented in
  8777. // commonly used development environments.
  8778. this._store = {props: props, originalProps: assign({}, props)};
  8779. // To make comparing ReactElements easier for testing purposes, we make
  8780. // the validation flag non-enumerable (where possible, which should
  8781. // include every environment we run tests in), so the test framework
  8782. // ignores it.
  8783. try {
  8784. Object.defineProperty(this._store, 'validated', {
  8785. configurable: false,
  8786. enumerable: false,
  8787. writable: true
  8788. });
  8789. } catch (x) {
  8790. }
  8791. this._store.validated = false;
  8792. // We're not allowed to set props directly on the object so we early
  8793. // return and rely on the prototype membrane to forward to the backing
  8794. // store.
  8795. if (useMutationMembrane) {
  8796. Object.freeze(this);
  8797. return;
  8798. }
  8799. }
  8800. this.props = props;
  8801. };
  8802. // We intentionally don't expose the function on the constructor property.
  8803. // ReactElement should be indistinguishable from a plain object.
  8804. ReactElement.prototype = {
  8805. _isReactElement: true
  8806. };
  8807. if ("production" !== "development") {
  8808. defineMutationMembrane(ReactElement.prototype);
  8809. }
  8810. ReactElement.createElement = function(type, config, children) {
  8811. var propName;
  8812. // Reserved names are extracted
  8813. var props = {};
  8814. var key = null;
  8815. var ref = null;
  8816. if (config != null) {
  8817. ref = config.ref === undefined ? null : config.ref;
  8818. key = config.key === undefined ? null : '' + config.key;
  8819. // Remaining properties are added to a new props object
  8820. for (propName in config) {
  8821. if (config.hasOwnProperty(propName) &&
  8822. !RESERVED_PROPS.hasOwnProperty(propName)) {
  8823. props[propName] = config[propName];
  8824. }
  8825. }
  8826. }
  8827. // Children can be more than one argument, and those are transferred onto
  8828. // the newly allocated props object.
  8829. var childrenLength = arguments.length - 2;
  8830. if (childrenLength === 1) {
  8831. props.children = children;
  8832. } else if (childrenLength > 1) {
  8833. var childArray = Array(childrenLength);
  8834. for (var i = 0; i < childrenLength; i++) {
  8835. childArray[i] = arguments[i + 2];
  8836. }
  8837. props.children = childArray;
  8838. }
  8839. // Resolve default props
  8840. if (type && type.defaultProps) {
  8841. var defaultProps = type.defaultProps;
  8842. for (propName in defaultProps) {
  8843. if (typeof props[propName] === 'undefined') {
  8844. props[propName] = defaultProps[propName];
  8845. }
  8846. }
  8847. }
  8848. return new ReactElement(
  8849. type,
  8850. key,
  8851. ref,
  8852. ReactCurrentOwner.current,
  8853. ReactContext.current,
  8854. props
  8855. );
  8856. };
  8857. ReactElement.createFactory = function(type) {
  8858. var factory = ReactElement.createElement.bind(null, type);
  8859. // Expose the type on the factory and the prototype so that it can be
  8860. // easily accessed on elements. E.g. <Foo />.type === Foo.type.
  8861. // This should not be named `constructor` since this may not be the function
  8862. // that created the element, and it may not even be a constructor.
  8863. // Legacy hook TODO: Warn if this is accessed
  8864. factory.type = type;
  8865. return factory;
  8866. };
  8867. ReactElement.cloneAndReplaceProps = function(oldElement, newProps) {
  8868. var newElement = new ReactElement(
  8869. oldElement.type,
  8870. oldElement.key,
  8871. oldElement.ref,
  8872. oldElement._owner,
  8873. oldElement._context,
  8874. newProps
  8875. );
  8876. if ("production" !== "development") {
  8877. // If the key on the original is valid, then the clone is valid
  8878. newElement._store.validated = oldElement._store.validated;
  8879. }
  8880. return newElement;
  8881. };
  8882. ReactElement.cloneElement = function(element, config, children) {
  8883. var propName;
  8884. // Original props are copied
  8885. var props = assign({}, element.props);
  8886. // Reserved names are extracted
  8887. var key = element.key;
  8888. var ref = element.ref;
  8889. // Owner will be preserved, unless ref is overridden
  8890. var owner = element._owner;
  8891. if (config != null) {
  8892. if (config.ref !== undefined) {
  8893. // Silently steal the ref from the parent.
  8894. ref = config.ref;
  8895. owner = ReactCurrentOwner.current;
  8896. }
  8897. if (config.key !== undefined) {
  8898. key = '' + config.key;
  8899. }
  8900. // Remaining properties override existing props
  8901. for (propName in config) {
  8902. if (config.hasOwnProperty(propName) &&
  8903. !RESERVED_PROPS.hasOwnProperty(propName)) {
  8904. props[propName] = config[propName];
  8905. }
  8906. }
  8907. }
  8908. // Children can be more than one argument, and those are transferred onto
  8909. // the newly allocated props object.
  8910. var childrenLength = arguments.length - 2;
  8911. if (childrenLength === 1) {
  8912. props.children = children;
  8913. } else if (childrenLength > 1) {
  8914. var childArray = Array(childrenLength);
  8915. for (var i = 0; i < childrenLength; i++) {
  8916. childArray[i] = arguments[i + 2];
  8917. }
  8918. props.children = childArray;
  8919. }
  8920. return new ReactElement(
  8921. element.type,
  8922. key,
  8923. ref,
  8924. owner,
  8925. element._context,
  8926. props
  8927. );
  8928. };
  8929. /**
  8930. * @param {?object} object
  8931. * @return {boolean} True if `object` is a valid component.
  8932. * @final
  8933. */
  8934. ReactElement.isValidElement = function(object) {
  8935. // ReactTestUtils is often used outside of beforeEach where as React is
  8936. // within it. This leads to two different instances of React on the same
  8937. // page. To identify a element from a different React instance we use
  8938. // a flag instead of an instanceof check.
  8939. var isElement = !!(object && object._isReactElement);
  8940. // if (isElement && !(object instanceof ReactElement)) {
  8941. // This is an indicator that you're using multiple versions of React at the
  8942. // same time. This will screw with ownership and stuff. Fix it, please.
  8943. // TODO: We could possibly warn here.
  8944. // }
  8945. return isElement;
  8946. };
  8947. module.exports = ReactElement;
  8948. },{"154":154,"27":27,"38":38,"39":39}],58:[function(_dereq_,module,exports){
  8949. /**
  8950. * Copyright 2014-2015, Facebook, Inc.
  8951. * All rights reserved.
  8952. *
  8953. * This source code is licensed under the BSD-style license found in the
  8954. * LICENSE file in the root directory of this source tree. An additional grant
  8955. * of patent rights can be found in the PATENTS file in the same directory.
  8956. *
  8957. * @providesModule ReactElementValidator
  8958. */
  8959. /**
  8960. * ReactElementValidator provides a wrapper around a element factory
  8961. * which validates the props passed to the element. This is intended to be
  8962. * used only in DEV and could be replaced by a static type checker for languages
  8963. * that support it.
  8964. */
  8965. 'use strict';
  8966. var ReactElement = _dereq_(57);
  8967. var ReactFragment = _dereq_(63);
  8968. var ReactPropTypeLocations = _dereq_(77);
  8969. var ReactPropTypeLocationNames = _dereq_(76);
  8970. var ReactCurrentOwner = _dereq_(39);
  8971. var ReactNativeComponent = _dereq_(73);
  8972. var getIteratorFn = _dereq_(126);
  8973. var invariant = _dereq_(135);
  8974. var warning = _dereq_(154);
  8975. function getDeclarationErrorAddendum() {
  8976. if (ReactCurrentOwner.current) {
  8977. var name = ReactCurrentOwner.current.getName();
  8978. if (name) {
  8979. return ' Check the render method of `' + name + '`.';
  8980. }
  8981. }
  8982. return '';
  8983. }
  8984. /**
  8985. * Warn if there's no key explicitly set on dynamic arrays of children or
  8986. * object keys are not valid. This allows us to keep track of children between
  8987. * updates.
  8988. */
  8989. var ownerHasKeyUseWarning = {};
  8990. var loggedTypeFailures = {};
  8991. var NUMERIC_PROPERTY_REGEX = /^\d+$/;
  8992. /**
  8993. * Gets the instance's name for use in warnings.
  8994. *
  8995. * @internal
  8996. * @return {?string} Display name or undefined
  8997. */
  8998. function getName(instance) {
  8999. var publicInstance = instance && instance.getPublicInstance();
  9000. if (!publicInstance) {
  9001. return undefined;
  9002. }
  9003. var constructor = publicInstance.constructor;
  9004. if (!constructor) {
  9005. return undefined;
  9006. }
  9007. return constructor.displayName || constructor.name || undefined;
  9008. }
  9009. /**
  9010. * Gets the current owner's displayName for use in warnings.
  9011. *
  9012. * @internal
  9013. * @return {?string} Display name or undefined
  9014. */
  9015. function getCurrentOwnerDisplayName() {
  9016. var current = ReactCurrentOwner.current;
  9017. return (
  9018. current && getName(current) || undefined
  9019. );
  9020. }
  9021. /**
  9022. * Warn if the element doesn't have an explicit key assigned to it.
  9023. * This element is in an array. The array could grow and shrink or be
  9024. * reordered. All children that haven't already been validated are required to
  9025. * have a "key" property assigned to it.
  9026. *
  9027. * @internal
  9028. * @param {ReactElement} element Element that requires a key.
  9029. * @param {*} parentType element's parent's type.
  9030. */
  9031. function validateExplicitKey(element, parentType) {
  9032. if (element._store.validated || element.key != null) {
  9033. return;
  9034. }
  9035. element._store.validated = true;
  9036. warnAndMonitorForKeyUse(
  9037. 'Each child in an array or iterator should have a unique "key" prop.',
  9038. element,
  9039. parentType
  9040. );
  9041. }
  9042. /**
  9043. * Warn if the key is being defined as an object property but has an incorrect
  9044. * value.
  9045. *
  9046. * @internal
  9047. * @param {string} name Property name of the key.
  9048. * @param {ReactElement} element Component that requires a key.
  9049. * @param {*} parentType element's parent's type.
  9050. */
  9051. function validatePropertyKey(name, element, parentType) {
  9052. if (!NUMERIC_PROPERTY_REGEX.test(name)) {
  9053. return;
  9054. }
  9055. warnAndMonitorForKeyUse(
  9056. 'Child objects should have non-numeric keys so ordering is preserved.',
  9057. element,
  9058. parentType
  9059. );
  9060. }
  9061. /**
  9062. * Shared warning and monitoring code for the key warnings.
  9063. *
  9064. * @internal
  9065. * @param {string} message The base warning that gets output.
  9066. * @param {ReactElement} element Component that requires a key.
  9067. * @param {*} parentType element's parent's type.
  9068. */
  9069. function warnAndMonitorForKeyUse(message, element, parentType) {
  9070. var ownerName = getCurrentOwnerDisplayName();
  9071. var parentName = typeof parentType === 'string' ?
  9072. parentType : parentType.displayName || parentType.name;
  9073. var useName = ownerName || parentName;
  9074. var memoizer = ownerHasKeyUseWarning[message] || (
  9075. (ownerHasKeyUseWarning[message] = {})
  9076. );
  9077. if (memoizer.hasOwnProperty(useName)) {
  9078. return;
  9079. }
  9080. memoizer[useName] = true;
  9081. var parentOrOwnerAddendum =
  9082. ownerName ? (" Check the render method of " + ownerName + ".") :
  9083. parentName ? (" Check the React.render call using <" + parentName + ">.") :
  9084. '';
  9085. // Usually the current owner is the offender, but if it accepts children as a
  9086. // property, it may be the creator of the child that's responsible for
  9087. // assigning it a key.
  9088. var childOwnerAddendum = '';
  9089. if (element &&
  9090. element._owner &&
  9091. element._owner !== ReactCurrentOwner.current) {
  9092. // Name of the component that originally created this child.
  9093. var childOwnerName = getName(element._owner);
  9094. childOwnerAddendum = (" It was passed a child from " + childOwnerName + ".");
  9095. }
  9096. ("production" !== "development" ? warning(
  9097. false,
  9098. message + '%s%s See http://fb.me/react-warning-keys for more information.',
  9099. parentOrOwnerAddendum,
  9100. childOwnerAddendum
  9101. ) : null);
  9102. }
  9103. /**
  9104. * Ensure that every element either is passed in a static location, in an
  9105. * array with an explicit keys property defined, or in an object literal
  9106. * with valid key property.
  9107. *
  9108. * @internal
  9109. * @param {ReactNode} node Statically passed child of any type.
  9110. * @param {*} parentType node's parent's type.
  9111. */
  9112. function validateChildKeys(node, parentType) {
  9113. if (Array.isArray(node)) {
  9114. for (var i = 0; i < node.length; i++) {
  9115. var child = node[i];
  9116. if (ReactElement.isValidElement(child)) {
  9117. validateExplicitKey(child, parentType);
  9118. }
  9119. }
  9120. } else if (ReactElement.isValidElement(node)) {
  9121. // This element was passed in a valid location.
  9122. node._store.validated = true;
  9123. } else if (node) {
  9124. var iteratorFn = getIteratorFn(node);
  9125. // Entry iterators provide implicit keys.
  9126. if (iteratorFn) {
  9127. if (iteratorFn !== node.entries) {
  9128. var iterator = iteratorFn.call(node);
  9129. var step;
  9130. while (!(step = iterator.next()).done) {
  9131. if (ReactElement.isValidElement(step.value)) {
  9132. validateExplicitKey(step.value, parentType);
  9133. }
  9134. }
  9135. }
  9136. } else if (typeof node === 'object') {
  9137. var fragment = ReactFragment.extractIfFragment(node);
  9138. for (var key in fragment) {
  9139. if (fragment.hasOwnProperty(key)) {
  9140. validatePropertyKey(key, fragment[key], parentType);
  9141. }
  9142. }
  9143. }
  9144. }
  9145. }
  9146. /**
  9147. * Assert that the props are valid
  9148. *
  9149. * @param {string} componentName Name of the component for error messages.
  9150. * @param {object} propTypes Map of prop name to a ReactPropType
  9151. * @param {object} props
  9152. * @param {string} location e.g. "prop", "context", "child context"
  9153. * @private
  9154. */
  9155. function checkPropTypes(componentName, propTypes, props, location) {
  9156. for (var propName in propTypes) {
  9157. if (propTypes.hasOwnProperty(propName)) {
  9158. var error;
  9159. // Prop type validation may throw. In case they do, we don't want to
  9160. // fail the render phase where it didn't fail before. So we log it.
  9161. // After these have been cleaned up, we'll let them throw.
  9162. try {
  9163. // This is intentionally an invariant that gets caught. It's the same
  9164. // behavior as without this statement except with a better message.
  9165. ("production" !== "development" ? invariant(
  9166. typeof propTypes[propName] === 'function',
  9167. '%s: %s type `%s` is invalid; it must be a function, usually from ' +
  9168. 'React.PropTypes.',
  9169. componentName || 'React class',
  9170. ReactPropTypeLocationNames[location],
  9171. propName
  9172. ) : invariant(typeof propTypes[propName] === 'function'));
  9173. error = propTypes[propName](props, propName, componentName, location);
  9174. } catch (ex) {
  9175. error = ex;
  9176. }
  9177. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  9178. // Only monitor this failure once because there tends to be a lot of the
  9179. // same error.
  9180. loggedTypeFailures[error.message] = true;
  9181. var addendum = getDeclarationErrorAddendum(this);
  9182. ("production" !== "development" ? warning(false, 'Failed propType: %s%s', error.message, addendum) : null);
  9183. }
  9184. }
  9185. }
  9186. }
  9187. var warnedPropsMutations = {};
  9188. /**
  9189. * Warn about mutating props when setting `propName` on `element`.
  9190. *
  9191. * @param {string} propName The string key within props that was set
  9192. * @param {ReactElement} element
  9193. */
  9194. function warnForPropsMutation(propName, element) {
  9195. var type = element.type;
  9196. var elementName = typeof type === 'string' ? type : type.displayName;
  9197. var ownerName = element._owner ?
  9198. element._owner.getPublicInstance().constructor.displayName : null;
  9199. var warningKey = propName + '|' + elementName + '|' + ownerName;
  9200. if (warnedPropsMutations.hasOwnProperty(warningKey)) {
  9201. return;
  9202. }
  9203. warnedPropsMutations[warningKey] = true;
  9204. var elementInfo = '';
  9205. if (elementName) {
  9206. elementInfo = ' <' + elementName + ' />';
  9207. }
  9208. var ownerInfo = '';
  9209. if (ownerName) {
  9210. ownerInfo = ' The element was created by ' + ownerName + '.';
  9211. }
  9212. ("production" !== "development" ? warning(
  9213. false,
  9214. 'Don\'t set .props.%s of the React component%s. ' +
  9215. 'Instead, specify the correct value when ' +
  9216. 'initially creating the element.%s',
  9217. propName,
  9218. elementInfo,
  9219. ownerInfo
  9220. ) : null);
  9221. }
  9222. // Inline Object.is polyfill
  9223. function is(a, b) {
  9224. if (a !== a) {
  9225. // NaN
  9226. return b !== b;
  9227. }
  9228. if (a === 0 && b === 0) {
  9229. // +-0
  9230. return 1 / a === 1 / b;
  9231. }
  9232. return a === b;
  9233. }
  9234. /**
  9235. * Given an element, check if its props have been mutated since element
  9236. * creation (or the last call to this function). In particular, check if any
  9237. * new props have been added, which we can't directly catch by defining warning
  9238. * properties on the props object.
  9239. *
  9240. * @param {ReactElement} element
  9241. */
  9242. function checkAndWarnForMutatedProps(element) {
  9243. if (!element._store) {
  9244. // Element was created using `new ReactElement` directly or with
  9245. // `ReactElement.createElement`; skip mutation checking
  9246. return;
  9247. }
  9248. var originalProps = element._store.originalProps;
  9249. var props = element.props;
  9250. for (var propName in props) {
  9251. if (props.hasOwnProperty(propName)) {
  9252. if (!originalProps.hasOwnProperty(propName) ||
  9253. !is(originalProps[propName], props[propName])) {
  9254. warnForPropsMutation(propName, element);
  9255. // Copy over the new value so that the two props objects match again
  9256. originalProps[propName] = props[propName];
  9257. }
  9258. }
  9259. }
  9260. }
  9261. /**
  9262. * Given an element, validate that its props follow the propTypes definition,
  9263. * provided by the type.
  9264. *
  9265. * @param {ReactElement} element
  9266. */
  9267. function validatePropTypes(element) {
  9268. if (element.type == null) {
  9269. // This has already warned. Don't throw.
  9270. return;
  9271. }
  9272. // Extract the component class from the element. Converts string types
  9273. // to a composite class which may have propTypes.
  9274. // TODO: Validating a string's propTypes is not decoupled from the
  9275. // rendering target which is problematic.
  9276. var componentClass = ReactNativeComponent.getComponentClassForElement(
  9277. element
  9278. );
  9279. var name = componentClass.displayName || componentClass.name;
  9280. if (componentClass.propTypes) {
  9281. checkPropTypes(
  9282. name,
  9283. componentClass.propTypes,
  9284. element.props,
  9285. ReactPropTypeLocations.prop
  9286. );
  9287. }
  9288. if (typeof componentClass.getDefaultProps === 'function') {
  9289. ("production" !== "development" ? warning(
  9290. componentClass.getDefaultProps.isReactClassApproved,
  9291. 'getDefaultProps is only used on classic React.createClass ' +
  9292. 'definitions. Use a static property named `defaultProps` instead.'
  9293. ) : null);
  9294. }
  9295. }
  9296. var ReactElementValidator = {
  9297. checkAndWarnForMutatedProps: checkAndWarnForMutatedProps,
  9298. createElement: function(type, props, children) {
  9299. // We warn in this case but don't throw. We expect the element creation to
  9300. // succeed and there will likely be errors in render.
  9301. ("production" !== "development" ? warning(
  9302. type != null,
  9303. 'React.createElement: type should not be null or undefined. It should ' +
  9304. 'be a string (for DOM elements) or a ReactClass (for composite ' +
  9305. 'components).'
  9306. ) : null);
  9307. var element = ReactElement.createElement.apply(this, arguments);
  9308. // The result can be nullish if a mock or a custom function is used.
  9309. // TODO: Drop this when these are no longer allowed as the type argument.
  9310. if (element == null) {
  9311. return element;
  9312. }
  9313. for (var i = 2; i < arguments.length; i++) {
  9314. validateChildKeys(arguments[i], type);
  9315. }
  9316. validatePropTypes(element);
  9317. return element;
  9318. },
  9319. createFactory: function(type) {
  9320. var validatedFactory = ReactElementValidator.createElement.bind(
  9321. null,
  9322. type
  9323. );
  9324. // Legacy hook TODO: Warn if this is accessed
  9325. validatedFactory.type = type;
  9326. if ("production" !== "development") {
  9327. try {
  9328. Object.defineProperty(
  9329. validatedFactory,
  9330. 'type',
  9331. {
  9332. enumerable: false,
  9333. get: function() {
  9334. ("production" !== "development" ? warning(
  9335. false,
  9336. 'Factory.type is deprecated. Access the class directly ' +
  9337. 'before passing it to createFactory.'
  9338. ) : null);
  9339. Object.defineProperty(this, 'type', {
  9340. value: type
  9341. });
  9342. return type;
  9343. }
  9344. }
  9345. );
  9346. } catch (x) {
  9347. // IE will fail on defineProperty (es5-shim/sham too)
  9348. }
  9349. }
  9350. return validatedFactory;
  9351. },
  9352. cloneElement: function(element, props, children) {
  9353. var newElement = ReactElement.cloneElement.apply(this, arguments);
  9354. for (var i = 2; i < arguments.length; i++) {
  9355. validateChildKeys(arguments[i], newElement.type);
  9356. }
  9357. validatePropTypes(newElement);
  9358. return newElement;
  9359. }
  9360. };
  9361. module.exports = ReactElementValidator;
  9362. },{"126":126,"135":135,"154":154,"39":39,"57":57,"63":63,"73":73,"76":76,"77":77}],59:[function(_dereq_,module,exports){
  9363. /**
  9364. * Copyright 2014-2015, Facebook, Inc.
  9365. * All rights reserved.
  9366. *
  9367. * This source code is licensed under the BSD-style license found in the
  9368. * LICENSE file in the root directory of this source tree. An additional grant
  9369. * of patent rights can be found in the PATENTS file in the same directory.
  9370. *
  9371. * @providesModule ReactEmptyComponent
  9372. */
  9373. 'use strict';
  9374. var ReactElement = _dereq_(57);
  9375. var ReactInstanceMap = _dereq_(67);
  9376. var invariant = _dereq_(135);
  9377. var component;
  9378. // This registry keeps track of the React IDs of the components that rendered to
  9379. // `null` (in reality a placeholder such as `noscript`)
  9380. var nullComponentIDsRegistry = {};
  9381. var ReactEmptyComponentInjection = {
  9382. injectEmptyComponent: function(emptyComponent) {
  9383. component = ReactElement.createFactory(emptyComponent);
  9384. }
  9385. };
  9386. var ReactEmptyComponentType = function() {};
  9387. ReactEmptyComponentType.prototype.componentDidMount = function() {
  9388. var internalInstance = ReactInstanceMap.get(this);
  9389. // TODO: Make sure we run these methods in the correct order, we shouldn't
  9390. // need this check. We're going to assume if we're here it means we ran
  9391. // componentWillUnmount already so there is no internal instance (it gets
  9392. // removed as part of the unmounting process).
  9393. if (!internalInstance) {
  9394. return;
  9395. }
  9396. registerNullComponentID(internalInstance._rootNodeID);
  9397. };
  9398. ReactEmptyComponentType.prototype.componentWillUnmount = function() {
  9399. var internalInstance = ReactInstanceMap.get(this);
  9400. // TODO: Get rid of this check. See TODO in componentDidMount.
  9401. if (!internalInstance) {
  9402. return;
  9403. }
  9404. deregisterNullComponentID(internalInstance._rootNodeID);
  9405. };
  9406. ReactEmptyComponentType.prototype.render = function() {
  9407. ("production" !== "development" ? invariant(
  9408. component,
  9409. 'Trying to return null from a render, but no null placeholder component ' +
  9410. 'was injected.'
  9411. ) : invariant(component));
  9412. return component();
  9413. };
  9414. var emptyElement = ReactElement.createElement(ReactEmptyComponentType);
  9415. /**
  9416. * Mark the component as having rendered to null.
  9417. * @param {string} id Component's `_rootNodeID`.
  9418. */
  9419. function registerNullComponentID(id) {
  9420. nullComponentIDsRegistry[id] = true;
  9421. }
  9422. /**
  9423. * Unmark the component as having rendered to null: it renders to something now.
  9424. * @param {string} id Component's `_rootNodeID`.
  9425. */
  9426. function deregisterNullComponentID(id) {
  9427. delete nullComponentIDsRegistry[id];
  9428. }
  9429. /**
  9430. * @param {string} id Component's `_rootNodeID`.
  9431. * @return {boolean} True if the component is rendered to null.
  9432. */
  9433. function isNullComponentID(id) {
  9434. return !!nullComponentIDsRegistry[id];
  9435. }
  9436. var ReactEmptyComponent = {
  9437. emptyElement: emptyElement,
  9438. injection: ReactEmptyComponentInjection,
  9439. isNullComponentID: isNullComponentID
  9440. };
  9441. module.exports = ReactEmptyComponent;
  9442. },{"135":135,"57":57,"67":67}],60:[function(_dereq_,module,exports){
  9443. /**
  9444. * Copyright 2013-2015, Facebook, Inc.
  9445. * All rights reserved.
  9446. *
  9447. * This source code is licensed under the BSD-style license found in the
  9448. * LICENSE file in the root directory of this source tree. An additional grant
  9449. * of patent rights can be found in the PATENTS file in the same directory.
  9450. *
  9451. * @providesModule ReactErrorUtils
  9452. * @typechecks
  9453. */
  9454. "use strict";
  9455. var ReactErrorUtils = {
  9456. /**
  9457. * Creates a guarded version of a function. This is supposed to make debugging
  9458. * of event handlers easier. To aid debugging with the browser's debugger,
  9459. * this currently simply returns the original function.
  9460. *
  9461. * @param {function} func Function to be executed
  9462. * @param {string} name The name of the guard
  9463. * @return {function}
  9464. */
  9465. guard: function(func, name) {
  9466. return func;
  9467. }
  9468. };
  9469. module.exports = ReactErrorUtils;
  9470. },{}],61:[function(_dereq_,module,exports){
  9471. /**
  9472. * Copyright 2013-2015, Facebook, Inc.
  9473. * All rights reserved.
  9474. *
  9475. * This source code is licensed under the BSD-style license found in the
  9476. * LICENSE file in the root directory of this source tree. An additional grant
  9477. * of patent rights can be found in the PATENTS file in the same directory.
  9478. *
  9479. * @providesModule ReactEventEmitterMixin
  9480. */
  9481. 'use strict';
  9482. var EventPluginHub = _dereq_(17);
  9483. function runEventQueueInBatch(events) {
  9484. EventPluginHub.enqueueEvents(events);
  9485. EventPluginHub.processEventQueue();
  9486. }
  9487. var ReactEventEmitterMixin = {
  9488. /**
  9489. * Streams a fired top-level event to `EventPluginHub` where plugins have the
  9490. * opportunity to create `ReactEvent`s to be dispatched.
  9491. *
  9492. * @param {string} topLevelType Record from `EventConstants`.
  9493. * @param {object} topLevelTarget The listening component root node.
  9494. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  9495. * @param {object} nativeEvent Native environment event.
  9496. */
  9497. handleTopLevel: function(
  9498. topLevelType,
  9499. topLevelTarget,
  9500. topLevelTargetID,
  9501. nativeEvent) {
  9502. var events = EventPluginHub.extractEvents(
  9503. topLevelType,
  9504. topLevelTarget,
  9505. topLevelTargetID,
  9506. nativeEvent
  9507. );
  9508. runEventQueueInBatch(events);
  9509. }
  9510. };
  9511. module.exports = ReactEventEmitterMixin;
  9512. },{"17":17}],62:[function(_dereq_,module,exports){
  9513. /**
  9514. * Copyright 2013-2015, Facebook, Inc.
  9515. * All rights reserved.
  9516. *
  9517. * This source code is licensed under the BSD-style license found in the
  9518. * LICENSE file in the root directory of this source tree. An additional grant
  9519. * of patent rights can be found in the PATENTS file in the same directory.
  9520. *
  9521. * @providesModule ReactEventListener
  9522. * @typechecks static-only
  9523. */
  9524. 'use strict';
  9525. var EventListener = _dereq_(16);
  9526. var ExecutionEnvironment = _dereq_(21);
  9527. var PooledClass = _dereq_(28);
  9528. var ReactInstanceHandles = _dereq_(66);
  9529. var ReactMount = _dereq_(70);
  9530. var ReactUpdates = _dereq_(87);
  9531. var assign = _dereq_(27);
  9532. var getEventTarget = _dereq_(125);
  9533. var getUnboundedScrollPosition = _dereq_(131);
  9534. /**
  9535. * Finds the parent React component of `node`.
  9536. *
  9537. * @param {*} node
  9538. * @return {?DOMEventTarget} Parent container, or `null` if the specified node
  9539. * is not nested.
  9540. */
  9541. function findParent(node) {
  9542. // TODO: It may be a good idea to cache this to prevent unnecessary DOM
  9543. // traversal, but caching is difficult to do correctly without using a
  9544. // mutation observer to listen for all DOM changes.
  9545. var nodeID = ReactMount.getID(node);
  9546. var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
  9547. var container = ReactMount.findReactContainerForID(rootID);
  9548. var parent = ReactMount.getFirstReactDOM(container);
  9549. return parent;
  9550. }
  9551. // Used to store ancestor hierarchy in top level callback
  9552. function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
  9553. this.topLevelType = topLevelType;
  9554. this.nativeEvent = nativeEvent;
  9555. this.ancestors = [];
  9556. }
  9557. assign(TopLevelCallbackBookKeeping.prototype, {
  9558. destructor: function() {
  9559. this.topLevelType = null;
  9560. this.nativeEvent = null;
  9561. this.ancestors.length = 0;
  9562. }
  9563. });
  9564. PooledClass.addPoolingTo(
  9565. TopLevelCallbackBookKeeping,
  9566. PooledClass.twoArgumentPooler
  9567. );
  9568. function handleTopLevelImpl(bookKeeping) {
  9569. var topLevelTarget = ReactMount.getFirstReactDOM(
  9570. getEventTarget(bookKeeping.nativeEvent)
  9571. ) || window;
  9572. // Loop through the hierarchy, in case there's any nested components.
  9573. // It's important that we build the array of ancestors before calling any
  9574. // event handlers, because event handlers can modify the DOM, leading to
  9575. // inconsistencies with ReactMount's node cache. See #1105.
  9576. var ancestor = topLevelTarget;
  9577. while (ancestor) {
  9578. bookKeeping.ancestors.push(ancestor);
  9579. ancestor = findParent(ancestor);
  9580. }
  9581. for (var i = 0, l = bookKeeping.ancestors.length; i < l; i++) {
  9582. topLevelTarget = bookKeeping.ancestors[i];
  9583. var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
  9584. ReactEventListener._handleTopLevel(
  9585. bookKeeping.topLevelType,
  9586. topLevelTarget,
  9587. topLevelTargetID,
  9588. bookKeeping.nativeEvent
  9589. );
  9590. }
  9591. }
  9592. function scrollValueMonitor(cb) {
  9593. var scrollPosition = getUnboundedScrollPosition(window);
  9594. cb(scrollPosition);
  9595. }
  9596. var ReactEventListener = {
  9597. _enabled: true,
  9598. _handleTopLevel: null,
  9599. WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
  9600. setHandleTopLevel: function(handleTopLevel) {
  9601. ReactEventListener._handleTopLevel = handleTopLevel;
  9602. },
  9603. setEnabled: function(enabled) {
  9604. ReactEventListener._enabled = !!enabled;
  9605. },
  9606. isEnabled: function() {
  9607. return ReactEventListener._enabled;
  9608. },
  9609. /**
  9610. * Traps top-level events by using event bubbling.
  9611. *
  9612. * @param {string} topLevelType Record from `EventConstants`.
  9613. * @param {string} handlerBaseName Event name (e.g. "click").
  9614. * @param {object} handle Element on which to attach listener.
  9615. * @return {object} An object with a remove function which will forcefully
  9616. * remove the listener.
  9617. * @internal
  9618. */
  9619. trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
  9620. var element = handle;
  9621. if (!element) {
  9622. return null;
  9623. }
  9624. return EventListener.listen(
  9625. element,
  9626. handlerBaseName,
  9627. ReactEventListener.dispatchEvent.bind(null, topLevelType)
  9628. );
  9629. },
  9630. /**
  9631. * Traps a top-level event by using event capturing.
  9632. *
  9633. * @param {string} topLevelType Record from `EventConstants`.
  9634. * @param {string} handlerBaseName Event name (e.g. "click").
  9635. * @param {object} handle Element on which to attach listener.
  9636. * @return {object} An object with a remove function which will forcefully
  9637. * remove the listener.
  9638. * @internal
  9639. */
  9640. trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
  9641. var element = handle;
  9642. if (!element) {
  9643. return null;
  9644. }
  9645. return EventListener.capture(
  9646. element,
  9647. handlerBaseName,
  9648. ReactEventListener.dispatchEvent.bind(null, topLevelType)
  9649. );
  9650. },
  9651. monitorScrollValue: function(refresh) {
  9652. var callback = scrollValueMonitor.bind(null, refresh);
  9653. EventListener.listen(window, 'scroll', callback);
  9654. },
  9655. dispatchEvent: function(topLevelType, nativeEvent) {
  9656. if (!ReactEventListener._enabled) {
  9657. return;
  9658. }
  9659. var bookKeeping = TopLevelCallbackBookKeeping.getPooled(
  9660. topLevelType,
  9661. nativeEvent
  9662. );
  9663. try {
  9664. // Event queue being processed in the same cycle allows
  9665. // `preventDefault`.
  9666. ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
  9667. } finally {
  9668. TopLevelCallbackBookKeeping.release(bookKeeping);
  9669. }
  9670. }
  9671. };
  9672. module.exports = ReactEventListener;
  9673. },{"125":125,"131":131,"16":16,"21":21,"27":27,"28":28,"66":66,"70":70,"87":87}],63:[function(_dereq_,module,exports){
  9674. /**
  9675. * Copyright 2015, Facebook, Inc.
  9676. * All rights reserved.
  9677. *
  9678. * This source code is licensed under the BSD-style license found in the
  9679. * LICENSE file in the root directory of this source tree. An additional grant
  9680. * of patent rights can be found in the PATENTS file in the same directory.
  9681. *
  9682. * @providesModule ReactFragment
  9683. */
  9684. 'use strict';
  9685. var ReactElement = _dereq_(57);
  9686. var warning = _dereq_(154);
  9687. /**
  9688. * We used to allow keyed objects to serve as a collection of ReactElements,
  9689. * or nested sets. This allowed us a way to explicitly key a set a fragment of
  9690. * components. This is now being replaced with an opaque data structure.
  9691. * The upgrade path is to call React.addons.createFragment({ key: value }) to
  9692. * create a keyed fragment. The resulting data structure is opaque, for now.
  9693. */
  9694. if ("production" !== "development") {
  9695. var fragmentKey = '_reactFragment';
  9696. var didWarnKey = '_reactDidWarn';
  9697. var canWarnForReactFragment = false;
  9698. try {
  9699. // Feature test. Don't even try to issue this warning if we can't use
  9700. // enumerable: false.
  9701. var dummy = function() {
  9702. return 1;
  9703. };
  9704. Object.defineProperty(
  9705. {},
  9706. fragmentKey,
  9707. {enumerable: false, value: true}
  9708. );
  9709. Object.defineProperty(
  9710. {},
  9711. 'key',
  9712. {enumerable: true, get: dummy}
  9713. );
  9714. canWarnForReactFragment = true;
  9715. } catch (x) { }
  9716. var proxyPropertyAccessWithWarning = function(obj, key) {
  9717. Object.defineProperty(obj, key, {
  9718. enumerable: true,
  9719. get: function() {
  9720. ("production" !== "development" ? warning(
  9721. this[didWarnKey],
  9722. 'A ReactFragment is an opaque type. Accessing any of its ' +
  9723. 'properties is deprecated. Pass it to one of the React.Children ' +
  9724. 'helpers.'
  9725. ) : null);
  9726. this[didWarnKey] = true;
  9727. return this[fragmentKey][key];
  9728. },
  9729. set: function(value) {
  9730. ("production" !== "development" ? warning(
  9731. this[didWarnKey],
  9732. 'A ReactFragment is an immutable opaque type. Mutating its ' +
  9733. 'properties is deprecated.'
  9734. ) : null);
  9735. this[didWarnKey] = true;
  9736. this[fragmentKey][key] = value;
  9737. }
  9738. });
  9739. };
  9740. var issuedWarnings = {};
  9741. var didWarnForFragment = function(fragment) {
  9742. // We use the keys and the type of the value as a heuristic to dedupe the
  9743. // warning to avoid spamming too much.
  9744. var fragmentCacheKey = '';
  9745. for (var key in fragment) {
  9746. fragmentCacheKey += key + ':' + (typeof fragment[key]) + ',';
  9747. }
  9748. var alreadyWarnedOnce = !!issuedWarnings[fragmentCacheKey];
  9749. issuedWarnings[fragmentCacheKey] = true;
  9750. return alreadyWarnedOnce;
  9751. };
  9752. }
  9753. var ReactFragment = {
  9754. // Wrap a keyed object in an opaque proxy that warns you if you access any
  9755. // of its properties.
  9756. create: function(object) {
  9757. if ("production" !== "development") {
  9758. if (typeof object !== 'object' || !object || Array.isArray(object)) {
  9759. ("production" !== "development" ? warning(
  9760. false,
  9761. 'React.addons.createFragment only accepts a single object.',
  9762. object
  9763. ) : null);
  9764. return object;
  9765. }
  9766. if (ReactElement.isValidElement(object)) {
  9767. ("production" !== "development" ? warning(
  9768. false,
  9769. 'React.addons.createFragment does not accept a ReactElement ' +
  9770. 'without a wrapper object.'
  9771. ) : null);
  9772. return object;
  9773. }
  9774. if (canWarnForReactFragment) {
  9775. var proxy = {};
  9776. Object.defineProperty(proxy, fragmentKey, {
  9777. enumerable: false,
  9778. value: object
  9779. });
  9780. Object.defineProperty(proxy, didWarnKey, {
  9781. writable: true,
  9782. enumerable: false,
  9783. value: false
  9784. });
  9785. for (var key in object) {
  9786. proxyPropertyAccessWithWarning(proxy, key);
  9787. }
  9788. Object.preventExtensions(proxy);
  9789. return proxy;
  9790. }
  9791. }
  9792. return object;
  9793. },
  9794. // Extract the original keyed object from the fragment opaque type. Warn if
  9795. // a plain object is passed here.
  9796. extract: function(fragment) {
  9797. if ("production" !== "development") {
  9798. if (canWarnForReactFragment) {
  9799. if (!fragment[fragmentKey]) {
  9800. ("production" !== "development" ? warning(
  9801. didWarnForFragment(fragment),
  9802. 'Any use of a keyed object should be wrapped in ' +
  9803. 'React.addons.createFragment(object) before being passed as a ' +
  9804. 'child.'
  9805. ) : null);
  9806. return fragment;
  9807. }
  9808. return fragment[fragmentKey];
  9809. }
  9810. }
  9811. return fragment;
  9812. },
  9813. // Check if this is a fragment and if so, extract the keyed object. If it
  9814. // is a fragment-like object, warn that it should be wrapped. Ignore if we
  9815. // can't determine what kind of object this is.
  9816. extractIfFragment: function(fragment) {
  9817. if ("production" !== "development") {
  9818. if (canWarnForReactFragment) {
  9819. // If it is the opaque type, return the keyed object.
  9820. if (fragment[fragmentKey]) {
  9821. return fragment[fragmentKey];
  9822. }
  9823. // Otherwise, check each property if it has an element, if it does
  9824. // it is probably meant as a fragment, so we can warn early. Defer,
  9825. // the warning to extract.
  9826. for (var key in fragment) {
  9827. if (fragment.hasOwnProperty(key) &&
  9828. ReactElement.isValidElement(fragment[key])) {
  9829. // This looks like a fragment object, we should provide an
  9830. // early warning.
  9831. return ReactFragment.extract(fragment);
  9832. }
  9833. }
  9834. }
  9835. }
  9836. return fragment;
  9837. }
  9838. };
  9839. module.exports = ReactFragment;
  9840. },{"154":154,"57":57}],64:[function(_dereq_,module,exports){
  9841. /**
  9842. * Copyright 2013-2015, Facebook, Inc.
  9843. * All rights reserved.
  9844. *
  9845. * This source code is licensed under the BSD-style license found in the
  9846. * LICENSE file in the root directory of this source tree. An additional grant
  9847. * of patent rights can be found in the PATENTS file in the same directory.
  9848. *
  9849. * @providesModule ReactInjection
  9850. */
  9851. 'use strict';
  9852. var DOMProperty = _dereq_(10);
  9853. var EventPluginHub = _dereq_(17);
  9854. var ReactComponentEnvironment = _dereq_(36);
  9855. var ReactClass = _dereq_(33);
  9856. var ReactEmptyComponent = _dereq_(59);
  9857. var ReactBrowserEventEmitter = _dereq_(30);
  9858. var ReactNativeComponent = _dereq_(73);
  9859. var ReactDOMComponent = _dereq_(42);
  9860. var ReactPerf = _dereq_(75);
  9861. var ReactRootIndex = _dereq_(83);
  9862. var ReactUpdates = _dereq_(87);
  9863. var ReactInjection = {
  9864. Component: ReactComponentEnvironment.injection,
  9865. Class: ReactClass.injection,
  9866. DOMComponent: ReactDOMComponent.injection,
  9867. DOMProperty: DOMProperty.injection,
  9868. EmptyComponent: ReactEmptyComponent.injection,
  9869. EventPluginHub: EventPluginHub.injection,
  9870. EventEmitter: ReactBrowserEventEmitter.injection,
  9871. NativeComponent: ReactNativeComponent.injection,
  9872. Perf: ReactPerf.injection,
  9873. RootIndex: ReactRootIndex.injection,
  9874. Updates: ReactUpdates.injection
  9875. };
  9876. module.exports = ReactInjection;
  9877. },{"10":10,"17":17,"30":30,"33":33,"36":36,"42":42,"59":59,"73":73,"75":75,"83":83,"87":87}],65:[function(_dereq_,module,exports){
  9878. /**
  9879. * Copyright 2013-2015, Facebook, Inc.
  9880. * All rights reserved.
  9881. *
  9882. * This source code is licensed under the BSD-style license found in the
  9883. * LICENSE file in the root directory of this source tree. An additional grant
  9884. * of patent rights can be found in the PATENTS file in the same directory.
  9885. *
  9886. * @providesModule ReactInputSelection
  9887. */
  9888. 'use strict';
  9889. var ReactDOMSelection = _dereq_(50);
  9890. var containsNode = _dereq_(109);
  9891. var focusNode = _dereq_(119);
  9892. var getActiveElement = _dereq_(121);
  9893. function isInDocument(node) {
  9894. return containsNode(document.documentElement, node);
  9895. }
  9896. /**
  9897. * @ReactInputSelection: React input selection module. Based on Selection.js,
  9898. * but modified to be suitable for react and has a couple of bug fixes (doesn't
  9899. * assume buttons have range selections allowed).
  9900. * Input selection module for React.
  9901. */
  9902. var ReactInputSelection = {
  9903. hasSelectionCapabilities: function(elem) {
  9904. return elem && (
  9905. ((elem.nodeName === 'INPUT' && elem.type === 'text') ||
  9906. elem.nodeName === 'TEXTAREA' || elem.contentEditable === 'true')
  9907. );
  9908. },
  9909. getSelectionInformation: function() {
  9910. var focusedElem = getActiveElement();
  9911. return {
  9912. focusedElem: focusedElem,
  9913. selectionRange:
  9914. ReactInputSelection.hasSelectionCapabilities(focusedElem) ?
  9915. ReactInputSelection.getSelection(focusedElem) :
  9916. null
  9917. };
  9918. },
  9919. /**
  9920. * @restoreSelection: If any selection information was potentially lost,
  9921. * restore it. This is useful when performing operations that could remove dom
  9922. * nodes and place them back in, resulting in focus being lost.
  9923. */
  9924. restoreSelection: function(priorSelectionInformation) {
  9925. var curFocusedElem = getActiveElement();
  9926. var priorFocusedElem = priorSelectionInformation.focusedElem;
  9927. var priorSelectionRange = priorSelectionInformation.selectionRange;
  9928. if (curFocusedElem !== priorFocusedElem &&
  9929. isInDocument(priorFocusedElem)) {
  9930. if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
  9931. ReactInputSelection.setSelection(
  9932. priorFocusedElem,
  9933. priorSelectionRange
  9934. );
  9935. }
  9936. focusNode(priorFocusedElem);
  9937. }
  9938. },
  9939. /**
  9940. * @getSelection: Gets the selection bounds of a focused textarea, input or
  9941. * contentEditable node.
  9942. * -@input: Look up selection bounds of this input
  9943. * -@return {start: selectionStart, end: selectionEnd}
  9944. */
  9945. getSelection: function(input) {
  9946. var selection;
  9947. if ('selectionStart' in input) {
  9948. // Modern browser with input or textarea.
  9949. selection = {
  9950. start: input.selectionStart,
  9951. end: input.selectionEnd
  9952. };
  9953. } else if (document.selection && input.nodeName === 'INPUT') {
  9954. // IE8 input.
  9955. var range = document.selection.createRange();
  9956. // There can only be one selection per document in IE, so it must
  9957. // be in our element.
  9958. if (range.parentElement() === input) {
  9959. selection = {
  9960. start: -range.moveStart('character', -input.value.length),
  9961. end: -range.moveEnd('character', -input.value.length)
  9962. };
  9963. }
  9964. } else {
  9965. // Content editable or old IE textarea.
  9966. selection = ReactDOMSelection.getOffsets(input);
  9967. }
  9968. return selection || {start: 0, end: 0};
  9969. },
  9970. /**
  9971. * @setSelection: Sets the selection bounds of a textarea or input and focuses
  9972. * the input.
  9973. * -@input Set selection bounds of this input or textarea
  9974. * -@offsets Object of same form that is returned from get*
  9975. */
  9976. setSelection: function(input, offsets) {
  9977. var start = offsets.start;
  9978. var end = offsets.end;
  9979. if (typeof end === 'undefined') {
  9980. end = start;
  9981. }
  9982. if ('selectionStart' in input) {
  9983. input.selectionStart = start;
  9984. input.selectionEnd = Math.min(end, input.value.length);
  9985. } else if (document.selection && input.nodeName === 'INPUT') {
  9986. var range = input.createTextRange();
  9987. range.collapse(true);
  9988. range.moveStart('character', start);
  9989. range.moveEnd('character', end - start);
  9990. range.select();
  9991. } else {
  9992. ReactDOMSelection.setOffsets(input, offsets);
  9993. }
  9994. }
  9995. };
  9996. module.exports = ReactInputSelection;
  9997. },{"109":109,"119":119,"121":121,"50":50}],66:[function(_dereq_,module,exports){
  9998. /**
  9999. * Copyright 2013-2015, Facebook, Inc.
  10000. * All rights reserved.
  10001. *
  10002. * This source code is licensed under the BSD-style license found in the
  10003. * LICENSE file in the root directory of this source tree. An additional grant
  10004. * of patent rights can be found in the PATENTS file in the same directory.
  10005. *
  10006. * @providesModule ReactInstanceHandles
  10007. * @typechecks static-only
  10008. */
  10009. 'use strict';
  10010. var ReactRootIndex = _dereq_(83);
  10011. var invariant = _dereq_(135);
  10012. var SEPARATOR = '.';
  10013. var SEPARATOR_LENGTH = SEPARATOR.length;
  10014. /**
  10015. * Maximum depth of traversals before we consider the possibility of a bad ID.
  10016. */
  10017. var MAX_TREE_DEPTH = 100;
  10018. /**
  10019. * Creates a DOM ID prefix to use when mounting React components.
  10020. *
  10021. * @param {number} index A unique integer
  10022. * @return {string} React root ID.
  10023. * @internal
  10024. */
  10025. function getReactRootIDString(index) {
  10026. return SEPARATOR + index.toString(36);
  10027. }
  10028. /**
  10029. * Checks if a character in the supplied ID is a separator or the end.
  10030. *
  10031. * @param {string} id A React DOM ID.
  10032. * @param {number} index Index of the character to check.
  10033. * @return {boolean} True if the character is a separator or end of the ID.
  10034. * @private
  10035. */
  10036. function isBoundary(id, index) {
  10037. return id.charAt(index) === SEPARATOR || index === id.length;
  10038. }
  10039. /**
  10040. * Checks if the supplied string is a valid React DOM ID.
  10041. *
  10042. * @param {string} id A React DOM ID, maybe.
  10043. * @return {boolean} True if the string is a valid React DOM ID.
  10044. * @private
  10045. */
  10046. function isValidID(id) {
  10047. return id === '' || (
  10048. id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR
  10049. );
  10050. }
  10051. /**
  10052. * Checks if the first ID is an ancestor of or equal to the second ID.
  10053. *
  10054. * @param {string} ancestorID
  10055. * @param {string} descendantID
  10056. * @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.
  10057. * @internal
  10058. */
  10059. function isAncestorIDOf(ancestorID, descendantID) {
  10060. return (
  10061. descendantID.indexOf(ancestorID) === 0 &&
  10062. isBoundary(descendantID, ancestorID.length)
  10063. );
  10064. }
  10065. /**
  10066. * Gets the parent ID of the supplied React DOM ID, `id`.
  10067. *
  10068. * @param {string} id ID of a component.
  10069. * @return {string} ID of the parent, or an empty string.
  10070. * @private
  10071. */
  10072. function getParentID(id) {
  10073. return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';
  10074. }
  10075. /**
  10076. * Gets the next DOM ID on the tree path from the supplied `ancestorID` to the
  10077. * supplied `destinationID`. If they are equal, the ID is returned.
  10078. *
  10079. * @param {string} ancestorID ID of an ancestor node of `destinationID`.
  10080. * @param {string} destinationID ID of the destination node.
  10081. * @return {string} Next ID on the path from `ancestorID` to `destinationID`.
  10082. * @private
  10083. */
  10084. function getNextDescendantID(ancestorID, destinationID) {
  10085. ("production" !== "development" ? invariant(
  10086. isValidID(ancestorID) && isValidID(destinationID),
  10087. 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.',
  10088. ancestorID,
  10089. destinationID
  10090. ) : invariant(isValidID(ancestorID) && isValidID(destinationID)));
  10091. ("production" !== "development" ? invariant(
  10092. isAncestorIDOf(ancestorID, destinationID),
  10093. 'getNextDescendantID(...): React has made an invalid assumption about ' +
  10094. 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.',
  10095. ancestorID,
  10096. destinationID
  10097. ) : invariant(isAncestorIDOf(ancestorID, destinationID)));
  10098. if (ancestorID === destinationID) {
  10099. return ancestorID;
  10100. }
  10101. // Skip over the ancestor and the immediate separator. Traverse until we hit
  10102. // another separator or we reach the end of `destinationID`.
  10103. var start = ancestorID.length + SEPARATOR_LENGTH;
  10104. var i;
  10105. for (i = start; i < destinationID.length; i++) {
  10106. if (isBoundary(destinationID, i)) {
  10107. break;
  10108. }
  10109. }
  10110. return destinationID.substr(0, i);
  10111. }
  10112. /**
  10113. * Gets the nearest common ancestor ID of two IDs.
  10114. *
  10115. * Using this ID scheme, the nearest common ancestor ID is the longest common
  10116. * prefix of the two IDs that immediately preceded a "marker" in both strings.
  10117. *
  10118. * @param {string} oneID
  10119. * @param {string} twoID
  10120. * @return {string} Nearest common ancestor ID, or the empty string if none.
  10121. * @private
  10122. */
  10123. function getFirstCommonAncestorID(oneID, twoID) {
  10124. var minLength = Math.min(oneID.length, twoID.length);
  10125. if (minLength === 0) {
  10126. return '';
  10127. }
  10128. var lastCommonMarkerIndex = 0;
  10129. // Use `<=` to traverse until the "EOL" of the shorter string.
  10130. for (var i = 0; i <= minLength; i++) {
  10131. if (isBoundary(oneID, i) && isBoundary(twoID, i)) {
  10132. lastCommonMarkerIndex = i;
  10133. } else if (oneID.charAt(i) !== twoID.charAt(i)) {
  10134. break;
  10135. }
  10136. }
  10137. var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
  10138. ("production" !== "development" ? invariant(
  10139. isValidID(longestCommonID),
  10140. 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s',
  10141. oneID,
  10142. twoID,
  10143. longestCommonID
  10144. ) : invariant(isValidID(longestCommonID)));
  10145. return longestCommonID;
  10146. }
  10147. /**
  10148. * Traverses the parent path between two IDs (either up or down). The IDs must
  10149. * not be the same, and there must exist a parent path between them. If the
  10150. * callback returns `false`, traversal is stopped.
  10151. *
  10152. * @param {?string} start ID at which to start traversal.
  10153. * @param {?string} stop ID at which to end traversal.
  10154. * @param {function} cb Callback to invoke each ID with.
  10155. * @param {?boolean} skipFirst Whether or not to skip the first node.
  10156. * @param {?boolean} skipLast Whether or not to skip the last node.
  10157. * @private
  10158. */
  10159. function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
  10160. start = start || '';
  10161. stop = stop || '';
  10162. ("production" !== "development" ? invariant(
  10163. start !== stop,
  10164. 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.',
  10165. start
  10166. ) : invariant(start !== stop));
  10167. var traverseUp = isAncestorIDOf(stop, start);
  10168. ("production" !== "development" ? invariant(
  10169. traverseUp || isAncestorIDOf(start, stop),
  10170. 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' +
  10171. 'not have a parent path.',
  10172. start,
  10173. stop
  10174. ) : invariant(traverseUp || isAncestorIDOf(start, stop)));
  10175. // Traverse from `start` to `stop` one depth at a time.
  10176. var depth = 0;
  10177. var traverse = traverseUp ? getParentID : getNextDescendantID;
  10178. for (var id = start; /* until break */; id = traverse(id, stop)) {
  10179. var ret;
  10180. if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
  10181. ret = cb(id, traverseUp, arg);
  10182. }
  10183. if (ret === false || id === stop) {
  10184. // Only break //after// visiting `stop`.
  10185. break;
  10186. }
  10187. ("production" !== "development" ? invariant(
  10188. depth++ < MAX_TREE_DEPTH,
  10189. 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' +
  10190. 'traversing the React DOM ID tree. This may be due to malformed IDs: %s',
  10191. start, stop
  10192. ) : invariant(depth++ < MAX_TREE_DEPTH));
  10193. }
  10194. }
  10195. /**
  10196. * Manages the IDs assigned to DOM representations of React components. This
  10197. * uses a specific scheme in order to traverse the DOM efficiently (e.g. in
  10198. * order to simulate events).
  10199. *
  10200. * @internal
  10201. */
  10202. var ReactInstanceHandles = {
  10203. /**
  10204. * Constructs a React root ID
  10205. * @return {string} A React root ID.
  10206. */
  10207. createReactRootID: function() {
  10208. return getReactRootIDString(ReactRootIndex.createReactRootIndex());
  10209. },
  10210. /**
  10211. * Constructs a React ID by joining a root ID with a name.
  10212. *
  10213. * @param {string} rootID Root ID of a parent component.
  10214. * @param {string} name A component's name (as flattened children).
  10215. * @return {string} A React ID.
  10216. * @internal
  10217. */
  10218. createReactID: function(rootID, name) {
  10219. return rootID + name;
  10220. },
  10221. /**
  10222. * Gets the DOM ID of the React component that is the root of the tree that
  10223. * contains the React component with the supplied DOM ID.
  10224. *
  10225. * @param {string} id DOM ID of a React component.
  10226. * @return {?string} DOM ID of the React component that is the root.
  10227. * @internal
  10228. */
  10229. getReactRootIDFromNodeID: function(id) {
  10230. if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
  10231. var index = id.indexOf(SEPARATOR, 1);
  10232. return index > -1 ? id.substr(0, index) : id;
  10233. }
  10234. return null;
  10235. },
  10236. /**
  10237. * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
  10238. * should would receive a `mouseEnter` or `mouseLeave` event.
  10239. *
  10240. * NOTE: Does not invoke the callback on the nearest common ancestor because
  10241. * nothing "entered" or "left" that element.
  10242. *
  10243. * @param {string} leaveID ID being left.
  10244. * @param {string} enterID ID being entered.
  10245. * @param {function} cb Callback to invoke on each entered/left ID.
  10246. * @param {*} upArg Argument to invoke the callback with on left IDs.
  10247. * @param {*} downArg Argument to invoke the callback with on entered IDs.
  10248. * @internal
  10249. */
  10250. traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {
  10251. var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
  10252. if (ancestorID !== leaveID) {
  10253. traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
  10254. }
  10255. if (ancestorID !== enterID) {
  10256. traverseParentPath(ancestorID, enterID, cb, downArg, true, false);
  10257. }
  10258. },
  10259. /**
  10260. * Simulates the traversal of a two-phase, capture/bubble event dispatch.
  10261. *
  10262. * NOTE: This traversal happens on IDs without touching the DOM.
  10263. *
  10264. * @param {string} targetID ID of the target node.
  10265. * @param {function} cb Callback to invoke.
  10266. * @param {*} arg Argument to invoke the callback with.
  10267. * @internal
  10268. */
  10269. traverseTwoPhase: function(targetID, cb, arg) {
  10270. if (targetID) {
  10271. traverseParentPath('', targetID, cb, arg, true, false);
  10272. traverseParentPath(targetID, '', cb, arg, false, true);
  10273. }
  10274. },
  10275. /**
  10276. * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
  10277. * example, passing `.0.$row-0.1` would result in `cb` getting called
  10278. * with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
  10279. *
  10280. * NOTE: This traversal happens on IDs without touching the DOM.
  10281. *
  10282. * @param {string} targetID ID of the target node.
  10283. * @param {function} cb Callback to invoke.
  10284. * @param {*} arg Argument to invoke the callback with.
  10285. * @internal
  10286. */
  10287. traverseAncestors: function(targetID, cb, arg) {
  10288. traverseParentPath('', targetID, cb, arg, true, false);
  10289. },
  10290. /**
  10291. * Exposed for unit testing.
  10292. * @private
  10293. */
  10294. _getFirstCommonAncestorID: getFirstCommonAncestorID,
  10295. /**
  10296. * Exposed for unit testing.
  10297. * @private
  10298. */
  10299. _getNextDescendantID: getNextDescendantID,
  10300. isAncestorIDOf: isAncestorIDOf,
  10301. SEPARATOR: SEPARATOR
  10302. };
  10303. module.exports = ReactInstanceHandles;
  10304. },{"135":135,"83":83}],67:[function(_dereq_,module,exports){
  10305. /**
  10306. * Copyright 2013-2015, Facebook, Inc.
  10307. * All rights reserved.
  10308. *
  10309. * This source code is licensed under the BSD-style license found in the
  10310. * LICENSE file in the root directory of this source tree. An additional grant
  10311. * of patent rights can be found in the PATENTS file in the same directory.
  10312. *
  10313. * @providesModule ReactInstanceMap
  10314. */
  10315. 'use strict';
  10316. /**
  10317. * `ReactInstanceMap` maintains a mapping from a public facing stateful
  10318. * instance (key) and the internal representation (value). This allows public
  10319. * methods to accept the user facing instance as an argument and map them back
  10320. * to internal methods.
  10321. */
  10322. // TODO: Replace this with ES6: var ReactInstanceMap = new Map();
  10323. var ReactInstanceMap = {
  10324. /**
  10325. * This API should be called `delete` but we'd have to make sure to always
  10326. * transform these to strings for IE support. When this transform is fully
  10327. * supported we can rename it.
  10328. */
  10329. remove: function(key) {
  10330. key._reactInternalInstance = undefined;
  10331. },
  10332. get: function(key) {
  10333. return key._reactInternalInstance;
  10334. },
  10335. has: function(key) {
  10336. return key._reactInternalInstance !== undefined;
  10337. },
  10338. set: function(key, value) {
  10339. key._reactInternalInstance = value;
  10340. }
  10341. };
  10342. module.exports = ReactInstanceMap;
  10343. },{}],68:[function(_dereq_,module,exports){
  10344. /**
  10345. * Copyright 2015, Facebook, Inc.
  10346. * All rights reserved.
  10347. *
  10348. * This source code is licensed under the BSD-style license found in the
  10349. * LICENSE file in the root directory of this source tree. An additional grant
  10350. * of patent rights can be found in the PATENTS file in the same directory.
  10351. *
  10352. * @providesModule ReactLifeCycle
  10353. */
  10354. 'use strict';
  10355. /**
  10356. * This module manages the bookkeeping when a component is in the process
  10357. * of being mounted or being unmounted. This is used as a way to enforce
  10358. * invariants (or warnings) when it is not recommended to call
  10359. * setState/forceUpdate.
  10360. *
  10361. * currentlyMountingInstance: During the construction phase, it is not possible
  10362. * to trigger an update since the instance is not fully mounted yet. However, we
  10363. * currently allow this as a convenience for mutating the initial state.
  10364. *
  10365. * currentlyUnmountingInstance: During the unmounting phase, the instance is
  10366. * still mounted and can therefore schedule an update. However, this is not
  10367. * recommended and probably an error since it's about to be unmounted.
  10368. * Therefore we still want to trigger in an error for that case.
  10369. */
  10370. var ReactLifeCycle = {
  10371. currentlyMountingInstance: null,
  10372. currentlyUnmountingInstance: null
  10373. };
  10374. module.exports = ReactLifeCycle;
  10375. },{}],69:[function(_dereq_,module,exports){
  10376. /**
  10377. * Copyright 2013-2015, Facebook, Inc.
  10378. * All rights reserved.
  10379. *
  10380. * This source code is licensed under the BSD-style license found in the
  10381. * LICENSE file in the root directory of this source tree. An additional grant
  10382. * of patent rights can be found in the PATENTS file in the same directory.
  10383. *
  10384. * @providesModule ReactMarkupChecksum
  10385. */
  10386. 'use strict';
  10387. var adler32 = _dereq_(106);
  10388. var ReactMarkupChecksum = {
  10389. CHECKSUM_ATTR_NAME: 'data-react-checksum',
  10390. /**
  10391. * @param {string} markup Markup string
  10392. * @return {string} Markup string with checksum attribute attached
  10393. */
  10394. addChecksumToMarkup: function(markup) {
  10395. var checksum = adler32(markup);
  10396. return markup.replace(
  10397. '>',
  10398. ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">'
  10399. );
  10400. },
  10401. /**
  10402. * @param {string} markup to use
  10403. * @param {DOMElement} element root React element
  10404. * @returns {boolean} whether or not the markup is the same
  10405. */
  10406. canReuseMarkup: function(markup, element) {
  10407. var existingChecksum = element.getAttribute(
  10408. ReactMarkupChecksum.CHECKSUM_ATTR_NAME
  10409. );
  10410. existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
  10411. var markupChecksum = adler32(markup);
  10412. return markupChecksum === existingChecksum;
  10413. }
  10414. };
  10415. module.exports = ReactMarkupChecksum;
  10416. },{"106":106}],70:[function(_dereq_,module,exports){
  10417. /**
  10418. * Copyright 2013-2015, Facebook, Inc.
  10419. * All rights reserved.
  10420. *
  10421. * This source code is licensed under the BSD-style license found in the
  10422. * LICENSE file in the root directory of this source tree. An additional grant
  10423. * of patent rights can be found in the PATENTS file in the same directory.
  10424. *
  10425. * @providesModule ReactMount
  10426. */
  10427. 'use strict';
  10428. var DOMProperty = _dereq_(10);
  10429. var ReactBrowserEventEmitter = _dereq_(30);
  10430. var ReactCurrentOwner = _dereq_(39);
  10431. var ReactElement = _dereq_(57);
  10432. var ReactElementValidator = _dereq_(58);
  10433. var ReactEmptyComponent = _dereq_(59);
  10434. var ReactInstanceHandles = _dereq_(66);
  10435. var ReactInstanceMap = _dereq_(67);
  10436. var ReactMarkupChecksum = _dereq_(69);
  10437. var ReactPerf = _dereq_(75);
  10438. var ReactReconciler = _dereq_(81);
  10439. var ReactUpdateQueue = _dereq_(86);
  10440. var ReactUpdates = _dereq_(87);
  10441. var emptyObject = _dereq_(115);
  10442. var containsNode = _dereq_(109);
  10443. var getReactRootElementInContainer = _dereq_(129);
  10444. var instantiateReactComponent = _dereq_(134);
  10445. var invariant = _dereq_(135);
  10446. var setInnerHTML = _dereq_(148);
  10447. var shouldUpdateReactComponent = _dereq_(151);
  10448. var warning = _dereq_(154);
  10449. var SEPARATOR = ReactInstanceHandles.SEPARATOR;
  10450. var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
  10451. var nodeCache = {};
  10452. var ELEMENT_NODE_TYPE = 1;
  10453. var DOC_NODE_TYPE = 9;
  10454. /** Mapping from reactRootID to React component instance. */
  10455. var instancesByReactRootID = {};
  10456. /** Mapping from reactRootID to `container` nodes. */
  10457. var containersByReactRootID = {};
  10458. if ("production" !== "development") {
  10459. /** __DEV__-only mapping from reactRootID to root elements. */
  10460. var rootElementsByReactRootID = {};
  10461. }
  10462. // Used to store breadth-first search state in findComponentRoot.
  10463. var findComponentRootReusableArray = [];
  10464. /**
  10465. * Finds the index of the first character
  10466. * that's not common between the two given strings.
  10467. *
  10468. * @return {number} the index of the character where the strings diverge
  10469. */
  10470. function firstDifferenceIndex(string1, string2) {
  10471. var minLen = Math.min(string1.length, string2.length);
  10472. for (var i = 0; i < minLen; i++) {
  10473. if (string1.charAt(i) !== string2.charAt(i)) {
  10474. return i;
  10475. }
  10476. }
  10477. return string1.length === string2.length ? -1 : minLen;
  10478. }
  10479. /**
  10480. * @param {DOMElement} container DOM element that may contain a React component.
  10481. * @return {?string} A "reactRoot" ID, if a React component is rendered.
  10482. */
  10483. function getReactRootID(container) {
  10484. var rootElement = getReactRootElementInContainer(container);
  10485. return rootElement && ReactMount.getID(rootElement);
  10486. }
  10487. /**
  10488. * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form
  10489. * element can return its control whose name or ID equals ATTR_NAME. All
  10490. * DOM nodes support `getAttributeNode` but this can also get called on
  10491. * other objects so just return '' if we're given something other than a
  10492. * DOM node (such as window).
  10493. *
  10494. * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.
  10495. * @return {string} ID of the supplied `domNode`.
  10496. */
  10497. function getID(node) {
  10498. var id = internalGetID(node);
  10499. if (id) {
  10500. if (nodeCache.hasOwnProperty(id)) {
  10501. var cached = nodeCache[id];
  10502. if (cached !== node) {
  10503. ("production" !== "development" ? invariant(
  10504. !isValid(cached, id),
  10505. 'ReactMount: Two valid but unequal nodes with the same `%s`: %s',
  10506. ATTR_NAME, id
  10507. ) : invariant(!isValid(cached, id)));
  10508. nodeCache[id] = node;
  10509. }
  10510. } else {
  10511. nodeCache[id] = node;
  10512. }
  10513. }
  10514. return id;
  10515. }
  10516. function internalGetID(node) {
  10517. // If node is something like a window, document, or text node, none of
  10518. // which support attributes or a .getAttribute method, gracefully return
  10519. // the empty string, as if the attribute were missing.
  10520. return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
  10521. }
  10522. /**
  10523. * Sets the React-specific ID of the given node.
  10524. *
  10525. * @param {DOMElement} node The DOM node whose ID will be set.
  10526. * @param {string} id The value of the ID attribute.
  10527. */
  10528. function setID(node, id) {
  10529. var oldID = internalGetID(node);
  10530. if (oldID !== id) {
  10531. delete nodeCache[oldID];
  10532. }
  10533. node.setAttribute(ATTR_NAME, id);
  10534. nodeCache[id] = node;
  10535. }
  10536. /**
  10537. * Finds the node with the supplied React-generated DOM ID.
  10538. *
  10539. * @param {string} id A React-generated DOM ID.
  10540. * @return {DOMElement} DOM node with the suppled `id`.
  10541. * @internal
  10542. */
  10543. function getNode(id) {
  10544. if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
  10545. nodeCache[id] = ReactMount.findReactNodeByID(id);
  10546. }
  10547. return nodeCache[id];
  10548. }
  10549. /**
  10550. * Finds the node with the supplied public React instance.
  10551. *
  10552. * @param {*} instance A public React instance.
  10553. * @return {?DOMElement} DOM node with the suppled `id`.
  10554. * @internal
  10555. */
  10556. function getNodeFromInstance(instance) {
  10557. var id = ReactInstanceMap.get(instance)._rootNodeID;
  10558. if (ReactEmptyComponent.isNullComponentID(id)) {
  10559. return null;
  10560. }
  10561. if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
  10562. nodeCache[id] = ReactMount.findReactNodeByID(id);
  10563. }
  10564. return nodeCache[id];
  10565. }
  10566. /**
  10567. * A node is "valid" if it is contained by a currently mounted container.
  10568. *
  10569. * This means that the node does not have to be contained by a document in
  10570. * order to be considered valid.
  10571. *
  10572. * @param {?DOMElement} node The candidate DOM node.
  10573. * @param {string} id The expected ID of the node.
  10574. * @return {boolean} Whether the node is contained by a mounted container.
  10575. */
  10576. function isValid(node, id) {
  10577. if (node) {
  10578. ("production" !== "development" ? invariant(
  10579. internalGetID(node) === id,
  10580. 'ReactMount: Unexpected modification of `%s`',
  10581. ATTR_NAME
  10582. ) : invariant(internalGetID(node) === id));
  10583. var container = ReactMount.findReactContainerForID(id);
  10584. if (container && containsNode(container, node)) {
  10585. return true;
  10586. }
  10587. }
  10588. return false;
  10589. }
  10590. /**
  10591. * Causes the cache to forget about one React-specific ID.
  10592. *
  10593. * @param {string} id The ID to forget.
  10594. */
  10595. function purgeID(id) {
  10596. delete nodeCache[id];
  10597. }
  10598. var deepestNodeSoFar = null;
  10599. function findDeepestCachedAncestorImpl(ancestorID) {
  10600. var ancestor = nodeCache[ancestorID];
  10601. if (ancestor && isValid(ancestor, ancestorID)) {
  10602. deepestNodeSoFar = ancestor;
  10603. } else {
  10604. // This node isn't populated in the cache, so presumably none of its
  10605. // descendants are. Break out of the loop.
  10606. return false;
  10607. }
  10608. }
  10609. /**
  10610. * Return the deepest cached node whose ID is a prefix of `targetID`.
  10611. */
  10612. function findDeepestCachedAncestor(targetID) {
  10613. deepestNodeSoFar = null;
  10614. ReactInstanceHandles.traverseAncestors(
  10615. targetID,
  10616. findDeepestCachedAncestorImpl
  10617. );
  10618. var foundNode = deepestNodeSoFar;
  10619. deepestNodeSoFar = null;
  10620. return foundNode;
  10621. }
  10622. /**
  10623. * Mounts this component and inserts it into the DOM.
  10624. *
  10625. * @param {ReactComponent} componentInstance The instance to mount.
  10626. * @param {string} rootID DOM ID of the root node.
  10627. * @param {DOMElement} container DOM element to mount into.
  10628. * @param {ReactReconcileTransaction} transaction
  10629. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  10630. */
  10631. function mountComponentIntoNode(
  10632. componentInstance,
  10633. rootID,
  10634. container,
  10635. transaction,
  10636. shouldReuseMarkup) {
  10637. var markup = ReactReconciler.mountComponent(
  10638. componentInstance, rootID, transaction, emptyObject
  10639. );
  10640. componentInstance._isTopLevel = true;
  10641. ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup);
  10642. }
  10643. /**
  10644. * Batched mount.
  10645. *
  10646. * @param {ReactComponent} componentInstance The instance to mount.
  10647. * @param {string} rootID DOM ID of the root node.
  10648. * @param {DOMElement} container DOM element to mount into.
  10649. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  10650. */
  10651. function batchedMountComponentIntoNode(
  10652. componentInstance,
  10653. rootID,
  10654. container,
  10655. shouldReuseMarkup) {
  10656. var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
  10657. transaction.perform(
  10658. mountComponentIntoNode,
  10659. null,
  10660. componentInstance,
  10661. rootID,
  10662. container,
  10663. transaction,
  10664. shouldReuseMarkup
  10665. );
  10666. ReactUpdates.ReactReconcileTransaction.release(transaction);
  10667. }
  10668. /**
  10669. * Mounting is the process of initializing a React component by creating its
  10670. * representative DOM elements and inserting them into a supplied `container`.
  10671. * Any prior content inside `container` is destroyed in the process.
  10672. *
  10673. * ReactMount.render(
  10674. * component,
  10675. * document.getElementById('container')
  10676. * );
  10677. *
  10678. * <div id="container"> <-- Supplied `container`.
  10679. * <div data-reactid=".3"> <-- Rendered reactRoot of React
  10680. * // ... component.
  10681. * </div>
  10682. * </div>
  10683. *
  10684. * Inside of `container`, the first element rendered is the "reactRoot".
  10685. */
  10686. var ReactMount = {
  10687. /** Exposed for debugging purposes **/
  10688. _instancesByReactRootID: instancesByReactRootID,
  10689. /**
  10690. * This is a hook provided to support rendering React components while
  10691. * ensuring that the apparent scroll position of its `container` does not
  10692. * change.
  10693. *
  10694. * @param {DOMElement} container The `container` being rendered into.
  10695. * @param {function} renderCallback This must be called once to do the render.
  10696. */
  10697. scrollMonitor: function(container, renderCallback) {
  10698. renderCallback();
  10699. },
  10700. /**
  10701. * Take a component that's already mounted into the DOM and replace its props
  10702. * @param {ReactComponent} prevComponent component instance already in the DOM
  10703. * @param {ReactElement} nextElement component instance to render
  10704. * @param {DOMElement} container container to render into
  10705. * @param {?function} callback function triggered on completion
  10706. */
  10707. _updateRootComponent: function(
  10708. prevComponent,
  10709. nextElement,
  10710. container,
  10711. callback) {
  10712. if ("production" !== "development") {
  10713. ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
  10714. }
  10715. ReactMount.scrollMonitor(container, function() {
  10716. ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
  10717. if (callback) {
  10718. ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
  10719. }
  10720. });
  10721. if ("production" !== "development") {
  10722. // Record the root element in case it later gets transplanted.
  10723. rootElementsByReactRootID[getReactRootID(container)] =
  10724. getReactRootElementInContainer(container);
  10725. }
  10726. return prevComponent;
  10727. },
  10728. /**
  10729. * Register a component into the instance map and starts scroll value
  10730. * monitoring
  10731. * @param {ReactComponent} nextComponent component instance to render
  10732. * @param {DOMElement} container container to render into
  10733. * @return {string} reactRoot ID prefix
  10734. */
  10735. _registerComponent: function(nextComponent, container) {
  10736. ("production" !== "development" ? invariant(
  10737. container && (
  10738. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  10739. ),
  10740. '_registerComponent(...): Target container is not a DOM element.'
  10741. ) : invariant(container && (
  10742. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  10743. )));
  10744. ReactBrowserEventEmitter.ensureScrollValueMonitoring();
  10745. var reactRootID = ReactMount.registerContainer(container);
  10746. instancesByReactRootID[reactRootID] = nextComponent;
  10747. return reactRootID;
  10748. },
  10749. /**
  10750. * Render a new component into the DOM.
  10751. * @param {ReactElement} nextElement element to render
  10752. * @param {DOMElement} container container to render into
  10753. * @param {boolean} shouldReuseMarkup if we should skip the markup insertion
  10754. * @return {ReactComponent} nextComponent
  10755. */
  10756. _renderNewRootComponent: function(
  10757. nextElement,
  10758. container,
  10759. shouldReuseMarkup
  10760. ) {
  10761. // Various parts of our code (such as ReactCompositeComponent's
  10762. // _renderValidatedComponent) assume that calls to render aren't nested;
  10763. // verify that that's the case.
  10764. ("production" !== "development" ? warning(
  10765. ReactCurrentOwner.current == null,
  10766. '_renderNewRootComponent(): Render methods should be a pure function ' +
  10767. 'of props and state; triggering nested component updates from ' +
  10768. 'render is not allowed. If necessary, trigger nested updates in ' +
  10769. 'componentDidUpdate.'
  10770. ) : null);
  10771. var componentInstance = instantiateReactComponent(nextElement, null);
  10772. var reactRootID = ReactMount._registerComponent(
  10773. componentInstance,
  10774. container
  10775. );
  10776. // The initial render is synchronous but any updates that happen during
  10777. // rendering, in componentWillMount or componentDidMount, will be batched
  10778. // according to the current batching strategy.
  10779. ReactUpdates.batchedUpdates(
  10780. batchedMountComponentIntoNode,
  10781. componentInstance,
  10782. reactRootID,
  10783. container,
  10784. shouldReuseMarkup
  10785. );
  10786. if ("production" !== "development") {
  10787. // Record the root element in case it later gets transplanted.
  10788. rootElementsByReactRootID[reactRootID] =
  10789. getReactRootElementInContainer(container);
  10790. }
  10791. return componentInstance;
  10792. },
  10793. /**
  10794. * Renders a React component into the DOM in the supplied `container`.
  10795. *
  10796. * If the React component was previously rendered into `container`, this will
  10797. * perform an update on it and only mutate the DOM as necessary to reflect the
  10798. * latest React component.
  10799. *
  10800. * @param {ReactElement} nextElement Component element to render.
  10801. * @param {DOMElement} container DOM element to render into.
  10802. * @param {?function} callback function triggered on completion
  10803. * @return {ReactComponent} Component instance rendered in `container`.
  10804. */
  10805. render: function(nextElement, container, callback) {
  10806. ("production" !== "development" ? invariant(
  10807. ReactElement.isValidElement(nextElement),
  10808. 'React.render(): Invalid component element.%s',
  10809. (
  10810. typeof nextElement === 'string' ?
  10811. ' Instead of passing an element string, make sure to instantiate ' +
  10812. 'it by passing it to React.createElement.' :
  10813. typeof nextElement === 'function' ?
  10814. ' Instead of passing a component class, make sure to instantiate ' +
  10815. 'it by passing it to React.createElement.' :
  10816. // Check if it quacks like an element
  10817. nextElement != null && nextElement.props !== undefined ?
  10818. ' This may be caused by unintentionally loading two independent ' +
  10819. 'copies of React.' :
  10820. ''
  10821. )
  10822. ) : invariant(ReactElement.isValidElement(nextElement)));
  10823. var prevComponent = instancesByReactRootID[getReactRootID(container)];
  10824. if (prevComponent) {
  10825. var prevElement = prevComponent._currentElement;
  10826. if (shouldUpdateReactComponent(prevElement, nextElement)) {
  10827. return ReactMount._updateRootComponent(
  10828. prevComponent,
  10829. nextElement,
  10830. container,
  10831. callback
  10832. ).getPublicInstance();
  10833. } else {
  10834. ReactMount.unmountComponentAtNode(container);
  10835. }
  10836. }
  10837. var reactRootElement = getReactRootElementInContainer(container);
  10838. var containerHasReactMarkup =
  10839. reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
  10840. if ("production" !== "development") {
  10841. if (!containerHasReactMarkup || reactRootElement.nextSibling) {
  10842. var rootElementSibling = reactRootElement;
  10843. while (rootElementSibling) {
  10844. if (ReactMount.isRenderedByReact(rootElementSibling)) {
  10845. ("production" !== "development" ? warning(
  10846. false,
  10847. 'render(): Target node has markup rendered by React, but there ' +
  10848. 'are unrelated nodes as well. This is most commonly caused by ' +
  10849. 'white-space inserted around server-rendered markup.'
  10850. ) : null);
  10851. break;
  10852. }
  10853. rootElementSibling = rootElementSibling.nextSibling;
  10854. }
  10855. }
  10856. }
  10857. var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;
  10858. var component = ReactMount._renderNewRootComponent(
  10859. nextElement,
  10860. container,
  10861. shouldReuseMarkup
  10862. ).getPublicInstance();
  10863. if (callback) {
  10864. callback.call(component);
  10865. }
  10866. return component;
  10867. },
  10868. /**
  10869. * Constructs a component instance of `constructor` with `initialProps` and
  10870. * renders it into the supplied `container`.
  10871. *
  10872. * @param {function} constructor React component constructor.
  10873. * @param {?object} props Initial props of the component instance.
  10874. * @param {DOMElement} container DOM element to render into.
  10875. * @return {ReactComponent} Component instance rendered in `container`.
  10876. */
  10877. constructAndRenderComponent: function(constructor, props, container) {
  10878. var element = ReactElement.createElement(constructor, props);
  10879. return ReactMount.render(element, container);
  10880. },
  10881. /**
  10882. * Constructs a component instance of `constructor` with `initialProps` and
  10883. * renders it into a container node identified by supplied `id`.
  10884. *
  10885. * @param {function} componentConstructor React component constructor
  10886. * @param {?object} props Initial props of the component instance.
  10887. * @param {string} id ID of the DOM element to render into.
  10888. * @return {ReactComponent} Component instance rendered in the container node.
  10889. */
  10890. constructAndRenderComponentByID: function(constructor, props, id) {
  10891. var domNode = document.getElementById(id);
  10892. ("production" !== "development" ? invariant(
  10893. domNode,
  10894. 'Tried to get element with id of "%s" but it is not present on the page.',
  10895. id
  10896. ) : invariant(domNode));
  10897. return ReactMount.constructAndRenderComponent(constructor, props, domNode);
  10898. },
  10899. /**
  10900. * Registers a container node into which React components will be rendered.
  10901. * This also creates the "reactRoot" ID that will be assigned to the element
  10902. * rendered within.
  10903. *
  10904. * @param {DOMElement} container DOM element to register as a container.
  10905. * @return {string} The "reactRoot" ID of elements rendered within.
  10906. */
  10907. registerContainer: function(container) {
  10908. var reactRootID = getReactRootID(container);
  10909. if (reactRootID) {
  10910. // If one exists, make sure it is a valid "reactRoot" ID.
  10911. reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);
  10912. }
  10913. if (!reactRootID) {
  10914. // No valid "reactRoot" ID found, create one.
  10915. reactRootID = ReactInstanceHandles.createReactRootID();
  10916. }
  10917. containersByReactRootID[reactRootID] = container;
  10918. return reactRootID;
  10919. },
  10920. /**
  10921. * Unmounts and destroys the React component rendered in the `container`.
  10922. *
  10923. * @param {DOMElement} container DOM element containing a React component.
  10924. * @return {boolean} True if a component was found in and unmounted from
  10925. * `container`
  10926. */
  10927. unmountComponentAtNode: function(container) {
  10928. // Various parts of our code (such as ReactCompositeComponent's
  10929. // _renderValidatedComponent) assume that calls to render aren't nested;
  10930. // verify that that's the case. (Strictly speaking, unmounting won't cause a
  10931. // render but we still don't expect to be in a render call here.)
  10932. ("production" !== "development" ? warning(
  10933. ReactCurrentOwner.current == null,
  10934. 'unmountComponentAtNode(): Render methods should be a pure function of ' +
  10935. 'props and state; triggering nested component updates from render is ' +
  10936. 'not allowed. If necessary, trigger nested updates in ' +
  10937. 'componentDidUpdate.'
  10938. ) : null);
  10939. ("production" !== "development" ? invariant(
  10940. container && (
  10941. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  10942. ),
  10943. 'unmountComponentAtNode(...): Target container is not a DOM element.'
  10944. ) : invariant(container && (
  10945. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  10946. )));
  10947. var reactRootID = getReactRootID(container);
  10948. var component = instancesByReactRootID[reactRootID];
  10949. if (!component) {
  10950. return false;
  10951. }
  10952. ReactMount.unmountComponentFromNode(component, container);
  10953. delete instancesByReactRootID[reactRootID];
  10954. delete containersByReactRootID[reactRootID];
  10955. if ("production" !== "development") {
  10956. delete rootElementsByReactRootID[reactRootID];
  10957. }
  10958. return true;
  10959. },
  10960. /**
  10961. * Unmounts a component and removes it from the DOM.
  10962. *
  10963. * @param {ReactComponent} instance React component instance.
  10964. * @param {DOMElement} container DOM element to unmount from.
  10965. * @final
  10966. * @internal
  10967. * @see {ReactMount.unmountComponentAtNode}
  10968. */
  10969. unmountComponentFromNode: function(instance, container) {
  10970. ReactReconciler.unmountComponent(instance);
  10971. if (container.nodeType === DOC_NODE_TYPE) {
  10972. container = container.documentElement;
  10973. }
  10974. // http://jsperf.com/emptying-a-node
  10975. while (container.lastChild) {
  10976. container.removeChild(container.lastChild);
  10977. }
  10978. },
  10979. /**
  10980. * Finds the container DOM element that contains React component to which the
  10981. * supplied DOM `id` belongs.
  10982. *
  10983. * @param {string} id The ID of an element rendered by a React component.
  10984. * @return {?DOMElement} DOM element that contains the `id`.
  10985. */
  10986. findReactContainerForID: function(id) {
  10987. var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
  10988. var container = containersByReactRootID[reactRootID];
  10989. if ("production" !== "development") {
  10990. var rootElement = rootElementsByReactRootID[reactRootID];
  10991. if (rootElement && rootElement.parentNode !== container) {
  10992. ("production" !== "development" ? invariant(
  10993. // Call internalGetID here because getID calls isValid which calls
  10994. // findReactContainerForID (this function).
  10995. internalGetID(rootElement) === reactRootID,
  10996. 'ReactMount: Root element ID differed from reactRootID.'
  10997. ) : invariant(// Call internalGetID here because getID calls isValid which calls
  10998. // findReactContainerForID (this function).
  10999. internalGetID(rootElement) === reactRootID));
  11000. var containerChild = container.firstChild;
  11001. if (containerChild &&
  11002. reactRootID === internalGetID(containerChild)) {
  11003. // If the container has a new child with the same ID as the old
  11004. // root element, then rootElementsByReactRootID[reactRootID] is
  11005. // just stale and needs to be updated. The case that deserves a
  11006. // warning is when the container is empty.
  11007. rootElementsByReactRootID[reactRootID] = containerChild;
  11008. } else {
  11009. ("production" !== "development" ? warning(
  11010. false,
  11011. 'ReactMount: Root element has been removed from its original ' +
  11012. 'container. New container:', rootElement.parentNode
  11013. ) : null);
  11014. }
  11015. }
  11016. }
  11017. return container;
  11018. },
  11019. /**
  11020. * Finds an element rendered by React with the supplied ID.
  11021. *
  11022. * @param {string} id ID of a DOM node in the React component.
  11023. * @return {DOMElement} Root DOM node of the React component.
  11024. */
  11025. findReactNodeByID: function(id) {
  11026. var reactRoot = ReactMount.findReactContainerForID(id);
  11027. return ReactMount.findComponentRoot(reactRoot, id);
  11028. },
  11029. /**
  11030. * True if the supplied `node` is rendered by React.
  11031. *
  11032. * @param {*} node DOM Element to check.
  11033. * @return {boolean} True if the DOM Element appears to be rendered by React.
  11034. * @internal
  11035. */
  11036. isRenderedByReact: function(node) {
  11037. if (node.nodeType !== 1) {
  11038. // Not a DOMElement, therefore not a React component
  11039. return false;
  11040. }
  11041. var id = ReactMount.getID(node);
  11042. return id ? id.charAt(0) === SEPARATOR : false;
  11043. },
  11044. /**
  11045. * Traverses up the ancestors of the supplied node to find a node that is a
  11046. * DOM representation of a React component.
  11047. *
  11048. * @param {*} node
  11049. * @return {?DOMEventTarget}
  11050. * @internal
  11051. */
  11052. getFirstReactDOM: function(node) {
  11053. var current = node;
  11054. while (current && current.parentNode !== current) {
  11055. if (ReactMount.isRenderedByReact(current)) {
  11056. return current;
  11057. }
  11058. current = current.parentNode;
  11059. }
  11060. return null;
  11061. },
  11062. /**
  11063. * Finds a node with the supplied `targetID` inside of the supplied
  11064. * `ancestorNode`. Exploits the ID naming scheme to perform the search
  11065. * quickly.
  11066. *
  11067. * @param {DOMEventTarget} ancestorNode Search from this root.
  11068. * @pararm {string} targetID ID of the DOM representation of the component.
  11069. * @return {DOMEventTarget} DOM node with the supplied `targetID`.
  11070. * @internal
  11071. */
  11072. findComponentRoot: function(ancestorNode, targetID) {
  11073. var firstChildren = findComponentRootReusableArray;
  11074. var childIndex = 0;
  11075. var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
  11076. firstChildren[0] = deepestAncestor.firstChild;
  11077. firstChildren.length = 1;
  11078. while (childIndex < firstChildren.length) {
  11079. var child = firstChildren[childIndex++];
  11080. var targetChild;
  11081. while (child) {
  11082. var childID = ReactMount.getID(child);
  11083. if (childID) {
  11084. // Even if we find the node we're looking for, we finish looping
  11085. // through its siblings to ensure they're cached so that we don't have
  11086. // to revisit this node again. Otherwise, we make n^2 calls to getID
  11087. // when visiting the many children of a single node in order.
  11088. if (targetID === childID) {
  11089. targetChild = child;
  11090. } else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) {
  11091. // If we find a child whose ID is an ancestor of the given ID,
  11092. // then we can be sure that we only want to search the subtree
  11093. // rooted at this child, so we can throw out the rest of the
  11094. // search state.
  11095. firstChildren.length = childIndex = 0;
  11096. firstChildren.push(child.firstChild);
  11097. }
  11098. } else {
  11099. // If this child had no ID, then there's a chance that it was
  11100. // injected automatically by the browser, as when a `<table>`
  11101. // element sprouts an extra `<tbody>` child as a side effect of
  11102. // `.innerHTML` parsing. Optimistically continue down this
  11103. // branch, but not before examining the other siblings.
  11104. firstChildren.push(child.firstChild);
  11105. }
  11106. child = child.nextSibling;
  11107. }
  11108. if (targetChild) {
  11109. // Emptying firstChildren/findComponentRootReusableArray is
  11110. // not necessary for correctness, but it helps the GC reclaim
  11111. // any nodes that were left at the end of the search.
  11112. firstChildren.length = 0;
  11113. return targetChild;
  11114. }
  11115. }
  11116. firstChildren.length = 0;
  11117. ("production" !== "development" ? invariant(
  11118. false,
  11119. 'findComponentRoot(..., %s): Unable to find element. This probably ' +
  11120. 'means the DOM was unexpectedly mutated (e.g., by the browser), ' +
  11121. 'usually due to forgetting a <tbody> when using tables, nesting tags ' +
  11122. 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' +
  11123. 'parent. ' +
  11124. 'Try inspecting the child nodes of the element with React ID `%s`.',
  11125. targetID,
  11126. ReactMount.getID(ancestorNode)
  11127. ) : invariant(false));
  11128. },
  11129. _mountImageIntoNode: function(markup, container, shouldReuseMarkup) {
  11130. ("production" !== "development" ? invariant(
  11131. container && (
  11132. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11133. ),
  11134. 'mountComponentIntoNode(...): Target container is not valid.'
  11135. ) : invariant(container && (
  11136. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11137. )));
  11138. if (shouldReuseMarkup) {
  11139. var rootElement = getReactRootElementInContainer(container);
  11140. if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
  11141. return;
  11142. } else {
  11143. var checksum = rootElement.getAttribute(
  11144. ReactMarkupChecksum.CHECKSUM_ATTR_NAME
  11145. );
  11146. rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  11147. var rootMarkup = rootElement.outerHTML;
  11148. rootElement.setAttribute(
  11149. ReactMarkupChecksum.CHECKSUM_ATTR_NAME,
  11150. checksum
  11151. );
  11152. var diffIndex = firstDifferenceIndex(markup, rootMarkup);
  11153. var difference = ' (client) ' +
  11154. markup.substring(diffIndex - 20, diffIndex + 20) +
  11155. '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
  11156. ("production" !== "development" ? invariant(
  11157. container.nodeType !== DOC_NODE_TYPE,
  11158. 'You\'re trying to render a component to the document using ' +
  11159. 'server rendering but the checksum was invalid. This usually ' +
  11160. 'means you rendered a different component type or props on ' +
  11161. 'the client from the one on the server, or your render() ' +
  11162. 'methods are impure. React cannot handle this case due to ' +
  11163. 'cross-browser quirks by rendering at the document root. You ' +
  11164. 'should look for environment dependent code in your components ' +
  11165. 'and ensure the props are the same client and server side:\n%s',
  11166. difference
  11167. ) : invariant(container.nodeType !== DOC_NODE_TYPE));
  11168. if ("production" !== "development") {
  11169. ("production" !== "development" ? warning(
  11170. false,
  11171. 'React attempted to reuse markup in a container but the ' +
  11172. 'checksum was invalid. This generally means that you are ' +
  11173. 'using server rendering and the markup generated on the ' +
  11174. 'server was not what the client was expecting. React injected ' +
  11175. 'new markup to compensate which works but you have lost many ' +
  11176. 'of the benefits of server rendering. Instead, figure out ' +
  11177. 'why the markup being generated is different on the client ' +
  11178. 'or server:\n%s',
  11179. difference
  11180. ) : null);
  11181. }
  11182. }
  11183. }
  11184. ("production" !== "development" ? invariant(
  11185. container.nodeType !== DOC_NODE_TYPE,
  11186. 'You\'re trying to render a component to the document but ' +
  11187. 'you didn\'t use server rendering. We can\'t do this ' +
  11188. 'without using server rendering due to cross-browser quirks. ' +
  11189. 'See React.renderToString() for server rendering.'
  11190. ) : invariant(container.nodeType !== DOC_NODE_TYPE));
  11191. setInnerHTML(container, markup);
  11192. },
  11193. /**
  11194. * React ID utilities.
  11195. */
  11196. getReactRootID: getReactRootID,
  11197. getID: getID,
  11198. setID: setID,
  11199. getNode: getNode,
  11200. getNodeFromInstance: getNodeFromInstance,
  11201. purgeID: purgeID
  11202. };
  11203. ReactPerf.measureMethods(ReactMount, 'ReactMount', {
  11204. _renderNewRootComponent: '_renderNewRootComponent',
  11205. _mountImageIntoNode: '_mountImageIntoNode'
  11206. });
  11207. module.exports = ReactMount;
  11208. },{"10":10,"109":109,"115":115,"129":129,"134":134,"135":135,"148":148,"151":151,"154":154,"30":30,"39":39,"57":57,"58":58,"59":59,"66":66,"67":67,"69":69,"75":75,"81":81,"86":86,"87":87}],71:[function(_dereq_,module,exports){
  11209. /**
  11210. * Copyright 2013-2015, Facebook, Inc.
  11211. * All rights reserved.
  11212. *
  11213. * This source code is licensed under the BSD-style license found in the
  11214. * LICENSE file in the root directory of this source tree. An additional grant
  11215. * of patent rights can be found in the PATENTS file in the same directory.
  11216. *
  11217. * @providesModule ReactMultiChild
  11218. * @typechecks static-only
  11219. */
  11220. 'use strict';
  11221. var ReactComponentEnvironment = _dereq_(36);
  11222. var ReactMultiChildUpdateTypes = _dereq_(72);
  11223. var ReactReconciler = _dereq_(81);
  11224. var ReactChildReconciler = _dereq_(31);
  11225. /**
  11226. * Updating children of a component may trigger recursive updates. The depth is
  11227. * used to batch recursive updates to render markup more efficiently.
  11228. *
  11229. * @type {number}
  11230. * @private
  11231. */
  11232. var updateDepth = 0;
  11233. /**
  11234. * Queue of update configuration objects.
  11235. *
  11236. * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
  11237. *
  11238. * @type {array<object>}
  11239. * @private
  11240. */
  11241. var updateQueue = [];
  11242. /**
  11243. * Queue of markup to be rendered.
  11244. *
  11245. * @type {array<string>}
  11246. * @private
  11247. */
  11248. var markupQueue = [];
  11249. /**
  11250. * Enqueues markup to be rendered and inserted at a supplied index.
  11251. *
  11252. * @param {string} parentID ID of the parent component.
  11253. * @param {string} markup Markup that renders into an element.
  11254. * @param {number} toIndex Destination index.
  11255. * @private
  11256. */
  11257. function enqueueMarkup(parentID, markup, toIndex) {
  11258. // NOTE: Null values reduce hidden classes.
  11259. updateQueue.push({
  11260. parentID: parentID,
  11261. parentNode: null,
  11262. type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
  11263. markupIndex: markupQueue.push(markup) - 1,
  11264. textContent: null,
  11265. fromIndex: null,
  11266. toIndex: toIndex
  11267. });
  11268. }
  11269. /**
  11270. * Enqueues moving an existing element to another index.
  11271. *
  11272. * @param {string} parentID ID of the parent component.
  11273. * @param {number} fromIndex Source index of the existing element.
  11274. * @param {number} toIndex Destination index of the element.
  11275. * @private
  11276. */
  11277. function enqueueMove(parentID, fromIndex, toIndex) {
  11278. // NOTE: Null values reduce hidden classes.
  11279. updateQueue.push({
  11280. parentID: parentID,
  11281. parentNode: null,
  11282. type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
  11283. markupIndex: null,
  11284. textContent: null,
  11285. fromIndex: fromIndex,
  11286. toIndex: toIndex
  11287. });
  11288. }
  11289. /**
  11290. * Enqueues removing an element at an index.
  11291. *
  11292. * @param {string} parentID ID of the parent component.
  11293. * @param {number} fromIndex Index of the element to remove.
  11294. * @private
  11295. */
  11296. function enqueueRemove(parentID, fromIndex) {
  11297. // NOTE: Null values reduce hidden classes.
  11298. updateQueue.push({
  11299. parentID: parentID,
  11300. parentNode: null,
  11301. type: ReactMultiChildUpdateTypes.REMOVE_NODE,
  11302. markupIndex: null,
  11303. textContent: null,
  11304. fromIndex: fromIndex,
  11305. toIndex: null
  11306. });
  11307. }
  11308. /**
  11309. * Enqueues setting the text content.
  11310. *
  11311. * @param {string} parentID ID of the parent component.
  11312. * @param {string} textContent Text content to set.
  11313. * @private
  11314. */
  11315. function enqueueTextContent(parentID, textContent) {
  11316. // NOTE: Null values reduce hidden classes.
  11317. updateQueue.push({
  11318. parentID: parentID,
  11319. parentNode: null,
  11320. type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
  11321. markupIndex: null,
  11322. textContent: textContent,
  11323. fromIndex: null,
  11324. toIndex: null
  11325. });
  11326. }
  11327. /**
  11328. * Processes any enqueued updates.
  11329. *
  11330. * @private
  11331. */
  11332. function processQueue() {
  11333. if (updateQueue.length) {
  11334. ReactComponentEnvironment.processChildrenUpdates(
  11335. updateQueue,
  11336. markupQueue
  11337. );
  11338. clearQueue();
  11339. }
  11340. }
  11341. /**
  11342. * Clears any enqueued updates.
  11343. *
  11344. * @private
  11345. */
  11346. function clearQueue() {
  11347. updateQueue.length = 0;
  11348. markupQueue.length = 0;
  11349. }
  11350. /**
  11351. * ReactMultiChild are capable of reconciling multiple children.
  11352. *
  11353. * @class ReactMultiChild
  11354. * @internal
  11355. */
  11356. var ReactMultiChild = {
  11357. /**
  11358. * Provides common functionality for components that must reconcile multiple
  11359. * children. This is used by `ReactDOMComponent` to mount, update, and
  11360. * unmount child components.
  11361. *
  11362. * @lends {ReactMultiChild.prototype}
  11363. */
  11364. Mixin: {
  11365. /**
  11366. * Generates a "mount image" for each of the supplied children. In the case
  11367. * of `ReactDOMComponent`, a mount image is a string of markup.
  11368. *
  11369. * @param {?object} nestedChildren Nested child maps.
  11370. * @return {array} An array of mounted representations.
  11371. * @internal
  11372. */
  11373. mountChildren: function(nestedChildren, transaction, context) {
  11374. var children = ReactChildReconciler.instantiateChildren(
  11375. nestedChildren, transaction, context
  11376. );
  11377. this._renderedChildren = children;
  11378. var mountImages = [];
  11379. var index = 0;
  11380. for (var name in children) {
  11381. if (children.hasOwnProperty(name)) {
  11382. var child = children[name];
  11383. // Inlined for performance, see `ReactInstanceHandles.createReactID`.
  11384. var rootID = this._rootNodeID + name;
  11385. var mountImage = ReactReconciler.mountComponent(
  11386. child,
  11387. rootID,
  11388. transaction,
  11389. context
  11390. );
  11391. child._mountIndex = index;
  11392. mountImages.push(mountImage);
  11393. index++;
  11394. }
  11395. }
  11396. return mountImages;
  11397. },
  11398. /**
  11399. * Replaces any rendered children with a text content string.
  11400. *
  11401. * @param {string} nextContent String of content.
  11402. * @internal
  11403. */
  11404. updateTextContent: function(nextContent) {
  11405. updateDepth++;
  11406. var errorThrown = true;
  11407. try {
  11408. var prevChildren = this._renderedChildren;
  11409. // Remove any rendered children.
  11410. ReactChildReconciler.unmountChildren(prevChildren);
  11411. // TODO: The setTextContent operation should be enough
  11412. for (var name in prevChildren) {
  11413. if (prevChildren.hasOwnProperty(name)) {
  11414. this._unmountChildByName(prevChildren[name], name);
  11415. }
  11416. }
  11417. // Set new text content.
  11418. this.setTextContent(nextContent);
  11419. errorThrown = false;
  11420. } finally {
  11421. updateDepth--;
  11422. if (!updateDepth) {
  11423. if (errorThrown) {
  11424. clearQueue();
  11425. } else {
  11426. processQueue();
  11427. }
  11428. }
  11429. }
  11430. },
  11431. /**
  11432. * Updates the rendered children with new children.
  11433. *
  11434. * @param {?object} nextNestedChildren Nested child maps.
  11435. * @param {ReactReconcileTransaction} transaction
  11436. * @internal
  11437. */
  11438. updateChildren: function(nextNestedChildren, transaction, context) {
  11439. updateDepth++;
  11440. var errorThrown = true;
  11441. try {
  11442. this._updateChildren(nextNestedChildren, transaction, context);
  11443. errorThrown = false;
  11444. } finally {
  11445. updateDepth--;
  11446. if (!updateDepth) {
  11447. if (errorThrown) {
  11448. clearQueue();
  11449. } else {
  11450. processQueue();
  11451. }
  11452. }
  11453. }
  11454. },
  11455. /**
  11456. * Improve performance by isolating this hot code path from the try/catch
  11457. * block in `updateChildren`.
  11458. *
  11459. * @param {?object} nextNestedChildren Nested child maps.
  11460. * @param {ReactReconcileTransaction} transaction
  11461. * @final
  11462. * @protected
  11463. */
  11464. _updateChildren: function(nextNestedChildren, transaction, context) {
  11465. var prevChildren = this._renderedChildren;
  11466. var nextChildren = ReactChildReconciler.updateChildren(
  11467. prevChildren, nextNestedChildren, transaction, context
  11468. );
  11469. this._renderedChildren = nextChildren;
  11470. if (!nextChildren && !prevChildren) {
  11471. return;
  11472. }
  11473. var name;
  11474. // `nextIndex` will increment for each child in `nextChildren`, but
  11475. // `lastIndex` will be the last index visited in `prevChildren`.
  11476. var lastIndex = 0;
  11477. var nextIndex = 0;
  11478. for (name in nextChildren) {
  11479. if (!nextChildren.hasOwnProperty(name)) {
  11480. continue;
  11481. }
  11482. var prevChild = prevChildren && prevChildren[name];
  11483. var nextChild = nextChildren[name];
  11484. if (prevChild === nextChild) {
  11485. this.moveChild(prevChild, nextIndex, lastIndex);
  11486. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  11487. prevChild._mountIndex = nextIndex;
  11488. } else {
  11489. if (prevChild) {
  11490. // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
  11491. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  11492. this._unmountChildByName(prevChild, name);
  11493. }
  11494. // The child must be instantiated before it's mounted.
  11495. this._mountChildByNameAtIndex(
  11496. nextChild, name, nextIndex, transaction, context
  11497. );
  11498. }
  11499. nextIndex++;
  11500. }
  11501. // Remove children that are no longer present.
  11502. for (name in prevChildren) {
  11503. if (prevChildren.hasOwnProperty(name) &&
  11504. !(nextChildren && nextChildren.hasOwnProperty(name))) {
  11505. this._unmountChildByName(prevChildren[name], name);
  11506. }
  11507. }
  11508. },
  11509. /**
  11510. * Unmounts all rendered children. This should be used to clean up children
  11511. * when this component is unmounted.
  11512. *
  11513. * @internal
  11514. */
  11515. unmountChildren: function() {
  11516. var renderedChildren = this._renderedChildren;
  11517. ReactChildReconciler.unmountChildren(renderedChildren);
  11518. this._renderedChildren = null;
  11519. },
  11520. /**
  11521. * Moves a child component to the supplied index.
  11522. *
  11523. * @param {ReactComponent} child Component to move.
  11524. * @param {number} toIndex Destination index of the element.
  11525. * @param {number} lastIndex Last index visited of the siblings of `child`.
  11526. * @protected
  11527. */
  11528. moveChild: function(child, toIndex, lastIndex) {
  11529. // If the index of `child` is less than `lastIndex`, then it needs to
  11530. // be moved. Otherwise, we do not need to move it because a child will be
  11531. // inserted or moved before `child`.
  11532. if (child._mountIndex < lastIndex) {
  11533. enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
  11534. }
  11535. },
  11536. /**
  11537. * Creates a child component.
  11538. *
  11539. * @param {ReactComponent} child Component to create.
  11540. * @param {string} mountImage Markup to insert.
  11541. * @protected
  11542. */
  11543. createChild: function(child, mountImage) {
  11544. enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex);
  11545. },
  11546. /**
  11547. * Removes a child component.
  11548. *
  11549. * @param {ReactComponent} child Child to remove.
  11550. * @protected
  11551. */
  11552. removeChild: function(child) {
  11553. enqueueRemove(this._rootNodeID, child._mountIndex);
  11554. },
  11555. /**
  11556. * Sets this text content string.
  11557. *
  11558. * @param {string} textContent Text content to set.
  11559. * @protected
  11560. */
  11561. setTextContent: function(textContent) {
  11562. enqueueTextContent(this._rootNodeID, textContent);
  11563. },
  11564. /**
  11565. * Mounts a child with the supplied name.
  11566. *
  11567. * NOTE: This is part of `updateChildren` and is here for readability.
  11568. *
  11569. * @param {ReactComponent} child Component to mount.
  11570. * @param {string} name Name of the child.
  11571. * @param {number} index Index at which to insert the child.
  11572. * @param {ReactReconcileTransaction} transaction
  11573. * @private
  11574. */
  11575. _mountChildByNameAtIndex: function(
  11576. child,
  11577. name,
  11578. index,
  11579. transaction,
  11580. context) {
  11581. // Inlined for performance, see `ReactInstanceHandles.createReactID`.
  11582. var rootID = this._rootNodeID + name;
  11583. var mountImage = ReactReconciler.mountComponent(
  11584. child,
  11585. rootID,
  11586. transaction,
  11587. context
  11588. );
  11589. child._mountIndex = index;
  11590. this.createChild(child, mountImage);
  11591. },
  11592. /**
  11593. * Unmounts a rendered child by name.
  11594. *
  11595. * NOTE: This is part of `updateChildren` and is here for readability.
  11596. *
  11597. * @param {ReactComponent} child Component to unmount.
  11598. * @param {string} name Name of the child in `this._renderedChildren`.
  11599. * @private
  11600. */
  11601. _unmountChildByName: function(child, name) {
  11602. this.removeChild(child);
  11603. child._mountIndex = null;
  11604. }
  11605. }
  11606. };
  11607. module.exports = ReactMultiChild;
  11608. },{"31":31,"36":36,"72":72,"81":81}],72:[function(_dereq_,module,exports){
  11609. /**
  11610. * Copyright 2013-2015, Facebook, Inc.
  11611. * All rights reserved.
  11612. *
  11613. * This source code is licensed under the BSD-style license found in the
  11614. * LICENSE file in the root directory of this source tree. An additional grant
  11615. * of patent rights can be found in the PATENTS file in the same directory.
  11616. *
  11617. * @providesModule ReactMultiChildUpdateTypes
  11618. */
  11619. 'use strict';
  11620. var keyMirror = _dereq_(140);
  11621. /**
  11622. * When a component's children are updated, a series of update configuration
  11623. * objects are created in order to batch and serialize the required changes.
  11624. *
  11625. * Enumerates all the possible types of update configurations.
  11626. *
  11627. * @internal
  11628. */
  11629. var ReactMultiChildUpdateTypes = keyMirror({
  11630. INSERT_MARKUP: null,
  11631. MOVE_EXISTING: null,
  11632. REMOVE_NODE: null,
  11633. TEXT_CONTENT: null
  11634. });
  11635. module.exports = ReactMultiChildUpdateTypes;
  11636. },{"140":140}],73:[function(_dereq_,module,exports){
  11637. /**
  11638. * Copyright 2014-2015, Facebook, Inc.
  11639. * All rights reserved.
  11640. *
  11641. * This source code is licensed under the BSD-style license found in the
  11642. * LICENSE file in the root directory of this source tree. An additional grant
  11643. * of patent rights can be found in the PATENTS file in the same directory.
  11644. *
  11645. * @providesModule ReactNativeComponent
  11646. */
  11647. 'use strict';
  11648. var assign = _dereq_(27);
  11649. var invariant = _dereq_(135);
  11650. var autoGenerateWrapperClass = null;
  11651. var genericComponentClass = null;
  11652. // This registry keeps track of wrapper classes around native tags
  11653. var tagToComponentClass = {};
  11654. var textComponentClass = null;
  11655. var ReactNativeComponentInjection = {
  11656. // This accepts a class that receives the tag string. This is a catch all
  11657. // that can render any kind of tag.
  11658. injectGenericComponentClass: function(componentClass) {
  11659. genericComponentClass = componentClass;
  11660. },
  11661. // This accepts a text component class that takes the text string to be
  11662. // rendered as props.
  11663. injectTextComponentClass: function(componentClass) {
  11664. textComponentClass = componentClass;
  11665. },
  11666. // This accepts a keyed object with classes as values. Each key represents a
  11667. // tag. That particular tag will use this class instead of the generic one.
  11668. injectComponentClasses: function(componentClasses) {
  11669. assign(tagToComponentClass, componentClasses);
  11670. },
  11671. // Temporary hack since we expect DOM refs to behave like composites,
  11672. // for this release.
  11673. injectAutoWrapper: function(wrapperFactory) {
  11674. autoGenerateWrapperClass = wrapperFactory;
  11675. }
  11676. };
  11677. /**
  11678. * Get a composite component wrapper class for a specific tag.
  11679. *
  11680. * @param {ReactElement} element The tag for which to get the class.
  11681. * @return {function} The React class constructor function.
  11682. */
  11683. function getComponentClassForElement(element) {
  11684. if (typeof element.type === 'function') {
  11685. return element.type;
  11686. }
  11687. var tag = element.type;
  11688. var componentClass = tagToComponentClass[tag];
  11689. if (componentClass == null) {
  11690. tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
  11691. }
  11692. return componentClass;
  11693. }
  11694. /**
  11695. * Get a native internal component class for a specific tag.
  11696. *
  11697. * @param {ReactElement} element The element to create.
  11698. * @return {function} The internal class constructor function.
  11699. */
  11700. function createInternalComponent(element) {
  11701. ("production" !== "development" ? invariant(
  11702. genericComponentClass,
  11703. 'There is no registered component for the tag %s',
  11704. element.type
  11705. ) : invariant(genericComponentClass));
  11706. return new genericComponentClass(element.type, element.props);
  11707. }
  11708. /**
  11709. * @param {ReactText} text
  11710. * @return {ReactComponent}
  11711. */
  11712. function createInstanceForText(text) {
  11713. return new textComponentClass(text);
  11714. }
  11715. /**
  11716. * @param {ReactComponent} component
  11717. * @return {boolean}
  11718. */
  11719. function isTextComponent(component) {
  11720. return component instanceof textComponentClass;
  11721. }
  11722. var ReactNativeComponent = {
  11723. getComponentClassForElement: getComponentClassForElement,
  11724. createInternalComponent: createInternalComponent,
  11725. createInstanceForText: createInstanceForText,
  11726. isTextComponent: isTextComponent,
  11727. injection: ReactNativeComponentInjection
  11728. };
  11729. module.exports = ReactNativeComponent;
  11730. },{"135":135,"27":27}],74:[function(_dereq_,module,exports){
  11731. /**
  11732. * Copyright 2013-2015, Facebook, Inc.
  11733. * All rights reserved.
  11734. *
  11735. * This source code is licensed under the BSD-style license found in the
  11736. * LICENSE file in the root directory of this source tree. An additional grant
  11737. * of patent rights can be found in the PATENTS file in the same directory.
  11738. *
  11739. * @providesModule ReactOwner
  11740. */
  11741. 'use strict';
  11742. var invariant = _dereq_(135);
  11743. /**
  11744. * ReactOwners are capable of storing references to owned components.
  11745. *
  11746. * All components are capable of //being// referenced by owner components, but
  11747. * only ReactOwner components are capable of //referencing// owned components.
  11748. * The named reference is known as a "ref".
  11749. *
  11750. * Refs are available when mounted and updated during reconciliation.
  11751. *
  11752. * var MyComponent = React.createClass({
  11753. * render: function() {
  11754. * return (
  11755. * <div onClick={this.handleClick}>
  11756. * <CustomComponent ref="custom" />
  11757. * </div>
  11758. * );
  11759. * },
  11760. * handleClick: function() {
  11761. * this.refs.custom.handleClick();
  11762. * },
  11763. * componentDidMount: function() {
  11764. * this.refs.custom.initialize();
  11765. * }
  11766. * });
  11767. *
  11768. * Refs should rarely be used. When refs are used, they should only be done to
  11769. * control data that is not handled by React's data flow.
  11770. *
  11771. * @class ReactOwner
  11772. */
  11773. var ReactOwner = {
  11774. /**
  11775. * @param {?object} object
  11776. * @return {boolean} True if `object` is a valid owner.
  11777. * @final
  11778. */
  11779. isValidOwner: function(object) {
  11780. return !!(
  11781. (object &&
  11782. typeof object.attachRef === 'function' && typeof object.detachRef === 'function')
  11783. );
  11784. },
  11785. /**
  11786. * Adds a component by ref to an owner component.
  11787. *
  11788. * @param {ReactComponent} component Component to reference.
  11789. * @param {string} ref Name by which to refer to the component.
  11790. * @param {ReactOwner} owner Component on which to record the ref.
  11791. * @final
  11792. * @internal
  11793. */
  11794. addComponentAsRefTo: function(component, ref, owner) {
  11795. ("production" !== "development" ? invariant(
  11796. ReactOwner.isValidOwner(owner),
  11797. 'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' +
  11798. 'usually means that you\'re trying to add a ref to a component that ' +
  11799. 'doesn\'t have an owner (that is, was not created inside of another ' +
  11800. 'component\'s `render` method). Try rendering this component inside of ' +
  11801. 'a new top-level component which will hold the ref.'
  11802. ) : invariant(ReactOwner.isValidOwner(owner)));
  11803. owner.attachRef(ref, component);
  11804. },
  11805. /**
  11806. * Removes a component by ref from an owner component.
  11807. *
  11808. * @param {ReactComponent} component Component to dereference.
  11809. * @param {string} ref Name of the ref to remove.
  11810. * @param {ReactOwner} owner Component on which the ref is recorded.
  11811. * @final
  11812. * @internal
  11813. */
  11814. removeComponentAsRefFrom: function(component, ref, owner) {
  11815. ("production" !== "development" ? invariant(
  11816. ReactOwner.isValidOwner(owner),
  11817. 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' +
  11818. 'usually means that you\'re trying to remove a ref to a component that ' +
  11819. 'doesn\'t have an owner (that is, was not created inside of another ' +
  11820. 'component\'s `render` method). Try rendering this component inside of ' +
  11821. 'a new top-level component which will hold the ref.'
  11822. ) : invariant(ReactOwner.isValidOwner(owner)));
  11823. // Check that `component` is still the current ref because we do not want to
  11824. // detach the ref if another component stole it.
  11825. if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
  11826. owner.detachRef(ref);
  11827. }
  11828. }
  11829. };
  11830. module.exports = ReactOwner;
  11831. },{"135":135}],75:[function(_dereq_,module,exports){
  11832. /**
  11833. * Copyright 2013-2015, Facebook, Inc.
  11834. * All rights reserved.
  11835. *
  11836. * This source code is licensed under the BSD-style license found in the
  11837. * LICENSE file in the root directory of this source tree. An additional grant
  11838. * of patent rights can be found in the PATENTS file in the same directory.
  11839. *
  11840. * @providesModule ReactPerf
  11841. * @typechecks static-only
  11842. */
  11843. 'use strict';
  11844. /**
  11845. * ReactPerf is a general AOP system designed to measure performance. This
  11846. * module only has the hooks: see ReactDefaultPerf for the analysis tool.
  11847. */
  11848. var ReactPerf = {
  11849. /**
  11850. * Boolean to enable/disable measurement. Set to false by default to prevent
  11851. * accidental logging and perf loss.
  11852. */
  11853. enableMeasure: false,
  11854. /**
  11855. * Holds onto the measure function in use. By default, don't measure
  11856. * anything, but we'll override this if we inject a measure function.
  11857. */
  11858. storedMeasure: _noMeasure,
  11859. /**
  11860. * @param {object} object
  11861. * @param {string} objectName
  11862. * @param {object<string>} methodNames
  11863. */
  11864. measureMethods: function(object, objectName, methodNames) {
  11865. if ("production" !== "development") {
  11866. for (var key in methodNames) {
  11867. if (!methodNames.hasOwnProperty(key)) {
  11868. continue;
  11869. }
  11870. object[key] = ReactPerf.measure(
  11871. objectName,
  11872. methodNames[key],
  11873. object[key]
  11874. );
  11875. }
  11876. }
  11877. },
  11878. /**
  11879. * Use this to wrap methods you want to measure. Zero overhead in production.
  11880. *
  11881. * @param {string} objName
  11882. * @param {string} fnName
  11883. * @param {function} func
  11884. * @return {function}
  11885. */
  11886. measure: function(objName, fnName, func) {
  11887. if ("production" !== "development") {
  11888. var measuredFunc = null;
  11889. var wrapper = function() {
  11890. if (ReactPerf.enableMeasure) {
  11891. if (!measuredFunc) {
  11892. measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
  11893. }
  11894. return measuredFunc.apply(this, arguments);
  11895. }
  11896. return func.apply(this, arguments);
  11897. };
  11898. wrapper.displayName = objName + '_' + fnName;
  11899. return wrapper;
  11900. }
  11901. return func;
  11902. },
  11903. injection: {
  11904. /**
  11905. * @param {function} measure
  11906. */
  11907. injectMeasure: function(measure) {
  11908. ReactPerf.storedMeasure = measure;
  11909. }
  11910. }
  11911. };
  11912. /**
  11913. * Simply passes through the measured function, without measuring it.
  11914. *
  11915. * @param {string} objName
  11916. * @param {string} fnName
  11917. * @param {function} func
  11918. * @return {function}
  11919. */
  11920. function _noMeasure(objName, fnName, func) {
  11921. return func;
  11922. }
  11923. module.exports = ReactPerf;
  11924. },{}],76:[function(_dereq_,module,exports){
  11925. /**
  11926. * Copyright 2013-2015, Facebook, Inc.
  11927. * All rights reserved.
  11928. *
  11929. * This source code is licensed under the BSD-style license found in the
  11930. * LICENSE file in the root directory of this source tree. An additional grant
  11931. * of patent rights can be found in the PATENTS file in the same directory.
  11932. *
  11933. * @providesModule ReactPropTypeLocationNames
  11934. */
  11935. 'use strict';
  11936. var ReactPropTypeLocationNames = {};
  11937. if ("production" !== "development") {
  11938. ReactPropTypeLocationNames = {
  11939. prop: 'prop',
  11940. context: 'context',
  11941. childContext: 'child context'
  11942. };
  11943. }
  11944. module.exports = ReactPropTypeLocationNames;
  11945. },{}],77:[function(_dereq_,module,exports){
  11946. /**
  11947. * Copyright 2013-2015, Facebook, Inc.
  11948. * All rights reserved.
  11949. *
  11950. * This source code is licensed under the BSD-style license found in the
  11951. * LICENSE file in the root directory of this source tree. An additional grant
  11952. * of patent rights can be found in the PATENTS file in the same directory.
  11953. *
  11954. * @providesModule ReactPropTypeLocations
  11955. */
  11956. 'use strict';
  11957. var keyMirror = _dereq_(140);
  11958. var ReactPropTypeLocations = keyMirror({
  11959. prop: null,
  11960. context: null,
  11961. childContext: null
  11962. });
  11963. module.exports = ReactPropTypeLocations;
  11964. },{"140":140}],78:[function(_dereq_,module,exports){
  11965. /**
  11966. * Copyright 2013-2015, Facebook, Inc.
  11967. * All rights reserved.
  11968. *
  11969. * This source code is licensed under the BSD-style license found in the
  11970. * LICENSE file in the root directory of this source tree. An additional grant
  11971. * of patent rights can be found in the PATENTS file in the same directory.
  11972. *
  11973. * @providesModule ReactPropTypes
  11974. */
  11975. 'use strict';
  11976. var ReactElement = _dereq_(57);
  11977. var ReactFragment = _dereq_(63);
  11978. var ReactPropTypeLocationNames = _dereq_(76);
  11979. var emptyFunction = _dereq_(114);
  11980. /**
  11981. * Collection of methods that allow declaration and validation of props that are
  11982. * supplied to React components. Example usage:
  11983. *
  11984. * var Props = require('ReactPropTypes');
  11985. * var MyArticle = React.createClass({
  11986. * propTypes: {
  11987. * // An optional string prop named "description".
  11988. * description: Props.string,
  11989. *
  11990. * // A required enum prop named "category".
  11991. * category: Props.oneOf(['News','Photos']).isRequired,
  11992. *
  11993. * // A prop named "dialog" that requires an instance of Dialog.
  11994. * dialog: Props.instanceOf(Dialog).isRequired
  11995. * },
  11996. * render: function() { ... }
  11997. * });
  11998. *
  11999. * A more formal specification of how these methods are used:
  12000. *
  12001. * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
  12002. * decl := ReactPropTypes.{type}(.isRequired)?
  12003. *
  12004. * Each and every declaration produces a function with the same signature. This
  12005. * allows the creation of custom validation functions. For example:
  12006. *
  12007. * var MyLink = React.createClass({
  12008. * propTypes: {
  12009. * // An optional string or URI prop named "href".
  12010. * href: function(props, propName, componentName) {
  12011. * var propValue = props[propName];
  12012. * if (propValue != null && typeof propValue !== 'string' &&
  12013. * !(propValue instanceof URI)) {
  12014. * return new Error(
  12015. * 'Expected a string or an URI for ' + propName + ' in ' +
  12016. * componentName
  12017. * );
  12018. * }
  12019. * }
  12020. * },
  12021. * render: function() {...}
  12022. * });
  12023. *
  12024. * @internal
  12025. */
  12026. var ANONYMOUS = '<<anonymous>>';
  12027. var elementTypeChecker = createElementTypeChecker();
  12028. var nodeTypeChecker = createNodeChecker();
  12029. var ReactPropTypes = {
  12030. array: createPrimitiveTypeChecker('array'),
  12031. bool: createPrimitiveTypeChecker('boolean'),
  12032. func: createPrimitiveTypeChecker('function'),
  12033. number: createPrimitiveTypeChecker('number'),
  12034. object: createPrimitiveTypeChecker('object'),
  12035. string: createPrimitiveTypeChecker('string'),
  12036. any: createAnyTypeChecker(),
  12037. arrayOf: createArrayOfTypeChecker,
  12038. element: elementTypeChecker,
  12039. instanceOf: createInstanceTypeChecker,
  12040. node: nodeTypeChecker,
  12041. objectOf: createObjectOfTypeChecker,
  12042. oneOf: createEnumTypeChecker,
  12043. oneOfType: createUnionTypeChecker,
  12044. shape: createShapeTypeChecker
  12045. };
  12046. function createChainableTypeChecker(validate) {
  12047. function checkType(isRequired, props, propName, componentName, location) {
  12048. componentName = componentName || ANONYMOUS;
  12049. if (props[propName] == null) {
  12050. var locationName = ReactPropTypeLocationNames[location];
  12051. if (isRequired) {
  12052. return new Error(
  12053. ("Required " + locationName + " `" + propName + "` was not specified in ") +
  12054. ("`" + componentName + "`.")
  12055. );
  12056. }
  12057. return null;
  12058. } else {
  12059. return validate(props, propName, componentName, location);
  12060. }
  12061. }
  12062. var chainedCheckType = checkType.bind(null, false);
  12063. chainedCheckType.isRequired = checkType.bind(null, true);
  12064. return chainedCheckType;
  12065. }
  12066. function createPrimitiveTypeChecker(expectedType) {
  12067. function validate(props, propName, componentName, location) {
  12068. var propValue = props[propName];
  12069. var propType = getPropType(propValue);
  12070. if (propType !== expectedType) {
  12071. var locationName = ReactPropTypeLocationNames[location];
  12072. // `propValue` being instance of, say, date/regexp, pass the 'object'
  12073. // check, but we can offer a more precise error message here rather than
  12074. // 'of type `object`'.
  12075. var preciseType = getPreciseType(propValue);
  12076. return new Error(
  12077. ("Invalid " + locationName + " `" + propName + "` of type `" + preciseType + "` ") +
  12078. ("supplied to `" + componentName + "`, expected `" + expectedType + "`.")
  12079. );
  12080. }
  12081. return null;
  12082. }
  12083. return createChainableTypeChecker(validate);
  12084. }
  12085. function createAnyTypeChecker() {
  12086. return createChainableTypeChecker(emptyFunction.thatReturns(null));
  12087. }
  12088. function createArrayOfTypeChecker(typeChecker) {
  12089. function validate(props, propName, componentName, location) {
  12090. var propValue = props[propName];
  12091. if (!Array.isArray(propValue)) {
  12092. var locationName = ReactPropTypeLocationNames[location];
  12093. var propType = getPropType(propValue);
  12094. return new Error(
  12095. ("Invalid " + locationName + " `" + propName + "` of type ") +
  12096. ("`" + propType + "` supplied to `" + componentName + "`, expected an array.")
  12097. );
  12098. }
  12099. for (var i = 0; i < propValue.length; i++) {
  12100. var error = typeChecker(propValue, i, componentName, location);
  12101. if (error instanceof Error) {
  12102. return error;
  12103. }
  12104. }
  12105. return null;
  12106. }
  12107. return createChainableTypeChecker(validate);
  12108. }
  12109. function createElementTypeChecker() {
  12110. function validate(props, propName, componentName, location) {
  12111. if (!ReactElement.isValidElement(props[propName])) {
  12112. var locationName = ReactPropTypeLocationNames[location];
  12113. return new Error(
  12114. ("Invalid " + locationName + " `" + propName + "` supplied to ") +
  12115. ("`" + componentName + "`, expected a ReactElement.")
  12116. );
  12117. }
  12118. return null;
  12119. }
  12120. return createChainableTypeChecker(validate);
  12121. }
  12122. function createInstanceTypeChecker(expectedClass) {
  12123. function validate(props, propName, componentName, location) {
  12124. if (!(props[propName] instanceof expectedClass)) {
  12125. var locationName = ReactPropTypeLocationNames[location];
  12126. var expectedClassName = expectedClass.name || ANONYMOUS;
  12127. return new Error(
  12128. ("Invalid " + locationName + " `" + propName + "` supplied to ") +
  12129. ("`" + componentName + "`, expected instance of `" + expectedClassName + "`.")
  12130. );
  12131. }
  12132. return null;
  12133. }
  12134. return createChainableTypeChecker(validate);
  12135. }
  12136. function createEnumTypeChecker(expectedValues) {
  12137. function validate(props, propName, componentName, location) {
  12138. var propValue = props[propName];
  12139. for (var i = 0; i < expectedValues.length; i++) {
  12140. if (propValue === expectedValues[i]) {
  12141. return null;
  12142. }
  12143. }
  12144. var locationName = ReactPropTypeLocationNames[location];
  12145. var valuesString = JSON.stringify(expectedValues);
  12146. return new Error(
  12147. ("Invalid " + locationName + " `" + propName + "` of value `" + propValue + "` ") +
  12148. ("supplied to `" + componentName + "`, expected one of " + valuesString + ".")
  12149. );
  12150. }
  12151. return createChainableTypeChecker(validate);
  12152. }
  12153. function createObjectOfTypeChecker(typeChecker) {
  12154. function validate(props, propName, componentName, location) {
  12155. var propValue = props[propName];
  12156. var propType = getPropType(propValue);
  12157. if (propType !== 'object') {
  12158. var locationName = ReactPropTypeLocationNames[location];
  12159. return new Error(
  12160. ("Invalid " + locationName + " `" + propName + "` of type ") +
  12161. ("`" + propType + "` supplied to `" + componentName + "`, expected an object.")
  12162. );
  12163. }
  12164. for (var key in propValue) {
  12165. if (propValue.hasOwnProperty(key)) {
  12166. var error = typeChecker(propValue, key, componentName, location);
  12167. if (error instanceof Error) {
  12168. return error;
  12169. }
  12170. }
  12171. }
  12172. return null;
  12173. }
  12174. return createChainableTypeChecker(validate);
  12175. }
  12176. function createUnionTypeChecker(arrayOfTypeCheckers) {
  12177. function validate(props, propName, componentName, location) {
  12178. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  12179. var checker = arrayOfTypeCheckers[i];
  12180. if (checker(props, propName, componentName, location) == null) {
  12181. return null;
  12182. }
  12183. }
  12184. var locationName = ReactPropTypeLocationNames[location];
  12185. return new Error(
  12186. ("Invalid " + locationName + " `" + propName + "` supplied to ") +
  12187. ("`" + componentName + "`.")
  12188. );
  12189. }
  12190. return createChainableTypeChecker(validate);
  12191. }
  12192. function createNodeChecker() {
  12193. function validate(props, propName, componentName, location) {
  12194. if (!isNode(props[propName])) {
  12195. var locationName = ReactPropTypeLocationNames[location];
  12196. return new Error(
  12197. ("Invalid " + locationName + " `" + propName + "` supplied to ") +
  12198. ("`" + componentName + "`, expected a ReactNode.")
  12199. );
  12200. }
  12201. return null;
  12202. }
  12203. return createChainableTypeChecker(validate);
  12204. }
  12205. function createShapeTypeChecker(shapeTypes) {
  12206. function validate(props, propName, componentName, location) {
  12207. var propValue = props[propName];
  12208. var propType = getPropType(propValue);
  12209. if (propType !== 'object') {
  12210. var locationName = ReactPropTypeLocationNames[location];
  12211. return new Error(
  12212. ("Invalid " + locationName + " `" + propName + "` of type `" + propType + "` ") +
  12213. ("supplied to `" + componentName + "`, expected `object`.")
  12214. );
  12215. }
  12216. for (var key in shapeTypes) {
  12217. var checker = shapeTypes[key];
  12218. if (!checker) {
  12219. continue;
  12220. }
  12221. var error = checker(propValue, key, componentName, location);
  12222. if (error) {
  12223. return error;
  12224. }
  12225. }
  12226. return null;
  12227. }
  12228. return createChainableTypeChecker(validate);
  12229. }
  12230. function isNode(propValue) {
  12231. switch (typeof propValue) {
  12232. case 'number':
  12233. case 'string':
  12234. case 'undefined':
  12235. return true;
  12236. case 'boolean':
  12237. return !propValue;
  12238. case 'object':
  12239. if (Array.isArray(propValue)) {
  12240. return propValue.every(isNode);
  12241. }
  12242. if (propValue === null || ReactElement.isValidElement(propValue)) {
  12243. return true;
  12244. }
  12245. propValue = ReactFragment.extractIfFragment(propValue);
  12246. for (var k in propValue) {
  12247. if (!isNode(propValue[k])) {
  12248. return false;
  12249. }
  12250. }
  12251. return true;
  12252. default:
  12253. return false;
  12254. }
  12255. }
  12256. // Equivalent of `typeof` but with special handling for array and regexp.
  12257. function getPropType(propValue) {
  12258. var propType = typeof propValue;
  12259. if (Array.isArray(propValue)) {
  12260. return 'array';
  12261. }
  12262. if (propValue instanceof RegExp) {
  12263. // Old webkits (at least until Android 4.0) return 'function' rather than
  12264. // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
  12265. // passes PropTypes.object.
  12266. return 'object';
  12267. }
  12268. return propType;
  12269. }
  12270. // This handles more types than `getPropType`. Only used for error messages.
  12271. // See `createPrimitiveTypeChecker`.
  12272. function getPreciseType(propValue) {
  12273. var propType = getPropType(propValue);
  12274. if (propType === 'object') {
  12275. if (propValue instanceof Date) {
  12276. return 'date';
  12277. } else if (propValue instanceof RegExp) {
  12278. return 'regexp';
  12279. }
  12280. }
  12281. return propType;
  12282. }
  12283. module.exports = ReactPropTypes;
  12284. },{"114":114,"57":57,"63":63,"76":76}],79:[function(_dereq_,module,exports){
  12285. /**
  12286. * Copyright 2013-2015, Facebook, Inc.
  12287. * All rights reserved.
  12288. *
  12289. * This source code is licensed under the BSD-style license found in the
  12290. * LICENSE file in the root directory of this source tree. An additional grant
  12291. * of patent rights can be found in the PATENTS file in the same directory.
  12292. *
  12293. * @providesModule ReactPutListenerQueue
  12294. */
  12295. 'use strict';
  12296. var PooledClass = _dereq_(28);
  12297. var ReactBrowserEventEmitter = _dereq_(30);
  12298. var assign = _dereq_(27);
  12299. function ReactPutListenerQueue() {
  12300. this.listenersToPut = [];
  12301. }
  12302. assign(ReactPutListenerQueue.prototype, {
  12303. enqueuePutListener: function(rootNodeID, propKey, propValue) {
  12304. this.listenersToPut.push({
  12305. rootNodeID: rootNodeID,
  12306. propKey: propKey,
  12307. propValue: propValue
  12308. });
  12309. },
  12310. putListeners: function() {
  12311. for (var i = 0; i < this.listenersToPut.length; i++) {
  12312. var listenerToPut = this.listenersToPut[i];
  12313. ReactBrowserEventEmitter.putListener(
  12314. listenerToPut.rootNodeID,
  12315. listenerToPut.propKey,
  12316. listenerToPut.propValue
  12317. );
  12318. }
  12319. },
  12320. reset: function() {
  12321. this.listenersToPut.length = 0;
  12322. },
  12323. destructor: function() {
  12324. this.reset();
  12325. }
  12326. });
  12327. PooledClass.addPoolingTo(ReactPutListenerQueue);
  12328. module.exports = ReactPutListenerQueue;
  12329. },{"27":27,"28":28,"30":30}],80:[function(_dereq_,module,exports){
  12330. /**
  12331. * Copyright 2013-2015, Facebook, Inc.
  12332. * All rights reserved.
  12333. *
  12334. * This source code is licensed under the BSD-style license found in the
  12335. * LICENSE file in the root directory of this source tree. An additional grant
  12336. * of patent rights can be found in the PATENTS file in the same directory.
  12337. *
  12338. * @providesModule ReactReconcileTransaction
  12339. * @typechecks static-only
  12340. */
  12341. 'use strict';
  12342. var CallbackQueue = _dereq_(6);
  12343. var PooledClass = _dereq_(28);
  12344. var ReactBrowserEventEmitter = _dereq_(30);
  12345. var ReactInputSelection = _dereq_(65);
  12346. var ReactPutListenerQueue = _dereq_(79);
  12347. var Transaction = _dereq_(103);
  12348. var assign = _dereq_(27);
  12349. /**
  12350. * Ensures that, when possible, the selection range (currently selected text
  12351. * input) is not disturbed by performing the transaction.
  12352. */
  12353. var SELECTION_RESTORATION = {
  12354. /**
  12355. * @return {Selection} Selection information.
  12356. */
  12357. initialize: ReactInputSelection.getSelectionInformation,
  12358. /**
  12359. * @param {Selection} sel Selection information returned from `initialize`.
  12360. */
  12361. close: ReactInputSelection.restoreSelection
  12362. };
  12363. /**
  12364. * Suppresses events (blur/focus) that could be inadvertently dispatched due to
  12365. * high level DOM manipulations (like temporarily removing a text input from the
  12366. * DOM).
  12367. */
  12368. var EVENT_SUPPRESSION = {
  12369. /**
  12370. * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
  12371. * the reconciliation.
  12372. */
  12373. initialize: function() {
  12374. var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
  12375. ReactBrowserEventEmitter.setEnabled(false);
  12376. return currentlyEnabled;
  12377. },
  12378. /**
  12379. * @param {boolean} previouslyEnabled Enabled status of
  12380. * `ReactBrowserEventEmitter` before the reconciliation occured. `close`
  12381. * restores the previous value.
  12382. */
  12383. close: function(previouslyEnabled) {
  12384. ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
  12385. }
  12386. };
  12387. /**
  12388. * Provides a queue for collecting `componentDidMount` and
  12389. * `componentDidUpdate` callbacks during the the transaction.
  12390. */
  12391. var ON_DOM_READY_QUEUEING = {
  12392. /**
  12393. * Initializes the internal `onDOMReady` queue.
  12394. */
  12395. initialize: function() {
  12396. this.reactMountReady.reset();
  12397. },
  12398. /**
  12399. * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
  12400. */
  12401. close: function() {
  12402. this.reactMountReady.notifyAll();
  12403. }
  12404. };
  12405. var PUT_LISTENER_QUEUEING = {
  12406. initialize: function() {
  12407. this.putListenerQueue.reset();
  12408. },
  12409. close: function() {
  12410. this.putListenerQueue.putListeners();
  12411. }
  12412. };
  12413. /**
  12414. * Executed within the scope of the `Transaction` instance. Consider these as
  12415. * being member methods, but with an implied ordering while being isolated from
  12416. * each other.
  12417. */
  12418. var TRANSACTION_WRAPPERS = [
  12419. PUT_LISTENER_QUEUEING,
  12420. SELECTION_RESTORATION,
  12421. EVENT_SUPPRESSION,
  12422. ON_DOM_READY_QUEUEING
  12423. ];
  12424. /**
  12425. * Currently:
  12426. * - The order that these are listed in the transaction is critical:
  12427. * - Suppresses events.
  12428. * - Restores selection range.
  12429. *
  12430. * Future:
  12431. * - Restore document/overflow scroll positions that were unintentionally
  12432. * modified via DOM insertions above the top viewport boundary.
  12433. * - Implement/integrate with customized constraint based layout system and keep
  12434. * track of which dimensions must be remeasured.
  12435. *
  12436. * @class ReactReconcileTransaction
  12437. */
  12438. function ReactReconcileTransaction() {
  12439. this.reinitializeTransaction();
  12440. // Only server-side rendering really needs this option (see
  12441. // `ReactServerRendering`), but server-side uses
  12442. // `ReactServerRenderingTransaction` instead. This option is here so that it's
  12443. // accessible and defaults to false when `ReactDOMComponent` and
  12444. // `ReactTextComponent` checks it in `mountComponent`.`
  12445. this.renderToStaticMarkup = false;
  12446. this.reactMountReady = CallbackQueue.getPooled(null);
  12447. this.putListenerQueue = ReactPutListenerQueue.getPooled();
  12448. }
  12449. var Mixin = {
  12450. /**
  12451. * @see Transaction
  12452. * @abstract
  12453. * @final
  12454. * @return {array<object>} List of operation wrap proceedures.
  12455. * TODO: convert to array<TransactionWrapper>
  12456. */
  12457. getTransactionWrappers: function() {
  12458. return TRANSACTION_WRAPPERS;
  12459. },
  12460. /**
  12461. * @return {object} The queue to collect `onDOMReady` callbacks with.
  12462. */
  12463. getReactMountReady: function() {
  12464. return this.reactMountReady;
  12465. },
  12466. getPutListenerQueue: function() {
  12467. return this.putListenerQueue;
  12468. },
  12469. /**
  12470. * `PooledClass` looks for this, and will invoke this before allowing this
  12471. * instance to be resused.
  12472. */
  12473. destructor: function() {
  12474. CallbackQueue.release(this.reactMountReady);
  12475. this.reactMountReady = null;
  12476. ReactPutListenerQueue.release(this.putListenerQueue);
  12477. this.putListenerQueue = null;
  12478. }
  12479. };
  12480. assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
  12481. PooledClass.addPoolingTo(ReactReconcileTransaction);
  12482. module.exports = ReactReconcileTransaction;
  12483. },{"103":103,"27":27,"28":28,"30":30,"6":6,"65":65,"79":79}],81:[function(_dereq_,module,exports){
  12484. /**
  12485. * Copyright 2013-2015, Facebook, Inc.
  12486. * All rights reserved.
  12487. *
  12488. * This source code is licensed under the BSD-style license found in the
  12489. * LICENSE file in the root directory of this source tree. An additional grant
  12490. * of patent rights can be found in the PATENTS file in the same directory.
  12491. *
  12492. * @providesModule ReactReconciler
  12493. */
  12494. 'use strict';
  12495. var ReactRef = _dereq_(82);
  12496. var ReactElementValidator = _dereq_(58);
  12497. /**
  12498. * Helper to call ReactRef.attachRefs with this composite component, split out
  12499. * to avoid allocations in the transaction mount-ready queue.
  12500. */
  12501. function attachRefs() {
  12502. ReactRef.attachRefs(this, this._currentElement);
  12503. }
  12504. var ReactReconciler = {
  12505. /**
  12506. * Initializes the component, renders markup, and registers event listeners.
  12507. *
  12508. * @param {ReactComponent} internalInstance
  12509. * @param {string} rootID DOM ID of the root node.
  12510. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  12511. * @return {?string} Rendered markup to be inserted into the DOM.
  12512. * @final
  12513. * @internal
  12514. */
  12515. mountComponent: function(internalInstance, rootID, transaction, context) {
  12516. var markup = internalInstance.mountComponent(rootID, transaction, context);
  12517. if ("production" !== "development") {
  12518. ReactElementValidator.checkAndWarnForMutatedProps(
  12519. internalInstance._currentElement
  12520. );
  12521. }
  12522. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  12523. return markup;
  12524. },
  12525. /**
  12526. * Releases any resources allocated by `mountComponent`.
  12527. *
  12528. * @final
  12529. * @internal
  12530. */
  12531. unmountComponent: function(internalInstance) {
  12532. ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
  12533. internalInstance.unmountComponent();
  12534. },
  12535. /**
  12536. * Update a component using a new element.
  12537. *
  12538. * @param {ReactComponent} internalInstance
  12539. * @param {ReactElement} nextElement
  12540. * @param {ReactReconcileTransaction} transaction
  12541. * @param {object} context
  12542. * @internal
  12543. */
  12544. receiveComponent: function(
  12545. internalInstance, nextElement, transaction, context
  12546. ) {
  12547. var prevElement = internalInstance._currentElement;
  12548. if (nextElement === prevElement && nextElement._owner != null) {
  12549. // Since elements are immutable after the owner is rendered,
  12550. // we can do a cheap identity compare here to determine if this is a
  12551. // superfluous reconcile. It's possible for state to be mutable but such
  12552. // change should trigger an update of the owner which would recreate
  12553. // the element. We explicitly check for the existence of an owner since
  12554. // it's possible for an element created outside a composite to be
  12555. // deeply mutated and reused.
  12556. return;
  12557. }
  12558. if ("production" !== "development") {
  12559. ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
  12560. }
  12561. var refsChanged = ReactRef.shouldUpdateRefs(
  12562. prevElement,
  12563. nextElement
  12564. );
  12565. if (refsChanged) {
  12566. ReactRef.detachRefs(internalInstance, prevElement);
  12567. }
  12568. internalInstance.receiveComponent(nextElement, transaction, context);
  12569. if (refsChanged) {
  12570. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  12571. }
  12572. },
  12573. /**
  12574. * Flush any dirty changes in a component.
  12575. *
  12576. * @param {ReactComponent} internalInstance
  12577. * @param {ReactReconcileTransaction} transaction
  12578. * @internal
  12579. */
  12580. performUpdateIfNecessary: function(
  12581. internalInstance,
  12582. transaction
  12583. ) {
  12584. internalInstance.performUpdateIfNecessary(transaction);
  12585. }
  12586. };
  12587. module.exports = ReactReconciler;
  12588. },{"58":58,"82":82}],82:[function(_dereq_,module,exports){
  12589. /**
  12590. * Copyright 2013-2015, Facebook, Inc.
  12591. * All rights reserved.
  12592. *
  12593. * This source code is licensed under the BSD-style license found in the
  12594. * LICENSE file in the root directory of this source tree. An additional grant
  12595. * of patent rights can be found in the PATENTS file in the same directory.
  12596. *
  12597. * @providesModule ReactRef
  12598. */
  12599. 'use strict';
  12600. var ReactOwner = _dereq_(74);
  12601. var ReactRef = {};
  12602. function attachRef(ref, component, owner) {
  12603. if (typeof ref === 'function') {
  12604. ref(component.getPublicInstance());
  12605. } else {
  12606. // Legacy ref
  12607. ReactOwner.addComponentAsRefTo(component, ref, owner);
  12608. }
  12609. }
  12610. function detachRef(ref, component, owner) {
  12611. if (typeof ref === 'function') {
  12612. ref(null);
  12613. } else {
  12614. // Legacy ref
  12615. ReactOwner.removeComponentAsRefFrom(component, ref, owner);
  12616. }
  12617. }
  12618. ReactRef.attachRefs = function(instance, element) {
  12619. var ref = element.ref;
  12620. if (ref != null) {
  12621. attachRef(ref, instance, element._owner);
  12622. }
  12623. };
  12624. ReactRef.shouldUpdateRefs = function(prevElement, nextElement) {
  12625. // If either the owner or a `ref` has changed, make sure the newest owner
  12626. // has stored a reference to `this`, and the previous owner (if different)
  12627. // has forgotten the reference to `this`. We use the element instead
  12628. // of the public this.props because the post processing cannot determine
  12629. // a ref. The ref conceptually lives on the element.
  12630. // TODO: Should this even be possible? The owner cannot change because
  12631. // it's forbidden by shouldUpdateReactComponent. The ref can change
  12632. // if you swap the keys of but not the refs. Reconsider where this check
  12633. // is made. It probably belongs where the key checking and
  12634. // instantiateReactComponent is done.
  12635. return (
  12636. nextElement._owner !== prevElement._owner ||
  12637. nextElement.ref !== prevElement.ref
  12638. );
  12639. };
  12640. ReactRef.detachRefs = function(instance, element) {
  12641. var ref = element.ref;
  12642. if (ref != null) {
  12643. detachRef(ref, instance, element._owner);
  12644. }
  12645. };
  12646. module.exports = ReactRef;
  12647. },{"74":74}],83:[function(_dereq_,module,exports){
  12648. /**
  12649. * Copyright 2013-2015, Facebook, Inc.
  12650. * All rights reserved.
  12651. *
  12652. * This source code is licensed under the BSD-style license found in the
  12653. * LICENSE file in the root directory of this source tree. An additional grant
  12654. * of patent rights can be found in the PATENTS file in the same directory.
  12655. *
  12656. * @providesModule ReactRootIndex
  12657. * @typechecks
  12658. */
  12659. 'use strict';
  12660. var ReactRootIndexInjection = {
  12661. /**
  12662. * @param {function} _createReactRootIndex
  12663. */
  12664. injectCreateReactRootIndex: function(_createReactRootIndex) {
  12665. ReactRootIndex.createReactRootIndex = _createReactRootIndex;
  12666. }
  12667. };
  12668. var ReactRootIndex = {
  12669. createReactRootIndex: null,
  12670. injection: ReactRootIndexInjection
  12671. };
  12672. module.exports = ReactRootIndex;
  12673. },{}],84:[function(_dereq_,module,exports){
  12674. /**
  12675. * Copyright 2013-2015, Facebook, Inc.
  12676. * All rights reserved.
  12677. *
  12678. * This source code is licensed under the BSD-style license found in the
  12679. * LICENSE file in the root directory of this source tree. An additional grant
  12680. * of patent rights can be found in the PATENTS file in the same directory.
  12681. *
  12682. * @typechecks static-only
  12683. * @providesModule ReactServerRendering
  12684. */
  12685. 'use strict';
  12686. var ReactElement = _dereq_(57);
  12687. var ReactInstanceHandles = _dereq_(66);
  12688. var ReactMarkupChecksum = _dereq_(69);
  12689. var ReactServerRenderingTransaction =
  12690. _dereq_(85);
  12691. var emptyObject = _dereq_(115);
  12692. var instantiateReactComponent = _dereq_(134);
  12693. var invariant = _dereq_(135);
  12694. /**
  12695. * @param {ReactElement} element
  12696. * @return {string} the HTML markup
  12697. */
  12698. function renderToString(element) {
  12699. ("production" !== "development" ? invariant(
  12700. ReactElement.isValidElement(element),
  12701. 'renderToString(): You must pass a valid ReactElement.'
  12702. ) : invariant(ReactElement.isValidElement(element)));
  12703. var transaction;
  12704. try {
  12705. var id = ReactInstanceHandles.createReactRootID();
  12706. transaction = ReactServerRenderingTransaction.getPooled(false);
  12707. return transaction.perform(function() {
  12708. var componentInstance = instantiateReactComponent(element, null);
  12709. var markup =
  12710. componentInstance.mountComponent(id, transaction, emptyObject);
  12711. return ReactMarkupChecksum.addChecksumToMarkup(markup);
  12712. }, null);
  12713. } finally {
  12714. ReactServerRenderingTransaction.release(transaction);
  12715. }
  12716. }
  12717. /**
  12718. * @param {ReactElement} element
  12719. * @return {string} the HTML markup, without the extra React ID and checksum
  12720. * (for generating static pages)
  12721. */
  12722. function renderToStaticMarkup(element) {
  12723. ("production" !== "development" ? invariant(
  12724. ReactElement.isValidElement(element),
  12725. 'renderToStaticMarkup(): You must pass a valid ReactElement.'
  12726. ) : invariant(ReactElement.isValidElement(element)));
  12727. var transaction;
  12728. try {
  12729. var id = ReactInstanceHandles.createReactRootID();
  12730. transaction = ReactServerRenderingTransaction.getPooled(true);
  12731. return transaction.perform(function() {
  12732. var componentInstance = instantiateReactComponent(element, null);
  12733. return componentInstance.mountComponent(id, transaction, emptyObject);
  12734. }, null);
  12735. } finally {
  12736. ReactServerRenderingTransaction.release(transaction);
  12737. }
  12738. }
  12739. module.exports = {
  12740. renderToString: renderToString,
  12741. renderToStaticMarkup: renderToStaticMarkup
  12742. };
  12743. },{"115":115,"134":134,"135":135,"57":57,"66":66,"69":69,"85":85}],85:[function(_dereq_,module,exports){
  12744. /**
  12745. * Copyright 2014-2015, Facebook, Inc.
  12746. * All rights reserved.
  12747. *
  12748. * This source code is licensed under the BSD-style license found in the
  12749. * LICENSE file in the root directory of this source tree. An additional grant
  12750. * of patent rights can be found in the PATENTS file in the same directory.
  12751. *
  12752. * @providesModule ReactServerRenderingTransaction
  12753. * @typechecks
  12754. */
  12755. 'use strict';
  12756. var PooledClass = _dereq_(28);
  12757. var CallbackQueue = _dereq_(6);
  12758. var ReactPutListenerQueue = _dereq_(79);
  12759. var Transaction = _dereq_(103);
  12760. var assign = _dereq_(27);
  12761. var emptyFunction = _dereq_(114);
  12762. /**
  12763. * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
  12764. * during the performing of the transaction.
  12765. */
  12766. var ON_DOM_READY_QUEUEING = {
  12767. /**
  12768. * Initializes the internal `onDOMReady` queue.
  12769. */
  12770. initialize: function() {
  12771. this.reactMountReady.reset();
  12772. },
  12773. close: emptyFunction
  12774. };
  12775. var PUT_LISTENER_QUEUEING = {
  12776. initialize: function() {
  12777. this.putListenerQueue.reset();
  12778. },
  12779. close: emptyFunction
  12780. };
  12781. /**
  12782. * Executed within the scope of the `Transaction` instance. Consider these as
  12783. * being member methods, but with an implied ordering while being isolated from
  12784. * each other.
  12785. */
  12786. var TRANSACTION_WRAPPERS = [
  12787. PUT_LISTENER_QUEUEING,
  12788. ON_DOM_READY_QUEUEING
  12789. ];
  12790. /**
  12791. * @class ReactServerRenderingTransaction
  12792. * @param {boolean} renderToStaticMarkup
  12793. */
  12794. function ReactServerRenderingTransaction(renderToStaticMarkup) {
  12795. this.reinitializeTransaction();
  12796. this.renderToStaticMarkup = renderToStaticMarkup;
  12797. this.reactMountReady = CallbackQueue.getPooled(null);
  12798. this.putListenerQueue = ReactPutListenerQueue.getPooled();
  12799. }
  12800. var Mixin = {
  12801. /**
  12802. * @see Transaction
  12803. * @abstract
  12804. * @final
  12805. * @return {array} Empty list of operation wrap proceedures.
  12806. */
  12807. getTransactionWrappers: function() {
  12808. return TRANSACTION_WRAPPERS;
  12809. },
  12810. /**
  12811. * @return {object} The queue to collect `onDOMReady` callbacks with.
  12812. */
  12813. getReactMountReady: function() {
  12814. return this.reactMountReady;
  12815. },
  12816. getPutListenerQueue: function() {
  12817. return this.putListenerQueue;
  12818. },
  12819. /**
  12820. * `PooledClass` looks for this, and will invoke this before allowing this
  12821. * instance to be resused.
  12822. */
  12823. destructor: function() {
  12824. CallbackQueue.release(this.reactMountReady);
  12825. this.reactMountReady = null;
  12826. ReactPutListenerQueue.release(this.putListenerQueue);
  12827. this.putListenerQueue = null;
  12828. }
  12829. };
  12830. assign(
  12831. ReactServerRenderingTransaction.prototype,
  12832. Transaction.Mixin,
  12833. Mixin
  12834. );
  12835. PooledClass.addPoolingTo(ReactServerRenderingTransaction);
  12836. module.exports = ReactServerRenderingTransaction;
  12837. },{"103":103,"114":114,"27":27,"28":28,"6":6,"79":79}],86:[function(_dereq_,module,exports){
  12838. /**
  12839. * Copyright 2015, Facebook, Inc.
  12840. * All rights reserved.
  12841. *
  12842. * This source code is licensed under the BSD-style license found in the
  12843. * LICENSE file in the root directory of this source tree. An additional grant
  12844. * of patent rights can be found in the PATENTS file in the same directory.
  12845. *
  12846. * @providesModule ReactUpdateQueue
  12847. */
  12848. 'use strict';
  12849. var ReactLifeCycle = _dereq_(68);
  12850. var ReactCurrentOwner = _dereq_(39);
  12851. var ReactElement = _dereq_(57);
  12852. var ReactInstanceMap = _dereq_(67);
  12853. var ReactUpdates = _dereq_(87);
  12854. var assign = _dereq_(27);
  12855. var invariant = _dereq_(135);
  12856. var warning = _dereq_(154);
  12857. function enqueueUpdate(internalInstance) {
  12858. if (internalInstance !== ReactLifeCycle.currentlyMountingInstance) {
  12859. // If we're in a componentWillMount handler, don't enqueue a rerender
  12860. // because ReactUpdates assumes we're in a browser context (which is
  12861. // wrong for server rendering) and we're about to do a render anyway.
  12862. // See bug in #1740.
  12863. ReactUpdates.enqueueUpdate(internalInstance);
  12864. }
  12865. }
  12866. function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
  12867. ("production" !== "development" ? invariant(
  12868. ReactCurrentOwner.current == null,
  12869. '%s(...): Cannot update during an existing state transition ' +
  12870. '(such as within `render`). Render methods should be a pure function ' +
  12871. 'of props and state.',
  12872. callerName
  12873. ) : invariant(ReactCurrentOwner.current == null));
  12874. var internalInstance = ReactInstanceMap.get(publicInstance);
  12875. if (!internalInstance) {
  12876. if ("production" !== "development") {
  12877. // Only warn when we have a callerName. Otherwise we should be silent.
  12878. // We're probably calling from enqueueCallback. We don't want to warn
  12879. // there because we already warned for the corresponding lifecycle method.
  12880. ("production" !== "development" ? warning(
  12881. !callerName,
  12882. '%s(...): Can only update a mounted or mounting component. ' +
  12883. 'This usually means you called %s() on an unmounted ' +
  12884. 'component. This is a no-op.',
  12885. callerName,
  12886. callerName
  12887. ) : null);
  12888. }
  12889. return null;
  12890. }
  12891. if (internalInstance === ReactLifeCycle.currentlyUnmountingInstance) {
  12892. return null;
  12893. }
  12894. return internalInstance;
  12895. }
  12896. /**
  12897. * ReactUpdateQueue allows for state updates to be scheduled into a later
  12898. * reconciliation step.
  12899. */
  12900. var ReactUpdateQueue = {
  12901. /**
  12902. * Enqueue a callback that will be executed after all the pending updates
  12903. * have processed.
  12904. *
  12905. * @param {ReactClass} publicInstance The instance to use as `this` context.
  12906. * @param {?function} callback Called after state is updated.
  12907. * @internal
  12908. */
  12909. enqueueCallback: function(publicInstance, callback) {
  12910. ("production" !== "development" ? invariant(
  12911. typeof callback === 'function',
  12912. 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
  12913. '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
  12914. 'isn\'t callable.'
  12915. ) : invariant(typeof callback === 'function'));
  12916. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
  12917. // Previously we would throw an error if we didn't have an internal
  12918. // instance. Since we want to make it a no-op instead, we mirror the same
  12919. // behavior we have in other enqueue* methods.
  12920. // We also need to ignore callbacks in componentWillMount. See
  12921. // enqueueUpdates.
  12922. if (!internalInstance ||
  12923. internalInstance === ReactLifeCycle.currentlyMountingInstance) {
  12924. return null;
  12925. }
  12926. if (internalInstance._pendingCallbacks) {
  12927. internalInstance._pendingCallbacks.push(callback);
  12928. } else {
  12929. internalInstance._pendingCallbacks = [callback];
  12930. }
  12931. // TODO: The callback here is ignored when setState is called from
  12932. // componentWillMount. Either fix it or disallow doing so completely in
  12933. // favor of getInitialState. Alternatively, we can disallow
  12934. // componentWillMount during server-side rendering.
  12935. enqueueUpdate(internalInstance);
  12936. },
  12937. enqueueCallbackInternal: function(internalInstance, callback) {
  12938. ("production" !== "development" ? invariant(
  12939. typeof callback === 'function',
  12940. 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
  12941. '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
  12942. 'isn\'t callable.'
  12943. ) : invariant(typeof callback === 'function'));
  12944. if (internalInstance._pendingCallbacks) {
  12945. internalInstance._pendingCallbacks.push(callback);
  12946. } else {
  12947. internalInstance._pendingCallbacks = [callback];
  12948. }
  12949. enqueueUpdate(internalInstance);
  12950. },
  12951. /**
  12952. * Forces an update. This should only be invoked when it is known with
  12953. * certainty that we are **not** in a DOM transaction.
  12954. *
  12955. * You may want to call this when you know that some deeper aspect of the
  12956. * component's state has changed but `setState` was not called.
  12957. *
  12958. * This will not invoke `shouldUpdateComponent`, but it will invoke
  12959. * `componentWillUpdate` and `componentDidUpdate`.
  12960. *
  12961. * @param {ReactClass} publicInstance The instance that should rerender.
  12962. * @internal
  12963. */
  12964. enqueueForceUpdate: function(publicInstance) {
  12965. var internalInstance = getInternalInstanceReadyForUpdate(
  12966. publicInstance,
  12967. 'forceUpdate'
  12968. );
  12969. if (!internalInstance) {
  12970. return;
  12971. }
  12972. internalInstance._pendingForceUpdate = true;
  12973. enqueueUpdate(internalInstance);
  12974. },
  12975. /**
  12976. * Replaces all of the state. Always use this or `setState` to mutate state.
  12977. * You should treat `this.state` as immutable.
  12978. *
  12979. * There is no guarantee that `this.state` will be immediately updated, so
  12980. * accessing `this.state` after calling this method may return the old value.
  12981. *
  12982. * @param {ReactClass} publicInstance The instance that should rerender.
  12983. * @param {object} completeState Next state.
  12984. * @internal
  12985. */
  12986. enqueueReplaceState: function(publicInstance, completeState) {
  12987. var internalInstance = getInternalInstanceReadyForUpdate(
  12988. publicInstance,
  12989. 'replaceState'
  12990. );
  12991. if (!internalInstance) {
  12992. return;
  12993. }
  12994. internalInstance._pendingStateQueue = [completeState];
  12995. internalInstance._pendingReplaceState = true;
  12996. enqueueUpdate(internalInstance);
  12997. },
  12998. /**
  12999. * Sets a subset of the state. This only exists because _pendingState is
  13000. * internal. This provides a merging strategy that is not available to deep
  13001. * properties which is confusing. TODO: Expose pendingState or don't use it
  13002. * during the merge.
  13003. *
  13004. * @param {ReactClass} publicInstance The instance that should rerender.
  13005. * @param {object} partialState Next partial state to be merged with state.
  13006. * @internal
  13007. */
  13008. enqueueSetState: function(publicInstance, partialState) {
  13009. var internalInstance = getInternalInstanceReadyForUpdate(
  13010. publicInstance,
  13011. 'setState'
  13012. );
  13013. if (!internalInstance) {
  13014. return;
  13015. }
  13016. var queue =
  13017. internalInstance._pendingStateQueue ||
  13018. (internalInstance._pendingStateQueue = []);
  13019. queue.push(partialState);
  13020. enqueueUpdate(internalInstance);
  13021. },
  13022. /**
  13023. * Sets a subset of the props.
  13024. *
  13025. * @param {ReactClass} publicInstance The instance that should rerender.
  13026. * @param {object} partialProps Subset of the next props.
  13027. * @internal
  13028. */
  13029. enqueueSetProps: function(publicInstance, partialProps) {
  13030. var internalInstance = getInternalInstanceReadyForUpdate(
  13031. publicInstance,
  13032. 'setProps'
  13033. );
  13034. if (!internalInstance) {
  13035. return;
  13036. }
  13037. ("production" !== "development" ? invariant(
  13038. internalInstance._isTopLevel,
  13039. 'setProps(...): You called `setProps` on a ' +
  13040. 'component with a parent. This is an anti-pattern since props will ' +
  13041. 'get reactively updated when rendered. Instead, change the owner\'s ' +
  13042. '`render` method to pass the correct value as props to the component ' +
  13043. 'where it is created.'
  13044. ) : invariant(internalInstance._isTopLevel));
  13045. // Merge with the pending element if it exists, otherwise with existing
  13046. // element props.
  13047. var element = internalInstance._pendingElement ||
  13048. internalInstance._currentElement;
  13049. var props = assign({}, element.props, partialProps);
  13050. internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
  13051. element,
  13052. props
  13053. );
  13054. enqueueUpdate(internalInstance);
  13055. },
  13056. /**
  13057. * Replaces all of the props.
  13058. *
  13059. * @param {ReactClass} publicInstance The instance that should rerender.
  13060. * @param {object} props New props.
  13061. * @internal
  13062. */
  13063. enqueueReplaceProps: function(publicInstance, props) {
  13064. var internalInstance = getInternalInstanceReadyForUpdate(
  13065. publicInstance,
  13066. 'replaceProps'
  13067. );
  13068. if (!internalInstance) {
  13069. return;
  13070. }
  13071. ("production" !== "development" ? invariant(
  13072. internalInstance._isTopLevel,
  13073. 'replaceProps(...): You called `replaceProps` on a ' +
  13074. 'component with a parent. This is an anti-pattern since props will ' +
  13075. 'get reactively updated when rendered. Instead, change the owner\'s ' +
  13076. '`render` method to pass the correct value as props to the component ' +
  13077. 'where it is created.'
  13078. ) : invariant(internalInstance._isTopLevel));
  13079. // Merge with the pending element if it exists, otherwise with existing
  13080. // element props.
  13081. var element = internalInstance._pendingElement ||
  13082. internalInstance._currentElement;
  13083. internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
  13084. element,
  13085. props
  13086. );
  13087. enqueueUpdate(internalInstance);
  13088. },
  13089. enqueueElementInternal: function(internalInstance, newElement) {
  13090. internalInstance._pendingElement = newElement;
  13091. enqueueUpdate(internalInstance);
  13092. }
  13093. };
  13094. module.exports = ReactUpdateQueue;
  13095. },{"135":135,"154":154,"27":27,"39":39,"57":57,"67":67,"68":68,"87":87}],87:[function(_dereq_,module,exports){
  13096. /**
  13097. * Copyright 2013-2015, Facebook, Inc.
  13098. * All rights reserved.
  13099. *
  13100. * This source code is licensed under the BSD-style license found in the
  13101. * LICENSE file in the root directory of this source tree. An additional grant
  13102. * of patent rights can be found in the PATENTS file in the same directory.
  13103. *
  13104. * @providesModule ReactUpdates
  13105. */
  13106. 'use strict';
  13107. var CallbackQueue = _dereq_(6);
  13108. var PooledClass = _dereq_(28);
  13109. var ReactCurrentOwner = _dereq_(39);
  13110. var ReactPerf = _dereq_(75);
  13111. var ReactReconciler = _dereq_(81);
  13112. var Transaction = _dereq_(103);
  13113. var assign = _dereq_(27);
  13114. var invariant = _dereq_(135);
  13115. var warning = _dereq_(154);
  13116. var dirtyComponents = [];
  13117. var asapCallbackQueue = CallbackQueue.getPooled();
  13118. var asapEnqueued = false;
  13119. var batchingStrategy = null;
  13120. function ensureInjected() {
  13121. ("production" !== "development" ? invariant(
  13122. ReactUpdates.ReactReconcileTransaction && batchingStrategy,
  13123. 'ReactUpdates: must inject a reconcile transaction class and batching ' +
  13124. 'strategy'
  13125. ) : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy));
  13126. }
  13127. var NESTED_UPDATES = {
  13128. initialize: function() {
  13129. this.dirtyComponentsLength = dirtyComponents.length;
  13130. },
  13131. close: function() {
  13132. if (this.dirtyComponentsLength !== dirtyComponents.length) {
  13133. // Additional updates were enqueued by componentDidUpdate handlers or
  13134. // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
  13135. // these new updates so that if A's componentDidUpdate calls setState on
  13136. // B, B will update before the callback A's updater provided when calling
  13137. // setState.
  13138. dirtyComponents.splice(0, this.dirtyComponentsLength);
  13139. flushBatchedUpdates();
  13140. } else {
  13141. dirtyComponents.length = 0;
  13142. }
  13143. }
  13144. };
  13145. var UPDATE_QUEUEING = {
  13146. initialize: function() {
  13147. this.callbackQueue.reset();
  13148. },
  13149. close: function() {
  13150. this.callbackQueue.notifyAll();
  13151. }
  13152. };
  13153. var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
  13154. function ReactUpdatesFlushTransaction() {
  13155. this.reinitializeTransaction();
  13156. this.dirtyComponentsLength = null;
  13157. this.callbackQueue = CallbackQueue.getPooled();
  13158. this.reconcileTransaction =
  13159. ReactUpdates.ReactReconcileTransaction.getPooled();
  13160. }
  13161. assign(
  13162. ReactUpdatesFlushTransaction.prototype,
  13163. Transaction.Mixin, {
  13164. getTransactionWrappers: function() {
  13165. return TRANSACTION_WRAPPERS;
  13166. },
  13167. destructor: function() {
  13168. this.dirtyComponentsLength = null;
  13169. CallbackQueue.release(this.callbackQueue);
  13170. this.callbackQueue = null;
  13171. ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
  13172. this.reconcileTransaction = null;
  13173. },
  13174. perform: function(method, scope, a) {
  13175. // Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
  13176. // with this transaction's wrappers around it.
  13177. return Transaction.Mixin.perform.call(
  13178. this,
  13179. this.reconcileTransaction.perform,
  13180. this.reconcileTransaction,
  13181. method,
  13182. scope,
  13183. a
  13184. );
  13185. }
  13186. });
  13187. PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
  13188. function batchedUpdates(callback, a, b, c, d) {
  13189. ensureInjected();
  13190. batchingStrategy.batchedUpdates(callback, a, b, c, d);
  13191. }
  13192. /**
  13193. * Array comparator for ReactComponents by mount ordering.
  13194. *
  13195. * @param {ReactComponent} c1 first component you're comparing
  13196. * @param {ReactComponent} c2 second component you're comparing
  13197. * @return {number} Return value usable by Array.prototype.sort().
  13198. */
  13199. function mountOrderComparator(c1, c2) {
  13200. return c1._mountOrder - c2._mountOrder;
  13201. }
  13202. function runBatchedUpdates(transaction) {
  13203. var len = transaction.dirtyComponentsLength;
  13204. ("production" !== "development" ? invariant(
  13205. len === dirtyComponents.length,
  13206. 'Expected flush transaction\'s stored dirty-components length (%s) to ' +
  13207. 'match dirty-components array length (%s).',
  13208. len,
  13209. dirtyComponents.length
  13210. ) : invariant(len === dirtyComponents.length));
  13211. // Since reconciling a component higher in the owner hierarchy usually (not
  13212. // always -- see shouldComponentUpdate()) will reconcile children, reconcile
  13213. // them before their children by sorting the array.
  13214. dirtyComponents.sort(mountOrderComparator);
  13215. for (var i = 0; i < len; i++) {
  13216. // If a component is unmounted before pending changes apply, it will still
  13217. // be here, but we assume that it has cleared its _pendingCallbacks and
  13218. // that performUpdateIfNecessary is a noop.
  13219. var component = dirtyComponents[i];
  13220. // If performUpdateIfNecessary happens to enqueue any new updates, we
  13221. // shouldn't execute the callbacks until the next render happens, so
  13222. // stash the callbacks first
  13223. var callbacks = component._pendingCallbacks;
  13224. component._pendingCallbacks = null;
  13225. ReactReconciler.performUpdateIfNecessary(
  13226. component,
  13227. transaction.reconcileTransaction
  13228. );
  13229. if (callbacks) {
  13230. for (var j = 0; j < callbacks.length; j++) {
  13231. transaction.callbackQueue.enqueue(
  13232. callbacks[j],
  13233. component.getPublicInstance()
  13234. );
  13235. }
  13236. }
  13237. }
  13238. }
  13239. var flushBatchedUpdates = function() {
  13240. // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
  13241. // array and perform any updates enqueued by mount-ready handlers (i.e.,
  13242. // componentDidUpdate) but we need to check here too in order to catch
  13243. // updates enqueued by setState callbacks and asap calls.
  13244. while (dirtyComponents.length || asapEnqueued) {
  13245. if (dirtyComponents.length) {
  13246. var transaction = ReactUpdatesFlushTransaction.getPooled();
  13247. transaction.perform(runBatchedUpdates, null, transaction);
  13248. ReactUpdatesFlushTransaction.release(transaction);
  13249. }
  13250. if (asapEnqueued) {
  13251. asapEnqueued = false;
  13252. var queue = asapCallbackQueue;
  13253. asapCallbackQueue = CallbackQueue.getPooled();
  13254. queue.notifyAll();
  13255. CallbackQueue.release(queue);
  13256. }
  13257. }
  13258. };
  13259. flushBatchedUpdates = ReactPerf.measure(
  13260. 'ReactUpdates',
  13261. 'flushBatchedUpdates',
  13262. flushBatchedUpdates
  13263. );
  13264. /**
  13265. * Mark a component as needing a rerender, adding an optional callback to a
  13266. * list of functions which will be executed once the rerender occurs.
  13267. */
  13268. function enqueueUpdate(component) {
  13269. ensureInjected();
  13270. // Various parts of our code (such as ReactCompositeComponent's
  13271. // _renderValidatedComponent) assume that calls to render aren't nested;
  13272. // verify that that's the case. (This is called by each top-level update
  13273. // function, like setProps, setState, forceUpdate, etc.; creation and
  13274. // destruction of top-level components is guarded in ReactMount.)
  13275. ("production" !== "development" ? warning(
  13276. ReactCurrentOwner.current == null,
  13277. 'enqueueUpdate(): Render methods should be a pure function of props ' +
  13278. 'and state; triggering nested component updates from render is not ' +
  13279. 'allowed. If necessary, trigger nested updates in ' +
  13280. 'componentDidUpdate.'
  13281. ) : null);
  13282. if (!batchingStrategy.isBatchingUpdates) {
  13283. batchingStrategy.batchedUpdates(enqueueUpdate, component);
  13284. return;
  13285. }
  13286. dirtyComponents.push(component);
  13287. }
  13288. /**
  13289. * Enqueue a callback to be run at the end of the current batching cycle. Throws
  13290. * if no updates are currently being performed.
  13291. */
  13292. function asap(callback, context) {
  13293. ("production" !== "development" ? invariant(
  13294. batchingStrategy.isBatchingUpdates,
  13295. 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' +
  13296. 'updates are not being batched.'
  13297. ) : invariant(batchingStrategy.isBatchingUpdates));
  13298. asapCallbackQueue.enqueue(callback, context);
  13299. asapEnqueued = true;
  13300. }
  13301. var ReactUpdatesInjection = {
  13302. injectReconcileTransaction: function(ReconcileTransaction) {
  13303. ("production" !== "development" ? invariant(
  13304. ReconcileTransaction,
  13305. 'ReactUpdates: must provide a reconcile transaction class'
  13306. ) : invariant(ReconcileTransaction));
  13307. ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
  13308. },
  13309. injectBatchingStrategy: function(_batchingStrategy) {
  13310. ("production" !== "development" ? invariant(
  13311. _batchingStrategy,
  13312. 'ReactUpdates: must provide a batching strategy'
  13313. ) : invariant(_batchingStrategy));
  13314. ("production" !== "development" ? invariant(
  13315. typeof _batchingStrategy.batchedUpdates === 'function',
  13316. 'ReactUpdates: must provide a batchedUpdates() function'
  13317. ) : invariant(typeof _batchingStrategy.batchedUpdates === 'function'));
  13318. ("production" !== "development" ? invariant(
  13319. typeof _batchingStrategy.isBatchingUpdates === 'boolean',
  13320. 'ReactUpdates: must provide an isBatchingUpdates boolean attribute'
  13321. ) : invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean'));
  13322. batchingStrategy = _batchingStrategy;
  13323. }
  13324. };
  13325. var ReactUpdates = {
  13326. /**
  13327. * React references `ReactReconcileTransaction` using this property in order
  13328. * to allow dependency injection.
  13329. *
  13330. * @internal
  13331. */
  13332. ReactReconcileTransaction: null,
  13333. batchedUpdates: batchedUpdates,
  13334. enqueueUpdate: enqueueUpdate,
  13335. flushBatchedUpdates: flushBatchedUpdates,
  13336. injection: ReactUpdatesInjection,
  13337. asap: asap
  13338. };
  13339. module.exports = ReactUpdates;
  13340. },{"103":103,"135":135,"154":154,"27":27,"28":28,"39":39,"6":6,"75":75,"81":81}],88:[function(_dereq_,module,exports){
  13341. /**
  13342. * Copyright 2013-2015, Facebook, Inc.
  13343. * All rights reserved.
  13344. *
  13345. * This source code is licensed under the BSD-style license found in the
  13346. * LICENSE file in the root directory of this source tree. An additional grant
  13347. * of patent rights can be found in the PATENTS file in the same directory.
  13348. *
  13349. * @providesModule SVGDOMPropertyConfig
  13350. */
  13351. /*jslint bitwise: true*/
  13352. 'use strict';
  13353. var DOMProperty = _dereq_(10);
  13354. var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
  13355. var SVGDOMPropertyConfig = {
  13356. Properties: {
  13357. cx: MUST_USE_ATTRIBUTE,
  13358. cy: MUST_USE_ATTRIBUTE,
  13359. d: MUST_USE_ATTRIBUTE,
  13360. dx: MUST_USE_ATTRIBUTE,
  13361. dy: MUST_USE_ATTRIBUTE,
  13362. fill: MUST_USE_ATTRIBUTE,
  13363. fillOpacity: MUST_USE_ATTRIBUTE,
  13364. fontFamily: MUST_USE_ATTRIBUTE,
  13365. fontSize: MUST_USE_ATTRIBUTE,
  13366. fx: MUST_USE_ATTRIBUTE,
  13367. fy: MUST_USE_ATTRIBUTE,
  13368. gradientTransform: MUST_USE_ATTRIBUTE,
  13369. gradientUnits: MUST_USE_ATTRIBUTE,
  13370. markerEnd: MUST_USE_ATTRIBUTE,
  13371. markerMid: MUST_USE_ATTRIBUTE,
  13372. markerStart: MUST_USE_ATTRIBUTE,
  13373. offset: MUST_USE_ATTRIBUTE,
  13374. opacity: MUST_USE_ATTRIBUTE,
  13375. patternContentUnits: MUST_USE_ATTRIBUTE,
  13376. patternUnits: MUST_USE_ATTRIBUTE,
  13377. points: MUST_USE_ATTRIBUTE,
  13378. preserveAspectRatio: MUST_USE_ATTRIBUTE,
  13379. r: MUST_USE_ATTRIBUTE,
  13380. rx: MUST_USE_ATTRIBUTE,
  13381. ry: MUST_USE_ATTRIBUTE,
  13382. spreadMethod: MUST_USE_ATTRIBUTE,
  13383. stopColor: MUST_USE_ATTRIBUTE,
  13384. stopOpacity: MUST_USE_ATTRIBUTE,
  13385. stroke: MUST_USE_ATTRIBUTE,
  13386. strokeDasharray: MUST_USE_ATTRIBUTE,
  13387. strokeLinecap: MUST_USE_ATTRIBUTE,
  13388. strokeOpacity: MUST_USE_ATTRIBUTE,
  13389. strokeWidth: MUST_USE_ATTRIBUTE,
  13390. textAnchor: MUST_USE_ATTRIBUTE,
  13391. transform: MUST_USE_ATTRIBUTE,
  13392. version: MUST_USE_ATTRIBUTE,
  13393. viewBox: MUST_USE_ATTRIBUTE,
  13394. x1: MUST_USE_ATTRIBUTE,
  13395. x2: MUST_USE_ATTRIBUTE,
  13396. x: MUST_USE_ATTRIBUTE,
  13397. y1: MUST_USE_ATTRIBUTE,
  13398. y2: MUST_USE_ATTRIBUTE,
  13399. y: MUST_USE_ATTRIBUTE
  13400. },
  13401. DOMAttributeNames: {
  13402. fillOpacity: 'fill-opacity',
  13403. fontFamily: 'font-family',
  13404. fontSize: 'font-size',
  13405. gradientTransform: 'gradientTransform',
  13406. gradientUnits: 'gradientUnits',
  13407. markerEnd: 'marker-end',
  13408. markerMid: 'marker-mid',
  13409. markerStart: 'marker-start',
  13410. patternContentUnits: 'patternContentUnits',
  13411. patternUnits: 'patternUnits',
  13412. preserveAspectRatio: 'preserveAspectRatio',
  13413. spreadMethod: 'spreadMethod',
  13414. stopColor: 'stop-color',
  13415. stopOpacity: 'stop-opacity',
  13416. strokeDasharray: 'stroke-dasharray',
  13417. strokeLinecap: 'stroke-linecap',
  13418. strokeOpacity: 'stroke-opacity',
  13419. strokeWidth: 'stroke-width',
  13420. textAnchor: 'text-anchor',
  13421. viewBox: 'viewBox'
  13422. }
  13423. };
  13424. module.exports = SVGDOMPropertyConfig;
  13425. },{"10":10}],89:[function(_dereq_,module,exports){
  13426. /**
  13427. * Copyright 2013-2015, Facebook, Inc.
  13428. * All rights reserved.
  13429. *
  13430. * This source code is licensed under the BSD-style license found in the
  13431. * LICENSE file in the root directory of this source tree. An additional grant
  13432. * of patent rights can be found in the PATENTS file in the same directory.
  13433. *
  13434. * @providesModule SelectEventPlugin
  13435. */
  13436. 'use strict';
  13437. var EventConstants = _dereq_(15);
  13438. var EventPropagators = _dereq_(20);
  13439. var ReactInputSelection = _dereq_(65);
  13440. var SyntheticEvent = _dereq_(95);
  13441. var getActiveElement = _dereq_(121);
  13442. var isTextInputElement = _dereq_(138);
  13443. var keyOf = _dereq_(141);
  13444. var shallowEqual = _dereq_(150);
  13445. var topLevelTypes = EventConstants.topLevelTypes;
  13446. var eventTypes = {
  13447. select: {
  13448. phasedRegistrationNames: {
  13449. bubbled: keyOf({onSelect: null}),
  13450. captured: keyOf({onSelectCapture: null})
  13451. },
  13452. dependencies: [
  13453. topLevelTypes.topBlur,
  13454. topLevelTypes.topContextMenu,
  13455. topLevelTypes.topFocus,
  13456. topLevelTypes.topKeyDown,
  13457. topLevelTypes.topMouseDown,
  13458. topLevelTypes.topMouseUp,
  13459. topLevelTypes.topSelectionChange
  13460. ]
  13461. }
  13462. };
  13463. var activeElement = null;
  13464. var activeElementID = null;
  13465. var lastSelection = null;
  13466. var mouseDown = false;
  13467. /**
  13468. * Get an object which is a unique representation of the current selection.
  13469. *
  13470. * The return value will not be consistent across nodes or browsers, but
  13471. * two identical selections on the same node will return identical objects.
  13472. *
  13473. * @param {DOMElement} node
  13474. * @param {object}
  13475. */
  13476. function getSelection(node) {
  13477. if ('selectionStart' in node &&
  13478. ReactInputSelection.hasSelectionCapabilities(node)) {
  13479. return {
  13480. start: node.selectionStart,
  13481. end: node.selectionEnd
  13482. };
  13483. } else if (window.getSelection) {
  13484. var selection = window.getSelection();
  13485. return {
  13486. anchorNode: selection.anchorNode,
  13487. anchorOffset: selection.anchorOffset,
  13488. focusNode: selection.focusNode,
  13489. focusOffset: selection.focusOffset
  13490. };
  13491. } else if (document.selection) {
  13492. var range = document.selection.createRange();
  13493. return {
  13494. parentElement: range.parentElement(),
  13495. text: range.text,
  13496. top: range.boundingTop,
  13497. left: range.boundingLeft
  13498. };
  13499. }
  13500. }
  13501. /**
  13502. * Poll selection to see whether it's changed.
  13503. *
  13504. * @param {object} nativeEvent
  13505. * @return {?SyntheticEvent}
  13506. */
  13507. function constructSelectEvent(nativeEvent) {
  13508. // Ensure we have the right element, and that the user is not dragging a
  13509. // selection (this matches native `select` event behavior). In HTML5, select
  13510. // fires only on input and textarea thus if there's no focused element we
  13511. // won't dispatch.
  13512. if (mouseDown ||
  13513. activeElement == null ||
  13514. activeElement !== getActiveElement()) {
  13515. return null;
  13516. }
  13517. // Only fire when selection has actually changed.
  13518. var currentSelection = getSelection(activeElement);
  13519. if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
  13520. lastSelection = currentSelection;
  13521. var syntheticEvent = SyntheticEvent.getPooled(
  13522. eventTypes.select,
  13523. activeElementID,
  13524. nativeEvent
  13525. );
  13526. syntheticEvent.type = 'select';
  13527. syntheticEvent.target = activeElement;
  13528. EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
  13529. return syntheticEvent;
  13530. }
  13531. }
  13532. /**
  13533. * This plugin creates an `onSelect` event that normalizes select events
  13534. * across form elements.
  13535. *
  13536. * Supported elements are:
  13537. * - input (see `isTextInputElement`)
  13538. * - textarea
  13539. * - contentEditable
  13540. *
  13541. * This differs from native browser implementations in the following ways:
  13542. * - Fires on contentEditable fields as well as inputs.
  13543. * - Fires for collapsed selection.
  13544. * - Fires after user input.
  13545. */
  13546. var SelectEventPlugin = {
  13547. eventTypes: eventTypes,
  13548. /**
  13549. * @param {string} topLevelType Record from `EventConstants`.
  13550. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  13551. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  13552. * @param {object} nativeEvent Native browser event.
  13553. * @return {*} An accumulation of synthetic events.
  13554. * @see {EventPluginHub.extractEvents}
  13555. */
  13556. extractEvents: function(
  13557. topLevelType,
  13558. topLevelTarget,
  13559. topLevelTargetID,
  13560. nativeEvent) {
  13561. switch (topLevelType) {
  13562. // Track the input node that has focus.
  13563. case topLevelTypes.topFocus:
  13564. if (isTextInputElement(topLevelTarget) ||
  13565. topLevelTarget.contentEditable === 'true') {
  13566. activeElement = topLevelTarget;
  13567. activeElementID = topLevelTargetID;
  13568. lastSelection = null;
  13569. }
  13570. break;
  13571. case topLevelTypes.topBlur:
  13572. activeElement = null;
  13573. activeElementID = null;
  13574. lastSelection = null;
  13575. break;
  13576. // Don't fire the event while the user is dragging. This matches the
  13577. // semantics of the native select event.
  13578. case topLevelTypes.topMouseDown:
  13579. mouseDown = true;
  13580. break;
  13581. case topLevelTypes.topContextMenu:
  13582. case topLevelTypes.topMouseUp:
  13583. mouseDown = false;
  13584. return constructSelectEvent(nativeEvent);
  13585. // Chrome and IE fire non-standard event when selection is changed (and
  13586. // sometimes when it hasn't).
  13587. // Firefox doesn't support selectionchange, so check selection status
  13588. // after each key entry. The selection changes after keydown and before
  13589. // keyup, but we check on keydown as well in the case of holding down a
  13590. // key, when multiple keydown events are fired but only one keyup is.
  13591. case topLevelTypes.topSelectionChange:
  13592. case topLevelTypes.topKeyDown:
  13593. case topLevelTypes.topKeyUp:
  13594. return constructSelectEvent(nativeEvent);
  13595. }
  13596. }
  13597. };
  13598. module.exports = SelectEventPlugin;
  13599. },{"121":121,"138":138,"141":141,"15":15,"150":150,"20":20,"65":65,"95":95}],90:[function(_dereq_,module,exports){
  13600. /**
  13601. * Copyright 2013-2015, Facebook, Inc.
  13602. * All rights reserved.
  13603. *
  13604. * This source code is licensed under the BSD-style license found in the
  13605. * LICENSE file in the root directory of this source tree. An additional grant
  13606. * of patent rights can be found in the PATENTS file in the same directory.
  13607. *
  13608. * @providesModule ServerReactRootIndex
  13609. * @typechecks
  13610. */
  13611. 'use strict';
  13612. /**
  13613. * Size of the reactRoot ID space. We generate random numbers for React root
  13614. * IDs and if there's a collision the events and DOM update system will
  13615. * get confused. In the future we need a way to generate GUIDs but for
  13616. * now this will work on a smaller scale.
  13617. */
  13618. var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
  13619. var ServerReactRootIndex = {
  13620. createReactRootIndex: function() {
  13621. return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
  13622. }
  13623. };
  13624. module.exports = ServerReactRootIndex;
  13625. },{}],91:[function(_dereq_,module,exports){
  13626. /**
  13627. * Copyright 2013-2015, Facebook, Inc.
  13628. * All rights reserved.
  13629. *
  13630. * This source code is licensed under the BSD-style license found in the
  13631. * LICENSE file in the root directory of this source tree. An additional grant
  13632. * of patent rights can be found in the PATENTS file in the same directory.
  13633. *
  13634. * @providesModule SimpleEventPlugin
  13635. */
  13636. 'use strict';
  13637. var EventConstants = _dereq_(15);
  13638. var EventPluginUtils = _dereq_(19);
  13639. var EventPropagators = _dereq_(20);
  13640. var SyntheticClipboardEvent = _dereq_(92);
  13641. var SyntheticEvent = _dereq_(95);
  13642. var SyntheticFocusEvent = _dereq_(96);
  13643. var SyntheticKeyboardEvent = _dereq_(98);
  13644. var SyntheticMouseEvent = _dereq_(99);
  13645. var SyntheticDragEvent = _dereq_(94);
  13646. var SyntheticTouchEvent = _dereq_(100);
  13647. var SyntheticUIEvent = _dereq_(101);
  13648. var SyntheticWheelEvent = _dereq_(102);
  13649. var getEventCharCode = _dereq_(122);
  13650. var invariant = _dereq_(135);
  13651. var keyOf = _dereq_(141);
  13652. var warning = _dereq_(154);
  13653. var topLevelTypes = EventConstants.topLevelTypes;
  13654. var eventTypes = {
  13655. blur: {
  13656. phasedRegistrationNames: {
  13657. bubbled: keyOf({onBlur: true}),
  13658. captured: keyOf({onBlurCapture: true})
  13659. }
  13660. },
  13661. click: {
  13662. phasedRegistrationNames: {
  13663. bubbled: keyOf({onClick: true}),
  13664. captured: keyOf({onClickCapture: true})
  13665. }
  13666. },
  13667. contextMenu: {
  13668. phasedRegistrationNames: {
  13669. bubbled: keyOf({onContextMenu: true}),
  13670. captured: keyOf({onContextMenuCapture: true})
  13671. }
  13672. },
  13673. copy: {
  13674. phasedRegistrationNames: {
  13675. bubbled: keyOf({onCopy: true}),
  13676. captured: keyOf({onCopyCapture: true})
  13677. }
  13678. },
  13679. cut: {
  13680. phasedRegistrationNames: {
  13681. bubbled: keyOf({onCut: true}),
  13682. captured: keyOf({onCutCapture: true})
  13683. }
  13684. },
  13685. doubleClick: {
  13686. phasedRegistrationNames: {
  13687. bubbled: keyOf({onDoubleClick: true}),
  13688. captured: keyOf({onDoubleClickCapture: true})
  13689. }
  13690. },
  13691. drag: {
  13692. phasedRegistrationNames: {
  13693. bubbled: keyOf({onDrag: true}),
  13694. captured: keyOf({onDragCapture: true})
  13695. }
  13696. },
  13697. dragEnd: {
  13698. phasedRegistrationNames: {
  13699. bubbled: keyOf({onDragEnd: true}),
  13700. captured: keyOf({onDragEndCapture: true})
  13701. }
  13702. },
  13703. dragEnter: {
  13704. phasedRegistrationNames: {
  13705. bubbled: keyOf({onDragEnter: true}),
  13706. captured: keyOf({onDragEnterCapture: true})
  13707. }
  13708. },
  13709. dragExit: {
  13710. phasedRegistrationNames: {
  13711. bubbled: keyOf({onDragExit: true}),
  13712. captured: keyOf({onDragExitCapture: true})
  13713. }
  13714. },
  13715. dragLeave: {
  13716. phasedRegistrationNames: {
  13717. bubbled: keyOf({onDragLeave: true}),
  13718. captured: keyOf({onDragLeaveCapture: true})
  13719. }
  13720. },
  13721. dragOver: {
  13722. phasedRegistrationNames: {
  13723. bubbled: keyOf({onDragOver: true}),
  13724. captured: keyOf({onDragOverCapture: true})
  13725. }
  13726. },
  13727. dragStart: {
  13728. phasedRegistrationNames: {
  13729. bubbled: keyOf({onDragStart: true}),
  13730. captured: keyOf({onDragStartCapture: true})
  13731. }
  13732. },
  13733. drop: {
  13734. phasedRegistrationNames: {
  13735. bubbled: keyOf({onDrop: true}),
  13736. captured: keyOf({onDropCapture: true})
  13737. }
  13738. },
  13739. focus: {
  13740. phasedRegistrationNames: {
  13741. bubbled: keyOf({onFocus: true}),
  13742. captured: keyOf({onFocusCapture: true})
  13743. }
  13744. },
  13745. input: {
  13746. phasedRegistrationNames: {
  13747. bubbled: keyOf({onInput: true}),
  13748. captured: keyOf({onInputCapture: true})
  13749. }
  13750. },
  13751. keyDown: {
  13752. phasedRegistrationNames: {
  13753. bubbled: keyOf({onKeyDown: true}),
  13754. captured: keyOf({onKeyDownCapture: true})
  13755. }
  13756. },
  13757. keyPress: {
  13758. phasedRegistrationNames: {
  13759. bubbled: keyOf({onKeyPress: true}),
  13760. captured: keyOf({onKeyPressCapture: true})
  13761. }
  13762. },
  13763. keyUp: {
  13764. phasedRegistrationNames: {
  13765. bubbled: keyOf({onKeyUp: true}),
  13766. captured: keyOf({onKeyUpCapture: true})
  13767. }
  13768. },
  13769. load: {
  13770. phasedRegistrationNames: {
  13771. bubbled: keyOf({onLoad: true}),
  13772. captured: keyOf({onLoadCapture: true})
  13773. }
  13774. },
  13775. error: {
  13776. phasedRegistrationNames: {
  13777. bubbled: keyOf({onError: true}),
  13778. captured: keyOf({onErrorCapture: true})
  13779. }
  13780. },
  13781. // Note: We do not allow listening to mouseOver events. Instead, use the
  13782. // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
  13783. mouseDown: {
  13784. phasedRegistrationNames: {
  13785. bubbled: keyOf({onMouseDown: true}),
  13786. captured: keyOf({onMouseDownCapture: true})
  13787. }
  13788. },
  13789. mouseMove: {
  13790. phasedRegistrationNames: {
  13791. bubbled: keyOf({onMouseMove: true}),
  13792. captured: keyOf({onMouseMoveCapture: true})
  13793. }
  13794. },
  13795. mouseOut: {
  13796. phasedRegistrationNames: {
  13797. bubbled: keyOf({onMouseOut: true}),
  13798. captured: keyOf({onMouseOutCapture: true})
  13799. }
  13800. },
  13801. mouseOver: {
  13802. phasedRegistrationNames: {
  13803. bubbled: keyOf({onMouseOver: true}),
  13804. captured: keyOf({onMouseOverCapture: true})
  13805. }
  13806. },
  13807. mouseUp: {
  13808. phasedRegistrationNames: {
  13809. bubbled: keyOf({onMouseUp: true}),
  13810. captured: keyOf({onMouseUpCapture: true})
  13811. }
  13812. },
  13813. paste: {
  13814. phasedRegistrationNames: {
  13815. bubbled: keyOf({onPaste: true}),
  13816. captured: keyOf({onPasteCapture: true})
  13817. }
  13818. },
  13819. reset: {
  13820. phasedRegistrationNames: {
  13821. bubbled: keyOf({onReset: true}),
  13822. captured: keyOf({onResetCapture: true})
  13823. }
  13824. },
  13825. scroll: {
  13826. phasedRegistrationNames: {
  13827. bubbled: keyOf({onScroll: true}),
  13828. captured: keyOf({onScrollCapture: true})
  13829. }
  13830. },
  13831. submit: {
  13832. phasedRegistrationNames: {
  13833. bubbled: keyOf({onSubmit: true}),
  13834. captured: keyOf({onSubmitCapture: true})
  13835. }
  13836. },
  13837. touchCancel: {
  13838. phasedRegistrationNames: {
  13839. bubbled: keyOf({onTouchCancel: true}),
  13840. captured: keyOf({onTouchCancelCapture: true})
  13841. }
  13842. },
  13843. touchEnd: {
  13844. phasedRegistrationNames: {
  13845. bubbled: keyOf({onTouchEnd: true}),
  13846. captured: keyOf({onTouchEndCapture: true})
  13847. }
  13848. },
  13849. touchMove: {
  13850. phasedRegistrationNames: {
  13851. bubbled: keyOf({onTouchMove: true}),
  13852. captured: keyOf({onTouchMoveCapture: true})
  13853. }
  13854. },
  13855. touchStart: {
  13856. phasedRegistrationNames: {
  13857. bubbled: keyOf({onTouchStart: true}),
  13858. captured: keyOf({onTouchStartCapture: true})
  13859. }
  13860. },
  13861. wheel: {
  13862. phasedRegistrationNames: {
  13863. bubbled: keyOf({onWheel: true}),
  13864. captured: keyOf({onWheelCapture: true})
  13865. }
  13866. }
  13867. };
  13868. var topLevelEventsToDispatchConfig = {
  13869. topBlur: eventTypes.blur,
  13870. topClick: eventTypes.click,
  13871. topContextMenu: eventTypes.contextMenu,
  13872. topCopy: eventTypes.copy,
  13873. topCut: eventTypes.cut,
  13874. topDoubleClick: eventTypes.doubleClick,
  13875. topDrag: eventTypes.drag,
  13876. topDragEnd: eventTypes.dragEnd,
  13877. topDragEnter: eventTypes.dragEnter,
  13878. topDragExit: eventTypes.dragExit,
  13879. topDragLeave: eventTypes.dragLeave,
  13880. topDragOver: eventTypes.dragOver,
  13881. topDragStart: eventTypes.dragStart,
  13882. topDrop: eventTypes.drop,
  13883. topError: eventTypes.error,
  13884. topFocus: eventTypes.focus,
  13885. topInput: eventTypes.input,
  13886. topKeyDown: eventTypes.keyDown,
  13887. topKeyPress: eventTypes.keyPress,
  13888. topKeyUp: eventTypes.keyUp,
  13889. topLoad: eventTypes.load,
  13890. topMouseDown: eventTypes.mouseDown,
  13891. topMouseMove: eventTypes.mouseMove,
  13892. topMouseOut: eventTypes.mouseOut,
  13893. topMouseOver: eventTypes.mouseOver,
  13894. topMouseUp: eventTypes.mouseUp,
  13895. topPaste: eventTypes.paste,
  13896. topReset: eventTypes.reset,
  13897. topScroll: eventTypes.scroll,
  13898. topSubmit: eventTypes.submit,
  13899. topTouchCancel: eventTypes.touchCancel,
  13900. topTouchEnd: eventTypes.touchEnd,
  13901. topTouchMove: eventTypes.touchMove,
  13902. topTouchStart: eventTypes.touchStart,
  13903. topWheel: eventTypes.wheel
  13904. };
  13905. for (var type in topLevelEventsToDispatchConfig) {
  13906. topLevelEventsToDispatchConfig[type].dependencies = [type];
  13907. }
  13908. var SimpleEventPlugin = {
  13909. eventTypes: eventTypes,
  13910. /**
  13911. * Same as the default implementation, except cancels the event when return
  13912. * value is false. This behavior will be disabled in a future release.
  13913. *
  13914. * @param {object} Event to be dispatched.
  13915. * @param {function} Application-level callback.
  13916. * @param {string} domID DOM ID to pass to the callback.
  13917. */
  13918. executeDispatch: function(event, listener, domID) {
  13919. var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
  13920. ("production" !== "development" ? warning(
  13921. typeof returnValue !== 'boolean',
  13922. 'Returning `false` from an event handler is deprecated and will be ' +
  13923. 'ignored in a future release. Instead, manually call ' +
  13924. 'e.stopPropagation() or e.preventDefault(), as appropriate.'
  13925. ) : null);
  13926. if (returnValue === false) {
  13927. event.stopPropagation();
  13928. event.preventDefault();
  13929. }
  13930. },
  13931. /**
  13932. * @param {string} topLevelType Record from `EventConstants`.
  13933. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  13934. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  13935. * @param {object} nativeEvent Native browser event.
  13936. * @return {*} An accumulation of synthetic events.
  13937. * @see {EventPluginHub.extractEvents}
  13938. */
  13939. extractEvents: function(
  13940. topLevelType,
  13941. topLevelTarget,
  13942. topLevelTargetID,
  13943. nativeEvent) {
  13944. var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
  13945. if (!dispatchConfig) {
  13946. return null;
  13947. }
  13948. var EventConstructor;
  13949. switch (topLevelType) {
  13950. case topLevelTypes.topInput:
  13951. case topLevelTypes.topLoad:
  13952. case topLevelTypes.topError:
  13953. case topLevelTypes.topReset:
  13954. case topLevelTypes.topSubmit:
  13955. // HTML Events
  13956. // @see http://www.w3.org/TR/html5/index.html#events-0
  13957. EventConstructor = SyntheticEvent;
  13958. break;
  13959. case topLevelTypes.topKeyPress:
  13960. // FireFox creates a keypress event for function keys too. This removes
  13961. // the unwanted keypress events. Enter is however both printable and
  13962. // non-printable. One would expect Tab to be as well (but it isn't).
  13963. if (getEventCharCode(nativeEvent) === 0) {
  13964. return null;
  13965. }
  13966. /* falls through */
  13967. case topLevelTypes.topKeyDown:
  13968. case topLevelTypes.topKeyUp:
  13969. EventConstructor = SyntheticKeyboardEvent;
  13970. break;
  13971. case topLevelTypes.topBlur:
  13972. case topLevelTypes.topFocus:
  13973. EventConstructor = SyntheticFocusEvent;
  13974. break;
  13975. case topLevelTypes.topClick:
  13976. // Firefox creates a click event on right mouse clicks. This removes the
  13977. // unwanted click events.
  13978. if (nativeEvent.button === 2) {
  13979. return null;
  13980. }
  13981. /* falls through */
  13982. case topLevelTypes.topContextMenu:
  13983. case topLevelTypes.topDoubleClick:
  13984. case topLevelTypes.topMouseDown:
  13985. case topLevelTypes.topMouseMove:
  13986. case topLevelTypes.topMouseOut:
  13987. case topLevelTypes.topMouseOver:
  13988. case topLevelTypes.topMouseUp:
  13989. EventConstructor = SyntheticMouseEvent;
  13990. break;
  13991. case topLevelTypes.topDrag:
  13992. case topLevelTypes.topDragEnd:
  13993. case topLevelTypes.topDragEnter:
  13994. case topLevelTypes.topDragExit:
  13995. case topLevelTypes.topDragLeave:
  13996. case topLevelTypes.topDragOver:
  13997. case topLevelTypes.topDragStart:
  13998. case topLevelTypes.topDrop:
  13999. EventConstructor = SyntheticDragEvent;
  14000. break;
  14001. case topLevelTypes.topTouchCancel:
  14002. case topLevelTypes.topTouchEnd:
  14003. case topLevelTypes.topTouchMove:
  14004. case topLevelTypes.topTouchStart:
  14005. EventConstructor = SyntheticTouchEvent;
  14006. break;
  14007. case topLevelTypes.topScroll:
  14008. EventConstructor = SyntheticUIEvent;
  14009. break;
  14010. case topLevelTypes.topWheel:
  14011. EventConstructor = SyntheticWheelEvent;
  14012. break;
  14013. case topLevelTypes.topCopy:
  14014. case topLevelTypes.topCut:
  14015. case topLevelTypes.topPaste:
  14016. EventConstructor = SyntheticClipboardEvent;
  14017. break;
  14018. }
  14019. ("production" !== "development" ? invariant(
  14020. EventConstructor,
  14021. 'SimpleEventPlugin: Unhandled event type, `%s`.',
  14022. topLevelType
  14023. ) : invariant(EventConstructor));
  14024. var event = EventConstructor.getPooled(
  14025. dispatchConfig,
  14026. topLevelTargetID,
  14027. nativeEvent
  14028. );
  14029. EventPropagators.accumulateTwoPhaseDispatches(event);
  14030. return event;
  14031. }
  14032. };
  14033. module.exports = SimpleEventPlugin;
  14034. },{"100":100,"101":101,"102":102,"122":122,"135":135,"141":141,"15":15,"154":154,"19":19,"20":20,"92":92,"94":94,"95":95,"96":96,"98":98,"99":99}],92:[function(_dereq_,module,exports){
  14035. /**
  14036. * Copyright 2013-2015, Facebook, Inc.
  14037. * All rights reserved.
  14038. *
  14039. * This source code is licensed under the BSD-style license found in the
  14040. * LICENSE file in the root directory of this source tree. An additional grant
  14041. * of patent rights can be found in the PATENTS file in the same directory.
  14042. *
  14043. * @providesModule SyntheticClipboardEvent
  14044. * @typechecks static-only
  14045. */
  14046. 'use strict';
  14047. var SyntheticEvent = _dereq_(95);
  14048. /**
  14049. * @interface Event
  14050. * @see http://www.w3.org/TR/clipboard-apis/
  14051. */
  14052. var ClipboardEventInterface = {
  14053. clipboardData: function(event) {
  14054. return (
  14055. 'clipboardData' in event ?
  14056. event.clipboardData :
  14057. window.clipboardData
  14058. );
  14059. }
  14060. };
  14061. /**
  14062. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14063. * @param {string} dispatchMarker Marker identifying the event target.
  14064. * @param {object} nativeEvent Native browser event.
  14065. * @extends {SyntheticUIEvent}
  14066. */
  14067. function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14068. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14069. }
  14070. SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
  14071. module.exports = SyntheticClipboardEvent;
  14072. },{"95":95}],93:[function(_dereq_,module,exports){
  14073. /**
  14074. * Copyright 2013-2015, Facebook, Inc.
  14075. * All rights reserved.
  14076. *
  14077. * This source code is licensed under the BSD-style license found in the
  14078. * LICENSE file in the root directory of this source tree. An additional grant
  14079. * of patent rights can be found in the PATENTS file in the same directory.
  14080. *
  14081. * @providesModule SyntheticCompositionEvent
  14082. * @typechecks static-only
  14083. */
  14084. 'use strict';
  14085. var SyntheticEvent = _dereq_(95);
  14086. /**
  14087. * @interface Event
  14088. * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
  14089. */
  14090. var CompositionEventInterface = {
  14091. data: null
  14092. };
  14093. /**
  14094. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14095. * @param {string} dispatchMarker Marker identifying the event target.
  14096. * @param {object} nativeEvent Native browser event.
  14097. * @extends {SyntheticUIEvent}
  14098. */
  14099. function SyntheticCompositionEvent(
  14100. dispatchConfig,
  14101. dispatchMarker,
  14102. nativeEvent) {
  14103. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14104. }
  14105. SyntheticEvent.augmentClass(
  14106. SyntheticCompositionEvent,
  14107. CompositionEventInterface
  14108. );
  14109. module.exports = SyntheticCompositionEvent;
  14110. },{"95":95}],94:[function(_dereq_,module,exports){
  14111. /**
  14112. * Copyright 2013-2015, Facebook, Inc.
  14113. * All rights reserved.
  14114. *
  14115. * This source code is licensed under the BSD-style license found in the
  14116. * LICENSE file in the root directory of this source tree. An additional grant
  14117. * of patent rights can be found in the PATENTS file in the same directory.
  14118. *
  14119. * @providesModule SyntheticDragEvent
  14120. * @typechecks static-only
  14121. */
  14122. 'use strict';
  14123. var SyntheticMouseEvent = _dereq_(99);
  14124. /**
  14125. * @interface DragEvent
  14126. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14127. */
  14128. var DragEventInterface = {
  14129. dataTransfer: null
  14130. };
  14131. /**
  14132. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14133. * @param {string} dispatchMarker Marker identifying the event target.
  14134. * @param {object} nativeEvent Native browser event.
  14135. * @extends {SyntheticUIEvent}
  14136. */
  14137. function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14138. SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14139. }
  14140. SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
  14141. module.exports = SyntheticDragEvent;
  14142. },{"99":99}],95:[function(_dereq_,module,exports){
  14143. /**
  14144. * Copyright 2013-2015, Facebook, Inc.
  14145. * All rights reserved.
  14146. *
  14147. * This source code is licensed under the BSD-style license found in the
  14148. * LICENSE file in the root directory of this source tree. An additional grant
  14149. * of patent rights can be found in the PATENTS file in the same directory.
  14150. *
  14151. * @providesModule SyntheticEvent
  14152. * @typechecks static-only
  14153. */
  14154. 'use strict';
  14155. var PooledClass = _dereq_(28);
  14156. var assign = _dereq_(27);
  14157. var emptyFunction = _dereq_(114);
  14158. var getEventTarget = _dereq_(125);
  14159. /**
  14160. * @interface Event
  14161. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14162. */
  14163. var EventInterface = {
  14164. type: null,
  14165. target: getEventTarget,
  14166. // currentTarget is set when dispatching; no use in copying it here
  14167. currentTarget: emptyFunction.thatReturnsNull,
  14168. eventPhase: null,
  14169. bubbles: null,
  14170. cancelable: null,
  14171. timeStamp: function(event) {
  14172. return event.timeStamp || Date.now();
  14173. },
  14174. defaultPrevented: null,
  14175. isTrusted: null
  14176. };
  14177. /**
  14178. * Synthetic events are dispatched by event plugins, typically in response to a
  14179. * top-level event delegation handler.
  14180. *
  14181. * These systems should generally use pooling to reduce the frequency of garbage
  14182. * collection. The system should check `isPersistent` to determine whether the
  14183. * event should be released into the pool after being dispatched. Users that
  14184. * need a persisted event should invoke `persist`.
  14185. *
  14186. * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
  14187. * normalizing browser quirks. Subclasses do not necessarily have to implement a
  14188. * DOM interface; custom application-specific events can also subclass this.
  14189. *
  14190. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14191. * @param {string} dispatchMarker Marker identifying the event target.
  14192. * @param {object} nativeEvent Native browser event.
  14193. */
  14194. function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14195. this.dispatchConfig = dispatchConfig;
  14196. this.dispatchMarker = dispatchMarker;
  14197. this.nativeEvent = nativeEvent;
  14198. var Interface = this.constructor.Interface;
  14199. for (var propName in Interface) {
  14200. if (!Interface.hasOwnProperty(propName)) {
  14201. continue;
  14202. }
  14203. var normalize = Interface[propName];
  14204. if (normalize) {
  14205. this[propName] = normalize(nativeEvent);
  14206. } else {
  14207. this[propName] = nativeEvent[propName];
  14208. }
  14209. }
  14210. var defaultPrevented = nativeEvent.defaultPrevented != null ?
  14211. nativeEvent.defaultPrevented :
  14212. nativeEvent.returnValue === false;
  14213. if (defaultPrevented) {
  14214. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  14215. } else {
  14216. this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
  14217. }
  14218. this.isPropagationStopped = emptyFunction.thatReturnsFalse;
  14219. }
  14220. assign(SyntheticEvent.prototype, {
  14221. preventDefault: function() {
  14222. this.defaultPrevented = true;
  14223. var event = this.nativeEvent;
  14224. if (event.preventDefault) {
  14225. event.preventDefault();
  14226. } else {
  14227. event.returnValue = false;
  14228. }
  14229. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  14230. },
  14231. stopPropagation: function() {
  14232. var event = this.nativeEvent;
  14233. if (event.stopPropagation) {
  14234. event.stopPropagation();
  14235. } else {
  14236. event.cancelBubble = true;
  14237. }
  14238. this.isPropagationStopped = emptyFunction.thatReturnsTrue;
  14239. },
  14240. /**
  14241. * We release all dispatched `SyntheticEvent`s after each event loop, adding
  14242. * them back into the pool. This allows a way to hold onto a reference that
  14243. * won't be added back into the pool.
  14244. */
  14245. persist: function() {
  14246. this.isPersistent = emptyFunction.thatReturnsTrue;
  14247. },
  14248. /**
  14249. * Checks if this event should be released back into the pool.
  14250. *
  14251. * @return {boolean} True if this should not be released, false otherwise.
  14252. */
  14253. isPersistent: emptyFunction.thatReturnsFalse,
  14254. /**
  14255. * `PooledClass` looks for `destructor` on each instance it releases.
  14256. */
  14257. destructor: function() {
  14258. var Interface = this.constructor.Interface;
  14259. for (var propName in Interface) {
  14260. this[propName] = null;
  14261. }
  14262. this.dispatchConfig = null;
  14263. this.dispatchMarker = null;
  14264. this.nativeEvent = null;
  14265. }
  14266. });
  14267. SyntheticEvent.Interface = EventInterface;
  14268. /**
  14269. * Helper to reduce boilerplate when creating subclasses.
  14270. *
  14271. * @param {function} Class
  14272. * @param {?object} Interface
  14273. */
  14274. SyntheticEvent.augmentClass = function(Class, Interface) {
  14275. var Super = this;
  14276. var prototype = Object.create(Super.prototype);
  14277. assign(prototype, Class.prototype);
  14278. Class.prototype = prototype;
  14279. Class.prototype.constructor = Class;
  14280. Class.Interface = assign({}, Super.Interface, Interface);
  14281. Class.augmentClass = Super.augmentClass;
  14282. PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler);
  14283. };
  14284. PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler);
  14285. module.exports = SyntheticEvent;
  14286. },{"114":114,"125":125,"27":27,"28":28}],96:[function(_dereq_,module,exports){
  14287. /**
  14288. * Copyright 2013-2015, Facebook, Inc.
  14289. * All rights reserved.
  14290. *
  14291. * This source code is licensed under the BSD-style license found in the
  14292. * LICENSE file in the root directory of this source tree. An additional grant
  14293. * of patent rights can be found in the PATENTS file in the same directory.
  14294. *
  14295. * @providesModule SyntheticFocusEvent
  14296. * @typechecks static-only
  14297. */
  14298. 'use strict';
  14299. var SyntheticUIEvent = _dereq_(101);
  14300. /**
  14301. * @interface FocusEvent
  14302. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14303. */
  14304. var FocusEventInterface = {
  14305. relatedTarget: null
  14306. };
  14307. /**
  14308. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14309. * @param {string} dispatchMarker Marker identifying the event target.
  14310. * @param {object} nativeEvent Native browser event.
  14311. * @extends {SyntheticUIEvent}
  14312. */
  14313. function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14314. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14315. }
  14316. SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
  14317. module.exports = SyntheticFocusEvent;
  14318. },{"101":101}],97:[function(_dereq_,module,exports){
  14319. /**
  14320. * Copyright 2013-2015, Facebook, Inc.
  14321. * All rights reserved.
  14322. *
  14323. * This source code is licensed under the BSD-style license found in the
  14324. * LICENSE file in the root directory of this source tree. An additional grant
  14325. * of patent rights can be found in the PATENTS file in the same directory.
  14326. *
  14327. * @providesModule SyntheticInputEvent
  14328. * @typechecks static-only
  14329. */
  14330. 'use strict';
  14331. var SyntheticEvent = _dereq_(95);
  14332. /**
  14333. * @interface Event
  14334. * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
  14335. * /#events-inputevents
  14336. */
  14337. var InputEventInterface = {
  14338. data: null
  14339. };
  14340. /**
  14341. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14342. * @param {string} dispatchMarker Marker identifying the event target.
  14343. * @param {object} nativeEvent Native browser event.
  14344. * @extends {SyntheticUIEvent}
  14345. */
  14346. function SyntheticInputEvent(
  14347. dispatchConfig,
  14348. dispatchMarker,
  14349. nativeEvent) {
  14350. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14351. }
  14352. SyntheticEvent.augmentClass(
  14353. SyntheticInputEvent,
  14354. InputEventInterface
  14355. );
  14356. module.exports = SyntheticInputEvent;
  14357. },{"95":95}],98:[function(_dereq_,module,exports){
  14358. /**
  14359. * Copyright 2013-2015, Facebook, Inc.
  14360. * All rights reserved.
  14361. *
  14362. * This source code is licensed under the BSD-style license found in the
  14363. * LICENSE file in the root directory of this source tree. An additional grant
  14364. * of patent rights can be found in the PATENTS file in the same directory.
  14365. *
  14366. * @providesModule SyntheticKeyboardEvent
  14367. * @typechecks static-only
  14368. */
  14369. 'use strict';
  14370. var SyntheticUIEvent = _dereq_(101);
  14371. var getEventCharCode = _dereq_(122);
  14372. var getEventKey = _dereq_(123);
  14373. var getEventModifierState = _dereq_(124);
  14374. /**
  14375. * @interface KeyboardEvent
  14376. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14377. */
  14378. var KeyboardEventInterface = {
  14379. key: getEventKey,
  14380. location: null,
  14381. ctrlKey: null,
  14382. shiftKey: null,
  14383. altKey: null,
  14384. metaKey: null,
  14385. repeat: null,
  14386. locale: null,
  14387. getModifierState: getEventModifierState,
  14388. // Legacy Interface
  14389. charCode: function(event) {
  14390. // `charCode` is the result of a KeyPress event and represents the value of
  14391. // the actual printable character.
  14392. // KeyPress is deprecated, but its replacement is not yet final and not
  14393. // implemented in any major browser. Only KeyPress has charCode.
  14394. if (event.type === 'keypress') {
  14395. return getEventCharCode(event);
  14396. }
  14397. return 0;
  14398. },
  14399. keyCode: function(event) {
  14400. // `keyCode` is the result of a KeyDown/Up event and represents the value of
  14401. // physical keyboard key.
  14402. // The actual meaning of the value depends on the users' keyboard layout
  14403. // which cannot be detected. Assuming that it is a US keyboard layout
  14404. // provides a surprisingly accurate mapping for US and European users.
  14405. // Due to this, it is left to the user to implement at this time.
  14406. if (event.type === 'keydown' || event.type === 'keyup') {
  14407. return event.keyCode;
  14408. }
  14409. return 0;
  14410. },
  14411. which: function(event) {
  14412. // `which` is an alias for either `keyCode` or `charCode` depending on the
  14413. // type of the event.
  14414. if (event.type === 'keypress') {
  14415. return getEventCharCode(event);
  14416. }
  14417. if (event.type === 'keydown' || event.type === 'keyup') {
  14418. return event.keyCode;
  14419. }
  14420. return 0;
  14421. }
  14422. };
  14423. /**
  14424. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14425. * @param {string} dispatchMarker Marker identifying the event target.
  14426. * @param {object} nativeEvent Native browser event.
  14427. * @extends {SyntheticUIEvent}
  14428. */
  14429. function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14430. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14431. }
  14432. SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
  14433. module.exports = SyntheticKeyboardEvent;
  14434. },{"101":101,"122":122,"123":123,"124":124}],99:[function(_dereq_,module,exports){
  14435. /**
  14436. * Copyright 2013-2015, Facebook, Inc.
  14437. * All rights reserved.
  14438. *
  14439. * This source code is licensed under the BSD-style license found in the
  14440. * LICENSE file in the root directory of this source tree. An additional grant
  14441. * of patent rights can be found in the PATENTS file in the same directory.
  14442. *
  14443. * @providesModule SyntheticMouseEvent
  14444. * @typechecks static-only
  14445. */
  14446. 'use strict';
  14447. var SyntheticUIEvent = _dereq_(101);
  14448. var ViewportMetrics = _dereq_(104);
  14449. var getEventModifierState = _dereq_(124);
  14450. /**
  14451. * @interface MouseEvent
  14452. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14453. */
  14454. var MouseEventInterface = {
  14455. screenX: null,
  14456. screenY: null,
  14457. clientX: null,
  14458. clientY: null,
  14459. ctrlKey: null,
  14460. shiftKey: null,
  14461. altKey: null,
  14462. metaKey: null,
  14463. getModifierState: getEventModifierState,
  14464. button: function(event) {
  14465. // Webkit, Firefox, IE9+
  14466. // which: 1 2 3
  14467. // button: 0 1 2 (standard)
  14468. var button = event.button;
  14469. if ('which' in event) {
  14470. return button;
  14471. }
  14472. // IE<9
  14473. // which: undefined
  14474. // button: 0 0 0
  14475. // button: 1 4 2 (onmouseup)
  14476. return button === 2 ? 2 : button === 4 ? 1 : 0;
  14477. },
  14478. buttons: null,
  14479. relatedTarget: function(event) {
  14480. return event.relatedTarget || (
  14481. ((event.fromElement === event.srcElement ? event.toElement : event.fromElement))
  14482. );
  14483. },
  14484. // "Proprietary" Interface.
  14485. pageX: function(event) {
  14486. return 'pageX' in event ?
  14487. event.pageX :
  14488. event.clientX + ViewportMetrics.currentScrollLeft;
  14489. },
  14490. pageY: function(event) {
  14491. return 'pageY' in event ?
  14492. event.pageY :
  14493. event.clientY + ViewportMetrics.currentScrollTop;
  14494. }
  14495. };
  14496. /**
  14497. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14498. * @param {string} dispatchMarker Marker identifying the event target.
  14499. * @param {object} nativeEvent Native browser event.
  14500. * @extends {SyntheticUIEvent}
  14501. */
  14502. function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14503. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14504. }
  14505. SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
  14506. module.exports = SyntheticMouseEvent;
  14507. },{"101":101,"104":104,"124":124}],100:[function(_dereq_,module,exports){
  14508. /**
  14509. * Copyright 2013-2015, Facebook, Inc.
  14510. * All rights reserved.
  14511. *
  14512. * This source code is licensed under the BSD-style license found in the
  14513. * LICENSE file in the root directory of this source tree. An additional grant
  14514. * of patent rights can be found in the PATENTS file in the same directory.
  14515. *
  14516. * @providesModule SyntheticTouchEvent
  14517. * @typechecks static-only
  14518. */
  14519. 'use strict';
  14520. var SyntheticUIEvent = _dereq_(101);
  14521. var getEventModifierState = _dereq_(124);
  14522. /**
  14523. * @interface TouchEvent
  14524. * @see http://www.w3.org/TR/touch-events/
  14525. */
  14526. var TouchEventInterface = {
  14527. touches: null,
  14528. targetTouches: null,
  14529. changedTouches: null,
  14530. altKey: null,
  14531. metaKey: null,
  14532. ctrlKey: null,
  14533. shiftKey: null,
  14534. getModifierState: getEventModifierState
  14535. };
  14536. /**
  14537. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14538. * @param {string} dispatchMarker Marker identifying the event target.
  14539. * @param {object} nativeEvent Native browser event.
  14540. * @extends {SyntheticUIEvent}
  14541. */
  14542. function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14543. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14544. }
  14545. SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
  14546. module.exports = SyntheticTouchEvent;
  14547. },{"101":101,"124":124}],101:[function(_dereq_,module,exports){
  14548. /**
  14549. * Copyright 2013-2015, Facebook, Inc.
  14550. * All rights reserved.
  14551. *
  14552. * This source code is licensed under the BSD-style license found in the
  14553. * LICENSE file in the root directory of this source tree. An additional grant
  14554. * of patent rights can be found in the PATENTS file in the same directory.
  14555. *
  14556. * @providesModule SyntheticUIEvent
  14557. * @typechecks static-only
  14558. */
  14559. 'use strict';
  14560. var SyntheticEvent = _dereq_(95);
  14561. var getEventTarget = _dereq_(125);
  14562. /**
  14563. * @interface UIEvent
  14564. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14565. */
  14566. var UIEventInterface = {
  14567. view: function(event) {
  14568. if (event.view) {
  14569. return event.view;
  14570. }
  14571. var target = getEventTarget(event);
  14572. if (target != null && target.window === target) {
  14573. // target is a window object
  14574. return target;
  14575. }
  14576. var doc = target.ownerDocument;
  14577. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  14578. if (doc) {
  14579. return doc.defaultView || doc.parentWindow;
  14580. } else {
  14581. return window;
  14582. }
  14583. },
  14584. detail: function(event) {
  14585. return event.detail || 0;
  14586. }
  14587. };
  14588. /**
  14589. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14590. * @param {string} dispatchMarker Marker identifying the event target.
  14591. * @param {object} nativeEvent Native browser event.
  14592. * @extends {SyntheticEvent}
  14593. */
  14594. function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14595. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14596. }
  14597. SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
  14598. module.exports = SyntheticUIEvent;
  14599. },{"125":125,"95":95}],102:[function(_dereq_,module,exports){
  14600. /**
  14601. * Copyright 2013-2015, Facebook, Inc.
  14602. * All rights reserved.
  14603. *
  14604. * This source code is licensed under the BSD-style license found in the
  14605. * LICENSE file in the root directory of this source tree. An additional grant
  14606. * of patent rights can be found in the PATENTS file in the same directory.
  14607. *
  14608. * @providesModule SyntheticWheelEvent
  14609. * @typechecks static-only
  14610. */
  14611. 'use strict';
  14612. var SyntheticMouseEvent = _dereq_(99);
  14613. /**
  14614. * @interface WheelEvent
  14615. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14616. */
  14617. var WheelEventInterface = {
  14618. deltaX: function(event) {
  14619. return (
  14620. 'deltaX' in event ? event.deltaX :
  14621. // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
  14622. 'wheelDeltaX' in event ? -event.wheelDeltaX : 0
  14623. );
  14624. },
  14625. deltaY: function(event) {
  14626. return (
  14627. 'deltaY' in event ? event.deltaY :
  14628. // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
  14629. 'wheelDeltaY' in event ? -event.wheelDeltaY :
  14630. // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
  14631. 'wheelDelta' in event ? -event.wheelDelta : 0
  14632. );
  14633. },
  14634. deltaZ: null,
  14635. // Browsers without "deltaMode" is reporting in raw wheel delta where one
  14636. // notch on the scroll is always +/- 120, roughly equivalent to pixels.
  14637. // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
  14638. // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
  14639. deltaMode: null
  14640. };
  14641. /**
  14642. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14643. * @param {string} dispatchMarker Marker identifying the event target.
  14644. * @param {object} nativeEvent Native browser event.
  14645. * @extends {SyntheticMouseEvent}
  14646. */
  14647. function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14648. SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14649. }
  14650. SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
  14651. module.exports = SyntheticWheelEvent;
  14652. },{"99":99}],103:[function(_dereq_,module,exports){
  14653. /**
  14654. * Copyright 2013-2015, Facebook, Inc.
  14655. * All rights reserved.
  14656. *
  14657. * This source code is licensed under the BSD-style license found in the
  14658. * LICENSE file in the root directory of this source tree. An additional grant
  14659. * of patent rights can be found in the PATENTS file in the same directory.
  14660. *
  14661. * @providesModule Transaction
  14662. */
  14663. 'use strict';
  14664. var invariant = _dereq_(135);
  14665. /**
  14666. * `Transaction` creates a black box that is able to wrap any method such that
  14667. * certain invariants are maintained before and after the method is invoked
  14668. * (Even if an exception is thrown while invoking the wrapped method). Whoever
  14669. * instantiates a transaction can provide enforcers of the invariants at
  14670. * creation time. The `Transaction` class itself will supply one additional
  14671. * automatic invariant for you - the invariant that any transaction instance
  14672. * should not be run while it is already being run. You would typically create a
  14673. * single instance of a `Transaction` for reuse multiple times, that potentially
  14674. * is used to wrap several different methods. Wrappers are extremely simple -
  14675. * they only require implementing two methods.
  14676. *
  14677. * <pre>
  14678. * wrappers (injected at creation time)
  14679. * + +
  14680. * | |
  14681. * +-----------------|--------|--------------+
  14682. * | v | |
  14683. * | +---------------+ | |
  14684. * | +--| wrapper1 |---|----+ |
  14685. * | | +---------------+ v | |
  14686. * | | +-------------+ | |
  14687. * | | +----| wrapper2 |--------+ |
  14688. * | | | +-------------+ | | |
  14689. * | | | | | |
  14690. * | v v v v | wrapper
  14691. * | +---+ +---+ +---------+ +---+ +---+ | invariants
  14692. * perform(anyMethod) | | | | | | | | | | | | maintained
  14693. * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
  14694. * | | | | | | | | | | | |
  14695. * | | | | | | | | | | | |
  14696. * | | | | | | | | | | | |
  14697. * | +---+ +---+ +---------+ +---+ +---+ |
  14698. * | initialize close |
  14699. * +-----------------------------------------+
  14700. * </pre>
  14701. *
  14702. * Use cases:
  14703. * - Preserving the input selection ranges before/after reconciliation.
  14704. * Restoring selection even in the event of an unexpected error.
  14705. * - Deactivating events while rearranging the DOM, preventing blurs/focuses,
  14706. * while guaranteeing that afterwards, the event system is reactivated.
  14707. * - Flushing a queue of collected DOM mutations to the main UI thread after a
  14708. * reconciliation takes place in a worker thread.
  14709. * - Invoking any collected `componentDidUpdate` callbacks after rendering new
  14710. * content.
  14711. * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
  14712. * to preserve the `scrollTop` (an automatic scroll aware DOM).
  14713. * - (Future use case): Layout calculations before and after DOM updates.
  14714. *
  14715. * Transactional plugin API:
  14716. * - A module that has an `initialize` method that returns any precomputation.
  14717. * - and a `close` method that accepts the precomputation. `close` is invoked
  14718. * when the wrapped process is completed, or has failed.
  14719. *
  14720. * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
  14721. * that implement `initialize` and `close`.
  14722. * @return {Transaction} Single transaction for reuse in thread.
  14723. *
  14724. * @class Transaction
  14725. */
  14726. var Mixin = {
  14727. /**
  14728. * Sets up this instance so that it is prepared for collecting metrics. Does
  14729. * so such that this setup method may be used on an instance that is already
  14730. * initialized, in a way that does not consume additional memory upon reuse.
  14731. * That can be useful if you decide to make your subclass of this mixin a
  14732. * "PooledClass".
  14733. */
  14734. reinitializeTransaction: function() {
  14735. this.transactionWrappers = this.getTransactionWrappers();
  14736. if (!this.wrapperInitData) {
  14737. this.wrapperInitData = [];
  14738. } else {
  14739. this.wrapperInitData.length = 0;
  14740. }
  14741. this._isInTransaction = false;
  14742. },
  14743. _isInTransaction: false,
  14744. /**
  14745. * @abstract
  14746. * @return {Array<TransactionWrapper>} Array of transaction wrappers.
  14747. */
  14748. getTransactionWrappers: null,
  14749. isInTransaction: function() {
  14750. return !!this._isInTransaction;
  14751. },
  14752. /**
  14753. * Executes the function within a safety window. Use this for the top level
  14754. * methods that result in large amounts of computation/mutations that would
  14755. * need to be safety checked.
  14756. *
  14757. * @param {function} method Member of scope to call.
  14758. * @param {Object} scope Scope to invoke from.
  14759. * @param {Object?=} args... Arguments to pass to the method (optional).
  14760. * Helps prevent need to bind in many cases.
  14761. * @return Return value from `method`.
  14762. */
  14763. perform: function(method, scope, a, b, c, d, e, f) {
  14764. ("production" !== "development" ? invariant(
  14765. !this.isInTransaction(),
  14766. 'Transaction.perform(...): Cannot initialize a transaction when there ' +
  14767. 'is already an outstanding transaction.'
  14768. ) : invariant(!this.isInTransaction()));
  14769. var errorThrown;
  14770. var ret;
  14771. try {
  14772. this._isInTransaction = true;
  14773. // Catching errors makes debugging more difficult, so we start with
  14774. // errorThrown set to true before setting it to false after calling
  14775. // close -- if it's still set to true in the finally block, it means
  14776. // one of these calls threw.
  14777. errorThrown = true;
  14778. this.initializeAll(0);
  14779. ret = method.call(scope, a, b, c, d, e, f);
  14780. errorThrown = false;
  14781. } finally {
  14782. try {
  14783. if (errorThrown) {
  14784. // If `method` throws, prefer to show that stack trace over any thrown
  14785. // by invoking `closeAll`.
  14786. try {
  14787. this.closeAll(0);
  14788. } catch (err) {
  14789. }
  14790. } else {
  14791. // Since `method` didn't throw, we don't want to silence the exception
  14792. // here.
  14793. this.closeAll(0);
  14794. }
  14795. } finally {
  14796. this._isInTransaction = false;
  14797. }
  14798. }
  14799. return ret;
  14800. },
  14801. initializeAll: function(startIndex) {
  14802. var transactionWrappers = this.transactionWrappers;
  14803. for (var i = startIndex; i < transactionWrappers.length; i++) {
  14804. var wrapper = transactionWrappers[i];
  14805. try {
  14806. // Catching errors makes debugging more difficult, so we start with the
  14807. // OBSERVED_ERROR state before overwriting it with the real return value
  14808. // of initialize -- if it's still set to OBSERVED_ERROR in the finally
  14809. // block, it means wrapper.initialize threw.
  14810. this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
  14811. this.wrapperInitData[i] = wrapper.initialize ?
  14812. wrapper.initialize.call(this) :
  14813. null;
  14814. } finally {
  14815. if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
  14816. // The initializer for wrapper i threw an error; initialize the
  14817. // remaining wrappers but silence any exceptions from them to ensure
  14818. // that the first error is the one to bubble up.
  14819. try {
  14820. this.initializeAll(i + 1);
  14821. } catch (err) {
  14822. }
  14823. }
  14824. }
  14825. }
  14826. },
  14827. /**
  14828. * Invokes each of `this.transactionWrappers.close[i]` functions, passing into
  14829. * them the respective return values of `this.transactionWrappers.init[i]`
  14830. * (`close`rs that correspond to initializers that failed will not be
  14831. * invoked).
  14832. */
  14833. closeAll: function(startIndex) {
  14834. ("production" !== "development" ? invariant(
  14835. this.isInTransaction(),
  14836. 'Transaction.closeAll(): Cannot close transaction when none are open.'
  14837. ) : invariant(this.isInTransaction()));
  14838. var transactionWrappers = this.transactionWrappers;
  14839. for (var i = startIndex; i < transactionWrappers.length; i++) {
  14840. var wrapper = transactionWrappers[i];
  14841. var initData = this.wrapperInitData[i];
  14842. var errorThrown;
  14843. try {
  14844. // Catching errors makes debugging more difficult, so we start with
  14845. // errorThrown set to true before setting it to false after calling
  14846. // close -- if it's still set to true in the finally block, it means
  14847. // wrapper.close threw.
  14848. errorThrown = true;
  14849. if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {
  14850. wrapper.close.call(this, initData);
  14851. }
  14852. errorThrown = false;
  14853. } finally {
  14854. if (errorThrown) {
  14855. // The closer for wrapper i threw an error; close the remaining
  14856. // wrappers but silence any exceptions from them to ensure that the
  14857. // first error is the one to bubble up.
  14858. try {
  14859. this.closeAll(i + 1);
  14860. } catch (e) {
  14861. }
  14862. }
  14863. }
  14864. }
  14865. this.wrapperInitData.length = 0;
  14866. }
  14867. };
  14868. var Transaction = {
  14869. Mixin: Mixin,
  14870. /**
  14871. * Token to look for to determine if an error occured.
  14872. */
  14873. OBSERVED_ERROR: {}
  14874. };
  14875. module.exports = Transaction;
  14876. },{"135":135}],104:[function(_dereq_,module,exports){
  14877. /**
  14878. * Copyright 2013-2015, Facebook, Inc.
  14879. * All rights reserved.
  14880. *
  14881. * This source code is licensed under the BSD-style license found in the
  14882. * LICENSE file in the root directory of this source tree. An additional grant
  14883. * of patent rights can be found in the PATENTS file in the same directory.
  14884. *
  14885. * @providesModule ViewportMetrics
  14886. */
  14887. 'use strict';
  14888. var ViewportMetrics = {
  14889. currentScrollLeft: 0,
  14890. currentScrollTop: 0,
  14891. refreshScrollValues: function(scrollPosition) {
  14892. ViewportMetrics.currentScrollLeft = scrollPosition.x;
  14893. ViewportMetrics.currentScrollTop = scrollPosition.y;
  14894. }
  14895. };
  14896. module.exports = ViewportMetrics;
  14897. },{}],105:[function(_dereq_,module,exports){
  14898. /**
  14899. * Copyright 2014-2015, Facebook, Inc.
  14900. * All rights reserved.
  14901. *
  14902. * This source code is licensed under the BSD-style license found in the
  14903. * LICENSE file in the root directory of this source tree. An additional grant
  14904. * of patent rights can be found in the PATENTS file in the same directory.
  14905. *
  14906. * @providesModule accumulateInto
  14907. */
  14908. 'use strict';
  14909. var invariant = _dereq_(135);
  14910. /**
  14911. *
  14912. * Accumulates items that must not be null or undefined into the first one. This
  14913. * is used to conserve memory by avoiding array allocations, and thus sacrifices
  14914. * API cleanness. Since `current` can be null before being passed in and not
  14915. * null after this function, make sure to assign it back to `current`:
  14916. *
  14917. * `a = accumulateInto(a, b);`
  14918. *
  14919. * This API should be sparingly used. Try `accumulate` for something cleaner.
  14920. *
  14921. * @return {*|array<*>} An accumulation of items.
  14922. */
  14923. function accumulateInto(current, next) {
  14924. ("production" !== "development" ? invariant(
  14925. next != null,
  14926. 'accumulateInto(...): Accumulated items must not be null or undefined.'
  14927. ) : invariant(next != null));
  14928. if (current == null) {
  14929. return next;
  14930. }
  14931. // Both are not empty. Warning: Never call x.concat(y) when you are not
  14932. // certain that x is an Array (x could be a string with concat method).
  14933. var currentIsArray = Array.isArray(current);
  14934. var nextIsArray = Array.isArray(next);
  14935. if (currentIsArray && nextIsArray) {
  14936. current.push.apply(current, next);
  14937. return current;
  14938. }
  14939. if (currentIsArray) {
  14940. current.push(next);
  14941. return current;
  14942. }
  14943. if (nextIsArray) {
  14944. // A bit too dangerous to mutate `next`.
  14945. return [current].concat(next);
  14946. }
  14947. return [current, next];
  14948. }
  14949. module.exports = accumulateInto;
  14950. },{"135":135}],106:[function(_dereq_,module,exports){
  14951. /**
  14952. * Copyright 2013-2015, Facebook, Inc.
  14953. * All rights reserved.
  14954. *
  14955. * This source code is licensed under the BSD-style license found in the
  14956. * LICENSE file in the root directory of this source tree. An additional grant
  14957. * of patent rights can be found in the PATENTS file in the same directory.
  14958. *
  14959. * @providesModule adler32
  14960. */
  14961. /* jslint bitwise:true */
  14962. 'use strict';
  14963. var MOD = 65521;
  14964. // This is a clean-room implementation of adler32 designed for detecting
  14965. // if markup is not what we expect it to be. It does not need to be
  14966. // cryptographically strong, only reasonably good at detecting if markup
  14967. // generated on the server is different than that on the client.
  14968. function adler32(data) {
  14969. var a = 1;
  14970. var b = 0;
  14971. for (var i = 0; i < data.length; i++) {
  14972. a = (a + data.charCodeAt(i)) % MOD;
  14973. b = (b + a) % MOD;
  14974. }
  14975. return a | (b << 16);
  14976. }
  14977. module.exports = adler32;
  14978. },{}],107:[function(_dereq_,module,exports){
  14979. /**
  14980. * Copyright 2013-2015, Facebook, Inc.
  14981. * All rights reserved.
  14982. *
  14983. * This source code is licensed under the BSD-style license found in the
  14984. * LICENSE file in the root directory of this source tree. An additional grant
  14985. * of patent rights can be found in the PATENTS file in the same directory.
  14986. *
  14987. * @providesModule camelize
  14988. * @typechecks
  14989. */
  14990. var _hyphenPattern = /-(.)/g;
  14991. /**
  14992. * Camelcases a hyphenated string, for example:
  14993. *
  14994. * > camelize('background-color')
  14995. * < "backgroundColor"
  14996. *
  14997. * @param {string} string
  14998. * @return {string}
  14999. */
  15000. function camelize(string) {
  15001. return string.replace(_hyphenPattern, function(_, character) {
  15002. return character.toUpperCase();
  15003. });
  15004. }
  15005. module.exports = camelize;
  15006. },{}],108:[function(_dereq_,module,exports){
  15007. /**
  15008. * Copyright 2014-2015, Facebook, Inc.
  15009. * All rights reserved.
  15010. *
  15011. * This source code is licensed under the BSD-style license found in the
  15012. * LICENSE file in the root directory of this source tree. An additional grant
  15013. * of patent rights can be found in the PATENTS file in the same directory.
  15014. *
  15015. * @providesModule camelizeStyleName
  15016. * @typechecks
  15017. */
  15018. "use strict";
  15019. var camelize = _dereq_(107);
  15020. var msPattern = /^-ms-/;
  15021. /**
  15022. * Camelcases a hyphenated CSS property name, for example:
  15023. *
  15024. * > camelizeStyleName('background-color')
  15025. * < "backgroundColor"
  15026. * > camelizeStyleName('-moz-transition')
  15027. * < "MozTransition"
  15028. * > camelizeStyleName('-ms-transition')
  15029. * < "msTransition"
  15030. *
  15031. * As Andi Smith suggests
  15032. * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
  15033. * is converted to lowercase `ms`.
  15034. *
  15035. * @param {string} string
  15036. * @return {string}
  15037. */
  15038. function camelizeStyleName(string) {
  15039. return camelize(string.replace(msPattern, 'ms-'));
  15040. }
  15041. module.exports = camelizeStyleName;
  15042. },{"107":107}],109:[function(_dereq_,module,exports){
  15043. /**
  15044. * Copyright 2013-2015, Facebook, Inc.
  15045. * All rights reserved.
  15046. *
  15047. * This source code is licensed under the BSD-style license found in the
  15048. * LICENSE file in the root directory of this source tree. An additional grant
  15049. * of patent rights can be found in the PATENTS file in the same directory.
  15050. *
  15051. * @providesModule containsNode
  15052. * @typechecks
  15053. */
  15054. var isTextNode = _dereq_(139);
  15055. /*jslint bitwise:true */
  15056. /**
  15057. * Checks if a given DOM node contains or is another DOM node.
  15058. *
  15059. * @param {?DOMNode} outerNode Outer DOM node.
  15060. * @param {?DOMNode} innerNode Inner DOM node.
  15061. * @return {boolean} True if `outerNode` contains or is `innerNode`.
  15062. */
  15063. function containsNode(outerNode, innerNode) {
  15064. if (!outerNode || !innerNode) {
  15065. return false;
  15066. } else if (outerNode === innerNode) {
  15067. return true;
  15068. } else if (isTextNode(outerNode)) {
  15069. return false;
  15070. } else if (isTextNode(innerNode)) {
  15071. return containsNode(outerNode, innerNode.parentNode);
  15072. } else if (outerNode.contains) {
  15073. return outerNode.contains(innerNode);
  15074. } else if (outerNode.compareDocumentPosition) {
  15075. return !!(outerNode.compareDocumentPosition(innerNode) & 16);
  15076. } else {
  15077. return false;
  15078. }
  15079. }
  15080. module.exports = containsNode;
  15081. },{"139":139}],110:[function(_dereq_,module,exports){
  15082. /**
  15083. * Copyright 2013-2015, Facebook, Inc.
  15084. * All rights reserved.
  15085. *
  15086. * This source code is licensed under the BSD-style license found in the
  15087. * LICENSE file in the root directory of this source tree. An additional grant
  15088. * of patent rights can be found in the PATENTS file in the same directory.
  15089. *
  15090. * @providesModule createArrayFromMixed
  15091. * @typechecks
  15092. */
  15093. var toArray = _dereq_(152);
  15094. /**
  15095. * Perform a heuristic test to determine if an object is "array-like".
  15096. *
  15097. * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
  15098. * Joshu replied: "Mu."
  15099. *
  15100. * This function determines if its argument has "array nature": it returns
  15101. * true if the argument is an actual array, an `arguments' object, or an
  15102. * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
  15103. *
  15104. * It will return false for other array-like objects like Filelist.
  15105. *
  15106. * @param {*} obj
  15107. * @return {boolean}
  15108. */
  15109. function hasArrayNature(obj) {
  15110. return (
  15111. // not null/false
  15112. !!obj &&
  15113. // arrays are objects, NodeLists are functions in Safari
  15114. (typeof obj == 'object' || typeof obj == 'function') &&
  15115. // quacks like an array
  15116. ('length' in obj) &&
  15117. // not window
  15118. !('setInterval' in obj) &&
  15119. // no DOM node should be considered an array-like
  15120. // a 'select' element has 'length' and 'item' properties on IE8
  15121. (typeof obj.nodeType != 'number') &&
  15122. (
  15123. // a real array
  15124. (// HTMLCollection/NodeList
  15125. (Array.isArray(obj) ||
  15126. // arguments
  15127. ('callee' in obj) || 'item' in obj))
  15128. )
  15129. );
  15130. }
  15131. /**
  15132. * Ensure that the argument is an array by wrapping it in an array if it is not.
  15133. * Creates a copy of the argument if it is already an array.
  15134. *
  15135. * This is mostly useful idiomatically:
  15136. *
  15137. * var createArrayFromMixed = require('createArrayFromMixed');
  15138. *
  15139. * function takesOneOrMoreThings(things) {
  15140. * things = createArrayFromMixed(things);
  15141. * ...
  15142. * }
  15143. *
  15144. * This allows you to treat `things' as an array, but accept scalars in the API.
  15145. *
  15146. * If you need to convert an array-like object, like `arguments`, into an array
  15147. * use toArray instead.
  15148. *
  15149. * @param {*} obj
  15150. * @return {array}
  15151. */
  15152. function createArrayFromMixed(obj) {
  15153. if (!hasArrayNature(obj)) {
  15154. return [obj];
  15155. } else if (Array.isArray(obj)) {
  15156. return obj.slice();
  15157. } else {
  15158. return toArray(obj);
  15159. }
  15160. }
  15161. module.exports = createArrayFromMixed;
  15162. },{"152":152}],111:[function(_dereq_,module,exports){
  15163. /**
  15164. * Copyright 2013-2015, Facebook, Inc.
  15165. * All rights reserved.
  15166. *
  15167. * This source code is licensed under the BSD-style license found in the
  15168. * LICENSE file in the root directory of this source tree. An additional grant
  15169. * of patent rights can be found in the PATENTS file in the same directory.
  15170. *
  15171. * @providesModule createFullPageComponent
  15172. * @typechecks
  15173. */
  15174. 'use strict';
  15175. // Defeat circular references by requiring this directly.
  15176. var ReactClass = _dereq_(33);
  15177. var ReactElement = _dereq_(57);
  15178. var invariant = _dereq_(135);
  15179. /**
  15180. * Create a component that will throw an exception when unmounted.
  15181. *
  15182. * Components like <html> <head> and <body> can't be removed or added
  15183. * easily in a cross-browser way, however it's valuable to be able to
  15184. * take advantage of React's reconciliation for styling and <title>
  15185. * management. So we just document it and throw in dangerous cases.
  15186. *
  15187. * @param {string} tag The tag to wrap
  15188. * @return {function} convenience constructor of new component
  15189. */
  15190. function createFullPageComponent(tag) {
  15191. var elementFactory = ReactElement.createFactory(tag);
  15192. var FullPageComponent = ReactClass.createClass({
  15193. tagName: tag.toUpperCase(),
  15194. displayName: 'ReactFullPageComponent' + tag,
  15195. componentWillUnmount: function() {
  15196. ("production" !== "development" ? invariant(
  15197. false,
  15198. '%s tried to unmount. Because of cross-browser quirks it is ' +
  15199. 'impossible to unmount some top-level components (eg <html>, <head>, ' +
  15200. 'and <body>) reliably and efficiently. To fix this, have a single ' +
  15201. 'top-level component that never unmounts render these elements.',
  15202. this.constructor.displayName
  15203. ) : invariant(false));
  15204. },
  15205. render: function() {
  15206. return elementFactory(this.props);
  15207. }
  15208. });
  15209. return FullPageComponent;
  15210. }
  15211. module.exports = createFullPageComponent;
  15212. },{"135":135,"33":33,"57":57}],112:[function(_dereq_,module,exports){
  15213. /**
  15214. * Copyright 2013-2015, Facebook, Inc.
  15215. * All rights reserved.
  15216. *
  15217. * This source code is licensed under the BSD-style license found in the
  15218. * LICENSE file in the root directory of this source tree. An additional grant
  15219. * of patent rights can be found in the PATENTS file in the same directory.
  15220. *
  15221. * @providesModule createNodesFromMarkup
  15222. * @typechecks
  15223. */
  15224. /*jslint evil: true, sub: true */
  15225. var ExecutionEnvironment = _dereq_(21);
  15226. var createArrayFromMixed = _dereq_(110);
  15227. var getMarkupWrap = _dereq_(127);
  15228. var invariant = _dereq_(135);
  15229. /**
  15230. * Dummy container used to render all markup.
  15231. */
  15232. var dummyNode =
  15233. ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  15234. /**
  15235. * Pattern used by `getNodeName`.
  15236. */
  15237. var nodeNamePattern = /^\s*<(\w+)/;
  15238. /**
  15239. * Extracts the `nodeName` of the first element in a string of markup.
  15240. *
  15241. * @param {string} markup String of markup.
  15242. * @return {?string} Node name of the supplied markup.
  15243. */
  15244. function getNodeName(markup) {
  15245. var nodeNameMatch = markup.match(nodeNamePattern);
  15246. return nodeNameMatch && nodeNameMatch[1].toLowerCase();
  15247. }
  15248. /**
  15249. * Creates an array containing the nodes rendered from the supplied markup. The
  15250. * optionally supplied `handleScript` function will be invoked once for each
  15251. * <script> element that is rendered. If no `handleScript` function is supplied,
  15252. * an exception is thrown if any <script> elements are rendered.
  15253. *
  15254. * @param {string} markup A string of valid HTML markup.
  15255. * @param {?function} handleScript Invoked once for each rendered <script>.
  15256. * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
  15257. */
  15258. function createNodesFromMarkup(markup, handleScript) {
  15259. var node = dummyNode;
  15260. ("production" !== "development" ? invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized') : invariant(!!dummyNode));
  15261. var nodeName = getNodeName(markup);
  15262. var wrap = nodeName && getMarkupWrap(nodeName);
  15263. if (wrap) {
  15264. node.innerHTML = wrap[1] + markup + wrap[2];
  15265. var wrapDepth = wrap[0];
  15266. while (wrapDepth--) {
  15267. node = node.lastChild;
  15268. }
  15269. } else {
  15270. node.innerHTML = markup;
  15271. }
  15272. var scripts = node.getElementsByTagName('script');
  15273. if (scripts.length) {
  15274. ("production" !== "development" ? invariant(
  15275. handleScript,
  15276. 'createNodesFromMarkup(...): Unexpected <script> element rendered.'
  15277. ) : invariant(handleScript));
  15278. createArrayFromMixed(scripts).forEach(handleScript);
  15279. }
  15280. var nodes = createArrayFromMixed(node.childNodes);
  15281. while (node.lastChild) {
  15282. node.removeChild(node.lastChild);
  15283. }
  15284. return nodes;
  15285. }
  15286. module.exports = createNodesFromMarkup;
  15287. },{"110":110,"127":127,"135":135,"21":21}],113:[function(_dereq_,module,exports){
  15288. /**
  15289. * Copyright 2013-2015, Facebook, Inc.
  15290. * All rights reserved.
  15291. *
  15292. * This source code is licensed under the BSD-style license found in the
  15293. * LICENSE file in the root directory of this source tree. An additional grant
  15294. * of patent rights can be found in the PATENTS file in the same directory.
  15295. *
  15296. * @providesModule dangerousStyleValue
  15297. * @typechecks static-only
  15298. */
  15299. 'use strict';
  15300. var CSSProperty = _dereq_(4);
  15301. var isUnitlessNumber = CSSProperty.isUnitlessNumber;
  15302. /**
  15303. * Convert a value into the proper css writable value. The style name `name`
  15304. * should be logical (no hyphens), as specified
  15305. * in `CSSProperty.isUnitlessNumber`.
  15306. *
  15307. * @param {string} name CSS property name such as `topMargin`.
  15308. * @param {*} value CSS property value such as `10px`.
  15309. * @return {string} Normalized style value with dimensions applied.
  15310. */
  15311. function dangerousStyleValue(name, value) {
  15312. // Note that we've removed escapeTextForBrowser() calls here since the
  15313. // whole string will be escaped when the attribute is injected into
  15314. // the markup. If you provide unsafe user data here they can inject
  15315. // arbitrary CSS which may be problematic (I couldn't repro this):
  15316. // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
  15317. // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
  15318. // This is not an XSS hole but instead a potential CSS injection issue
  15319. // which has lead to a greater discussion about how we're going to
  15320. // trust URLs moving forward. See #2115901
  15321. var isEmpty = value == null || typeof value === 'boolean' || value === '';
  15322. if (isEmpty) {
  15323. return '';
  15324. }
  15325. var isNonNumeric = isNaN(value);
  15326. if (isNonNumeric || value === 0 ||
  15327. isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
  15328. return '' + value; // cast to string
  15329. }
  15330. if (typeof value === 'string') {
  15331. value = value.trim();
  15332. }
  15333. return value + 'px';
  15334. }
  15335. module.exports = dangerousStyleValue;
  15336. },{"4":4}],114:[function(_dereq_,module,exports){
  15337. /**
  15338. * Copyright 2013-2015, Facebook, Inc.
  15339. * All rights reserved.
  15340. *
  15341. * This source code is licensed under the BSD-style license found in the
  15342. * LICENSE file in the root directory of this source tree. An additional grant
  15343. * of patent rights can be found in the PATENTS file in the same directory.
  15344. *
  15345. * @providesModule emptyFunction
  15346. */
  15347. function makeEmptyFunction(arg) {
  15348. return function() {
  15349. return arg;
  15350. };
  15351. }
  15352. /**
  15353. * This function accepts and discards inputs; it has no side effects. This is
  15354. * primarily useful idiomatically for overridable function endpoints which
  15355. * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
  15356. */
  15357. function emptyFunction() {}
  15358. emptyFunction.thatReturns = makeEmptyFunction;
  15359. emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
  15360. emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
  15361. emptyFunction.thatReturnsNull = makeEmptyFunction(null);
  15362. emptyFunction.thatReturnsThis = function() { return this; };
  15363. emptyFunction.thatReturnsArgument = function(arg) { return arg; };
  15364. module.exports = emptyFunction;
  15365. },{}],115:[function(_dereq_,module,exports){
  15366. /**
  15367. * Copyright 2013-2015, Facebook, Inc.
  15368. * All rights reserved.
  15369. *
  15370. * This source code is licensed under the BSD-style license found in the
  15371. * LICENSE file in the root directory of this source tree. An additional grant
  15372. * of patent rights can be found in the PATENTS file in the same directory.
  15373. *
  15374. * @providesModule emptyObject
  15375. */
  15376. "use strict";
  15377. var emptyObject = {};
  15378. if ("production" !== "development") {
  15379. Object.freeze(emptyObject);
  15380. }
  15381. module.exports = emptyObject;
  15382. },{}],116:[function(_dereq_,module,exports){
  15383. /**
  15384. * Copyright 2013-2015, Facebook, Inc.
  15385. * All rights reserved.
  15386. *
  15387. * This source code is licensed under the BSD-style license found in the
  15388. * LICENSE file in the root directory of this source tree. An additional grant
  15389. * of patent rights can be found in the PATENTS file in the same directory.
  15390. *
  15391. * @providesModule escapeTextContentForBrowser
  15392. */
  15393. 'use strict';
  15394. var ESCAPE_LOOKUP = {
  15395. '&': '&amp;',
  15396. '>': '&gt;',
  15397. '<': '&lt;',
  15398. '"': '&quot;',
  15399. '\'': '&#x27;'
  15400. };
  15401. var ESCAPE_REGEX = /[&><"']/g;
  15402. function escaper(match) {
  15403. return ESCAPE_LOOKUP[match];
  15404. }
  15405. /**
  15406. * Escapes text to prevent scripting attacks.
  15407. *
  15408. * @param {*} text Text value to escape.
  15409. * @return {string} An escaped string.
  15410. */
  15411. function escapeTextContentForBrowser(text) {
  15412. return ('' + text).replace(ESCAPE_REGEX, escaper);
  15413. }
  15414. module.exports = escapeTextContentForBrowser;
  15415. },{}],117:[function(_dereq_,module,exports){
  15416. /**
  15417. * Copyright 2013-2015, Facebook, Inc.
  15418. * All rights reserved.
  15419. *
  15420. * This source code is licensed under the BSD-style license found in the
  15421. * LICENSE file in the root directory of this source tree. An additional grant
  15422. * of patent rights can be found in the PATENTS file in the same directory.
  15423. *
  15424. * @providesModule findDOMNode
  15425. * @typechecks static-only
  15426. */
  15427. 'use strict';
  15428. var ReactCurrentOwner = _dereq_(39);
  15429. var ReactInstanceMap = _dereq_(67);
  15430. var ReactMount = _dereq_(70);
  15431. var invariant = _dereq_(135);
  15432. var isNode = _dereq_(137);
  15433. var warning = _dereq_(154);
  15434. /**
  15435. * Returns the DOM node rendered by this element.
  15436. *
  15437. * @param {ReactComponent|DOMElement} componentOrElement
  15438. * @return {DOMElement} The root node of this element.
  15439. */
  15440. function findDOMNode(componentOrElement) {
  15441. if ("production" !== "development") {
  15442. var owner = ReactCurrentOwner.current;
  15443. if (owner !== null) {
  15444. ("production" !== "development" ? warning(
  15445. owner._warnedAboutRefsInRender,
  15446. '%s is accessing getDOMNode or findDOMNode inside its render(). ' +
  15447. 'render() should be a pure function of props and state. It should ' +
  15448. 'never access something that requires stale data from the previous ' +
  15449. 'render, such as refs. Move this logic to componentDidMount and ' +
  15450. 'componentDidUpdate instead.',
  15451. owner.getName() || 'A component'
  15452. ) : null);
  15453. owner._warnedAboutRefsInRender = true;
  15454. }
  15455. }
  15456. if (componentOrElement == null) {
  15457. return null;
  15458. }
  15459. if (isNode(componentOrElement)) {
  15460. return componentOrElement;
  15461. }
  15462. if (ReactInstanceMap.has(componentOrElement)) {
  15463. return ReactMount.getNodeFromInstance(componentOrElement);
  15464. }
  15465. ("production" !== "development" ? invariant(
  15466. componentOrElement.render == null ||
  15467. typeof componentOrElement.render !== 'function',
  15468. 'Component (with keys: %s) contains `render` method ' +
  15469. 'but is not mounted in the DOM',
  15470. Object.keys(componentOrElement)
  15471. ) : invariant(componentOrElement.render == null ||
  15472. typeof componentOrElement.render !== 'function'));
  15473. ("production" !== "development" ? invariant(
  15474. false,
  15475. 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)',
  15476. Object.keys(componentOrElement)
  15477. ) : invariant(false));
  15478. }
  15479. module.exports = findDOMNode;
  15480. },{"135":135,"137":137,"154":154,"39":39,"67":67,"70":70}],118:[function(_dereq_,module,exports){
  15481. /**
  15482. * Copyright 2013-2015, Facebook, Inc.
  15483. * All rights reserved.
  15484. *
  15485. * This source code is licensed under the BSD-style license found in the
  15486. * LICENSE file in the root directory of this source tree. An additional grant
  15487. * of patent rights can be found in the PATENTS file in the same directory.
  15488. *
  15489. * @providesModule flattenChildren
  15490. */
  15491. 'use strict';
  15492. var traverseAllChildren = _dereq_(153);
  15493. var warning = _dereq_(154);
  15494. /**
  15495. * @param {function} traverseContext Context passed through traversal.
  15496. * @param {?ReactComponent} child React child component.
  15497. * @param {!string} name String name of key path to child.
  15498. */
  15499. function flattenSingleChildIntoContext(traverseContext, child, name) {
  15500. // We found a component instance.
  15501. var result = traverseContext;
  15502. var keyUnique = !result.hasOwnProperty(name);
  15503. if ("production" !== "development") {
  15504. ("production" !== "development" ? warning(
  15505. keyUnique,
  15506. 'flattenChildren(...): Encountered two children with the same key, ' +
  15507. '`%s`. Child keys must be unique; when two children share a key, only ' +
  15508. 'the first child will be used.',
  15509. name
  15510. ) : null);
  15511. }
  15512. if (keyUnique && child != null) {
  15513. result[name] = child;
  15514. }
  15515. }
  15516. /**
  15517. * Flattens children that are typically specified as `props.children`. Any null
  15518. * children will not be included in the resulting object.
  15519. * @return {!object} flattened children keyed by name.
  15520. */
  15521. function flattenChildren(children) {
  15522. if (children == null) {
  15523. return children;
  15524. }
  15525. var result = {};
  15526. traverseAllChildren(children, flattenSingleChildIntoContext, result);
  15527. return result;
  15528. }
  15529. module.exports = flattenChildren;
  15530. },{"153":153,"154":154}],119:[function(_dereq_,module,exports){
  15531. /**
  15532. * Copyright 2014-2015, Facebook, Inc.
  15533. * All rights reserved.
  15534. *
  15535. * This source code is licensed under the BSD-style license found in the
  15536. * LICENSE file in the root directory of this source tree. An additional grant
  15537. * of patent rights can be found in the PATENTS file in the same directory.
  15538. *
  15539. * @providesModule focusNode
  15540. */
  15541. "use strict";
  15542. /**
  15543. * @param {DOMElement} node input/textarea to focus
  15544. */
  15545. function focusNode(node) {
  15546. // IE8 can throw "Can't move focus to the control because it is invisible,
  15547. // not enabled, or of a type that does not accept the focus." for all kinds of
  15548. // reasons that are too expensive and fragile to test.
  15549. try {
  15550. node.focus();
  15551. } catch(e) {
  15552. }
  15553. }
  15554. module.exports = focusNode;
  15555. },{}],120:[function(_dereq_,module,exports){
  15556. /**
  15557. * Copyright 2013-2015, Facebook, Inc.
  15558. * All rights reserved.
  15559. *
  15560. * This source code is licensed under the BSD-style license found in the
  15561. * LICENSE file in the root directory of this source tree. An additional grant
  15562. * of patent rights can be found in the PATENTS file in the same directory.
  15563. *
  15564. * @providesModule forEachAccumulated
  15565. */
  15566. 'use strict';
  15567. /**
  15568. * @param {array} an "accumulation" of items which is either an Array or
  15569. * a single item. Useful when paired with the `accumulate` module. This is a
  15570. * simple utility that allows us to reason about a collection of items, but
  15571. * handling the case when there is exactly one item (and we do not need to
  15572. * allocate an array).
  15573. */
  15574. var forEachAccumulated = function(arr, cb, scope) {
  15575. if (Array.isArray(arr)) {
  15576. arr.forEach(cb, scope);
  15577. } else if (arr) {
  15578. cb.call(scope, arr);
  15579. }
  15580. };
  15581. module.exports = forEachAccumulated;
  15582. },{}],121:[function(_dereq_,module,exports){
  15583. /**
  15584. * Copyright 2013-2015, Facebook, Inc.
  15585. * All rights reserved.
  15586. *
  15587. * This source code is licensed under the BSD-style license found in the
  15588. * LICENSE file in the root directory of this source tree. An additional grant
  15589. * of patent rights can be found in the PATENTS file in the same directory.
  15590. *
  15591. * @providesModule getActiveElement
  15592. * @typechecks
  15593. */
  15594. /**
  15595. * Same as document.activeElement but wraps in a try-catch block. In IE it is
  15596. * not safe to call document.activeElement if there is nothing focused.
  15597. *
  15598. * The activeElement will be null only if the document body is not yet defined.
  15599. */
  15600. function getActiveElement() /*?DOMElement*/ {
  15601. try {
  15602. return document.activeElement || document.body;
  15603. } catch (e) {
  15604. return document.body;
  15605. }
  15606. }
  15607. module.exports = getActiveElement;
  15608. },{}],122:[function(_dereq_,module,exports){
  15609. /**
  15610. * Copyright 2013-2015, Facebook, Inc.
  15611. * All rights reserved.
  15612. *
  15613. * This source code is licensed under the BSD-style license found in the
  15614. * LICENSE file in the root directory of this source tree. An additional grant
  15615. * of patent rights can be found in the PATENTS file in the same directory.
  15616. *
  15617. * @providesModule getEventCharCode
  15618. * @typechecks static-only
  15619. */
  15620. 'use strict';
  15621. /**
  15622. * `charCode` represents the actual "character code" and is safe to use with
  15623. * `String.fromCharCode`. As such, only keys that correspond to printable
  15624. * characters produce a valid `charCode`, the only exception to this is Enter.
  15625. * The Tab-key is considered non-printable and does not have a `charCode`,
  15626. * presumably because it does not produce a tab-character in browsers.
  15627. *
  15628. * @param {object} nativeEvent Native browser event.
  15629. * @return {string} Normalized `charCode` property.
  15630. */
  15631. function getEventCharCode(nativeEvent) {
  15632. var charCode;
  15633. var keyCode = nativeEvent.keyCode;
  15634. if ('charCode' in nativeEvent) {
  15635. charCode = nativeEvent.charCode;
  15636. // FF does not set `charCode` for the Enter-key, check against `keyCode`.
  15637. if (charCode === 0 && keyCode === 13) {
  15638. charCode = 13;
  15639. }
  15640. } else {
  15641. // IE8 does not implement `charCode`, but `keyCode` has the correct value.
  15642. charCode = keyCode;
  15643. }
  15644. // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
  15645. // Must not discard the (non-)printable Enter-key.
  15646. if (charCode >= 32 || charCode === 13) {
  15647. return charCode;
  15648. }
  15649. return 0;
  15650. }
  15651. module.exports = getEventCharCode;
  15652. },{}],123:[function(_dereq_,module,exports){
  15653. /**
  15654. * Copyright 2013-2015, Facebook, Inc.
  15655. * All rights reserved.
  15656. *
  15657. * This source code is licensed under the BSD-style license found in the
  15658. * LICENSE file in the root directory of this source tree. An additional grant
  15659. * of patent rights can be found in the PATENTS file in the same directory.
  15660. *
  15661. * @providesModule getEventKey
  15662. * @typechecks static-only
  15663. */
  15664. 'use strict';
  15665. var getEventCharCode = _dereq_(122);
  15666. /**
  15667. * Normalization of deprecated HTML5 `key` values
  15668. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  15669. */
  15670. var normalizeKey = {
  15671. 'Esc': 'Escape',
  15672. 'Spacebar': ' ',
  15673. 'Left': 'ArrowLeft',
  15674. 'Up': 'ArrowUp',
  15675. 'Right': 'ArrowRight',
  15676. 'Down': 'ArrowDown',
  15677. 'Del': 'Delete',
  15678. 'Win': 'OS',
  15679. 'Menu': 'ContextMenu',
  15680. 'Apps': 'ContextMenu',
  15681. 'Scroll': 'ScrollLock',
  15682. 'MozPrintableKey': 'Unidentified'
  15683. };
  15684. /**
  15685. * Translation from legacy `keyCode` to HTML5 `key`
  15686. * Only special keys supported, all others depend on keyboard layout or browser
  15687. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  15688. */
  15689. var translateToKey = {
  15690. 8: 'Backspace',
  15691. 9: 'Tab',
  15692. 12: 'Clear',
  15693. 13: 'Enter',
  15694. 16: 'Shift',
  15695. 17: 'Control',
  15696. 18: 'Alt',
  15697. 19: 'Pause',
  15698. 20: 'CapsLock',
  15699. 27: 'Escape',
  15700. 32: ' ',
  15701. 33: 'PageUp',
  15702. 34: 'PageDown',
  15703. 35: 'End',
  15704. 36: 'Home',
  15705. 37: 'ArrowLeft',
  15706. 38: 'ArrowUp',
  15707. 39: 'ArrowRight',
  15708. 40: 'ArrowDown',
  15709. 45: 'Insert',
  15710. 46: 'Delete',
  15711. 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
  15712. 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
  15713. 144: 'NumLock',
  15714. 145: 'ScrollLock',
  15715. 224: 'Meta'
  15716. };
  15717. /**
  15718. * @param {object} nativeEvent Native browser event.
  15719. * @return {string} Normalized `key` property.
  15720. */
  15721. function getEventKey(nativeEvent) {
  15722. if (nativeEvent.key) {
  15723. // Normalize inconsistent values reported by browsers due to
  15724. // implementations of a working draft specification.
  15725. // FireFox implements `key` but returns `MozPrintableKey` for all
  15726. // printable characters (normalized to `Unidentified`), ignore it.
  15727. var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
  15728. if (key !== 'Unidentified') {
  15729. return key;
  15730. }
  15731. }
  15732. // Browser does not implement `key`, polyfill as much of it as we can.
  15733. if (nativeEvent.type === 'keypress') {
  15734. var charCode = getEventCharCode(nativeEvent);
  15735. // The enter-key is technically both printable and non-printable and can
  15736. // thus be captured by `keypress`, no other non-printable key should.
  15737. return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
  15738. }
  15739. if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
  15740. // While user keyboard layout determines the actual meaning of each
  15741. // `keyCode` value, almost all function keys have a universal value.
  15742. return translateToKey[nativeEvent.keyCode] || 'Unidentified';
  15743. }
  15744. return '';
  15745. }
  15746. module.exports = getEventKey;
  15747. },{"122":122}],124:[function(_dereq_,module,exports){
  15748. /**
  15749. * Copyright 2013-2015, Facebook, Inc.
  15750. * All rights reserved.
  15751. *
  15752. * This source code is licensed under the BSD-style license found in the
  15753. * LICENSE file in the root directory of this source tree. An additional grant
  15754. * of patent rights can be found in the PATENTS file in the same directory.
  15755. *
  15756. * @providesModule getEventModifierState
  15757. * @typechecks static-only
  15758. */
  15759. 'use strict';
  15760. /**
  15761. * Translation from modifier key to the associated property in the event.
  15762. * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
  15763. */
  15764. var modifierKeyToProp = {
  15765. 'Alt': 'altKey',
  15766. 'Control': 'ctrlKey',
  15767. 'Meta': 'metaKey',
  15768. 'Shift': 'shiftKey'
  15769. };
  15770. // IE8 does not implement getModifierState so we simply map it to the only
  15771. // modifier keys exposed by the event itself, does not support Lock-keys.
  15772. // Currently, all major browsers except Chrome seems to support Lock-keys.
  15773. function modifierStateGetter(keyArg) {
  15774. /*jshint validthis:true */
  15775. var syntheticEvent = this;
  15776. var nativeEvent = syntheticEvent.nativeEvent;
  15777. if (nativeEvent.getModifierState) {
  15778. return nativeEvent.getModifierState(keyArg);
  15779. }
  15780. var keyProp = modifierKeyToProp[keyArg];
  15781. return keyProp ? !!nativeEvent[keyProp] : false;
  15782. }
  15783. function getEventModifierState(nativeEvent) {
  15784. return modifierStateGetter;
  15785. }
  15786. module.exports = getEventModifierState;
  15787. },{}],125:[function(_dereq_,module,exports){
  15788. /**
  15789. * Copyright 2013-2015, Facebook, Inc.
  15790. * All rights reserved.
  15791. *
  15792. * This source code is licensed under the BSD-style license found in the
  15793. * LICENSE file in the root directory of this source tree. An additional grant
  15794. * of patent rights can be found in the PATENTS file in the same directory.
  15795. *
  15796. * @providesModule getEventTarget
  15797. * @typechecks static-only
  15798. */
  15799. 'use strict';
  15800. /**
  15801. * Gets the target node from a native browser event by accounting for
  15802. * inconsistencies in browser DOM APIs.
  15803. *
  15804. * @param {object} nativeEvent Native browser event.
  15805. * @return {DOMEventTarget} Target node.
  15806. */
  15807. function getEventTarget(nativeEvent) {
  15808. var target = nativeEvent.target || nativeEvent.srcElement || window;
  15809. // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
  15810. // @see http://www.quirksmode.org/js/events_properties.html
  15811. return target.nodeType === 3 ? target.parentNode : target;
  15812. }
  15813. module.exports = getEventTarget;
  15814. },{}],126:[function(_dereq_,module,exports){
  15815. /**
  15816. * Copyright 2013-2015, Facebook, Inc.
  15817. * All rights reserved.
  15818. *
  15819. * This source code is licensed under the BSD-style license found in the
  15820. * LICENSE file in the root directory of this source tree. An additional grant
  15821. * of patent rights can be found in the PATENTS file in the same directory.
  15822. *
  15823. * @providesModule getIteratorFn
  15824. * @typechecks static-only
  15825. */
  15826. 'use strict';
  15827. /* global Symbol */
  15828. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  15829. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  15830. /**
  15831. * Returns the iterator method function contained on the iterable object.
  15832. *
  15833. * Be sure to invoke the function with the iterable as context:
  15834. *
  15835. * var iteratorFn = getIteratorFn(myIterable);
  15836. * if (iteratorFn) {
  15837. * var iterator = iteratorFn.call(myIterable);
  15838. * ...
  15839. * }
  15840. *
  15841. * @param {?object} maybeIterable
  15842. * @return {?function}
  15843. */
  15844. function getIteratorFn(maybeIterable) {
  15845. var iteratorFn = maybeIterable && (
  15846. (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL])
  15847. );
  15848. if (typeof iteratorFn === 'function') {
  15849. return iteratorFn;
  15850. }
  15851. }
  15852. module.exports = getIteratorFn;
  15853. },{}],127:[function(_dereq_,module,exports){
  15854. /**
  15855. * Copyright 2013-2015, Facebook, Inc.
  15856. * All rights reserved.
  15857. *
  15858. * This source code is licensed under the BSD-style license found in the
  15859. * LICENSE file in the root directory of this source tree. An additional grant
  15860. * of patent rights can be found in the PATENTS file in the same directory.
  15861. *
  15862. * @providesModule getMarkupWrap
  15863. */
  15864. var ExecutionEnvironment = _dereq_(21);
  15865. var invariant = _dereq_(135);
  15866. /**
  15867. * Dummy container used to detect which wraps are necessary.
  15868. */
  15869. var dummyNode =
  15870. ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  15871. /**
  15872. * Some browsers cannot use `innerHTML` to render certain elements standalone,
  15873. * so we wrap them, render the wrapped nodes, then extract the desired node.
  15874. *
  15875. * In IE8, certain elements cannot render alone, so wrap all elements ('*').
  15876. */
  15877. var shouldWrap = {
  15878. // Force wrapping for SVG elements because if they get created inside a <div>,
  15879. // they will be initialized in the wrong namespace (and will not display).
  15880. 'circle': true,
  15881. 'defs': true,
  15882. 'ellipse': true,
  15883. 'g': true,
  15884. 'line': true,
  15885. 'linearGradient': true,
  15886. 'path': true,
  15887. 'polygon': true,
  15888. 'polyline': true,
  15889. 'radialGradient': true,
  15890. 'rect': true,
  15891. 'stop': true,
  15892. 'text': true
  15893. };
  15894. var selectWrap = [1, '<select multiple="true">', '</select>'];
  15895. var tableWrap = [1, '<table>', '</table>'];
  15896. var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
  15897. var svgWrap = [1, '<svg>', '</svg>'];
  15898. var markupWrap = {
  15899. '*': [1, '?<div>', '</div>'],
  15900. 'area': [1, '<map>', '</map>'],
  15901. 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
  15902. 'legend': [1, '<fieldset>', '</fieldset>'],
  15903. 'param': [1, '<object>', '</object>'],
  15904. 'tr': [2, '<table><tbody>', '</tbody></table>'],
  15905. 'optgroup': selectWrap,
  15906. 'option': selectWrap,
  15907. 'caption': tableWrap,
  15908. 'colgroup': tableWrap,
  15909. 'tbody': tableWrap,
  15910. 'tfoot': tableWrap,
  15911. 'thead': tableWrap,
  15912. 'td': trWrap,
  15913. 'th': trWrap,
  15914. 'circle': svgWrap,
  15915. 'defs': svgWrap,
  15916. 'ellipse': svgWrap,
  15917. 'g': svgWrap,
  15918. 'line': svgWrap,
  15919. 'linearGradient': svgWrap,
  15920. 'path': svgWrap,
  15921. 'polygon': svgWrap,
  15922. 'polyline': svgWrap,
  15923. 'radialGradient': svgWrap,
  15924. 'rect': svgWrap,
  15925. 'stop': svgWrap,
  15926. 'text': svgWrap
  15927. };
  15928. /**
  15929. * Gets the markup wrap configuration for the supplied `nodeName`.
  15930. *
  15931. * NOTE: This lazily detects which wraps are necessary for the current browser.
  15932. *
  15933. * @param {string} nodeName Lowercase `nodeName`.
  15934. * @return {?array} Markup wrap configuration, if applicable.
  15935. */
  15936. function getMarkupWrap(nodeName) {
  15937. ("production" !== "development" ? invariant(!!dummyNode, 'Markup wrapping node not initialized') : invariant(!!dummyNode));
  15938. if (!markupWrap.hasOwnProperty(nodeName)) {
  15939. nodeName = '*';
  15940. }
  15941. if (!shouldWrap.hasOwnProperty(nodeName)) {
  15942. if (nodeName === '*') {
  15943. dummyNode.innerHTML = '<link />';
  15944. } else {
  15945. dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
  15946. }
  15947. shouldWrap[nodeName] = !dummyNode.firstChild;
  15948. }
  15949. return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
  15950. }
  15951. module.exports = getMarkupWrap;
  15952. },{"135":135,"21":21}],128:[function(_dereq_,module,exports){
  15953. /**
  15954. * Copyright 2013-2015, Facebook, Inc.
  15955. * All rights reserved.
  15956. *
  15957. * This source code is licensed under the BSD-style license found in the
  15958. * LICENSE file in the root directory of this source tree. An additional grant
  15959. * of patent rights can be found in the PATENTS file in the same directory.
  15960. *
  15961. * @providesModule getNodeForCharacterOffset
  15962. */
  15963. 'use strict';
  15964. /**
  15965. * Given any node return the first leaf node without children.
  15966. *
  15967. * @param {DOMElement|DOMTextNode} node
  15968. * @return {DOMElement|DOMTextNode}
  15969. */
  15970. function getLeafNode(node) {
  15971. while (node && node.firstChild) {
  15972. node = node.firstChild;
  15973. }
  15974. return node;
  15975. }
  15976. /**
  15977. * Get the next sibling within a container. This will walk up the
  15978. * DOM if a node's siblings have been exhausted.
  15979. *
  15980. * @param {DOMElement|DOMTextNode} node
  15981. * @return {?DOMElement|DOMTextNode}
  15982. */
  15983. function getSiblingNode(node) {
  15984. while (node) {
  15985. if (node.nextSibling) {
  15986. return node.nextSibling;
  15987. }
  15988. node = node.parentNode;
  15989. }
  15990. }
  15991. /**
  15992. * Get object describing the nodes which contain characters at offset.
  15993. *
  15994. * @param {DOMElement|DOMTextNode} root
  15995. * @param {number} offset
  15996. * @return {?object}
  15997. */
  15998. function getNodeForCharacterOffset(root, offset) {
  15999. var node = getLeafNode(root);
  16000. var nodeStart = 0;
  16001. var nodeEnd = 0;
  16002. while (node) {
  16003. if (node.nodeType === 3) {
  16004. nodeEnd = nodeStart + node.textContent.length;
  16005. if (nodeStart <= offset && nodeEnd >= offset) {
  16006. return {
  16007. node: node,
  16008. offset: offset - nodeStart
  16009. };
  16010. }
  16011. nodeStart = nodeEnd;
  16012. }
  16013. node = getLeafNode(getSiblingNode(node));
  16014. }
  16015. }
  16016. module.exports = getNodeForCharacterOffset;
  16017. },{}],129:[function(_dereq_,module,exports){
  16018. /**
  16019. * Copyright 2013-2015, Facebook, Inc.
  16020. * All rights reserved.
  16021. *
  16022. * This source code is licensed under the BSD-style license found in the
  16023. * LICENSE file in the root directory of this source tree. An additional grant
  16024. * of patent rights can be found in the PATENTS file in the same directory.
  16025. *
  16026. * @providesModule getReactRootElementInContainer
  16027. */
  16028. 'use strict';
  16029. var DOC_NODE_TYPE = 9;
  16030. /**
  16031. * @param {DOMElement|DOMDocument} container DOM element that may contain
  16032. * a React component
  16033. * @return {?*} DOM element that may have the reactRoot ID, or null.
  16034. */
  16035. function getReactRootElementInContainer(container) {
  16036. if (!container) {
  16037. return null;
  16038. }
  16039. if (container.nodeType === DOC_NODE_TYPE) {
  16040. return container.documentElement;
  16041. } else {
  16042. return container.firstChild;
  16043. }
  16044. }
  16045. module.exports = getReactRootElementInContainer;
  16046. },{}],130:[function(_dereq_,module,exports){
  16047. /**
  16048. * Copyright 2013-2015, Facebook, Inc.
  16049. * All rights reserved.
  16050. *
  16051. * This source code is licensed under the BSD-style license found in the
  16052. * LICENSE file in the root directory of this source tree. An additional grant
  16053. * of patent rights can be found in the PATENTS file in the same directory.
  16054. *
  16055. * @providesModule getTextContentAccessor
  16056. */
  16057. 'use strict';
  16058. var ExecutionEnvironment = _dereq_(21);
  16059. var contentKey = null;
  16060. /**
  16061. * Gets the key used to access text content on a DOM node.
  16062. *
  16063. * @return {?string} Key used to access text content.
  16064. * @internal
  16065. */
  16066. function getTextContentAccessor() {
  16067. if (!contentKey && ExecutionEnvironment.canUseDOM) {
  16068. // Prefer textContent to innerText because many browsers support both but
  16069. // SVG <text> elements don't support innerText even when <div> does.
  16070. contentKey = 'textContent' in document.documentElement ?
  16071. 'textContent' :
  16072. 'innerText';
  16073. }
  16074. return contentKey;
  16075. }
  16076. module.exports = getTextContentAccessor;
  16077. },{"21":21}],131:[function(_dereq_,module,exports){
  16078. /**
  16079. * Copyright 2013-2015, Facebook, Inc.
  16080. * All rights reserved.
  16081. *
  16082. * This source code is licensed under the BSD-style license found in the
  16083. * LICENSE file in the root directory of this source tree. An additional grant
  16084. * of patent rights can be found in the PATENTS file in the same directory.
  16085. *
  16086. * @providesModule getUnboundedScrollPosition
  16087. * @typechecks
  16088. */
  16089. "use strict";
  16090. /**
  16091. * Gets the scroll position of the supplied element or window.
  16092. *
  16093. * The return values are unbounded, unlike `getScrollPosition`. This means they
  16094. * may be negative or exceed the element boundaries (which is possible using
  16095. * inertial scrolling).
  16096. *
  16097. * @param {DOMWindow|DOMElement} scrollable
  16098. * @return {object} Map with `x` and `y` keys.
  16099. */
  16100. function getUnboundedScrollPosition(scrollable) {
  16101. if (scrollable === window) {
  16102. return {
  16103. x: window.pageXOffset || document.documentElement.scrollLeft,
  16104. y: window.pageYOffset || document.documentElement.scrollTop
  16105. };
  16106. }
  16107. return {
  16108. x: scrollable.scrollLeft,
  16109. y: scrollable.scrollTop
  16110. };
  16111. }
  16112. module.exports = getUnboundedScrollPosition;
  16113. },{}],132:[function(_dereq_,module,exports){
  16114. /**
  16115. * Copyright 2013-2015, Facebook, Inc.
  16116. * All rights reserved.
  16117. *
  16118. * This source code is licensed under the BSD-style license found in the
  16119. * LICENSE file in the root directory of this source tree. An additional grant
  16120. * of patent rights can be found in the PATENTS file in the same directory.
  16121. *
  16122. * @providesModule hyphenate
  16123. * @typechecks
  16124. */
  16125. var _uppercasePattern = /([A-Z])/g;
  16126. /**
  16127. * Hyphenates a camelcased string, for example:
  16128. *
  16129. * > hyphenate('backgroundColor')
  16130. * < "background-color"
  16131. *
  16132. * For CSS style names, use `hyphenateStyleName` instead which works properly
  16133. * with all vendor prefixes, including `ms`.
  16134. *
  16135. * @param {string} string
  16136. * @return {string}
  16137. */
  16138. function hyphenate(string) {
  16139. return string.replace(_uppercasePattern, '-$1').toLowerCase();
  16140. }
  16141. module.exports = hyphenate;
  16142. },{}],133:[function(_dereq_,module,exports){
  16143. /**
  16144. * Copyright 2013-2015, Facebook, Inc.
  16145. * All rights reserved.
  16146. *
  16147. * This source code is licensed under the BSD-style license found in the
  16148. * LICENSE file in the root directory of this source tree. An additional grant
  16149. * of patent rights can be found in the PATENTS file in the same directory.
  16150. *
  16151. * @providesModule hyphenateStyleName
  16152. * @typechecks
  16153. */
  16154. "use strict";
  16155. var hyphenate = _dereq_(132);
  16156. var msPattern = /^ms-/;
  16157. /**
  16158. * Hyphenates a camelcased CSS property name, for example:
  16159. *
  16160. * > hyphenateStyleName('backgroundColor')
  16161. * < "background-color"
  16162. * > hyphenateStyleName('MozTransition')
  16163. * < "-moz-transition"
  16164. * > hyphenateStyleName('msTransition')
  16165. * < "-ms-transition"
  16166. *
  16167. * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
  16168. * is converted to `-ms-`.
  16169. *
  16170. * @param {string} string
  16171. * @return {string}
  16172. */
  16173. function hyphenateStyleName(string) {
  16174. return hyphenate(string).replace(msPattern, '-ms-');
  16175. }
  16176. module.exports = hyphenateStyleName;
  16177. },{"132":132}],134:[function(_dereq_,module,exports){
  16178. /**
  16179. * Copyright 2013-2015, Facebook, Inc.
  16180. * All rights reserved.
  16181. *
  16182. * This source code is licensed under the BSD-style license found in the
  16183. * LICENSE file in the root directory of this source tree. An additional grant
  16184. * of patent rights can be found in the PATENTS file in the same directory.
  16185. *
  16186. * @providesModule instantiateReactComponent
  16187. * @typechecks static-only
  16188. */
  16189. 'use strict';
  16190. var ReactCompositeComponent = _dereq_(37);
  16191. var ReactEmptyComponent = _dereq_(59);
  16192. var ReactNativeComponent = _dereq_(73);
  16193. var assign = _dereq_(27);
  16194. var invariant = _dereq_(135);
  16195. var warning = _dereq_(154);
  16196. // To avoid a cyclic dependency, we create the final class in this module
  16197. var ReactCompositeComponentWrapper = function() { };
  16198. assign(
  16199. ReactCompositeComponentWrapper.prototype,
  16200. ReactCompositeComponent.Mixin,
  16201. {
  16202. _instantiateReactComponent: instantiateReactComponent
  16203. }
  16204. );
  16205. /**
  16206. * Check if the type reference is a known internal type. I.e. not a user
  16207. * provided composite type.
  16208. *
  16209. * @param {function} type
  16210. * @return {boolean} Returns true if this is a valid internal type.
  16211. */
  16212. function isInternalComponentType(type) {
  16213. return (
  16214. typeof type === 'function' &&
  16215. typeof type.prototype.mountComponent === 'function' &&
  16216. typeof type.prototype.receiveComponent === 'function'
  16217. );
  16218. }
  16219. /**
  16220. * Given a ReactNode, create an instance that will actually be mounted.
  16221. *
  16222. * @param {ReactNode} node
  16223. * @param {*} parentCompositeType The composite type that resolved this.
  16224. * @return {object} A new instance of the element's constructor.
  16225. * @protected
  16226. */
  16227. function instantiateReactComponent(node, parentCompositeType) {
  16228. var instance;
  16229. if (node === null || node === false) {
  16230. node = ReactEmptyComponent.emptyElement;
  16231. }
  16232. if (typeof node === 'object') {
  16233. var element = node;
  16234. if ("production" !== "development") {
  16235. ("production" !== "development" ? warning(
  16236. element && (typeof element.type === 'function' ||
  16237. typeof element.type === 'string'),
  16238. 'Only functions or strings can be mounted as React components.'
  16239. ) : null);
  16240. }
  16241. // Special case string values
  16242. if (parentCompositeType === element.type &&
  16243. typeof element.type === 'string') {
  16244. // Avoid recursion if the wrapper renders itself.
  16245. instance = ReactNativeComponent.createInternalComponent(element);
  16246. // All native components are currently wrapped in a composite so we're
  16247. // safe to assume that this is what we should instantiate.
  16248. } else if (isInternalComponentType(element.type)) {
  16249. // This is temporarily available for custom components that are not string
  16250. // represenations. I.e. ART. Once those are updated to use the string
  16251. // representation, we can drop this code path.
  16252. instance = new element.type(element);
  16253. } else {
  16254. instance = new ReactCompositeComponentWrapper();
  16255. }
  16256. } else if (typeof node === 'string' || typeof node === 'number') {
  16257. instance = ReactNativeComponent.createInstanceForText(node);
  16258. } else {
  16259. ("production" !== "development" ? invariant(
  16260. false,
  16261. 'Encountered invalid React node of type %s',
  16262. typeof node
  16263. ) : invariant(false));
  16264. }
  16265. if ("production" !== "development") {
  16266. ("production" !== "development" ? warning(
  16267. typeof instance.construct === 'function' &&
  16268. typeof instance.mountComponent === 'function' &&
  16269. typeof instance.receiveComponent === 'function' &&
  16270. typeof instance.unmountComponent === 'function',
  16271. 'Only React Components can be mounted.'
  16272. ) : null);
  16273. }
  16274. // Sets up the instance. This can probably just move into the constructor now.
  16275. instance.construct(node);
  16276. // These two fields are used by the DOM and ART diffing algorithms
  16277. // respectively. Instead of using expandos on components, we should be
  16278. // storing the state needed by the diffing algorithms elsewhere.
  16279. instance._mountIndex = 0;
  16280. instance._mountImage = null;
  16281. if ("production" !== "development") {
  16282. instance._isOwnerNecessary = false;
  16283. instance._warnedAboutRefsInRender = false;
  16284. }
  16285. // Internal instances should fully constructed at this point, so they should
  16286. // not get any new fields added to them at this point.
  16287. if ("production" !== "development") {
  16288. if (Object.preventExtensions) {
  16289. Object.preventExtensions(instance);
  16290. }
  16291. }
  16292. return instance;
  16293. }
  16294. module.exports = instantiateReactComponent;
  16295. },{"135":135,"154":154,"27":27,"37":37,"59":59,"73":73}],135:[function(_dereq_,module,exports){
  16296. /**
  16297. * Copyright 2013-2015, Facebook, Inc.
  16298. * All rights reserved.
  16299. *
  16300. * This source code is licensed under the BSD-style license found in the
  16301. * LICENSE file in the root directory of this source tree. An additional grant
  16302. * of patent rights can be found in the PATENTS file in the same directory.
  16303. *
  16304. * @providesModule invariant
  16305. */
  16306. "use strict";
  16307. /**
  16308. * Use invariant() to assert state which your program assumes to be true.
  16309. *
  16310. * Provide sprintf-style format (only %s is supported) and arguments
  16311. * to provide information about what broke and what you were
  16312. * expecting.
  16313. *
  16314. * The invariant message will be stripped in production, but the invariant
  16315. * will remain to ensure logic does not differ in production.
  16316. */
  16317. var invariant = function(condition, format, a, b, c, d, e, f) {
  16318. if ("production" !== "development") {
  16319. if (format === undefined) {
  16320. throw new Error('invariant requires an error message argument');
  16321. }
  16322. }
  16323. if (!condition) {
  16324. var error;
  16325. if (format === undefined) {
  16326. error = new Error(
  16327. 'Minified exception occurred; use the non-minified dev environment ' +
  16328. 'for the full error message and additional helpful warnings.'
  16329. );
  16330. } else {
  16331. var args = [a, b, c, d, e, f];
  16332. var argIndex = 0;
  16333. error = new Error(
  16334. 'Invariant Violation: ' +
  16335. format.replace(/%s/g, function() { return args[argIndex++]; })
  16336. );
  16337. }
  16338. error.framesToPop = 1; // we don't care about invariant's own frame
  16339. throw error;
  16340. }
  16341. };
  16342. module.exports = invariant;
  16343. },{}],136:[function(_dereq_,module,exports){
  16344. /**
  16345. * Copyright 2013-2015, Facebook, Inc.
  16346. * All rights reserved.
  16347. *
  16348. * This source code is licensed under the BSD-style license found in the
  16349. * LICENSE file in the root directory of this source tree. An additional grant
  16350. * of patent rights can be found in the PATENTS file in the same directory.
  16351. *
  16352. * @providesModule isEventSupported
  16353. */
  16354. 'use strict';
  16355. var ExecutionEnvironment = _dereq_(21);
  16356. var useHasFeature;
  16357. if (ExecutionEnvironment.canUseDOM) {
  16358. useHasFeature =
  16359. document.implementation &&
  16360. document.implementation.hasFeature &&
  16361. // always returns true in newer browsers as per the standard.
  16362. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
  16363. document.implementation.hasFeature('', '') !== true;
  16364. }
  16365. /**
  16366. * Checks if an event is supported in the current execution environment.
  16367. *
  16368. * NOTE: This will not work correctly for non-generic events such as `change`,
  16369. * `reset`, `load`, `error`, and `select`.
  16370. *
  16371. * Borrows from Modernizr.
  16372. *
  16373. * @param {string} eventNameSuffix Event name, e.g. "click".
  16374. * @param {?boolean} capture Check if the capture phase is supported.
  16375. * @return {boolean} True if the event is supported.
  16376. * @internal
  16377. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  16378. */
  16379. function isEventSupported(eventNameSuffix, capture) {
  16380. if (!ExecutionEnvironment.canUseDOM ||
  16381. capture && !('addEventListener' in document)) {
  16382. return false;
  16383. }
  16384. var eventName = 'on' + eventNameSuffix;
  16385. var isSupported = eventName in document;
  16386. if (!isSupported) {
  16387. var element = document.createElement('div');
  16388. element.setAttribute(eventName, 'return;');
  16389. isSupported = typeof element[eventName] === 'function';
  16390. }
  16391. if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
  16392. // This is the only way to test support for the `wheel` event in IE9+.
  16393. isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  16394. }
  16395. return isSupported;
  16396. }
  16397. module.exports = isEventSupported;
  16398. },{"21":21}],137:[function(_dereq_,module,exports){
  16399. /**
  16400. * Copyright 2013-2015, Facebook, Inc.
  16401. * All rights reserved.
  16402. *
  16403. * This source code is licensed under the BSD-style license found in the
  16404. * LICENSE file in the root directory of this source tree. An additional grant
  16405. * of patent rights can be found in the PATENTS file in the same directory.
  16406. *
  16407. * @providesModule isNode
  16408. * @typechecks
  16409. */
  16410. /**
  16411. * @param {*} object The object to check.
  16412. * @return {boolean} Whether or not the object is a DOM node.
  16413. */
  16414. function isNode(object) {
  16415. return !!(object && (
  16416. ((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' &&
  16417. typeof object.nodeType === 'number' &&
  16418. typeof object.nodeName === 'string'))
  16419. ));
  16420. }
  16421. module.exports = isNode;
  16422. },{}],138:[function(_dereq_,module,exports){
  16423. /**
  16424. * Copyright 2013-2015, Facebook, Inc.
  16425. * All rights reserved.
  16426. *
  16427. * This source code is licensed under the BSD-style license found in the
  16428. * LICENSE file in the root directory of this source tree. An additional grant
  16429. * of patent rights can be found in the PATENTS file in the same directory.
  16430. *
  16431. * @providesModule isTextInputElement
  16432. */
  16433. 'use strict';
  16434. /**
  16435. * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
  16436. */
  16437. var supportedInputTypes = {
  16438. 'color': true,
  16439. 'date': true,
  16440. 'datetime': true,
  16441. 'datetime-local': true,
  16442. 'email': true,
  16443. 'month': true,
  16444. 'number': true,
  16445. 'password': true,
  16446. 'range': true,
  16447. 'search': true,
  16448. 'tel': true,
  16449. 'text': true,
  16450. 'time': true,
  16451. 'url': true,
  16452. 'week': true
  16453. };
  16454. function isTextInputElement(elem) {
  16455. return elem && (
  16456. (elem.nodeName === 'INPUT' && supportedInputTypes[elem.type] || elem.nodeName === 'TEXTAREA')
  16457. );
  16458. }
  16459. module.exports = isTextInputElement;
  16460. },{}],139:[function(_dereq_,module,exports){
  16461. /**
  16462. * Copyright 2013-2015, Facebook, Inc.
  16463. * All rights reserved.
  16464. *
  16465. * This source code is licensed under the BSD-style license found in the
  16466. * LICENSE file in the root directory of this source tree. An additional grant
  16467. * of patent rights can be found in the PATENTS file in the same directory.
  16468. *
  16469. * @providesModule isTextNode
  16470. * @typechecks
  16471. */
  16472. var isNode = _dereq_(137);
  16473. /**
  16474. * @param {*} object The object to check.
  16475. * @return {boolean} Whether or not the object is a DOM text node.
  16476. */
  16477. function isTextNode(object) {
  16478. return isNode(object) && object.nodeType == 3;
  16479. }
  16480. module.exports = isTextNode;
  16481. },{"137":137}],140:[function(_dereq_,module,exports){
  16482. /**
  16483. * Copyright 2013-2015, Facebook, Inc.
  16484. * All rights reserved.
  16485. *
  16486. * This source code is licensed under the BSD-style license found in the
  16487. * LICENSE file in the root directory of this source tree. An additional grant
  16488. * of patent rights can be found in the PATENTS file in the same directory.
  16489. *
  16490. * @providesModule keyMirror
  16491. * @typechecks static-only
  16492. */
  16493. 'use strict';
  16494. var invariant = _dereq_(135);
  16495. /**
  16496. * Constructs an enumeration with keys equal to their value.
  16497. *
  16498. * For example:
  16499. *
  16500. * var COLORS = keyMirror({blue: null, red: null});
  16501. * var myColor = COLORS.blue;
  16502. * var isColorValid = !!COLORS[myColor];
  16503. *
  16504. * The last line could not be performed if the values of the generated enum were
  16505. * not equal to their keys.
  16506. *
  16507. * Input: {key1: val1, key2: val2}
  16508. * Output: {key1: key1, key2: key2}
  16509. *
  16510. * @param {object} obj
  16511. * @return {object}
  16512. */
  16513. var keyMirror = function(obj) {
  16514. var ret = {};
  16515. var key;
  16516. ("production" !== "development" ? invariant(
  16517. obj instanceof Object && !Array.isArray(obj),
  16518. 'keyMirror(...): Argument must be an object.'
  16519. ) : invariant(obj instanceof Object && !Array.isArray(obj)));
  16520. for (key in obj) {
  16521. if (!obj.hasOwnProperty(key)) {
  16522. continue;
  16523. }
  16524. ret[key] = key;
  16525. }
  16526. return ret;
  16527. };
  16528. module.exports = keyMirror;
  16529. },{"135":135}],141:[function(_dereq_,module,exports){
  16530. /**
  16531. * Copyright 2013-2015, Facebook, Inc.
  16532. * All rights reserved.
  16533. *
  16534. * This source code is licensed under the BSD-style license found in the
  16535. * LICENSE file in the root directory of this source tree. An additional grant
  16536. * of patent rights can be found in the PATENTS file in the same directory.
  16537. *
  16538. * @providesModule keyOf
  16539. */
  16540. /**
  16541. * Allows extraction of a minified key. Let's the build system minify keys
  16542. * without loosing the ability to dynamically use key strings as values
  16543. * themselves. Pass in an object with a single key/val pair and it will return
  16544. * you the string key of that single record. Suppose you want to grab the
  16545. * value for a key 'className' inside of an object. Key/val minification may
  16546. * have aliased that key to be 'xa12'. keyOf({className: null}) will return
  16547. * 'xa12' in that case. Resolve keys you want to use once at startup time, then
  16548. * reuse those resolutions.
  16549. */
  16550. var keyOf = function(oneKeyObj) {
  16551. var key;
  16552. for (key in oneKeyObj) {
  16553. if (!oneKeyObj.hasOwnProperty(key)) {
  16554. continue;
  16555. }
  16556. return key;
  16557. }
  16558. return null;
  16559. };
  16560. module.exports = keyOf;
  16561. },{}],142:[function(_dereq_,module,exports){
  16562. /**
  16563. * Copyright 2013-2015, Facebook, Inc.
  16564. * All rights reserved.
  16565. *
  16566. * This source code is licensed under the BSD-style license found in the
  16567. * LICENSE file in the root directory of this source tree. An additional grant
  16568. * of patent rights can be found in the PATENTS file in the same directory.
  16569. *
  16570. * @providesModule mapObject
  16571. */
  16572. 'use strict';
  16573. var hasOwnProperty = Object.prototype.hasOwnProperty;
  16574. /**
  16575. * Executes the provided `callback` once for each enumerable own property in the
  16576. * object and constructs a new object from the results. The `callback` is
  16577. * invoked with three arguments:
  16578. *
  16579. * - the property value
  16580. * - the property name
  16581. * - the object being traversed
  16582. *
  16583. * Properties that are added after the call to `mapObject` will not be visited
  16584. * by `callback`. If the values of existing properties are changed, the value
  16585. * passed to `callback` will be the value at the time `mapObject` visits them.
  16586. * Properties that are deleted before being visited are not visited.
  16587. *
  16588. * @grep function objectMap()
  16589. * @grep function objMap()
  16590. *
  16591. * @param {?object} object
  16592. * @param {function} callback
  16593. * @param {*} context
  16594. * @return {?object}
  16595. */
  16596. function mapObject(object, callback, context) {
  16597. if (!object) {
  16598. return null;
  16599. }
  16600. var result = {};
  16601. for (var name in object) {
  16602. if (hasOwnProperty.call(object, name)) {
  16603. result[name] = callback.call(context, object[name], name, object);
  16604. }
  16605. }
  16606. return result;
  16607. }
  16608. module.exports = mapObject;
  16609. },{}],143:[function(_dereq_,module,exports){
  16610. /**
  16611. * Copyright 2013-2015, Facebook, Inc.
  16612. * All rights reserved.
  16613. *
  16614. * This source code is licensed under the BSD-style license found in the
  16615. * LICENSE file in the root directory of this source tree. An additional grant
  16616. * of patent rights can be found in the PATENTS file in the same directory.
  16617. *
  16618. * @providesModule memoizeStringOnly
  16619. * @typechecks static-only
  16620. */
  16621. 'use strict';
  16622. /**
  16623. * Memoizes the return value of a function that accepts one string argument.
  16624. *
  16625. * @param {function} callback
  16626. * @return {function}
  16627. */
  16628. function memoizeStringOnly(callback) {
  16629. var cache = {};
  16630. return function(string) {
  16631. if (!cache.hasOwnProperty(string)) {
  16632. cache[string] = callback.call(this, string);
  16633. }
  16634. return cache[string];
  16635. };
  16636. }
  16637. module.exports = memoizeStringOnly;
  16638. },{}],144:[function(_dereq_,module,exports){
  16639. /**
  16640. * Copyright 2013-2015, Facebook, Inc.
  16641. * All rights reserved.
  16642. *
  16643. * This source code is licensed under the BSD-style license found in the
  16644. * LICENSE file in the root directory of this source tree. An additional grant
  16645. * of patent rights can be found in the PATENTS file in the same directory.
  16646. *
  16647. * @providesModule onlyChild
  16648. */
  16649. 'use strict';
  16650. var ReactElement = _dereq_(57);
  16651. var invariant = _dereq_(135);
  16652. /**
  16653. * Returns the first child in a collection of children and verifies that there
  16654. * is only one child in the collection. The current implementation of this
  16655. * function assumes that a single child gets passed without a wrapper, but the
  16656. * purpose of this helper function is to abstract away the particular structure
  16657. * of children.
  16658. *
  16659. * @param {?object} children Child collection structure.
  16660. * @return {ReactComponent} The first and only `ReactComponent` contained in the
  16661. * structure.
  16662. */
  16663. function onlyChild(children) {
  16664. ("production" !== "development" ? invariant(
  16665. ReactElement.isValidElement(children),
  16666. 'onlyChild must be passed a children with exactly one child.'
  16667. ) : invariant(ReactElement.isValidElement(children)));
  16668. return children;
  16669. }
  16670. module.exports = onlyChild;
  16671. },{"135":135,"57":57}],145:[function(_dereq_,module,exports){
  16672. /**
  16673. * Copyright 2013-2015, Facebook, Inc.
  16674. * All rights reserved.
  16675. *
  16676. * This source code is licensed under the BSD-style license found in the
  16677. * LICENSE file in the root directory of this source tree. An additional grant
  16678. * of patent rights can be found in the PATENTS file in the same directory.
  16679. *
  16680. * @providesModule performance
  16681. * @typechecks
  16682. */
  16683. "use strict";
  16684. var ExecutionEnvironment = _dereq_(21);
  16685. var performance;
  16686. if (ExecutionEnvironment.canUseDOM) {
  16687. performance =
  16688. window.performance ||
  16689. window.msPerformance ||
  16690. window.webkitPerformance;
  16691. }
  16692. module.exports = performance || {};
  16693. },{"21":21}],146:[function(_dereq_,module,exports){
  16694. /**
  16695. * Copyright 2013-2015, Facebook, Inc.
  16696. * All rights reserved.
  16697. *
  16698. * This source code is licensed under the BSD-style license found in the
  16699. * LICENSE file in the root directory of this source tree. An additional grant
  16700. * of patent rights can be found in the PATENTS file in the same directory.
  16701. *
  16702. * @providesModule performanceNow
  16703. * @typechecks
  16704. */
  16705. var performance = _dereq_(145);
  16706. /**
  16707. * Detect if we can use `window.performance.now()` and gracefully fallback to
  16708. * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
  16709. * because of Facebook's testing infrastructure.
  16710. */
  16711. if (!performance || !performance.now) {
  16712. performance = Date;
  16713. }
  16714. var performanceNow = performance.now.bind(performance);
  16715. module.exports = performanceNow;
  16716. },{"145":145}],147:[function(_dereq_,module,exports){
  16717. /**
  16718. * Copyright 2013-2015, Facebook, Inc.
  16719. * All rights reserved.
  16720. *
  16721. * This source code is licensed under the BSD-style license found in the
  16722. * LICENSE file in the root directory of this source tree. An additional grant
  16723. * of patent rights can be found in the PATENTS file in the same directory.
  16724. *
  16725. * @providesModule quoteAttributeValueForBrowser
  16726. */
  16727. 'use strict';
  16728. var escapeTextContentForBrowser = _dereq_(116);
  16729. /**
  16730. * Escapes attribute value to prevent scripting attacks.
  16731. *
  16732. * @param {*} value Value to escape.
  16733. * @return {string} An escaped string.
  16734. */
  16735. function quoteAttributeValueForBrowser(value) {
  16736. return '"' + escapeTextContentForBrowser(value) + '"';
  16737. }
  16738. module.exports = quoteAttributeValueForBrowser;
  16739. },{"116":116}],148:[function(_dereq_,module,exports){
  16740. /**
  16741. * Copyright 2013-2015, Facebook, Inc.
  16742. * All rights reserved.
  16743. *
  16744. * This source code is licensed under the BSD-style license found in the
  16745. * LICENSE file in the root directory of this source tree. An additional grant
  16746. * of patent rights can be found in the PATENTS file in the same directory.
  16747. *
  16748. * @providesModule setInnerHTML
  16749. */
  16750. /* globals MSApp */
  16751. 'use strict';
  16752. var ExecutionEnvironment = _dereq_(21);
  16753. var WHITESPACE_TEST = /^[ \r\n\t\f]/;
  16754. var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
  16755. /**
  16756. * Set the innerHTML property of a node, ensuring that whitespace is preserved
  16757. * even in IE8.
  16758. *
  16759. * @param {DOMElement} node
  16760. * @param {string} html
  16761. * @internal
  16762. */
  16763. var setInnerHTML = function(node, html) {
  16764. node.innerHTML = html;
  16765. };
  16766. // Win8 apps: Allow all html to be inserted
  16767. if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
  16768. setInnerHTML = function(node, html) {
  16769. MSApp.execUnsafeLocalFunction(function() {
  16770. node.innerHTML = html;
  16771. });
  16772. };
  16773. }
  16774. if (ExecutionEnvironment.canUseDOM) {
  16775. // IE8: When updating a just created node with innerHTML only leading
  16776. // whitespace is removed. When updating an existing node with innerHTML
  16777. // whitespace in root TextNodes is also collapsed.
  16778. // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
  16779. // Feature detection; only IE8 is known to behave improperly like this.
  16780. var testElement = document.createElement('div');
  16781. testElement.innerHTML = ' ';
  16782. if (testElement.innerHTML === '') {
  16783. setInnerHTML = function(node, html) {
  16784. // Magic theory: IE8 supposedly differentiates between added and updated
  16785. // nodes when processing innerHTML, innerHTML on updated nodes suffers
  16786. // from worse whitespace behavior. Re-adding a node like this triggers
  16787. // the initial and more favorable whitespace behavior.
  16788. // TODO: What to do on a detached node?
  16789. if (node.parentNode) {
  16790. node.parentNode.replaceChild(node, node);
  16791. }
  16792. // We also implement a workaround for non-visible tags disappearing into
  16793. // thin air on IE8, this only happens if there is no visible text
  16794. // in-front of the non-visible tags. Piggyback on the whitespace fix
  16795. // and simply check if any non-visible tags appear in the source.
  16796. if (WHITESPACE_TEST.test(html) ||
  16797. html[0] === '<' && NONVISIBLE_TEST.test(html)) {
  16798. // Recover leading whitespace by temporarily prepending any character.
  16799. // \uFEFF has the potential advantage of being zero-width/invisible.
  16800. node.innerHTML = '\uFEFF' + html;
  16801. // deleteData leaves an empty `TextNode` which offsets the index of all
  16802. // children. Definitely want to avoid this.
  16803. var textNode = node.firstChild;
  16804. if (textNode.data.length === 1) {
  16805. node.removeChild(textNode);
  16806. } else {
  16807. textNode.deleteData(0, 1);
  16808. }
  16809. } else {
  16810. node.innerHTML = html;
  16811. }
  16812. };
  16813. }
  16814. }
  16815. module.exports = setInnerHTML;
  16816. },{"21":21}],149:[function(_dereq_,module,exports){
  16817. /**
  16818. * Copyright 2013-2015, Facebook, Inc.
  16819. * All rights reserved.
  16820. *
  16821. * This source code is licensed under the BSD-style license found in the
  16822. * LICENSE file in the root directory of this source tree. An additional grant
  16823. * of patent rights can be found in the PATENTS file in the same directory.
  16824. *
  16825. * @providesModule setTextContent
  16826. */
  16827. 'use strict';
  16828. var ExecutionEnvironment = _dereq_(21);
  16829. var escapeTextContentForBrowser = _dereq_(116);
  16830. var setInnerHTML = _dereq_(148);
  16831. /**
  16832. * Set the textContent property of a node, ensuring that whitespace is preserved
  16833. * even in IE8. innerText is a poor substitute for textContent and, among many
  16834. * issues, inserts <br> instead of the literal newline chars. innerHTML behaves
  16835. * as it should.
  16836. *
  16837. * @param {DOMElement} node
  16838. * @param {string} text
  16839. * @internal
  16840. */
  16841. var setTextContent = function(node, text) {
  16842. node.textContent = text;
  16843. };
  16844. if (ExecutionEnvironment.canUseDOM) {
  16845. if (!('textContent' in document.documentElement)) {
  16846. setTextContent = function(node, text) {
  16847. setInnerHTML(node, escapeTextContentForBrowser(text));
  16848. };
  16849. }
  16850. }
  16851. module.exports = setTextContent;
  16852. },{"116":116,"148":148,"21":21}],150:[function(_dereq_,module,exports){
  16853. /**
  16854. * Copyright 2013-2015, Facebook, Inc.
  16855. * All rights reserved.
  16856. *
  16857. * This source code is licensed under the BSD-style license found in the
  16858. * LICENSE file in the root directory of this source tree. An additional grant
  16859. * of patent rights can be found in the PATENTS file in the same directory.
  16860. *
  16861. * @providesModule shallowEqual
  16862. */
  16863. 'use strict';
  16864. /**
  16865. * Performs equality by iterating through keys on an object and returning
  16866. * false when any key has values which are not strictly equal between
  16867. * objA and objB. Returns true when the values of all keys are strictly equal.
  16868. *
  16869. * @return {boolean}
  16870. */
  16871. function shallowEqual(objA, objB) {
  16872. if (objA === objB) {
  16873. return true;
  16874. }
  16875. var key;
  16876. // Test for A's keys different from B.
  16877. for (key in objA) {
  16878. if (objA.hasOwnProperty(key) &&
  16879. (!objB.hasOwnProperty(key) || objA[key] !== objB[key])) {
  16880. return false;
  16881. }
  16882. }
  16883. // Test for B's keys missing from A.
  16884. for (key in objB) {
  16885. if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) {
  16886. return false;
  16887. }
  16888. }
  16889. return true;
  16890. }
  16891. module.exports = shallowEqual;
  16892. },{}],151:[function(_dereq_,module,exports){
  16893. /**
  16894. * Copyright 2013-2015, Facebook, Inc.
  16895. * All rights reserved.
  16896. *
  16897. * This source code is licensed under the BSD-style license found in the
  16898. * LICENSE file in the root directory of this source tree. An additional grant
  16899. * of patent rights can be found in the PATENTS file in the same directory.
  16900. *
  16901. * @providesModule shouldUpdateReactComponent
  16902. * @typechecks static-only
  16903. */
  16904. 'use strict';
  16905. var warning = _dereq_(154);
  16906. /**
  16907. * Given a `prevElement` and `nextElement`, determines if the existing
  16908. * instance should be updated as opposed to being destroyed or replaced by a new
  16909. * instance. Both arguments are elements. This ensures that this logic can
  16910. * operate on stateless trees without any backing instance.
  16911. *
  16912. * @param {?object} prevElement
  16913. * @param {?object} nextElement
  16914. * @return {boolean} True if the existing instance should be updated.
  16915. * @protected
  16916. */
  16917. function shouldUpdateReactComponent(prevElement, nextElement) {
  16918. if (prevElement != null && nextElement != null) {
  16919. var prevType = typeof prevElement;
  16920. var nextType = typeof nextElement;
  16921. if (prevType === 'string' || prevType === 'number') {
  16922. return (nextType === 'string' || nextType === 'number');
  16923. } else {
  16924. if (nextType === 'object' &&
  16925. prevElement.type === nextElement.type &&
  16926. prevElement.key === nextElement.key) {
  16927. var ownersMatch = prevElement._owner === nextElement._owner;
  16928. var prevName = null;
  16929. var nextName = null;
  16930. var nextDisplayName = null;
  16931. if ("production" !== "development") {
  16932. if (!ownersMatch) {
  16933. if (prevElement._owner != null &&
  16934. prevElement._owner.getPublicInstance() != null &&
  16935. prevElement._owner.getPublicInstance().constructor != null) {
  16936. prevName =
  16937. prevElement._owner.getPublicInstance().constructor.displayName;
  16938. }
  16939. if (nextElement._owner != null &&
  16940. nextElement._owner.getPublicInstance() != null &&
  16941. nextElement._owner.getPublicInstance().constructor != null) {
  16942. nextName =
  16943. nextElement._owner.getPublicInstance().constructor.displayName;
  16944. }
  16945. if (nextElement.type != null &&
  16946. nextElement.type.displayName != null) {
  16947. nextDisplayName = nextElement.type.displayName;
  16948. }
  16949. if (nextElement.type != null && typeof nextElement.type === 'string') {
  16950. nextDisplayName = nextElement.type;
  16951. }
  16952. if (typeof nextElement.type !== 'string' ||
  16953. nextElement.type === 'input' ||
  16954. nextElement.type === 'textarea') {
  16955. if ((prevElement._owner != null &&
  16956. prevElement._owner._isOwnerNecessary === false) ||
  16957. (nextElement._owner != null &&
  16958. nextElement._owner._isOwnerNecessary === false)) {
  16959. if (prevElement._owner != null) {
  16960. prevElement._owner._isOwnerNecessary = true;
  16961. }
  16962. if (nextElement._owner != null) {
  16963. nextElement._owner._isOwnerNecessary = true;
  16964. }
  16965. ("production" !== "development" ? warning(
  16966. false,
  16967. '<%s /> is being rendered by both %s and %s using the same ' +
  16968. 'key (%s) in the same place. Currently, this means that ' +
  16969. 'they don\'t preserve state. This behavior should be very ' +
  16970. 'rare so we\'re considering deprecating it. Please contact ' +
  16971. 'the React team and explain your use case so that we can ' +
  16972. 'take that into consideration.',
  16973. nextDisplayName || 'Unknown Component',
  16974. prevName || '[Unknown]',
  16975. nextName || '[Unknown]',
  16976. prevElement.key
  16977. ) : null);
  16978. }
  16979. }
  16980. }
  16981. }
  16982. return ownersMatch;
  16983. }
  16984. }
  16985. }
  16986. return false;
  16987. }
  16988. module.exports = shouldUpdateReactComponent;
  16989. },{"154":154}],152:[function(_dereq_,module,exports){
  16990. /**
  16991. * Copyright 2014-2015, Facebook, Inc.
  16992. * All rights reserved.
  16993. *
  16994. * This source code is licensed under the BSD-style license found in the
  16995. * LICENSE file in the root directory of this source tree. An additional grant
  16996. * of patent rights can be found in the PATENTS file in the same directory.
  16997. *
  16998. * @providesModule toArray
  16999. * @typechecks
  17000. */
  17001. var invariant = _dereq_(135);
  17002. /**
  17003. * Convert array-like objects to arrays.
  17004. *
  17005. * This API assumes the caller knows the contents of the data type. For less
  17006. * well defined inputs use createArrayFromMixed.
  17007. *
  17008. * @param {object|function|filelist} obj
  17009. * @return {array}
  17010. */
  17011. function toArray(obj) {
  17012. var length = obj.length;
  17013. // Some browse builtin objects can report typeof 'function' (e.g. NodeList in
  17014. // old versions of Safari).
  17015. ("production" !== "development" ? invariant(
  17016. !Array.isArray(obj) &&
  17017. (typeof obj === 'object' || typeof obj === 'function'),
  17018. 'toArray: Array-like object expected'
  17019. ) : invariant(!Array.isArray(obj) &&
  17020. (typeof obj === 'object' || typeof obj === 'function')));
  17021. ("production" !== "development" ? invariant(
  17022. typeof length === 'number',
  17023. 'toArray: Object needs a length property'
  17024. ) : invariant(typeof length === 'number'));
  17025. ("production" !== "development" ? invariant(
  17026. length === 0 ||
  17027. (length - 1) in obj,
  17028. 'toArray: Object should have keys for indices'
  17029. ) : invariant(length === 0 ||
  17030. (length - 1) in obj));
  17031. // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
  17032. // without method will throw during the slice call and skip straight to the
  17033. // fallback.
  17034. if (obj.hasOwnProperty) {
  17035. try {
  17036. return Array.prototype.slice.call(obj);
  17037. } catch (e) {
  17038. // IE < 9 does not support Array#slice on collections objects
  17039. }
  17040. }
  17041. // Fall back to copying key by key. This assumes all keys have a value,
  17042. // so will not preserve sparsely populated inputs.
  17043. var ret = Array(length);
  17044. for (var ii = 0; ii < length; ii++) {
  17045. ret[ii] = obj[ii];
  17046. }
  17047. return ret;
  17048. }
  17049. module.exports = toArray;
  17050. },{"135":135}],153:[function(_dereq_,module,exports){
  17051. /**
  17052. * Copyright 2013-2015, Facebook, Inc.
  17053. * All rights reserved.
  17054. *
  17055. * This source code is licensed under the BSD-style license found in the
  17056. * LICENSE file in the root directory of this source tree. An additional grant
  17057. * of patent rights can be found in the PATENTS file in the same directory.
  17058. *
  17059. * @providesModule traverseAllChildren
  17060. */
  17061. 'use strict';
  17062. var ReactElement = _dereq_(57);
  17063. var ReactFragment = _dereq_(63);
  17064. var ReactInstanceHandles = _dereq_(66);
  17065. var getIteratorFn = _dereq_(126);
  17066. var invariant = _dereq_(135);
  17067. var warning = _dereq_(154);
  17068. var SEPARATOR = ReactInstanceHandles.SEPARATOR;
  17069. var SUBSEPARATOR = ':';
  17070. /**
  17071. * TODO: Test that a single child and an array with one item have the same key
  17072. * pattern.
  17073. */
  17074. var userProvidedKeyEscaperLookup = {
  17075. '=': '=0',
  17076. '.': '=1',
  17077. ':': '=2'
  17078. };
  17079. var userProvidedKeyEscapeRegex = /[=.:]/g;
  17080. var didWarnAboutMaps = false;
  17081. function userProvidedKeyEscaper(match) {
  17082. return userProvidedKeyEscaperLookup[match];
  17083. }
  17084. /**
  17085. * Generate a key string that identifies a component within a set.
  17086. *
  17087. * @param {*} component A component that could contain a manual key.
  17088. * @param {number} index Index that is used if a manual key is not provided.
  17089. * @return {string}
  17090. */
  17091. function getComponentKey(component, index) {
  17092. if (component && component.key != null) {
  17093. // Explicit key
  17094. return wrapUserProvidedKey(component.key);
  17095. }
  17096. // Implicit key determined by the index in the set
  17097. return index.toString(36);
  17098. }
  17099. /**
  17100. * Escape a component key so that it is safe to use in a reactid.
  17101. *
  17102. * @param {*} key Component key to be escaped.
  17103. * @return {string} An escaped string.
  17104. */
  17105. function escapeUserProvidedKey(text) {
  17106. return ('' + text).replace(
  17107. userProvidedKeyEscapeRegex,
  17108. userProvidedKeyEscaper
  17109. );
  17110. }
  17111. /**
  17112. * Wrap a `key` value explicitly provided by the user to distinguish it from
  17113. * implicitly-generated keys generated by a component's index in its parent.
  17114. *
  17115. * @param {string} key Value of a user-provided `key` attribute
  17116. * @return {string}
  17117. */
  17118. function wrapUserProvidedKey(key) {
  17119. return '$' + escapeUserProvidedKey(key);
  17120. }
  17121. /**
  17122. * @param {?*} children Children tree container.
  17123. * @param {!string} nameSoFar Name of the key path so far.
  17124. * @param {!number} indexSoFar Number of children encountered until this point.
  17125. * @param {!function} callback Callback to invoke with each child found.
  17126. * @param {?*} traverseContext Used to pass information throughout the traversal
  17127. * process.
  17128. * @return {!number} The number of children in this subtree.
  17129. */
  17130. function traverseAllChildrenImpl(
  17131. children,
  17132. nameSoFar,
  17133. indexSoFar,
  17134. callback,
  17135. traverseContext
  17136. ) {
  17137. var type = typeof children;
  17138. if (type === 'undefined' || type === 'boolean') {
  17139. // All of the above are perceived as null.
  17140. children = null;
  17141. }
  17142. if (children === null ||
  17143. type === 'string' ||
  17144. type === 'number' ||
  17145. ReactElement.isValidElement(children)) {
  17146. callback(
  17147. traverseContext,
  17148. children,
  17149. // If it's the only child, treat the name as if it was wrapped in an array
  17150. // so that it's consistent if the number of children grows.
  17151. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar,
  17152. indexSoFar
  17153. );
  17154. return 1;
  17155. }
  17156. var child, nextName, nextIndex;
  17157. var subtreeCount = 0; // Count of children found in the current subtree.
  17158. if (Array.isArray(children)) {
  17159. for (var i = 0; i < children.length; i++) {
  17160. child = children[i];
  17161. nextName = (
  17162. (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
  17163. getComponentKey(child, i)
  17164. );
  17165. nextIndex = indexSoFar + subtreeCount;
  17166. subtreeCount += traverseAllChildrenImpl(
  17167. child,
  17168. nextName,
  17169. nextIndex,
  17170. callback,
  17171. traverseContext
  17172. );
  17173. }
  17174. } else {
  17175. var iteratorFn = getIteratorFn(children);
  17176. if (iteratorFn) {
  17177. var iterator = iteratorFn.call(children);
  17178. var step;
  17179. if (iteratorFn !== children.entries) {
  17180. var ii = 0;
  17181. while (!(step = iterator.next()).done) {
  17182. child = step.value;
  17183. nextName = (
  17184. (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
  17185. getComponentKey(child, ii++)
  17186. );
  17187. nextIndex = indexSoFar + subtreeCount;
  17188. subtreeCount += traverseAllChildrenImpl(
  17189. child,
  17190. nextName,
  17191. nextIndex,
  17192. callback,
  17193. traverseContext
  17194. );
  17195. }
  17196. } else {
  17197. if ("production" !== "development") {
  17198. ("production" !== "development" ? warning(
  17199. didWarnAboutMaps,
  17200. 'Using Maps as children is not yet fully supported. It is an ' +
  17201. 'experimental feature that might be removed. Convert it to a ' +
  17202. 'sequence / iterable of keyed ReactElements instead.'
  17203. ) : null);
  17204. didWarnAboutMaps = true;
  17205. }
  17206. // Iterator will provide entry [k,v] tuples rather than values.
  17207. while (!(step = iterator.next()).done) {
  17208. var entry = step.value;
  17209. if (entry) {
  17210. child = entry[1];
  17211. nextName = (
  17212. (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
  17213. wrapUserProvidedKey(entry[0]) + SUBSEPARATOR +
  17214. getComponentKey(child, 0)
  17215. );
  17216. nextIndex = indexSoFar + subtreeCount;
  17217. subtreeCount += traverseAllChildrenImpl(
  17218. child,
  17219. nextName,
  17220. nextIndex,
  17221. callback,
  17222. traverseContext
  17223. );
  17224. }
  17225. }
  17226. }
  17227. } else if (type === 'object') {
  17228. ("production" !== "development" ? invariant(
  17229. children.nodeType !== 1,
  17230. 'traverseAllChildren(...): Encountered an invalid child; DOM ' +
  17231. 'elements are not valid children of React components.'
  17232. ) : invariant(children.nodeType !== 1));
  17233. var fragment = ReactFragment.extract(children);
  17234. for (var key in fragment) {
  17235. if (fragment.hasOwnProperty(key)) {
  17236. child = fragment[key];
  17237. nextName = (
  17238. (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
  17239. wrapUserProvidedKey(key) + SUBSEPARATOR +
  17240. getComponentKey(child, 0)
  17241. );
  17242. nextIndex = indexSoFar + subtreeCount;
  17243. subtreeCount += traverseAllChildrenImpl(
  17244. child,
  17245. nextName,
  17246. nextIndex,
  17247. callback,
  17248. traverseContext
  17249. );
  17250. }
  17251. }
  17252. }
  17253. }
  17254. return subtreeCount;
  17255. }
  17256. /**
  17257. * Traverses children that are typically specified as `props.children`, but
  17258. * might also be specified through attributes:
  17259. *
  17260. * - `traverseAllChildren(this.props.children, ...)`
  17261. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  17262. *
  17263. * The `traverseContext` is an optional argument that is passed through the
  17264. * entire traversal. It can be used to store accumulations or anything else that
  17265. * the callback might find relevant.
  17266. *
  17267. * @param {?*} children Children tree object.
  17268. * @param {!function} callback To invoke upon traversing each child.
  17269. * @param {?*} traverseContext Context for traversal.
  17270. * @return {!number} The number of children in this subtree.
  17271. */
  17272. function traverseAllChildren(children, callback, traverseContext) {
  17273. if (children == null) {
  17274. return 0;
  17275. }
  17276. return traverseAllChildrenImpl(children, '', 0, callback, traverseContext);
  17277. }
  17278. module.exports = traverseAllChildren;
  17279. },{"126":126,"135":135,"154":154,"57":57,"63":63,"66":66}],154:[function(_dereq_,module,exports){
  17280. /**
  17281. * Copyright 2014-2015, Facebook, Inc.
  17282. * All rights reserved.
  17283. *
  17284. * This source code is licensed under the BSD-style license found in the
  17285. * LICENSE file in the root directory of this source tree. An additional grant
  17286. * of patent rights can be found in the PATENTS file in the same directory.
  17287. *
  17288. * @providesModule warning
  17289. */
  17290. "use strict";
  17291. var emptyFunction = _dereq_(114);
  17292. /**
  17293. * Similar to invariant but only logs a warning if the condition is not met.
  17294. * This can be used to log issues in development environments in critical
  17295. * paths. Removing the logging code for production environments will keep the
  17296. * same logic and follow the same code paths.
  17297. */
  17298. var warning = emptyFunction;
  17299. if ("production" !== "development") {
  17300. warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
  17301. if (format === undefined) {
  17302. throw new Error(
  17303. '`warning(condition, format, ...args)` requires a warning ' +
  17304. 'message argument'
  17305. );
  17306. }
  17307. if (format.length < 10 || /^[s\W]*$/.test(format)) {
  17308. throw new Error(
  17309. 'The warning format should be able to uniquely identify this ' +
  17310. 'warning. Please, use a more descriptive format than: ' + format
  17311. );
  17312. }
  17313. if (format.indexOf('Failed Composite propType: ') === 0) {
  17314. return; // Ignore CompositeComponent proptype check.
  17315. }
  17316. if (!condition) {
  17317. var argIndex = 0;
  17318. var message = 'Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];});
  17319. console.warn(message);
  17320. try {
  17321. // --- Welcome to debugging React ---
  17322. // This error was thrown as a convenience so that you can use this stack
  17323. // to find the callsite that caused this warning to fire.
  17324. throw new Error(message);
  17325. } catch(x) {}
  17326. }
  17327. };
  17328. }
  17329. module.exports = warning;
  17330. },{"114":114}]},{},[1])(1)
  17331. });