react.js 691 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764
  1. /**
  2. * React (with addons) v0.14.6
  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 ReactWithAddons
  14. */
  15. /**
  16. * This module exists purely in the open source project, and is meant as a way
  17. * to create a separate standalone build of React. This build has "addons", or
  18. * functionality we've built and think might be useful but doesn't have a good
  19. * place to live inside React core.
  20. */
  21. 'use strict';
  22. var LinkedStateMixin = _dereq_(22);
  23. var React = _dereq_(26);
  24. var ReactComponentWithPureRenderMixin = _dereq_(37);
  25. var ReactCSSTransitionGroup = _dereq_(29);
  26. var ReactFragment = _dereq_(64);
  27. var ReactTransitionGroup = _dereq_(94);
  28. var ReactUpdates = _dereq_(96);
  29. var cloneWithProps = _dereq_(118);
  30. var shallowCompare = _dereq_(140);
  31. var update = _dereq_(143);
  32. var warning = _dereq_(173);
  33. var warnedAboutBatchedUpdates = false;
  34. React.addons = {
  35. CSSTransitionGroup: ReactCSSTransitionGroup,
  36. LinkedStateMixin: LinkedStateMixin,
  37. PureRenderMixin: ReactComponentWithPureRenderMixin,
  38. TransitionGroup: ReactTransitionGroup,
  39. batchedUpdates: function () {
  40. if ("production" !== 'production') {
  41. "production" !== 'production' ? warning(warnedAboutBatchedUpdates, 'React.addons.batchedUpdates is deprecated. Use ' + 'ReactDOM.unstable_batchedUpdates instead.') : undefined;
  42. warnedAboutBatchedUpdates = true;
  43. }
  44. return ReactUpdates.batchedUpdates.apply(this, arguments);
  45. },
  46. cloneWithProps: cloneWithProps,
  47. createFragment: ReactFragment.create,
  48. shallowCompare: shallowCompare,
  49. update: update
  50. };
  51. React.addons.TestUtils = _dereq_(91);
  52. if ("production" !== 'production') {
  53. React.addons.Perf = _dereq_(55);
  54. }
  55. module.exports = React;
  56. },{"118":118,"140":140,"143":143,"173":173,"22":22,"26":26,"29":29,"37":37,"55":55,"64":64,"91":91,"94":94,"96":96}],2:[function(_dereq_,module,exports){
  57. /**
  58. * Copyright 2013-2015, Facebook, Inc.
  59. * All rights reserved.
  60. *
  61. * This source code is licensed under the BSD-style license found in the
  62. * LICENSE file in the root directory of this source tree. An additional grant
  63. * of patent rights can be found in the PATENTS file in the same directory.
  64. *
  65. * @providesModule AutoFocusUtils
  66. * @typechecks static-only
  67. */
  68. 'use strict';
  69. var ReactMount = _dereq_(72);
  70. var findDOMNode = _dereq_(122);
  71. var focusNode = _dereq_(155);
  72. var Mixin = {
  73. componentDidMount: function () {
  74. if (this.props.autoFocus) {
  75. focusNode(findDOMNode(this));
  76. }
  77. }
  78. };
  79. var AutoFocusUtils = {
  80. Mixin: Mixin,
  81. focusDOMComponent: function () {
  82. focusNode(ReactMount.getNode(this._rootNodeID));
  83. }
  84. };
  85. module.exports = AutoFocusUtils;
  86. },{"122":122,"155":155,"72":72}],3:[function(_dereq_,module,exports){
  87. /**
  88. * Copyright 2013-2015 Facebook, Inc.
  89. * All rights reserved.
  90. *
  91. * This source code is licensed under the BSD-style license found in the
  92. * LICENSE file in the root directory of this source tree. An additional grant
  93. * of patent rights can be found in the PATENTS file in the same directory.
  94. *
  95. * @providesModule BeforeInputEventPlugin
  96. * @typechecks static-only
  97. */
  98. 'use strict';
  99. var EventConstants = _dereq_(15);
  100. var EventPropagators = _dereq_(19);
  101. var ExecutionEnvironment = _dereq_(147);
  102. var FallbackCompositionState = _dereq_(20);
  103. var SyntheticCompositionEvent = _dereq_(103);
  104. var SyntheticInputEvent = _dereq_(107);
  105. var keyOf = _dereq_(166);
  106. var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
  107. var START_KEYCODE = 229;
  108. var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
  109. var documentMode = null;
  110. if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
  111. documentMode = document.documentMode;
  112. }
  113. // Webkit offers a very useful `textInput` event that can be used to
  114. // directly represent `beforeInput`. The IE `textinput` event is not as
  115. // useful, so we don't use it.
  116. var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
  117. // In IE9+, we have access to composition events, but the data supplied
  118. // by the native compositionend event may be incorrect. Japanese ideographic
  119. // spaces, for instance (\u3000) are not recorded correctly.
  120. var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
  121. /**
  122. * Opera <= 12 includes TextEvent in window, but does not fire
  123. * text input events. Rely on keypress instead.
  124. */
  125. function isPresto() {
  126. var opera = window.opera;
  127. return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
  128. }
  129. var SPACEBAR_CODE = 32;
  130. var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
  131. var topLevelTypes = EventConstants.topLevelTypes;
  132. // Events and their corresponding property names.
  133. var eventTypes = {
  134. beforeInput: {
  135. phasedRegistrationNames: {
  136. bubbled: keyOf({ onBeforeInput: null }),
  137. captured: keyOf({ onBeforeInputCapture: null })
  138. },
  139. dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
  140. },
  141. compositionEnd: {
  142. phasedRegistrationNames: {
  143. bubbled: keyOf({ onCompositionEnd: null }),
  144. captured: keyOf({ onCompositionEndCapture: null })
  145. },
  146. dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
  147. },
  148. compositionStart: {
  149. phasedRegistrationNames: {
  150. bubbled: keyOf({ onCompositionStart: null }),
  151. captured: keyOf({ onCompositionStartCapture: null })
  152. },
  153. dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
  154. },
  155. compositionUpdate: {
  156. phasedRegistrationNames: {
  157. bubbled: keyOf({ onCompositionUpdate: null }),
  158. captured: keyOf({ onCompositionUpdateCapture: null })
  159. },
  160. dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
  161. }
  162. };
  163. // Track whether we've ever handled a keypress on the space key.
  164. var hasSpaceKeypress = false;
  165. /**
  166. * Return whether a native keypress event is assumed to be a command.
  167. * This is required because Firefox fires `keypress` events for key commands
  168. * (cut, copy, select-all, etc.) even though no character is inserted.
  169. */
  170. function isKeypressCommand(nativeEvent) {
  171. return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
  172. // ctrlKey && altKey is equivalent to AltGr, and is not a command.
  173. !(nativeEvent.ctrlKey && nativeEvent.altKey);
  174. }
  175. /**
  176. * Translate native top level events into event types.
  177. *
  178. * @param {string} topLevelType
  179. * @return {object}
  180. */
  181. function getCompositionEventType(topLevelType) {
  182. switch (topLevelType) {
  183. case topLevelTypes.topCompositionStart:
  184. return eventTypes.compositionStart;
  185. case topLevelTypes.topCompositionEnd:
  186. return eventTypes.compositionEnd;
  187. case topLevelTypes.topCompositionUpdate:
  188. return eventTypes.compositionUpdate;
  189. }
  190. }
  191. /**
  192. * Does our fallback best-guess model think this event signifies that
  193. * composition has begun?
  194. *
  195. * @param {string} topLevelType
  196. * @param {object} nativeEvent
  197. * @return {boolean}
  198. */
  199. function isFallbackCompositionStart(topLevelType, nativeEvent) {
  200. return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE;
  201. }
  202. /**
  203. * Does our fallback mode think that this event is the end of composition?
  204. *
  205. * @param {string} topLevelType
  206. * @param {object} nativeEvent
  207. * @return {boolean}
  208. */
  209. function isFallbackCompositionEnd(topLevelType, nativeEvent) {
  210. switch (topLevelType) {
  211. case topLevelTypes.topKeyUp:
  212. // Command keys insert or clear IME input.
  213. return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
  214. case topLevelTypes.topKeyDown:
  215. // Expect IME keyCode on each keydown. If we get any other
  216. // code we must have exited earlier.
  217. return nativeEvent.keyCode !== START_KEYCODE;
  218. case topLevelTypes.topKeyPress:
  219. case topLevelTypes.topMouseDown:
  220. case topLevelTypes.topBlur:
  221. // Events are not possible without cancelling IME.
  222. return true;
  223. default:
  224. return false;
  225. }
  226. }
  227. /**
  228. * Google Input Tools provides composition data via a CustomEvent,
  229. * with the `data` property populated in the `detail` object. If this
  230. * is available on the event object, use it. If not, this is a plain
  231. * composition event and we have nothing special to extract.
  232. *
  233. * @param {object} nativeEvent
  234. * @return {?string}
  235. */
  236. function getDataFromCustomEvent(nativeEvent) {
  237. var detail = nativeEvent.detail;
  238. if (typeof detail === 'object' && 'data' in detail) {
  239. return detail.data;
  240. }
  241. return null;
  242. }
  243. // Track the current IME composition fallback object, if any.
  244. var currentComposition = null;
  245. /**
  246. * @param {string} topLevelType Record from `EventConstants`.
  247. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  248. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  249. * @param {object} nativeEvent Native browser event.
  250. * @return {?object} A SyntheticCompositionEvent.
  251. */
  252. function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
  253. var eventType;
  254. var fallbackData;
  255. if (canUseCompositionEvent) {
  256. eventType = getCompositionEventType(topLevelType);
  257. } else if (!currentComposition) {
  258. if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
  259. eventType = eventTypes.compositionStart;
  260. }
  261. } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  262. eventType = eventTypes.compositionEnd;
  263. }
  264. if (!eventType) {
  265. return null;
  266. }
  267. if (useFallbackCompositionData) {
  268. // The current composition is stored statically and must not be
  269. // overwritten while composition continues.
  270. if (!currentComposition && eventType === eventTypes.compositionStart) {
  271. currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
  272. } else if (eventType === eventTypes.compositionEnd) {
  273. if (currentComposition) {
  274. fallbackData = currentComposition.getData();
  275. }
  276. }
  277. }
  278. var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget);
  279. if (fallbackData) {
  280. // Inject data generated from fallback path into the synthetic event.
  281. // This matches the property of native CompositionEventInterface.
  282. event.data = fallbackData;
  283. } else {
  284. var customData = getDataFromCustomEvent(nativeEvent);
  285. if (customData !== null) {
  286. event.data = customData;
  287. }
  288. }
  289. EventPropagators.accumulateTwoPhaseDispatches(event);
  290. return event;
  291. }
  292. /**
  293. * @param {string} topLevelType Record from `EventConstants`.
  294. * @param {object} nativeEvent Native browser event.
  295. * @return {?string} The string corresponding to this `beforeInput` event.
  296. */
  297. function getNativeBeforeInputChars(topLevelType, nativeEvent) {
  298. switch (topLevelType) {
  299. case topLevelTypes.topCompositionEnd:
  300. return getDataFromCustomEvent(nativeEvent);
  301. case topLevelTypes.topKeyPress:
  302. /**
  303. * If native `textInput` events are available, our goal is to make
  304. * use of them. However, there is a special case: the spacebar key.
  305. * In Webkit, preventing default on a spacebar `textInput` event
  306. * cancels character insertion, but it *also* causes the browser
  307. * to fall back to its default spacebar behavior of scrolling the
  308. * page.
  309. *
  310. * Tracking at:
  311. * https://code.google.com/p/chromium/issues/detail?id=355103
  312. *
  313. * To avoid this issue, use the keypress event as if no `textInput`
  314. * event is available.
  315. */
  316. var which = nativeEvent.which;
  317. if (which !== SPACEBAR_CODE) {
  318. return null;
  319. }
  320. hasSpaceKeypress = true;
  321. return SPACEBAR_CHAR;
  322. case topLevelTypes.topTextInput:
  323. // Record the characters to be added to the DOM.
  324. var chars = nativeEvent.data;
  325. // If it's a spacebar character, assume that we have already handled
  326. // it at the keypress level and bail immediately. Android Chrome
  327. // doesn't give us keycodes, so we need to blacklist it.
  328. if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
  329. return null;
  330. }
  331. return chars;
  332. default:
  333. // For other native event types, do nothing.
  334. return null;
  335. }
  336. }
  337. /**
  338. * For browsers that do not provide the `textInput` event, extract the
  339. * appropriate string to use for SyntheticInputEvent.
  340. *
  341. * @param {string} topLevelType Record from `EventConstants`.
  342. * @param {object} nativeEvent Native browser event.
  343. * @return {?string} The fallback string for this `beforeInput` event.
  344. */
  345. function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
  346. // If we are currently composing (IME) and using a fallback to do so,
  347. // try to extract the composed characters from the fallback object.
  348. if (currentComposition) {
  349. if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  350. var chars = currentComposition.getData();
  351. FallbackCompositionState.release(currentComposition);
  352. currentComposition = null;
  353. return chars;
  354. }
  355. return null;
  356. }
  357. switch (topLevelType) {
  358. case topLevelTypes.topPaste:
  359. // If a paste event occurs after a keypress, throw out the input
  360. // chars. Paste events should not lead to BeforeInput events.
  361. return null;
  362. case topLevelTypes.topKeyPress:
  363. /**
  364. * As of v27, Firefox may fire keypress events even when no character
  365. * will be inserted. A few possibilities:
  366. *
  367. * - `which` is `0`. Arrow keys, Esc key, etc.
  368. *
  369. * - `which` is the pressed key code, but no char is available.
  370. * Ex: 'AltGr + d` in Polish. There is no modified character for
  371. * this key combination and no character is inserted into the
  372. * document, but FF fires the keypress for char code `100` anyway.
  373. * No `input` event will occur.
  374. *
  375. * - `which` is the pressed key code, but a command combination is
  376. * being used. Ex: `Cmd+C`. No character is inserted, and no
  377. * `input` event will occur.
  378. */
  379. if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
  380. return String.fromCharCode(nativeEvent.which);
  381. }
  382. return null;
  383. case topLevelTypes.topCompositionEnd:
  384. return useFallbackCompositionData ? null : nativeEvent.data;
  385. default:
  386. return null;
  387. }
  388. }
  389. /**
  390. * Extract a SyntheticInputEvent for `beforeInput`, based on either native
  391. * `textInput` or fallback behavior.
  392. *
  393. * @param {string} topLevelType Record from `EventConstants`.
  394. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  395. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  396. * @param {object} nativeEvent Native browser event.
  397. * @return {?object} A SyntheticInputEvent.
  398. */
  399. function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
  400. var chars;
  401. if (canUseTextInputEvent) {
  402. chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
  403. } else {
  404. chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
  405. }
  406. // If no characters are being inserted, no BeforeInput event should
  407. // be fired.
  408. if (!chars) {
  409. return null;
  410. }
  411. var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget);
  412. event.data = chars;
  413. EventPropagators.accumulateTwoPhaseDispatches(event);
  414. return event;
  415. }
  416. /**
  417. * Create an `onBeforeInput` event to match
  418. * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
  419. *
  420. * This event plugin is based on the native `textInput` event
  421. * available in Chrome, Safari, Opera, and IE. This event fires after
  422. * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
  423. *
  424. * `beforeInput` is spec'd but not implemented in any browsers, and
  425. * the `input` event does not provide any useful information about what has
  426. * actually been added, contrary to the spec. Thus, `textInput` is the best
  427. * available event to identify the characters that have actually been inserted
  428. * into the target node.
  429. *
  430. * This plugin is also responsible for emitting `composition` events, thus
  431. * allowing us to share composition fallback code for both `beforeInput` and
  432. * `composition` event types.
  433. */
  434. var BeforeInputEventPlugin = {
  435. eventTypes: eventTypes,
  436. /**
  437. * @param {string} topLevelType Record from `EventConstants`.
  438. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  439. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  440. * @param {object} nativeEvent Native browser event.
  441. * @return {*} An accumulation of synthetic events.
  442. * @see {EventPluginHub.extractEvents}
  443. */
  444. extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
  445. return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)];
  446. }
  447. };
  448. module.exports = BeforeInputEventPlugin;
  449. },{"103":103,"107":107,"147":147,"15":15,"166":166,"19":19,"20":20}],4:[function(_dereq_,module,exports){
  450. /**
  451. * Copyright 2013-2015, Facebook, Inc.
  452. * All rights reserved.
  453. *
  454. * This source code is licensed under the BSD-style license found in the
  455. * LICENSE file in the root directory of this source tree. An additional grant
  456. * of patent rights can be found in the PATENTS file in the same directory.
  457. *
  458. * @providesModule CSSProperty
  459. */
  460. 'use strict';
  461. /**
  462. * CSS properties which accept numbers but are not in units of "px".
  463. */
  464. var isUnitlessNumber = {
  465. animationIterationCount: true,
  466. boxFlex: true,
  467. boxFlexGroup: true,
  468. boxOrdinalGroup: true,
  469. columnCount: true,
  470. flex: true,
  471. flexGrow: true,
  472. flexPositive: true,
  473. flexShrink: true,
  474. flexNegative: true,
  475. flexOrder: true,
  476. fontWeight: true,
  477. lineClamp: true,
  478. lineHeight: true,
  479. opacity: true,
  480. order: true,
  481. orphans: true,
  482. tabSize: true,
  483. widows: true,
  484. zIndex: true,
  485. zoom: true,
  486. // SVG-related properties
  487. fillOpacity: true,
  488. stopOpacity: true,
  489. strokeDashoffset: true,
  490. strokeOpacity: true,
  491. strokeWidth: true
  492. };
  493. /**
  494. * @param {string} prefix vendor-specific prefix, eg: Webkit
  495. * @param {string} key style name, eg: transitionDuration
  496. * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
  497. * WebkitTransitionDuration
  498. */
  499. function prefixKey(prefix, key) {
  500. return prefix + key.charAt(0).toUpperCase() + key.substring(1);
  501. }
  502. /**
  503. * Support style names that may come passed in prefixed by adding permutations
  504. * of vendor prefixes.
  505. */
  506. var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
  507. // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
  508. // infinite loop, because it iterates over the newly added props too.
  509. Object.keys(isUnitlessNumber).forEach(function (prop) {
  510. prefixes.forEach(function (prefix) {
  511. isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
  512. });
  513. });
  514. /**
  515. * Most style properties can be unset by doing .style[prop] = '' but IE8
  516. * doesn't like doing that with shorthand properties so for the properties that
  517. * IE8 breaks on, which are listed here, we instead unset each of the
  518. * individual properties. See http://bugs.jquery.com/ticket/12385.
  519. * The 4-value 'clock' properties like margin, padding, border-width seem to
  520. * behave without any problems. Curiously, list-style works too without any
  521. * special prodding.
  522. */
  523. var shorthandPropertyExpansions = {
  524. background: {
  525. backgroundAttachment: true,
  526. backgroundColor: true,
  527. backgroundImage: true,
  528. backgroundPositionX: true,
  529. backgroundPositionY: true,
  530. backgroundRepeat: true
  531. },
  532. backgroundPosition: {
  533. backgroundPositionX: true,
  534. backgroundPositionY: true
  535. },
  536. border: {
  537. borderWidth: true,
  538. borderStyle: true,
  539. borderColor: true
  540. },
  541. borderBottom: {
  542. borderBottomWidth: true,
  543. borderBottomStyle: true,
  544. borderBottomColor: true
  545. },
  546. borderLeft: {
  547. borderLeftWidth: true,
  548. borderLeftStyle: true,
  549. borderLeftColor: true
  550. },
  551. borderRight: {
  552. borderRightWidth: true,
  553. borderRightStyle: true,
  554. borderRightColor: true
  555. },
  556. borderTop: {
  557. borderTopWidth: true,
  558. borderTopStyle: true,
  559. borderTopColor: true
  560. },
  561. font: {
  562. fontStyle: true,
  563. fontVariant: true,
  564. fontWeight: true,
  565. fontSize: true,
  566. lineHeight: true,
  567. fontFamily: true
  568. },
  569. outline: {
  570. outlineWidth: true,
  571. outlineStyle: true,
  572. outlineColor: true
  573. }
  574. };
  575. var CSSProperty = {
  576. isUnitlessNumber: isUnitlessNumber,
  577. shorthandPropertyExpansions: shorthandPropertyExpansions
  578. };
  579. module.exports = CSSProperty;
  580. },{}],5:[function(_dereq_,module,exports){
  581. /**
  582. * Copyright 2013-2015, Facebook, Inc.
  583. * All rights reserved.
  584. *
  585. * This source code is licensed under the BSD-style license found in the
  586. * LICENSE file in the root directory of this source tree. An additional grant
  587. * of patent rights can be found in the PATENTS file in the same directory.
  588. *
  589. * @providesModule CSSPropertyOperations
  590. * @typechecks static-only
  591. */
  592. 'use strict';
  593. var CSSProperty = _dereq_(4);
  594. var ExecutionEnvironment = _dereq_(147);
  595. var ReactPerf = _dereq_(78);
  596. var camelizeStyleName = _dereq_(149);
  597. var dangerousStyleValue = _dereq_(119);
  598. var hyphenateStyleName = _dereq_(160);
  599. var memoizeStringOnly = _dereq_(168);
  600. var warning = _dereq_(173);
  601. var processStyleName = memoizeStringOnly(function (styleName) {
  602. return hyphenateStyleName(styleName);
  603. });
  604. var hasShorthandPropertyBug = false;
  605. var styleFloatAccessor = 'cssFloat';
  606. if (ExecutionEnvironment.canUseDOM) {
  607. var tempStyle = document.createElementNS('http://www.w3.org/1999/xhtml', 'div').style;
  608. try {
  609. // IE8 throws "Invalid argument." if resetting shorthand style properties.
  610. tempStyle.font = '';
  611. } catch (e) {
  612. hasShorthandPropertyBug = true;
  613. }
  614. // IE8 only supports accessing cssFloat (standard) as styleFloat
  615. if (document.documentElement.style.cssFloat === undefined) {
  616. styleFloatAccessor = 'styleFloat';
  617. }
  618. }
  619. if ("production" !== 'production') {
  620. // 'msTransform' is correct, but the other prefixes should be capitalized
  621. var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
  622. // style values shouldn't contain a semicolon
  623. var badStyleValueWithSemicolonPattern = /;\s*$/;
  624. var warnedStyleNames = {};
  625. var warnedStyleValues = {};
  626. var warnHyphenatedStyleName = function (name) {
  627. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  628. return;
  629. }
  630. warnedStyleNames[name] = true;
  631. "production" !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined;
  632. };
  633. var warnBadVendoredStyleName = function (name) {
  634. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  635. return;
  636. }
  637. warnedStyleNames[name] = true;
  638. "production" !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined;
  639. };
  640. var warnStyleValueWithSemicolon = function (name, value) {
  641. if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
  642. return;
  643. }
  644. warnedStyleValues[value] = true;
  645. "production" !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined;
  646. };
  647. /**
  648. * @param {string} name
  649. * @param {*} value
  650. */
  651. var warnValidStyle = function (name, value) {
  652. if (name.indexOf('-') > -1) {
  653. warnHyphenatedStyleName(name);
  654. } else if (badVendoredStyleNamePattern.test(name)) {
  655. warnBadVendoredStyleName(name);
  656. } else if (badStyleValueWithSemicolonPattern.test(value)) {
  657. warnStyleValueWithSemicolon(name, value);
  658. }
  659. };
  660. }
  661. /**
  662. * Operations for dealing with CSS properties.
  663. */
  664. var CSSPropertyOperations = {
  665. /**
  666. * Serializes a mapping of style properties for use as inline styles:
  667. *
  668. * > createMarkupForStyles({width: '200px', height: 0})
  669. * "width:200px;height:0;"
  670. *
  671. * Undefined values are ignored so that declarative programming is easier.
  672. * The result should be HTML-escaped before insertion into the DOM.
  673. *
  674. * @param {object} styles
  675. * @return {?string}
  676. */
  677. createMarkupForStyles: function (styles) {
  678. var serialized = '';
  679. for (var styleName in styles) {
  680. if (!styles.hasOwnProperty(styleName)) {
  681. continue;
  682. }
  683. var styleValue = styles[styleName];
  684. if ("production" !== 'production') {
  685. warnValidStyle(styleName, styleValue);
  686. }
  687. if (styleValue != null) {
  688. serialized += processStyleName(styleName) + ':';
  689. serialized += dangerousStyleValue(styleName, styleValue) + ';';
  690. }
  691. }
  692. return serialized || null;
  693. },
  694. /**
  695. * Sets the value for multiple styles on a node. If a value is specified as
  696. * '' (empty string), the corresponding style property will be unset.
  697. *
  698. * @param {DOMElement} node
  699. * @param {object} styles
  700. */
  701. setValueForStyles: function (node, styles) {
  702. var style = node.style;
  703. for (var styleName in styles) {
  704. if (!styles.hasOwnProperty(styleName)) {
  705. continue;
  706. }
  707. if ("production" !== 'production') {
  708. warnValidStyle(styleName, styles[styleName]);
  709. }
  710. var styleValue = dangerousStyleValue(styleName, styles[styleName]);
  711. if (styleName === 'float') {
  712. styleName = styleFloatAccessor;
  713. }
  714. if (styleValue) {
  715. style[styleName] = styleValue;
  716. } else {
  717. var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
  718. if (expansion) {
  719. // Shorthand property that IE8 won't like unsetting, so unset each
  720. // component to placate it
  721. for (var individualStyleName in expansion) {
  722. style[individualStyleName] = '';
  723. }
  724. } else {
  725. style[styleName] = '';
  726. }
  727. }
  728. }
  729. }
  730. };
  731. ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', {
  732. setValueForStyles: 'setValueForStyles'
  733. });
  734. module.exports = CSSPropertyOperations;
  735. },{"119":119,"147":147,"149":149,"160":160,"168":168,"173":173,"4":4,"78":78}],6:[function(_dereq_,module,exports){
  736. /**
  737. * Copyright 2013-2015, Facebook, Inc.
  738. * All rights reserved.
  739. *
  740. * This source code is licensed under the BSD-style license found in the
  741. * LICENSE file in the root directory of this source tree. An additional grant
  742. * of patent rights can be found in the PATENTS file in the same directory.
  743. *
  744. * @providesModule CallbackQueue
  745. */
  746. 'use strict';
  747. var PooledClass = _dereq_(25);
  748. var assign = _dereq_(24);
  749. var invariant = _dereq_(161);
  750. /**
  751. * A specialized pseudo-event module to help keep track of components waiting to
  752. * be notified when their DOM representations are available for use.
  753. *
  754. * This implements `PooledClass`, so you should never need to instantiate this.
  755. * Instead, use `CallbackQueue.getPooled()`.
  756. *
  757. * @class ReactMountReady
  758. * @implements PooledClass
  759. * @internal
  760. */
  761. function CallbackQueue() {
  762. this._callbacks = null;
  763. this._contexts = null;
  764. }
  765. assign(CallbackQueue.prototype, {
  766. /**
  767. * Enqueues a callback to be invoked when `notifyAll` is invoked.
  768. *
  769. * @param {function} callback Invoked when `notifyAll` is invoked.
  770. * @param {?object} context Context to call `callback` with.
  771. * @internal
  772. */
  773. enqueue: function (callback, context) {
  774. this._callbacks = this._callbacks || [];
  775. this._contexts = this._contexts || [];
  776. this._callbacks.push(callback);
  777. this._contexts.push(context);
  778. },
  779. /**
  780. * Invokes all enqueued callbacks and clears the queue. This is invoked after
  781. * the DOM representation of a component has been created or updated.
  782. *
  783. * @internal
  784. */
  785. notifyAll: function () {
  786. var callbacks = this._callbacks;
  787. var contexts = this._contexts;
  788. if (callbacks) {
  789. !(callbacks.length === contexts.length) ? "production" !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined;
  790. this._callbacks = null;
  791. this._contexts = null;
  792. for (var i = 0; i < callbacks.length; i++) {
  793. callbacks[i].call(contexts[i]);
  794. }
  795. callbacks.length = 0;
  796. contexts.length = 0;
  797. }
  798. },
  799. /**
  800. * Resets the internal queue.
  801. *
  802. * @internal
  803. */
  804. reset: function () {
  805. this._callbacks = null;
  806. this._contexts = null;
  807. },
  808. /**
  809. * `PooledClass` looks for this.
  810. */
  811. destructor: function () {
  812. this.reset();
  813. }
  814. });
  815. PooledClass.addPoolingTo(CallbackQueue);
  816. module.exports = CallbackQueue;
  817. },{"161":161,"24":24,"25":25}],7:[function(_dereq_,module,exports){
  818. /**
  819. * Copyright 2013-2015, Facebook, Inc.
  820. * All rights reserved.
  821. *
  822. * This source code is licensed under the BSD-style license found in the
  823. * LICENSE file in the root directory of this source tree. An additional grant
  824. * of patent rights can be found in the PATENTS file in the same directory.
  825. *
  826. * @providesModule ChangeEventPlugin
  827. */
  828. 'use strict';
  829. var EventConstants = _dereq_(15);
  830. var EventPluginHub = _dereq_(16);
  831. var EventPropagators = _dereq_(19);
  832. var ExecutionEnvironment = _dereq_(147);
  833. var ReactUpdates = _dereq_(96);
  834. var SyntheticEvent = _dereq_(105);
  835. var getEventTarget = _dereq_(128);
  836. var isEventSupported = _dereq_(133);
  837. var isTextInputElement = _dereq_(134);
  838. var keyOf = _dereq_(166);
  839. var topLevelTypes = EventConstants.topLevelTypes;
  840. var eventTypes = {
  841. change: {
  842. phasedRegistrationNames: {
  843. bubbled: keyOf({ onChange: null }),
  844. captured: keyOf({ onChangeCapture: null })
  845. },
  846. dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange]
  847. }
  848. };
  849. /**
  850. * For IE shims
  851. */
  852. var activeElement = null;
  853. var activeElementID = null;
  854. var activeElementValue = null;
  855. var activeElementValueProp = null;
  856. /**
  857. * SECTION: handle `change` event
  858. */
  859. function shouldUseChangeEvent(elem) {
  860. var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
  861. return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
  862. }
  863. var doesChangeEventBubble = false;
  864. if (ExecutionEnvironment.canUseDOM) {
  865. // See `handleChange` comment below
  866. doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8);
  867. }
  868. function manualDispatchChangeEvent(nativeEvent) {
  869. var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent));
  870. EventPropagators.accumulateTwoPhaseDispatches(event);
  871. // If change and propertychange bubbled, we'd just bind to it like all the
  872. // other events and have it go through ReactBrowserEventEmitter. Since it
  873. // doesn't, we manually listen for the events and so we have to enqueue and
  874. // process the abstract event manually.
  875. //
  876. // Batching is necessary here in order to ensure that all event handlers run
  877. // before the next rerender (including event handlers attached to ancestor
  878. // elements instead of directly on the input). Without this, controlled
  879. // components don't work properly in conjunction with event bubbling because
  880. // the component is rerendered and the value reverted before all the event
  881. // handlers can run. See https://github.com/facebook/react/issues/708.
  882. ReactUpdates.batchedUpdates(runEventInBatch, event);
  883. }
  884. function runEventInBatch(event) {
  885. EventPluginHub.enqueueEvents(event);
  886. EventPluginHub.processEventQueue(false);
  887. }
  888. function startWatchingForChangeEventIE8(target, targetID) {
  889. activeElement = target;
  890. activeElementID = targetID;
  891. activeElement.attachEvent('onchange', manualDispatchChangeEvent);
  892. }
  893. function stopWatchingForChangeEventIE8() {
  894. if (!activeElement) {
  895. return;
  896. }
  897. activeElement.detachEvent('onchange', manualDispatchChangeEvent);
  898. activeElement = null;
  899. activeElementID = null;
  900. }
  901. function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) {
  902. if (topLevelType === topLevelTypes.topChange) {
  903. return topLevelTargetID;
  904. }
  905. }
  906. function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) {
  907. if (topLevelType === topLevelTypes.topFocus) {
  908. // stopWatching() should be a noop here but we call it just in case we
  909. // missed a blur event somehow.
  910. stopWatchingForChangeEventIE8();
  911. startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
  912. } else if (topLevelType === topLevelTypes.topBlur) {
  913. stopWatchingForChangeEventIE8();
  914. }
  915. }
  916. /**
  917. * SECTION: handle `input` event
  918. */
  919. var isInputEventSupported = false;
  920. if (ExecutionEnvironment.canUseDOM) {
  921. // IE9 claims to support the input event but fails to trigger it when
  922. // deleting text, so we ignore its input events
  923. isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9);
  924. }
  925. /**
  926. * (For old IE.) Replacement getter/setter for the `value` property that gets
  927. * set on the active element.
  928. */
  929. var newValueProp = {
  930. get: function () {
  931. return activeElementValueProp.get.call(this);
  932. },
  933. set: function (val) {
  934. // Cast to a string so we can do equality checks.
  935. activeElementValue = '' + val;
  936. activeElementValueProp.set.call(this, val);
  937. }
  938. };
  939. /**
  940. * (For old IE.) Starts tracking propertychange events on the passed-in element
  941. * and override the value property so that we can distinguish user events from
  942. * value changes in JS.
  943. */
  944. function startWatchingForValueChange(target, targetID) {
  945. activeElement = target;
  946. activeElementID = targetID;
  947. activeElementValue = target.value;
  948. activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
  949. // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
  950. // on DOM elements
  951. Object.defineProperty(activeElement, 'value', newValueProp);
  952. activeElement.attachEvent('onpropertychange', handlePropertyChange);
  953. }
  954. /**
  955. * (For old IE.) Removes the event listeners from the currently-tracked element,
  956. * if any exists.
  957. */
  958. function stopWatchingForValueChange() {
  959. if (!activeElement) {
  960. return;
  961. }
  962. // delete restores the original property definition
  963. delete activeElement.value;
  964. activeElement.detachEvent('onpropertychange', handlePropertyChange);
  965. activeElement = null;
  966. activeElementID = null;
  967. activeElementValue = null;
  968. activeElementValueProp = null;
  969. }
  970. /**
  971. * (For old IE.) Handles a propertychange event, sending a `change` event if
  972. * the value of the active element has changed.
  973. */
  974. function handlePropertyChange(nativeEvent) {
  975. if (nativeEvent.propertyName !== 'value') {
  976. return;
  977. }
  978. var value = nativeEvent.srcElement.value;
  979. if (value === activeElementValue) {
  980. return;
  981. }
  982. activeElementValue = value;
  983. manualDispatchChangeEvent(nativeEvent);
  984. }
  985. /**
  986. * If a `change` event should be fired, returns the target's ID.
  987. */
  988. function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) {
  989. if (topLevelType === topLevelTypes.topInput) {
  990. // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
  991. // what we want so fall through here and trigger an abstract event
  992. return topLevelTargetID;
  993. }
  994. }
  995. // For IE8 and IE9.
  996. function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
  997. if (topLevelType === topLevelTypes.topFocus) {
  998. // In IE8, we can capture almost all .value changes by adding a
  999. // propertychange handler and looking for events with propertyName
  1000. // equal to 'value'
  1001. // In IE9, propertychange fires for most input events but is buggy and
  1002. // doesn't fire when text is deleted, but conveniently, selectionchange
  1003. // appears to fire in all of the remaining cases so we catch those and
  1004. // forward the event if the value has changed
  1005. // In either case, we don't want to call the event handler if the value
  1006. // is changed from JS so we redefine a setter for `.value` that updates
  1007. // our activeElementValue variable, allowing us to ignore those changes
  1008. //
  1009. // stopWatching() should be a noop here but we call it just in case we
  1010. // missed a blur event somehow.
  1011. stopWatchingForValueChange();
  1012. startWatchingForValueChange(topLevelTarget, topLevelTargetID);
  1013. } else if (topLevelType === topLevelTypes.topBlur) {
  1014. stopWatchingForValueChange();
  1015. }
  1016. }
  1017. // For IE8 and IE9.
  1018. function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
  1019. if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
  1020. // On the selectionchange event, the target is just document which isn't
  1021. // helpful for us so just check activeElement instead.
  1022. //
  1023. // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
  1024. // propertychange on the first input event after setting `value` from a
  1025. // script and fires only keydown, keypress, keyup. Catching keyup usually
  1026. // gets it and catching keydown lets us fire an event for the first
  1027. // keystroke if user does a key repeat (it'll be a little delayed: right
  1028. // before the second keystroke). Other input methods (e.g., paste) seem to
  1029. // fire selectionchange normally.
  1030. if (activeElement && activeElement.value !== activeElementValue) {
  1031. activeElementValue = activeElement.value;
  1032. return activeElementID;
  1033. }
  1034. }
  1035. }
  1036. /**
  1037. * SECTION: handle `click` event
  1038. */
  1039. function shouldUseClickEvent(elem) {
  1040. // Use the `click` event to detect changes to checkbox and radio inputs.
  1041. // This approach works across all browsers, whereas `change` does not fire
  1042. // until `blur` in IE8.
  1043. return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
  1044. }
  1045. function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) {
  1046. if (topLevelType === topLevelTypes.topClick) {
  1047. return topLevelTargetID;
  1048. }
  1049. }
  1050. /**
  1051. * This plugin creates an `onChange` event that normalizes change events
  1052. * across form elements. This event fires at a time when it's possible to
  1053. * change the element's value without seeing a flicker.
  1054. *
  1055. * Supported elements are:
  1056. * - input (see `isTextInputElement`)
  1057. * - textarea
  1058. * - select
  1059. */
  1060. var ChangeEventPlugin = {
  1061. eventTypes: eventTypes,
  1062. /**
  1063. * @param {string} topLevelType Record from `EventConstants`.
  1064. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  1065. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  1066. * @param {object} nativeEvent Native browser event.
  1067. * @return {*} An accumulation of synthetic events.
  1068. * @see {EventPluginHub.extractEvents}
  1069. */
  1070. extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
  1071. var getTargetIDFunc, handleEventFunc;
  1072. if (shouldUseChangeEvent(topLevelTarget)) {
  1073. if (doesChangeEventBubble) {
  1074. getTargetIDFunc = getTargetIDForChangeEvent;
  1075. } else {
  1076. handleEventFunc = handleEventsForChangeEventIE8;
  1077. }
  1078. } else if (isTextInputElement(topLevelTarget)) {
  1079. if (isInputEventSupported) {
  1080. getTargetIDFunc = getTargetIDForInputEvent;
  1081. } else {
  1082. getTargetIDFunc = getTargetIDForInputEventIE;
  1083. handleEventFunc = handleEventsForInputEventIE;
  1084. }
  1085. } else if (shouldUseClickEvent(topLevelTarget)) {
  1086. getTargetIDFunc = getTargetIDForClickEvent;
  1087. }
  1088. if (getTargetIDFunc) {
  1089. var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID);
  1090. if (targetID) {
  1091. var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget);
  1092. event.type = 'change';
  1093. EventPropagators.accumulateTwoPhaseDispatches(event);
  1094. return event;
  1095. }
  1096. }
  1097. if (handleEventFunc) {
  1098. handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID);
  1099. }
  1100. }
  1101. };
  1102. module.exports = ChangeEventPlugin;
  1103. },{"105":105,"128":128,"133":133,"134":134,"147":147,"15":15,"16":16,"166":166,"19":19,"96":96}],8:[function(_dereq_,module,exports){
  1104. /**
  1105. * Copyright 2013-2015, Facebook, Inc.
  1106. * All rights reserved.
  1107. *
  1108. * This source code is licensed under the BSD-style license found in the
  1109. * LICENSE file in the root directory of this source tree. An additional grant
  1110. * of patent rights can be found in the PATENTS file in the same directory.
  1111. *
  1112. * @providesModule ClientReactRootIndex
  1113. * @typechecks
  1114. */
  1115. 'use strict';
  1116. var nextReactRootIndex = 0;
  1117. var ClientReactRootIndex = {
  1118. createReactRootIndex: function () {
  1119. return nextReactRootIndex++;
  1120. }
  1121. };
  1122. module.exports = ClientReactRootIndex;
  1123. },{}],9:[function(_dereq_,module,exports){
  1124. /**
  1125. * Copyright 2013-2015, Facebook, Inc.
  1126. * All rights reserved.
  1127. *
  1128. * This source code is licensed under the BSD-style license found in the
  1129. * LICENSE file in the root directory of this source tree. An additional grant
  1130. * of patent rights can be found in the PATENTS file in the same directory.
  1131. *
  1132. * @providesModule DOMChildrenOperations
  1133. * @typechecks static-only
  1134. */
  1135. 'use strict';
  1136. var Danger = _dereq_(12);
  1137. var ReactMultiChildUpdateTypes = _dereq_(74);
  1138. var ReactPerf = _dereq_(78);
  1139. var setInnerHTML = _dereq_(138);
  1140. var setTextContent = _dereq_(139);
  1141. var invariant = _dereq_(161);
  1142. /**
  1143. * Inserts `childNode` as a child of `parentNode` at the `index`.
  1144. *
  1145. * @param {DOMElement} parentNode Parent node in which to insert.
  1146. * @param {DOMElement} childNode Child node to insert.
  1147. * @param {number} index Index at which to insert the child.
  1148. * @internal
  1149. */
  1150. function insertChildAt(parentNode, childNode, index) {
  1151. // By exploiting arrays returning `undefined` for an undefined index, we can
  1152. // rely exclusively on `insertBefore(node, null)` instead of also using
  1153. // `appendChild(node)`. However, using `undefined` is not allowed by all
  1154. // browsers so we must replace it with `null`.
  1155. // fix render order error in safari
  1156. // IE8 will throw error when index out of list size.
  1157. var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
  1158. parentNode.insertBefore(childNode, beforeChild);
  1159. }
  1160. /**
  1161. * Operations for updating with DOM children.
  1162. */
  1163. var DOMChildrenOperations = {
  1164. dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
  1165. updateTextContent: setTextContent,
  1166. /**
  1167. * Updates a component's children by processing a series of updates. The
  1168. * update configurations are each expected to have a `parentNode` property.
  1169. *
  1170. * @param {array<object>} updates List of update configurations.
  1171. * @param {array<string>} markupList List of markup strings.
  1172. * @internal
  1173. */
  1174. processUpdates: function (updates, markupList) {
  1175. var update;
  1176. // Mapping from parent IDs to initial child orderings.
  1177. var initialChildren = null;
  1178. // List of children that will be moved or removed.
  1179. var updatedChildren = null;
  1180. for (var i = 0; i < updates.length; i++) {
  1181. update = updates[i];
  1182. if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
  1183. var updatedIndex = update.fromIndex;
  1184. var updatedChild = update.parentNode.childNodes[updatedIndex];
  1185. var parentID = update.parentID;
  1186. !updatedChild ? "production" !== 'production' ? invariant(false, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' + 'in an <svg> parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : invariant(false) : undefined;
  1187. initialChildren = initialChildren || {};
  1188. initialChildren[parentID] = initialChildren[parentID] || [];
  1189. initialChildren[parentID][updatedIndex] = updatedChild;
  1190. updatedChildren = updatedChildren || [];
  1191. updatedChildren.push(updatedChild);
  1192. }
  1193. }
  1194. var renderedMarkup;
  1195. // markupList is either a list of markup or just a list of elements
  1196. if (markupList.length && typeof markupList[0] === 'string') {
  1197. renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
  1198. } else {
  1199. renderedMarkup = markupList;
  1200. }
  1201. // Remove updated children first so that `toIndex` is consistent.
  1202. if (updatedChildren) {
  1203. for (var j = 0; j < updatedChildren.length; j++) {
  1204. updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
  1205. }
  1206. }
  1207. for (var k = 0; k < updates.length; k++) {
  1208. update = updates[k];
  1209. switch (update.type) {
  1210. case ReactMultiChildUpdateTypes.INSERT_MARKUP:
  1211. insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex);
  1212. break;
  1213. case ReactMultiChildUpdateTypes.MOVE_EXISTING:
  1214. insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex);
  1215. break;
  1216. case ReactMultiChildUpdateTypes.SET_MARKUP:
  1217. setInnerHTML(update.parentNode, update.content);
  1218. break;
  1219. case ReactMultiChildUpdateTypes.TEXT_CONTENT:
  1220. setTextContent(update.parentNode, update.content);
  1221. break;
  1222. case ReactMultiChildUpdateTypes.REMOVE_NODE:
  1223. // Already removed by the for-loop above.
  1224. break;
  1225. }
  1226. }
  1227. }
  1228. };
  1229. ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', {
  1230. updateTextContent: 'updateTextContent'
  1231. });
  1232. module.exports = DOMChildrenOperations;
  1233. },{"12":12,"138":138,"139":139,"161":161,"74":74,"78":78}],10:[function(_dereq_,module,exports){
  1234. /**
  1235. * Copyright 2013-2015, Facebook, Inc.
  1236. * All rights reserved.
  1237. *
  1238. * This source code is licensed under the BSD-style license found in the
  1239. * LICENSE file in the root directory of this source tree. An additional grant
  1240. * of patent rights can be found in the PATENTS file in the same directory.
  1241. *
  1242. * @providesModule DOMProperty
  1243. * @typechecks static-only
  1244. */
  1245. 'use strict';
  1246. var invariant = _dereq_(161);
  1247. function checkMask(value, bitmask) {
  1248. return (value & bitmask) === bitmask;
  1249. }
  1250. var DOMPropertyInjection = {
  1251. /**
  1252. * Mapping from normalized, camelcased property names to a configuration that
  1253. * specifies how the associated DOM property should be accessed or rendered.
  1254. */
  1255. MUST_USE_ATTRIBUTE: 0x1,
  1256. MUST_USE_PROPERTY: 0x2,
  1257. HAS_SIDE_EFFECTS: 0x4,
  1258. HAS_BOOLEAN_VALUE: 0x8,
  1259. HAS_NUMERIC_VALUE: 0x10,
  1260. HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
  1261. HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
  1262. /**
  1263. * Inject some specialized knowledge about the DOM. This takes a config object
  1264. * with the following properties:
  1265. *
  1266. * isCustomAttribute: function that given an attribute name will return true
  1267. * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
  1268. * attributes where it's impossible to enumerate all of the possible
  1269. * attribute names,
  1270. *
  1271. * Properties: object mapping DOM property name to one of the
  1272. * DOMPropertyInjection constants or null. If your attribute isn't in here,
  1273. * it won't get written to the DOM.
  1274. *
  1275. * DOMAttributeNames: object mapping React attribute name to the DOM
  1276. * attribute name. Attribute names not specified use the **lowercase**
  1277. * normalized name.
  1278. *
  1279. * DOMAttributeNamespaces: object mapping React attribute name to the DOM
  1280. * attribute namespace URL. (Attribute names not specified use no namespace.)
  1281. *
  1282. * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
  1283. * Property names not specified use the normalized name.
  1284. *
  1285. * DOMMutationMethods: Properties that require special mutation methods. If
  1286. * `value` is undefined, the mutation method should unset the property.
  1287. *
  1288. * @param {object} domPropertyConfig the config as described above.
  1289. */
  1290. injectDOMPropertyConfig: function (domPropertyConfig) {
  1291. var Injection = DOMPropertyInjection;
  1292. var Properties = domPropertyConfig.Properties || {};
  1293. var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
  1294. var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
  1295. var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
  1296. var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
  1297. if (domPropertyConfig.isCustomAttribute) {
  1298. DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
  1299. }
  1300. for (var propName in Properties) {
  1301. !!DOMProperty.properties.hasOwnProperty(propName) ? "production" !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : invariant(false) : undefined;
  1302. var lowerCased = propName.toLowerCase();
  1303. var propConfig = Properties[propName];
  1304. var propertyInfo = {
  1305. attributeName: lowerCased,
  1306. attributeNamespace: null,
  1307. propertyName: propName,
  1308. mutationMethod: null,
  1309. mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE),
  1310. mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
  1311. hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
  1312. hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
  1313. hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
  1314. hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
  1315. hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
  1316. };
  1317. !(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? "production" !== 'production' ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : invariant(false) : undefined;
  1318. !(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? "production" !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : undefined;
  1319. !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? "production" !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : undefined;
  1320. if ("production" !== 'production') {
  1321. DOMProperty.getPossibleStandardName[lowerCased] = propName;
  1322. }
  1323. if (DOMAttributeNames.hasOwnProperty(propName)) {
  1324. var attributeName = DOMAttributeNames[propName];
  1325. propertyInfo.attributeName = attributeName;
  1326. if ("production" !== 'production') {
  1327. DOMProperty.getPossibleStandardName[attributeName] = propName;
  1328. }
  1329. }
  1330. if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
  1331. propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
  1332. }
  1333. if (DOMPropertyNames.hasOwnProperty(propName)) {
  1334. propertyInfo.propertyName = DOMPropertyNames[propName];
  1335. }
  1336. if (DOMMutationMethods.hasOwnProperty(propName)) {
  1337. propertyInfo.mutationMethod = DOMMutationMethods[propName];
  1338. }
  1339. DOMProperty.properties[propName] = propertyInfo;
  1340. }
  1341. }
  1342. };
  1343. var defaultValueCache = {};
  1344. /**
  1345. * DOMProperty exports lookup objects that can be used like functions:
  1346. *
  1347. * > DOMProperty.isValid['id']
  1348. * true
  1349. * > DOMProperty.isValid['foobar']
  1350. * undefined
  1351. *
  1352. * Although this may be confusing, it performs better in general.
  1353. *
  1354. * @see http://jsperf.com/key-exists
  1355. * @see http://jsperf.com/key-missing
  1356. */
  1357. var DOMProperty = {
  1358. ID_ATTRIBUTE_NAME: 'data-reactid',
  1359. /**
  1360. * Map from property "standard name" to an object with info about how to set
  1361. * the property in the DOM. Each object contains:
  1362. *
  1363. * attributeName:
  1364. * Used when rendering markup or with `*Attribute()`.
  1365. * attributeNamespace
  1366. * propertyName:
  1367. * Used on DOM node instances. (This includes properties that mutate due to
  1368. * external factors.)
  1369. * mutationMethod:
  1370. * If non-null, used instead of the property or `setAttribute()` after
  1371. * initial render.
  1372. * mustUseAttribute:
  1373. * Whether the property must be accessed and mutated using `*Attribute()`.
  1374. * (This includes anything that fails `<propName> in <element>`.)
  1375. * mustUseProperty:
  1376. * Whether the property must be accessed and mutated as an object property.
  1377. * hasSideEffects:
  1378. * Whether or not setting a value causes side effects such as triggering
  1379. * resources to be loaded or text selection changes. If true, we read from
  1380. * the DOM before updating to ensure that the value is only set if it has
  1381. * changed.
  1382. * hasBooleanValue:
  1383. * Whether the property should be removed when set to a falsey value.
  1384. * hasNumericValue:
  1385. * Whether the property must be numeric or parse as a numeric and should be
  1386. * removed when set to a falsey value.
  1387. * hasPositiveNumericValue:
  1388. * Whether the property must be positive numeric or parse as a positive
  1389. * numeric and should be removed when set to a falsey value.
  1390. * hasOverloadedBooleanValue:
  1391. * Whether the property can be used as a flag as well as with a value.
  1392. * Removed when strictly equal to false; present without a value when
  1393. * strictly equal to true; present with a value otherwise.
  1394. */
  1395. properties: {},
  1396. /**
  1397. * Mapping from lowercase property names to the properly cased version, used
  1398. * to warn in the case of missing properties. Available only in __DEV__.
  1399. * @type {Object}
  1400. */
  1401. getPossibleStandardName: "production" !== 'production' ? {} : null,
  1402. /**
  1403. * All of the isCustomAttribute() functions that have been injected.
  1404. */
  1405. _isCustomAttributeFunctions: [],
  1406. /**
  1407. * Checks whether a property name is a custom attribute.
  1408. * @method
  1409. */
  1410. isCustomAttribute: function (attributeName) {
  1411. for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
  1412. var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
  1413. if (isCustomAttributeFn(attributeName)) {
  1414. return true;
  1415. }
  1416. }
  1417. return false;
  1418. },
  1419. /**
  1420. * Returns the default property value for a DOM property (i.e., not an
  1421. * attribute). Most default values are '' or false, but not all. Worse yet,
  1422. * some (in particular, `type`) vary depending on the type of element.
  1423. *
  1424. * TODO: Is it better to grab all the possible properties when creating an
  1425. * element to avoid having to create the same element twice?
  1426. */
  1427. getDefaultValueForProperty: function (nodeName, prop) {
  1428. var nodeDefaults = defaultValueCache[nodeName];
  1429. var testElement;
  1430. if (!nodeDefaults) {
  1431. defaultValueCache[nodeName] = nodeDefaults = {};
  1432. }
  1433. if (!(prop in nodeDefaults)) {
  1434. testElement = document.createElementNS('http://www.w3.org/1999/xhtml', nodeName);
  1435. nodeDefaults[prop] = testElement[prop];
  1436. }
  1437. return nodeDefaults[prop];
  1438. },
  1439. injection: DOMPropertyInjection
  1440. };
  1441. module.exports = DOMProperty;
  1442. },{"161":161}],11:[function(_dereq_,module,exports){
  1443. /**
  1444. * Copyright 2013-2015, Facebook, Inc.
  1445. * All rights reserved.
  1446. *
  1447. * This source code is licensed under the BSD-style license found in the
  1448. * LICENSE file in the root directory of this source tree. An additional grant
  1449. * of patent rights can be found in the PATENTS file in the same directory.
  1450. *
  1451. * @providesModule DOMPropertyOperations
  1452. * @typechecks static-only
  1453. */
  1454. 'use strict';
  1455. var DOMProperty = _dereq_(10);
  1456. var ReactPerf = _dereq_(78);
  1457. var quoteAttributeValueForBrowser = _dereq_(136);
  1458. var warning = _dereq_(173);
  1459. // Simplified subset
  1460. var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/;
  1461. var illegalAttributeNameCache = {};
  1462. var validatedAttributeNameCache = {};
  1463. function isAttributeNameSafe(attributeName) {
  1464. if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
  1465. return true;
  1466. }
  1467. if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
  1468. return false;
  1469. }
  1470. if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
  1471. validatedAttributeNameCache[attributeName] = true;
  1472. return true;
  1473. }
  1474. illegalAttributeNameCache[attributeName] = true;
  1475. "production" !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined;
  1476. return false;
  1477. }
  1478. function shouldIgnoreValue(propertyInfo, value) {
  1479. return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
  1480. }
  1481. if ("production" !== 'production') {
  1482. var reactProps = {
  1483. children: true,
  1484. dangerouslySetInnerHTML: true,
  1485. key: true,
  1486. ref: true
  1487. };
  1488. var warnedProperties = {};
  1489. var warnUnknownProperty = function (name) {
  1490. if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
  1491. return;
  1492. }
  1493. warnedProperties[name] = true;
  1494. var lowerCasedName = name.toLowerCase();
  1495. // data-* attributes should be lowercase; suggest the lowercase version
  1496. var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
  1497. // For now, only warn when we have a suggested correction. This prevents
  1498. // logging too much when using transferPropsTo.
  1499. "production" !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
  1500. };
  1501. }
  1502. /**
  1503. * Operations for dealing with DOM properties.
  1504. */
  1505. var DOMPropertyOperations = {
  1506. /**
  1507. * Creates markup for the ID property.
  1508. *
  1509. * @param {string} id Unescaped ID.
  1510. * @return {string} Markup string.
  1511. */
  1512. createMarkupForID: function (id) {
  1513. return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
  1514. },
  1515. setAttributeForID: function (node, id) {
  1516. node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
  1517. },
  1518. /**
  1519. * Creates markup for a property.
  1520. *
  1521. * @param {string} name
  1522. * @param {*} value
  1523. * @return {?string} Markup string, or null if the property was invalid.
  1524. */
  1525. createMarkupForProperty: function (name, value) {
  1526. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  1527. if (propertyInfo) {
  1528. if (shouldIgnoreValue(propertyInfo, value)) {
  1529. return '';
  1530. }
  1531. var attributeName = propertyInfo.attributeName;
  1532. if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
  1533. return attributeName + '=""';
  1534. }
  1535. return attributeName + '=' + quoteAttributeValueForBrowser(value);
  1536. } else if (DOMProperty.isCustomAttribute(name)) {
  1537. if (value == null) {
  1538. return '';
  1539. }
  1540. return name + '=' + quoteAttributeValueForBrowser(value);
  1541. } else if ("production" !== 'production') {
  1542. warnUnknownProperty(name);
  1543. }
  1544. return null;
  1545. },
  1546. /**
  1547. * Creates markup for a custom property.
  1548. *
  1549. * @param {string} name
  1550. * @param {*} value
  1551. * @return {string} Markup string, or empty string if the property was invalid.
  1552. */
  1553. createMarkupForCustomAttribute: function (name, value) {
  1554. if (!isAttributeNameSafe(name) || value == null) {
  1555. return '';
  1556. }
  1557. return name + '=' + quoteAttributeValueForBrowser(value);
  1558. },
  1559. /**
  1560. * Sets the value for a property on a node.
  1561. *
  1562. * @param {DOMElement} node
  1563. * @param {string} name
  1564. * @param {*} value
  1565. */
  1566. setValueForProperty: function (node, name, value) {
  1567. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  1568. if (propertyInfo) {
  1569. var mutationMethod = propertyInfo.mutationMethod;
  1570. if (mutationMethod) {
  1571. mutationMethod(node, value);
  1572. } else if (shouldIgnoreValue(propertyInfo, value)) {
  1573. this.deleteValueForProperty(node, name);
  1574. } else if (propertyInfo.mustUseAttribute) {
  1575. var attributeName = propertyInfo.attributeName;
  1576. var namespace = propertyInfo.attributeNamespace;
  1577. // `setAttribute` with objects becomes only `[object]` in IE8/9,
  1578. // ('' + value) makes it output the correct toString()-value.
  1579. if (namespace) {
  1580. node.setAttributeNS(namespace, attributeName, '' + value);
  1581. } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
  1582. node.setAttribute(attributeName, '');
  1583. } else {
  1584. node.setAttribute(attributeName, '' + value);
  1585. }
  1586. } else {
  1587. var propName = propertyInfo.propertyName;
  1588. // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
  1589. // property type before comparing; only `value` does and is string.
  1590. if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
  1591. // Contrary to `setAttribute`, object properties are properly
  1592. // `toString`ed by IE8/9.
  1593. node[propName] = value;
  1594. }
  1595. }
  1596. } else if (DOMProperty.isCustomAttribute(name)) {
  1597. DOMPropertyOperations.setValueForAttribute(node, name, value);
  1598. } else if ("production" !== 'production') {
  1599. warnUnknownProperty(name);
  1600. }
  1601. },
  1602. setValueForAttribute: function (node, name, value) {
  1603. if (!isAttributeNameSafe(name)) {
  1604. return;
  1605. }
  1606. if (value == null) {
  1607. node.removeAttribute(name);
  1608. } else {
  1609. node.setAttribute(name, '' + value);
  1610. }
  1611. },
  1612. /**
  1613. * Deletes the value for a property on a node.
  1614. *
  1615. * @param {DOMElement} node
  1616. * @param {string} name
  1617. */
  1618. deleteValueForProperty: function (node, name) {
  1619. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  1620. if (propertyInfo) {
  1621. var mutationMethod = propertyInfo.mutationMethod;
  1622. if (mutationMethod) {
  1623. mutationMethod(node, undefined);
  1624. } else if (propertyInfo.mustUseAttribute) {
  1625. node.removeAttribute(propertyInfo.attributeName);
  1626. } else {
  1627. var propName = propertyInfo.propertyName;
  1628. var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName);
  1629. if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) {
  1630. node[propName] = defaultValue;
  1631. }
  1632. }
  1633. } else if (DOMProperty.isCustomAttribute(name)) {
  1634. node.removeAttribute(name);
  1635. } else if ("production" !== 'production') {
  1636. warnUnknownProperty(name);
  1637. }
  1638. }
  1639. };
  1640. ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', {
  1641. setValueForProperty: 'setValueForProperty',
  1642. setValueForAttribute: 'setValueForAttribute',
  1643. deleteValueForProperty: 'deleteValueForProperty'
  1644. });
  1645. module.exports = DOMPropertyOperations;
  1646. },{"10":10,"136":136,"173":173,"78":78}],12:[function(_dereq_,module,exports){
  1647. /**
  1648. * Copyright 2013-2015, Facebook, Inc.
  1649. * All rights reserved.
  1650. *
  1651. * This source code is licensed under the BSD-style license found in the
  1652. * LICENSE file in the root directory of this source tree. An additional grant
  1653. * of patent rights can be found in the PATENTS file in the same directory.
  1654. *
  1655. * @providesModule Danger
  1656. * @typechecks static-only
  1657. */
  1658. 'use strict';
  1659. var ExecutionEnvironment = _dereq_(147);
  1660. var createNodesFromMarkup = _dereq_(152);
  1661. var emptyFunction = _dereq_(153);
  1662. var getMarkupWrap = _dereq_(157);
  1663. var invariant = _dereq_(161);
  1664. var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
  1665. var RESULT_INDEX_ATTR = 'data-danger-index';
  1666. /**
  1667. * Extracts the `nodeName` from a string of markup.
  1668. *
  1669. * NOTE: Extracting the `nodeName` does not require a regular expression match
  1670. * because we make assumptions about React-generated markup (i.e. there are no
  1671. * spaces surrounding the opening tag and there is at least one attribute).
  1672. *
  1673. * @param {string} markup String of markup.
  1674. * @return {string} Node name of the supplied markup.
  1675. * @see http://jsperf.com/extract-nodename
  1676. */
  1677. function getNodeName(markup) {
  1678. return markup.substring(1, markup.indexOf(' '));
  1679. }
  1680. var Danger = {
  1681. /**
  1682. * Renders markup into an array of nodes. The markup is expected to render
  1683. * into a list of root nodes. Also, the length of `resultList` and
  1684. * `markupList` should be the same.
  1685. *
  1686. * @param {array<string>} markupList List of markup strings to render.
  1687. * @return {array<DOMElement>} List of rendered nodes.
  1688. * @internal
  1689. */
  1690. dangerouslyRenderMarkup: function (markupList) {
  1691. !ExecutionEnvironment.canUseDOM ? "production" !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : undefined;
  1692. var nodeName;
  1693. var markupByNodeName = {};
  1694. // Group markup by `nodeName` if a wrap is necessary, else by '*'.
  1695. for (var i = 0; i < markupList.length; i++) {
  1696. !markupList[i] ? "production" !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
  1697. nodeName = getNodeName(markupList[i]);
  1698. nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
  1699. markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
  1700. markupByNodeName[nodeName][i] = markupList[i];
  1701. }
  1702. var resultList = [];
  1703. var resultListAssignmentCount = 0;
  1704. for (nodeName in markupByNodeName) {
  1705. if (!markupByNodeName.hasOwnProperty(nodeName)) {
  1706. continue;
  1707. }
  1708. var markupListByNodeName = markupByNodeName[nodeName];
  1709. // This for-in loop skips the holes of the sparse array. The order of
  1710. // iteration should follow the order of assignment, which happens to match
  1711. // numerical index order, but we don't rely on that.
  1712. var resultIndex;
  1713. for (resultIndex in markupListByNodeName) {
  1714. if (markupListByNodeName.hasOwnProperty(resultIndex)) {
  1715. var markup = markupListByNodeName[resultIndex];
  1716. // Push the requested markup with an additional RESULT_INDEX_ATTR
  1717. // attribute. If the markup does not start with a < character, it
  1718. // will be discarded below (with an appropriate console.error).
  1719. markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP,
  1720. // This index will be parsed back out below.
  1721. '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ');
  1722. }
  1723. }
  1724. // Render each group of markup with similar wrapping `nodeName`.
  1725. var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags.
  1726. );
  1727. for (var j = 0; j < renderNodes.length; ++j) {
  1728. var renderNode = renderNodes[j];
  1729. if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
  1730. resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
  1731. renderNode.removeAttribute(RESULT_INDEX_ATTR);
  1732. !!resultList.hasOwnProperty(resultIndex) ? "production" !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined;
  1733. resultList[resultIndex] = renderNode;
  1734. // This should match resultList.length and markupList.length when
  1735. // we're done.
  1736. resultListAssignmentCount += 1;
  1737. } else if ("production" !== 'production') {
  1738. console.error('Danger: Discarding unexpected node:', renderNode);
  1739. }
  1740. }
  1741. }
  1742. // Although resultList was populated out of order, it should now be a dense
  1743. // array.
  1744. !(resultListAssignmentCount === resultList.length) ? "production" !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined;
  1745. !(resultList.length === markupList.length) ? "production" !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined;
  1746. return resultList;
  1747. },
  1748. /**
  1749. * Replaces a node with a string of markup at its current position within its
  1750. * parent. The markup must render into a single root node.
  1751. *
  1752. * @param {DOMElement} oldChild Child node to replace.
  1753. * @param {string} markup Markup to render in place of the child node.
  1754. * @internal
  1755. */
  1756. dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
  1757. !ExecutionEnvironment.canUseDOM ? "production" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
  1758. !markup ? "production" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
  1759. !(oldChild.tagName.toLowerCase() !== 'html') ? "production" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See ReactDOMServer.renderToString().') : invariant(false) : undefined;
  1760. var newChild;
  1761. if (typeof markup === 'string') {
  1762. newChild = createNodesFromMarkup(markup, emptyFunction)[0];
  1763. } else {
  1764. newChild = markup;
  1765. }
  1766. oldChild.parentNode.replaceChild(newChild, oldChild);
  1767. }
  1768. };
  1769. module.exports = Danger;
  1770. },{"147":147,"152":152,"153":153,"157":157,"161":161}],13:[function(_dereq_,module,exports){
  1771. /**
  1772. * Copyright 2013-2015, Facebook, Inc.
  1773. * All rights reserved.
  1774. *
  1775. * This source code is licensed under the BSD-style license found in the
  1776. * LICENSE file in the root directory of this source tree. An additional grant
  1777. * of patent rights can be found in the PATENTS file in the same directory.
  1778. *
  1779. * @providesModule DefaultEventPluginOrder
  1780. */
  1781. 'use strict';
  1782. var keyOf = _dereq_(166);
  1783. /**
  1784. * Module that is injectable into `EventPluginHub`, that specifies a
  1785. * deterministic ordering of `EventPlugin`s. A convenient way to reason about
  1786. * plugins, without having to package every one of them. This is better than
  1787. * having plugins be ordered in the same order that they are injected because
  1788. * that ordering would be influenced by the packaging order.
  1789. * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
  1790. * preventing default on events is convenient in `SimpleEventPlugin` handlers.
  1791. */
  1792. var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })];
  1793. module.exports = DefaultEventPluginOrder;
  1794. },{"166":166}],14:[function(_dereq_,module,exports){
  1795. /**
  1796. * Copyright 2013-2015, Facebook, Inc.
  1797. * All rights reserved.
  1798. *
  1799. * This source code is licensed under the BSD-style license found in the
  1800. * LICENSE file in the root directory of this source tree. An additional grant
  1801. * of patent rights can be found in the PATENTS file in the same directory.
  1802. *
  1803. * @providesModule EnterLeaveEventPlugin
  1804. * @typechecks static-only
  1805. */
  1806. 'use strict';
  1807. var EventConstants = _dereq_(15);
  1808. var EventPropagators = _dereq_(19);
  1809. var SyntheticMouseEvent = _dereq_(109);
  1810. var ReactMount = _dereq_(72);
  1811. var keyOf = _dereq_(166);
  1812. var topLevelTypes = EventConstants.topLevelTypes;
  1813. var getFirstReactDOM = ReactMount.getFirstReactDOM;
  1814. var eventTypes = {
  1815. mouseEnter: {
  1816. registrationName: keyOf({ onMouseEnter: null }),
  1817. dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
  1818. },
  1819. mouseLeave: {
  1820. registrationName: keyOf({ onMouseLeave: null }),
  1821. dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
  1822. }
  1823. };
  1824. var extractedEvents = [null, null];
  1825. var EnterLeaveEventPlugin = {
  1826. eventTypes: eventTypes,
  1827. /**
  1828. * For almost every interaction we care about, there will be both a top-level
  1829. * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
  1830. * we do not extract duplicate events. However, moving the mouse into the
  1831. * browser from outside will not fire a `mouseout` event. In this case, we use
  1832. * the `mouseover` top-level event.
  1833. *
  1834. * @param {string} topLevelType Record from `EventConstants`.
  1835. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  1836. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  1837. * @param {object} nativeEvent Native browser event.
  1838. * @return {*} An accumulation of synthetic events.
  1839. * @see {EventPluginHub.extractEvents}
  1840. */
  1841. extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
  1842. if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
  1843. return null;
  1844. }
  1845. if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) {
  1846. // Must not be a mouse in or mouse out - ignoring.
  1847. return null;
  1848. }
  1849. var win;
  1850. if (topLevelTarget.window === topLevelTarget) {
  1851. // `topLevelTarget` is probably a window object.
  1852. win = topLevelTarget;
  1853. } else {
  1854. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  1855. var doc = topLevelTarget.ownerDocument;
  1856. if (doc) {
  1857. win = doc.defaultView || doc.parentWindow;
  1858. } else {
  1859. win = window;
  1860. }
  1861. }
  1862. var from;
  1863. var to;
  1864. var fromID = '';
  1865. var toID = '';
  1866. if (topLevelType === topLevelTypes.topMouseOut) {
  1867. from = topLevelTarget;
  1868. fromID = topLevelTargetID;
  1869. to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement);
  1870. if (to) {
  1871. toID = ReactMount.getID(to);
  1872. } else {
  1873. to = win;
  1874. }
  1875. to = to || win;
  1876. } else {
  1877. from = win;
  1878. to = topLevelTarget;
  1879. toID = topLevelTargetID;
  1880. }
  1881. if (from === to) {
  1882. // Nothing pertains to our managed components.
  1883. return null;
  1884. }
  1885. var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);
  1886. leave.type = 'mouseleave';
  1887. leave.target = from;
  1888. leave.relatedTarget = to;
  1889. var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget);
  1890. enter.type = 'mouseenter';
  1891. enter.target = to;
  1892. enter.relatedTarget = from;
  1893. EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
  1894. extractedEvents[0] = leave;
  1895. extractedEvents[1] = enter;
  1896. return extractedEvents;
  1897. }
  1898. };
  1899. module.exports = EnterLeaveEventPlugin;
  1900. },{"109":109,"15":15,"166":166,"19":19,"72":72}],15:[function(_dereq_,module,exports){
  1901. /**
  1902. * Copyright 2013-2015, Facebook, Inc.
  1903. * All rights reserved.
  1904. *
  1905. * This source code is licensed under the BSD-style license found in the
  1906. * LICENSE file in the root directory of this source tree. An additional grant
  1907. * of patent rights can be found in the PATENTS file in the same directory.
  1908. *
  1909. * @providesModule EventConstants
  1910. */
  1911. 'use strict';
  1912. var keyMirror = _dereq_(165);
  1913. var PropagationPhases = keyMirror({ bubbled: null, captured: null });
  1914. /**
  1915. * Types of raw signals from the browser caught at the top level.
  1916. */
  1917. var topLevelTypes = keyMirror({
  1918. topAbort: null,
  1919. topBlur: null,
  1920. topCanPlay: null,
  1921. topCanPlayThrough: null,
  1922. topChange: null,
  1923. topClick: null,
  1924. topCompositionEnd: null,
  1925. topCompositionStart: null,
  1926. topCompositionUpdate: null,
  1927. topContextMenu: null,
  1928. topCopy: null,
  1929. topCut: null,
  1930. topDoubleClick: null,
  1931. topDrag: null,
  1932. topDragEnd: null,
  1933. topDragEnter: null,
  1934. topDragExit: null,
  1935. topDragLeave: null,
  1936. topDragOver: null,
  1937. topDragStart: null,
  1938. topDrop: null,
  1939. topDurationChange: null,
  1940. topEmptied: null,
  1941. topEncrypted: null,
  1942. topEnded: null,
  1943. topError: null,
  1944. topFocus: null,
  1945. topInput: null,
  1946. topKeyDown: null,
  1947. topKeyPress: null,
  1948. topKeyUp: null,
  1949. topLoad: null,
  1950. topLoadedData: null,
  1951. topLoadedMetadata: null,
  1952. topLoadStart: null,
  1953. topMouseDown: null,
  1954. topMouseMove: null,
  1955. topMouseOut: null,
  1956. topMouseOver: null,
  1957. topMouseUp: null,
  1958. topPaste: null,
  1959. topPause: null,
  1960. topPlay: null,
  1961. topPlaying: null,
  1962. topProgress: null,
  1963. topRateChange: null,
  1964. topReset: null,
  1965. topScroll: null,
  1966. topSeeked: null,
  1967. topSeeking: null,
  1968. topSelectionChange: null,
  1969. topStalled: null,
  1970. topSubmit: null,
  1971. topSuspend: null,
  1972. topTextInput: null,
  1973. topTimeUpdate: null,
  1974. topTouchCancel: null,
  1975. topTouchEnd: null,
  1976. topTouchMove: null,
  1977. topTouchStart: null,
  1978. topVolumeChange: null,
  1979. topWaiting: null,
  1980. topWheel: null
  1981. });
  1982. var EventConstants = {
  1983. topLevelTypes: topLevelTypes,
  1984. PropagationPhases: PropagationPhases
  1985. };
  1986. module.exports = EventConstants;
  1987. },{"165":165}],16:[function(_dereq_,module,exports){
  1988. /**
  1989. * Copyright 2013-2015, Facebook, Inc.
  1990. * All rights reserved.
  1991. *
  1992. * This source code is licensed under the BSD-style license found in the
  1993. * LICENSE file in the root directory of this source tree. An additional grant
  1994. * of patent rights can be found in the PATENTS file in the same directory.
  1995. *
  1996. * @providesModule EventPluginHub
  1997. */
  1998. 'use strict';
  1999. var EventPluginRegistry = _dereq_(17);
  2000. var EventPluginUtils = _dereq_(18);
  2001. var ReactErrorUtils = _dereq_(61);
  2002. var accumulateInto = _dereq_(115);
  2003. var forEachAccumulated = _dereq_(124);
  2004. var invariant = _dereq_(161);
  2005. var warning = _dereq_(173);
  2006. /**
  2007. * Internal store for event listeners
  2008. */
  2009. var listenerBank = {};
  2010. /**
  2011. * Internal queue of events that have accumulated their dispatches and are
  2012. * waiting to have their dispatches executed.
  2013. */
  2014. var eventQueue = null;
  2015. /**
  2016. * Dispatches an event and releases it back into the pool, unless persistent.
  2017. *
  2018. * @param {?object} event Synthetic event to be dispatched.
  2019. * @param {boolean} simulated If the event is simulated (changes exn behavior)
  2020. * @private
  2021. */
  2022. var executeDispatchesAndRelease = function (event, simulated) {
  2023. if (event) {
  2024. EventPluginUtils.executeDispatchesInOrder(event, simulated);
  2025. if (!event.isPersistent()) {
  2026. event.constructor.release(event);
  2027. }
  2028. }
  2029. };
  2030. var executeDispatchesAndReleaseSimulated = function (e) {
  2031. return executeDispatchesAndRelease(e, true);
  2032. };
  2033. var executeDispatchesAndReleaseTopLevel = function (e) {
  2034. return executeDispatchesAndRelease(e, false);
  2035. };
  2036. /**
  2037. * - `InstanceHandle`: [required] Module that performs logical traversals of DOM
  2038. * hierarchy given ids of the logical DOM elements involved.
  2039. */
  2040. var InstanceHandle = null;
  2041. function validateInstanceHandle() {
  2042. var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave;
  2043. "production" !== 'production' ? warning(valid, 'InstanceHandle not injected before use!') : undefined;
  2044. }
  2045. /**
  2046. * This is a unified interface for event plugins to be installed and configured.
  2047. *
  2048. * Event plugins can implement the following properties:
  2049. *
  2050. * `extractEvents` {function(string, DOMEventTarget, string, object): *}
  2051. * Required. When a top-level event is fired, this method is expected to
  2052. * extract synthetic events that will in turn be queued and dispatched.
  2053. *
  2054. * `eventTypes` {object}
  2055. * Optional, plugins that fire events must publish a mapping of registration
  2056. * names that are used to register listeners. Values of this mapping must
  2057. * be objects that contain `registrationName` or `phasedRegistrationNames`.
  2058. *
  2059. * `executeDispatch` {function(object, function, string)}
  2060. * Optional, allows plugins to override how an event gets dispatched. By
  2061. * default, the listener is simply invoked.
  2062. *
  2063. * Each plugin that is injected into `EventsPluginHub` is immediately operable.
  2064. *
  2065. * @public
  2066. */
  2067. var EventPluginHub = {
  2068. /**
  2069. * Methods for injecting dependencies.
  2070. */
  2071. injection: {
  2072. /**
  2073. * @param {object} InjectedMount
  2074. * @public
  2075. */
  2076. injectMount: EventPluginUtils.injection.injectMount,
  2077. /**
  2078. * @param {object} InjectedInstanceHandle
  2079. * @public
  2080. */
  2081. injectInstanceHandle: function (InjectedInstanceHandle) {
  2082. InstanceHandle = InjectedInstanceHandle;
  2083. if ("production" !== 'production') {
  2084. validateInstanceHandle();
  2085. }
  2086. },
  2087. getInstanceHandle: function () {
  2088. if ("production" !== 'production') {
  2089. validateInstanceHandle();
  2090. }
  2091. return InstanceHandle;
  2092. },
  2093. /**
  2094. * @param {array} InjectedEventPluginOrder
  2095. * @public
  2096. */
  2097. injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
  2098. /**
  2099. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2100. */
  2101. injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
  2102. },
  2103. eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
  2104. registrationNameModules: EventPluginRegistry.registrationNameModules,
  2105. /**
  2106. * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
  2107. *
  2108. * @param {string} id ID of the DOM element.
  2109. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2110. * @param {?function} listener The callback to store.
  2111. */
  2112. putListener: function (id, registrationName, listener) {
  2113. !(typeof listener === 'function') ? "production" !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : undefined;
  2114. var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
  2115. bankForRegistrationName[id] = listener;
  2116. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2117. if (PluginModule && PluginModule.didPutListener) {
  2118. PluginModule.didPutListener(id, registrationName, listener);
  2119. }
  2120. },
  2121. /**
  2122. * @param {string} id ID of the DOM element.
  2123. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2124. * @return {?function} The stored callback.
  2125. */
  2126. getListener: function (id, registrationName) {
  2127. var bankForRegistrationName = listenerBank[registrationName];
  2128. return bankForRegistrationName && bankForRegistrationName[id];
  2129. },
  2130. /**
  2131. * Deletes a listener from the registration bank.
  2132. *
  2133. * @param {string} id ID of the DOM element.
  2134. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2135. */
  2136. deleteListener: function (id, registrationName) {
  2137. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2138. if (PluginModule && PluginModule.willDeleteListener) {
  2139. PluginModule.willDeleteListener(id, registrationName);
  2140. }
  2141. var bankForRegistrationName = listenerBank[registrationName];
  2142. // TODO: This should never be null -- when is it?
  2143. if (bankForRegistrationName) {
  2144. delete bankForRegistrationName[id];
  2145. }
  2146. },
  2147. /**
  2148. * Deletes all listeners for the DOM element with the supplied ID.
  2149. *
  2150. * @param {string} id ID of the DOM element.
  2151. */
  2152. deleteAllListeners: function (id) {
  2153. for (var registrationName in listenerBank) {
  2154. if (!listenerBank[registrationName][id]) {
  2155. continue;
  2156. }
  2157. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2158. if (PluginModule && PluginModule.willDeleteListener) {
  2159. PluginModule.willDeleteListener(id, registrationName);
  2160. }
  2161. delete listenerBank[registrationName][id];
  2162. }
  2163. },
  2164. /**
  2165. * Allows registered plugins an opportunity to extract events from top-level
  2166. * native browser events.
  2167. *
  2168. * @param {string} topLevelType Record from `EventConstants`.
  2169. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  2170. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  2171. * @param {object} nativeEvent Native browser event.
  2172. * @return {*} An accumulation of synthetic events.
  2173. * @internal
  2174. */
  2175. extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
  2176. var events;
  2177. var plugins = EventPluginRegistry.plugins;
  2178. for (var i = 0; i < plugins.length; i++) {
  2179. // Not every plugin in the ordering may be loaded at runtime.
  2180. var possiblePlugin = plugins[i];
  2181. if (possiblePlugin) {
  2182. var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
  2183. if (extractedEvents) {
  2184. events = accumulateInto(events, extractedEvents);
  2185. }
  2186. }
  2187. }
  2188. return events;
  2189. },
  2190. /**
  2191. * Enqueues a synthetic event that should be dispatched when
  2192. * `processEventQueue` is invoked.
  2193. *
  2194. * @param {*} events An accumulation of synthetic events.
  2195. * @internal
  2196. */
  2197. enqueueEvents: function (events) {
  2198. if (events) {
  2199. eventQueue = accumulateInto(eventQueue, events);
  2200. }
  2201. },
  2202. /**
  2203. * Dispatches all synthetic events on the event queue.
  2204. *
  2205. * @internal
  2206. */
  2207. processEventQueue: function (simulated) {
  2208. // Set `eventQueue` to null before processing it so that we can tell if more
  2209. // events get enqueued while processing.
  2210. var processingEventQueue = eventQueue;
  2211. eventQueue = null;
  2212. if (simulated) {
  2213. forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
  2214. } else {
  2215. forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
  2216. }
  2217. !!eventQueue ? "production" !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : invariant(false) : undefined;
  2218. // This would be a good time to rethrow if any of the event handlers threw.
  2219. ReactErrorUtils.rethrowCaughtError();
  2220. },
  2221. /**
  2222. * These are needed for tests only. Do not use!
  2223. */
  2224. __purge: function () {
  2225. listenerBank = {};
  2226. },
  2227. __getListenerBank: function () {
  2228. return listenerBank;
  2229. }
  2230. };
  2231. module.exports = EventPluginHub;
  2232. },{"115":115,"124":124,"161":161,"17":17,"173":173,"18":18,"61":61}],17:[function(_dereq_,module,exports){
  2233. /**
  2234. * Copyright 2013-2015, Facebook, Inc.
  2235. * All rights reserved.
  2236. *
  2237. * This source code is licensed under the BSD-style license found in the
  2238. * LICENSE file in the root directory of this source tree. An additional grant
  2239. * of patent rights can be found in the PATENTS file in the same directory.
  2240. *
  2241. * @providesModule EventPluginRegistry
  2242. * @typechecks static-only
  2243. */
  2244. 'use strict';
  2245. var invariant = _dereq_(161);
  2246. /**
  2247. * Injectable ordering of event plugins.
  2248. */
  2249. var EventPluginOrder = null;
  2250. /**
  2251. * Injectable mapping from names to event plugin modules.
  2252. */
  2253. var namesToPlugins = {};
  2254. /**
  2255. * Recomputes the plugin list using the injected plugins and plugin ordering.
  2256. *
  2257. * @private
  2258. */
  2259. function recomputePluginOrdering() {
  2260. if (!EventPluginOrder) {
  2261. // Wait until an `EventPluginOrder` is injected.
  2262. return;
  2263. }
  2264. for (var pluginName in namesToPlugins) {
  2265. var PluginModule = namesToPlugins[pluginName];
  2266. var pluginIndex = EventPluginOrder.indexOf(pluginName);
  2267. !(pluginIndex > -1) ? "production" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : undefined;
  2268. if (EventPluginRegistry.plugins[pluginIndex]) {
  2269. continue;
  2270. }
  2271. !PluginModule.extractEvents ? "production" !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : undefined;
  2272. EventPluginRegistry.plugins[pluginIndex] = PluginModule;
  2273. var publishedEvents = PluginModule.eventTypes;
  2274. for (var eventName in publishedEvents) {
  2275. !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? "production" !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : undefined;
  2276. }
  2277. }
  2278. }
  2279. /**
  2280. * Publishes an event so that it can be dispatched by the supplied plugin.
  2281. *
  2282. * @param {object} dispatchConfig Dispatch configuration for the event.
  2283. * @param {object} PluginModule Plugin publishing the event.
  2284. * @return {boolean} True if the event was successfully published.
  2285. * @private
  2286. */
  2287. function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
  2288. !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? "production" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : undefined;
  2289. EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
  2290. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  2291. if (phasedRegistrationNames) {
  2292. for (var phaseName in phasedRegistrationNames) {
  2293. if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
  2294. var phasedRegistrationName = phasedRegistrationNames[phaseName];
  2295. publishRegistrationName(phasedRegistrationName, PluginModule, eventName);
  2296. }
  2297. }
  2298. return true;
  2299. } else if (dispatchConfig.registrationName) {
  2300. publishRegistrationName(dispatchConfig.registrationName, PluginModule, eventName);
  2301. return true;
  2302. }
  2303. return false;
  2304. }
  2305. /**
  2306. * Publishes a registration name that is used to identify dispatched events and
  2307. * can be used with `EventPluginHub.putListener` to register listeners.
  2308. *
  2309. * @param {string} registrationName Registration name to add.
  2310. * @param {object} PluginModule Plugin publishing the event.
  2311. * @private
  2312. */
  2313. function publishRegistrationName(registrationName, PluginModule, eventName) {
  2314. !!EventPluginRegistry.registrationNameModules[registrationName] ? "production" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : undefined;
  2315. EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
  2316. EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
  2317. }
  2318. /**
  2319. * Registers plugins so that they can extract and dispatch events.
  2320. *
  2321. * @see {EventPluginHub}
  2322. */
  2323. var EventPluginRegistry = {
  2324. /**
  2325. * Ordered list of injected plugins.
  2326. */
  2327. plugins: [],
  2328. /**
  2329. * Mapping from event name to dispatch config
  2330. */
  2331. eventNameDispatchConfigs: {},
  2332. /**
  2333. * Mapping from registration name to plugin module
  2334. */
  2335. registrationNameModules: {},
  2336. /**
  2337. * Mapping from registration name to event name
  2338. */
  2339. registrationNameDependencies: {},
  2340. /**
  2341. * Injects an ordering of plugins (by plugin name). This allows the ordering
  2342. * to be decoupled from injection of the actual plugins so that ordering is
  2343. * always deterministic regardless of packaging, on-the-fly injection, etc.
  2344. *
  2345. * @param {array} InjectedEventPluginOrder
  2346. * @internal
  2347. * @see {EventPluginHub.injection.injectEventPluginOrder}
  2348. */
  2349. injectEventPluginOrder: function (InjectedEventPluginOrder) {
  2350. !!EventPluginOrder ? "production" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : undefined;
  2351. // Clone the ordering so it cannot be dynamically mutated.
  2352. EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
  2353. recomputePluginOrdering();
  2354. },
  2355. /**
  2356. * Injects plugins to be used by `EventPluginHub`. The plugin names must be
  2357. * in the ordering injected by `injectEventPluginOrder`.
  2358. *
  2359. * Plugins can be injected as part of page initialization or on-the-fly.
  2360. *
  2361. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2362. * @internal
  2363. * @see {EventPluginHub.injection.injectEventPluginsByName}
  2364. */
  2365. injectEventPluginsByName: function (injectedNamesToPlugins) {
  2366. var isOrderingDirty = false;
  2367. for (var pluginName in injectedNamesToPlugins) {
  2368. if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
  2369. continue;
  2370. }
  2371. var PluginModule = injectedNamesToPlugins[pluginName];
  2372. if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
  2373. !!namesToPlugins[pluginName] ? "production" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : undefined;
  2374. namesToPlugins[pluginName] = PluginModule;
  2375. isOrderingDirty = true;
  2376. }
  2377. }
  2378. if (isOrderingDirty) {
  2379. recomputePluginOrdering();
  2380. }
  2381. },
  2382. /**
  2383. * Looks up the plugin for the supplied event.
  2384. *
  2385. * @param {object} event A synthetic event.
  2386. * @return {?object} The plugin that created the supplied event.
  2387. * @internal
  2388. */
  2389. getPluginModuleForEvent: function (event) {
  2390. var dispatchConfig = event.dispatchConfig;
  2391. if (dispatchConfig.registrationName) {
  2392. return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
  2393. }
  2394. for (var phase in dispatchConfig.phasedRegistrationNames) {
  2395. if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
  2396. continue;
  2397. }
  2398. var PluginModule = EventPluginRegistry.registrationNameModules[dispatchConfig.phasedRegistrationNames[phase]];
  2399. if (PluginModule) {
  2400. return PluginModule;
  2401. }
  2402. }
  2403. return null;
  2404. },
  2405. /**
  2406. * Exposed for unit testing.
  2407. * @private
  2408. */
  2409. _resetEventPlugins: function () {
  2410. EventPluginOrder = null;
  2411. for (var pluginName in namesToPlugins) {
  2412. if (namesToPlugins.hasOwnProperty(pluginName)) {
  2413. delete namesToPlugins[pluginName];
  2414. }
  2415. }
  2416. EventPluginRegistry.plugins.length = 0;
  2417. var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
  2418. for (var eventName in eventNameDispatchConfigs) {
  2419. if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
  2420. delete eventNameDispatchConfigs[eventName];
  2421. }
  2422. }
  2423. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  2424. for (var registrationName in registrationNameModules) {
  2425. if (registrationNameModules.hasOwnProperty(registrationName)) {
  2426. delete registrationNameModules[registrationName];
  2427. }
  2428. }
  2429. }
  2430. };
  2431. module.exports = EventPluginRegistry;
  2432. },{"161":161}],18:[function(_dereq_,module,exports){
  2433. /**
  2434. * Copyright 2013-2015, Facebook, Inc.
  2435. * All rights reserved.
  2436. *
  2437. * This source code is licensed under the BSD-style license found in the
  2438. * LICENSE file in the root directory of this source tree. An additional grant
  2439. * of patent rights can be found in the PATENTS file in the same directory.
  2440. *
  2441. * @providesModule EventPluginUtils
  2442. */
  2443. 'use strict';
  2444. var EventConstants = _dereq_(15);
  2445. var ReactErrorUtils = _dereq_(61);
  2446. var invariant = _dereq_(161);
  2447. var warning = _dereq_(173);
  2448. /**
  2449. * Injected dependencies:
  2450. */
  2451. /**
  2452. * - `Mount`: [required] Module that can convert between React dom IDs and
  2453. * actual node references.
  2454. */
  2455. var injection = {
  2456. Mount: null,
  2457. injectMount: function (InjectedMount) {
  2458. injection.Mount = InjectedMount;
  2459. if ("production" !== 'production') {
  2460. "production" !== 'production' ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined;
  2461. }
  2462. }
  2463. };
  2464. var topLevelTypes = EventConstants.topLevelTypes;
  2465. function isEndish(topLevelType) {
  2466. return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel;
  2467. }
  2468. function isMoveish(topLevelType) {
  2469. return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove;
  2470. }
  2471. function isStartish(topLevelType) {
  2472. return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart;
  2473. }
  2474. var validateEventDispatches;
  2475. if ("production" !== 'production') {
  2476. validateEventDispatches = function (event) {
  2477. var dispatchListeners = event._dispatchListeners;
  2478. var dispatchIDs = event._dispatchIDs;
  2479. var listenersIsArr = Array.isArray(dispatchListeners);
  2480. var idsIsArr = Array.isArray(dispatchIDs);
  2481. var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
  2482. var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
  2483. "production" !== 'production' ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined;
  2484. };
  2485. }
  2486. /**
  2487. * Dispatch the event to the listener.
  2488. * @param {SyntheticEvent} event SyntheticEvent to handle
  2489. * @param {boolean} simulated If the event is simulated (changes exn behavior)
  2490. * @param {function} listener Application-level callback
  2491. * @param {string} domID DOM id to pass to the callback.
  2492. */
  2493. function executeDispatch(event, simulated, listener, domID) {
  2494. var type = event.type || 'unknown-event';
  2495. event.currentTarget = injection.Mount.getNode(domID);
  2496. if (simulated) {
  2497. ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID);
  2498. } else {
  2499. ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID);
  2500. }
  2501. event.currentTarget = null;
  2502. }
  2503. /**
  2504. * Standard/simple iteration through an event's collected dispatches.
  2505. */
  2506. function executeDispatchesInOrder(event, simulated) {
  2507. var dispatchListeners = event._dispatchListeners;
  2508. var dispatchIDs = event._dispatchIDs;
  2509. if ("production" !== 'production') {
  2510. validateEventDispatches(event);
  2511. }
  2512. if (Array.isArray(dispatchListeners)) {
  2513. for (var i = 0; i < dispatchListeners.length; i++) {
  2514. if (event.isPropagationStopped()) {
  2515. break;
  2516. }
  2517. // Listeners and IDs are two parallel arrays that are always in sync.
  2518. executeDispatch(event, simulated, dispatchListeners[i], dispatchIDs[i]);
  2519. }
  2520. } else if (dispatchListeners) {
  2521. executeDispatch(event, simulated, dispatchListeners, dispatchIDs);
  2522. }
  2523. event._dispatchListeners = null;
  2524. event._dispatchIDs = null;
  2525. }
  2526. /**
  2527. * Standard/simple iteration through an event's collected dispatches, but stops
  2528. * at the first dispatch execution returning true, and returns that id.
  2529. *
  2530. * @return {?string} id of the first dispatch execution who's listener returns
  2531. * true, or null if no listener returned true.
  2532. */
  2533. function executeDispatchesInOrderStopAtTrueImpl(event) {
  2534. var dispatchListeners = event._dispatchListeners;
  2535. var dispatchIDs = event._dispatchIDs;
  2536. if ("production" !== 'production') {
  2537. validateEventDispatches(event);
  2538. }
  2539. if (Array.isArray(dispatchListeners)) {
  2540. for (var i = 0; i < dispatchListeners.length; i++) {
  2541. if (event.isPropagationStopped()) {
  2542. break;
  2543. }
  2544. // Listeners and IDs are two parallel arrays that are always in sync.
  2545. if (dispatchListeners[i](event, dispatchIDs[i])) {
  2546. return dispatchIDs[i];
  2547. }
  2548. }
  2549. } else if (dispatchListeners) {
  2550. if (dispatchListeners(event, dispatchIDs)) {
  2551. return dispatchIDs;
  2552. }
  2553. }
  2554. return null;
  2555. }
  2556. /**
  2557. * @see executeDispatchesInOrderStopAtTrueImpl
  2558. */
  2559. function executeDispatchesInOrderStopAtTrue(event) {
  2560. var ret = executeDispatchesInOrderStopAtTrueImpl(event);
  2561. event._dispatchIDs = null;
  2562. event._dispatchListeners = null;
  2563. return ret;
  2564. }
  2565. /**
  2566. * Execution of a "direct" dispatch - there must be at most one dispatch
  2567. * accumulated on the event or it is considered an error. It doesn't really make
  2568. * sense for an event with multiple dispatches (bubbled) to keep track of the
  2569. * return values at each dispatch execution, but it does tend to make sense when
  2570. * dealing with "direct" dispatches.
  2571. *
  2572. * @return {*} The return value of executing the single dispatch.
  2573. */
  2574. function executeDirectDispatch(event) {
  2575. if ("production" !== 'production') {
  2576. validateEventDispatches(event);
  2577. }
  2578. var dispatchListener = event._dispatchListeners;
  2579. var dispatchID = event._dispatchIDs;
  2580. !!Array.isArray(dispatchListener) ? "production" !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined;
  2581. var res = dispatchListener ? dispatchListener(event, dispatchID) : null;
  2582. event._dispatchListeners = null;
  2583. event._dispatchIDs = null;
  2584. return res;
  2585. }
  2586. /**
  2587. * @param {SyntheticEvent} event
  2588. * @return {boolean} True iff number of dispatches accumulated is greater than 0.
  2589. */
  2590. function hasDispatches(event) {
  2591. return !!event._dispatchListeners;
  2592. }
  2593. /**
  2594. * General utilities that are useful in creating custom Event Plugins.
  2595. */
  2596. var EventPluginUtils = {
  2597. isEndish: isEndish,
  2598. isMoveish: isMoveish,
  2599. isStartish: isStartish,
  2600. executeDirectDispatch: executeDirectDispatch,
  2601. executeDispatchesInOrder: executeDispatchesInOrder,
  2602. executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
  2603. hasDispatches: hasDispatches,
  2604. getNode: function (id) {
  2605. return injection.Mount.getNode(id);
  2606. },
  2607. getID: function (node) {
  2608. return injection.Mount.getID(node);
  2609. },
  2610. injection: injection
  2611. };
  2612. module.exports = EventPluginUtils;
  2613. },{"15":15,"161":161,"173":173,"61":61}],19:[function(_dereq_,module,exports){
  2614. /**
  2615. * Copyright 2013-2015, Facebook, Inc.
  2616. * All rights reserved.
  2617. *
  2618. * This source code is licensed under the BSD-style license found in the
  2619. * LICENSE file in the root directory of this source tree. An additional grant
  2620. * of patent rights can be found in the PATENTS file in the same directory.
  2621. *
  2622. * @providesModule EventPropagators
  2623. */
  2624. 'use strict';
  2625. var EventConstants = _dereq_(15);
  2626. var EventPluginHub = _dereq_(16);
  2627. var warning = _dereq_(173);
  2628. var accumulateInto = _dereq_(115);
  2629. var forEachAccumulated = _dereq_(124);
  2630. var PropagationPhases = EventConstants.PropagationPhases;
  2631. var getListener = EventPluginHub.getListener;
  2632. /**
  2633. * Some event types have a notion of different registration names for different
  2634. * "phases" of propagation. This finds listeners by a given phase.
  2635. */
  2636. function listenerAtPhase(id, event, propagationPhase) {
  2637. var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
  2638. return getListener(id, registrationName);
  2639. }
  2640. /**
  2641. * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
  2642. * here, allows us to not have to bind or create functions for each event.
  2643. * Mutating the event's members allows us to not have to create a wrapping
  2644. * "dispatch" object that pairs the event with the listener.
  2645. */
  2646. function accumulateDirectionalDispatches(domID, upwards, event) {
  2647. if ("production" !== 'production') {
  2648. "production" !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined;
  2649. }
  2650. var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
  2651. var listener = listenerAtPhase(domID, event, phase);
  2652. if (listener) {
  2653. event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
  2654. event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
  2655. }
  2656. }
  2657. /**
  2658. * Collect dispatches (must be entirely collected before dispatching - see unit
  2659. * tests). Lazily allocate the array to conserve memory. We must loop through
  2660. * each event and perform the traversal for each one. We cannot perform a
  2661. * single traversal for the entire collection of events because each event may
  2662. * have a different target.
  2663. */
  2664. function accumulateTwoPhaseDispatchesSingle(event) {
  2665. if (event && event.dispatchConfig.phasedRegistrationNames) {
  2666. EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, accumulateDirectionalDispatches, event);
  2667. }
  2668. }
  2669. /**
  2670. * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
  2671. */
  2672. function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
  2673. if (event && event.dispatchConfig.phasedRegistrationNames) {
  2674. EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event);
  2675. }
  2676. }
  2677. /**
  2678. * Accumulates without regard to direction, does not look for phased
  2679. * registration names. Same as `accumulateDirectDispatchesSingle` but without
  2680. * requiring that the `dispatchMarker` be the same as the dispatched ID.
  2681. */
  2682. function accumulateDispatches(id, ignoredDirection, event) {
  2683. if (event && event.dispatchConfig.registrationName) {
  2684. var registrationName = event.dispatchConfig.registrationName;
  2685. var listener = getListener(id, registrationName);
  2686. if (listener) {
  2687. event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
  2688. event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
  2689. }
  2690. }
  2691. }
  2692. /**
  2693. * Accumulates dispatches on an `SyntheticEvent`, but only for the
  2694. * `dispatchMarker`.
  2695. * @param {SyntheticEvent} event
  2696. */
  2697. function accumulateDirectDispatchesSingle(event) {
  2698. if (event && event.dispatchConfig.registrationName) {
  2699. accumulateDispatches(event.dispatchMarker, null, event);
  2700. }
  2701. }
  2702. function accumulateTwoPhaseDispatches(events) {
  2703. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
  2704. }
  2705. function accumulateTwoPhaseDispatchesSkipTarget(events) {
  2706. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
  2707. }
  2708. function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
  2709. EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter);
  2710. }
  2711. function accumulateDirectDispatches(events) {
  2712. forEachAccumulated(events, accumulateDirectDispatchesSingle);
  2713. }
  2714. /**
  2715. * A small set of propagation patterns, each of which will accept a small amount
  2716. * of information, and generate a set of "dispatch ready event objects" - which
  2717. * are sets of events that have already been annotated with a set of dispatched
  2718. * listener functions/ids. The API is designed this way to discourage these
  2719. * propagation strategies from actually executing the dispatches, since we
  2720. * always want to collect the entire set of dispatches before executing event a
  2721. * single one.
  2722. *
  2723. * @constructor EventPropagators
  2724. */
  2725. var EventPropagators = {
  2726. accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
  2727. accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
  2728. accumulateDirectDispatches: accumulateDirectDispatches,
  2729. accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
  2730. };
  2731. module.exports = EventPropagators;
  2732. },{"115":115,"124":124,"15":15,"16":16,"173":173}],20:[function(_dereq_,module,exports){
  2733. /**
  2734. * Copyright 2013-2015, Facebook, Inc.
  2735. * All rights reserved.
  2736. *
  2737. * This source code is licensed under the BSD-style license found in the
  2738. * LICENSE file in the root directory of this source tree. An additional grant
  2739. * of patent rights can be found in the PATENTS file in the same directory.
  2740. *
  2741. * @providesModule FallbackCompositionState
  2742. * @typechecks static-only
  2743. */
  2744. 'use strict';
  2745. var PooledClass = _dereq_(25);
  2746. var assign = _dereq_(24);
  2747. var getTextContentAccessor = _dereq_(131);
  2748. /**
  2749. * This helper class stores information about text content of a target node,
  2750. * allowing comparison of content before and after a given event.
  2751. *
  2752. * Identify the node where selection currently begins, then observe
  2753. * both its text content and its current position in the DOM. Since the
  2754. * browser may natively replace the target node during composition, we can
  2755. * use its position to find its replacement.
  2756. *
  2757. * @param {DOMEventTarget} root
  2758. */
  2759. function FallbackCompositionState(root) {
  2760. this._root = root;
  2761. this._startText = this.getText();
  2762. this._fallbackText = null;
  2763. }
  2764. assign(FallbackCompositionState.prototype, {
  2765. destructor: function () {
  2766. this._root = null;
  2767. this._startText = null;
  2768. this._fallbackText = null;
  2769. },
  2770. /**
  2771. * Get current text of input.
  2772. *
  2773. * @return {string}
  2774. */
  2775. getText: function () {
  2776. if ('value' in this._root) {
  2777. return this._root.value;
  2778. }
  2779. return this._root[getTextContentAccessor()];
  2780. },
  2781. /**
  2782. * Determine the differing substring between the initially stored
  2783. * text content and the current content.
  2784. *
  2785. * @return {string}
  2786. */
  2787. getData: function () {
  2788. if (this._fallbackText) {
  2789. return this._fallbackText;
  2790. }
  2791. var start;
  2792. var startValue = this._startText;
  2793. var startLength = startValue.length;
  2794. var end;
  2795. var endValue = this.getText();
  2796. var endLength = endValue.length;
  2797. for (start = 0; start < startLength; start++) {
  2798. if (startValue[start] !== endValue[start]) {
  2799. break;
  2800. }
  2801. }
  2802. var minEnd = startLength - start;
  2803. for (end = 1; end <= minEnd; end++) {
  2804. if (startValue[startLength - end] !== endValue[endLength - end]) {
  2805. break;
  2806. }
  2807. }
  2808. var sliceTail = end > 1 ? 1 - end : undefined;
  2809. this._fallbackText = endValue.slice(start, sliceTail);
  2810. return this._fallbackText;
  2811. }
  2812. });
  2813. PooledClass.addPoolingTo(FallbackCompositionState);
  2814. module.exports = FallbackCompositionState;
  2815. },{"131":131,"24":24,"25":25}],21:[function(_dereq_,module,exports){
  2816. /**
  2817. * Copyright 2013-2015, Facebook, Inc.
  2818. * All rights reserved.
  2819. *
  2820. * This source code is licensed under the BSD-style license found in the
  2821. * LICENSE file in the root directory of this source tree. An additional grant
  2822. * of patent rights can be found in the PATENTS file in the same directory.
  2823. *
  2824. * @providesModule HTMLDOMPropertyConfig
  2825. */
  2826. 'use strict';
  2827. var DOMProperty = _dereq_(10);
  2828. var ExecutionEnvironment = _dereq_(147);
  2829. var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
  2830. var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
  2831. var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
  2832. var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
  2833. var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
  2834. var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
  2835. var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
  2836. var hasSVG;
  2837. if (ExecutionEnvironment.canUseDOM) {
  2838. var implementation = document.implementation;
  2839. hasSVG = implementation && implementation.hasFeature && implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1');
  2840. }
  2841. var HTMLDOMPropertyConfig = {
  2842. isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),
  2843. Properties: {
  2844. /**
  2845. * Standard Properties
  2846. */
  2847. accept: null,
  2848. acceptCharset: null,
  2849. accessKey: null,
  2850. action: null,
  2851. allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  2852. allowTransparency: MUST_USE_ATTRIBUTE,
  2853. alt: null,
  2854. async: HAS_BOOLEAN_VALUE,
  2855. autoComplete: null,
  2856. // autoFocus is polyfilled/normalized by AutoFocusUtils
  2857. // autoFocus: HAS_BOOLEAN_VALUE,
  2858. autoPlay: HAS_BOOLEAN_VALUE,
  2859. capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  2860. cellPadding: null,
  2861. cellSpacing: null,
  2862. charSet: MUST_USE_ATTRIBUTE,
  2863. challenge: MUST_USE_ATTRIBUTE,
  2864. checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  2865. classID: MUST_USE_ATTRIBUTE,
  2866. // To set className on SVG elements, it's necessary to use .setAttribute;
  2867. // this works on HTML elements too in all browsers except IE8. Conveniently,
  2868. // IE8 doesn't support SVG and so we can simply use the attribute in
  2869. // browsers that support SVG and the property in browsers that don't,
  2870. // regardless of whether the element is HTML or SVG.
  2871. className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
  2872. cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
  2873. colSpan: null,
  2874. content: null,
  2875. contentEditable: null,
  2876. contextMenu: MUST_USE_ATTRIBUTE,
  2877. controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  2878. coords: null,
  2879. crossOrigin: null,
  2880. data: null, // For `<object />` acts as `src`.
  2881. dateTime: MUST_USE_ATTRIBUTE,
  2882. 'default': HAS_BOOLEAN_VALUE,
  2883. defer: HAS_BOOLEAN_VALUE,
  2884. dir: null,
  2885. disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  2886. download: HAS_OVERLOADED_BOOLEAN_VALUE,
  2887. draggable: null,
  2888. encType: null,
  2889. form: MUST_USE_ATTRIBUTE,
  2890. formAction: MUST_USE_ATTRIBUTE,
  2891. formEncType: MUST_USE_ATTRIBUTE,
  2892. formMethod: MUST_USE_ATTRIBUTE,
  2893. formNoValidate: HAS_BOOLEAN_VALUE,
  2894. formTarget: MUST_USE_ATTRIBUTE,
  2895. frameBorder: MUST_USE_ATTRIBUTE,
  2896. headers: null,
  2897. height: MUST_USE_ATTRIBUTE,
  2898. hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  2899. high: null,
  2900. href: null,
  2901. hrefLang: null,
  2902. htmlFor: null,
  2903. httpEquiv: null,
  2904. icon: null,
  2905. id: MUST_USE_PROPERTY,
  2906. inputMode: MUST_USE_ATTRIBUTE,
  2907. integrity: null,
  2908. is: MUST_USE_ATTRIBUTE,
  2909. keyParams: MUST_USE_ATTRIBUTE,
  2910. keyType: MUST_USE_ATTRIBUTE,
  2911. kind: null,
  2912. label: null,
  2913. lang: null,
  2914. list: MUST_USE_ATTRIBUTE,
  2915. loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  2916. low: null,
  2917. manifest: MUST_USE_ATTRIBUTE,
  2918. marginHeight: null,
  2919. marginWidth: null,
  2920. max: null,
  2921. maxLength: MUST_USE_ATTRIBUTE,
  2922. media: MUST_USE_ATTRIBUTE,
  2923. mediaGroup: null,
  2924. method: null,
  2925. min: null,
  2926. minLength: MUST_USE_ATTRIBUTE,
  2927. multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  2928. muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  2929. name: null,
  2930. nonce: MUST_USE_ATTRIBUTE,
  2931. noValidate: HAS_BOOLEAN_VALUE,
  2932. open: HAS_BOOLEAN_VALUE,
  2933. optimum: null,
  2934. pattern: null,
  2935. placeholder: null,
  2936. poster: null,
  2937. preload: null,
  2938. radioGroup: null,
  2939. readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  2940. rel: null,
  2941. required: HAS_BOOLEAN_VALUE,
  2942. reversed: HAS_BOOLEAN_VALUE,
  2943. role: MUST_USE_ATTRIBUTE,
  2944. rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
  2945. rowSpan: null,
  2946. sandbox: null,
  2947. scope: null,
  2948. scoped: HAS_BOOLEAN_VALUE,
  2949. scrolling: null,
  2950. seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  2951. selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  2952. shape: null,
  2953. size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
  2954. sizes: MUST_USE_ATTRIBUTE,
  2955. span: HAS_POSITIVE_NUMERIC_VALUE,
  2956. spellCheck: null,
  2957. src: null,
  2958. srcDoc: MUST_USE_PROPERTY,
  2959. srcLang: null,
  2960. srcSet: MUST_USE_ATTRIBUTE,
  2961. start: HAS_NUMERIC_VALUE,
  2962. step: null,
  2963. style: null,
  2964. summary: null,
  2965. tabIndex: null,
  2966. target: null,
  2967. title: null,
  2968. type: null,
  2969. useMap: null,
  2970. value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
  2971. width: MUST_USE_ATTRIBUTE,
  2972. wmode: MUST_USE_ATTRIBUTE,
  2973. wrap: null,
  2974. /**
  2975. * RDFa Properties
  2976. */
  2977. about: MUST_USE_ATTRIBUTE,
  2978. datatype: MUST_USE_ATTRIBUTE,
  2979. inlist: MUST_USE_ATTRIBUTE,
  2980. prefix: MUST_USE_ATTRIBUTE,
  2981. // property is also supported for OpenGraph in meta tags.
  2982. property: MUST_USE_ATTRIBUTE,
  2983. resource: MUST_USE_ATTRIBUTE,
  2984. 'typeof': MUST_USE_ATTRIBUTE,
  2985. vocab: MUST_USE_ATTRIBUTE,
  2986. /**
  2987. * Non-standard Properties
  2988. */
  2989. // autoCapitalize and autoCorrect are supported in Mobile Safari for
  2990. // keyboard hints.
  2991. autoCapitalize: MUST_USE_ATTRIBUTE,
  2992. autoCorrect: MUST_USE_ATTRIBUTE,
  2993. // autoSave allows WebKit/Blink to persist values of input fields on page reloads
  2994. autoSave: null,
  2995. // color is for Safari mask-icon link
  2996. color: null,
  2997. // itemProp, itemScope, itemType are for
  2998. // Microdata support. See http://schema.org/docs/gs.html
  2999. itemProp: MUST_USE_ATTRIBUTE,
  3000. itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3001. itemType: MUST_USE_ATTRIBUTE,
  3002. // itemID and itemRef are for Microdata support as well but
  3003. // only specified in the the WHATWG spec document. See
  3004. // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
  3005. itemID: MUST_USE_ATTRIBUTE,
  3006. itemRef: MUST_USE_ATTRIBUTE,
  3007. // results show looking glass icon and recent searches on input
  3008. // search fields in WebKit/Blink
  3009. results: null,
  3010. // IE-only attribute that specifies security restrictions on an iframe
  3011. // as an alternative to the sandbox attribute on IE<10
  3012. security: MUST_USE_ATTRIBUTE,
  3013. // IE-only attribute that controls focus behavior
  3014. unselectable: MUST_USE_ATTRIBUTE
  3015. },
  3016. DOMAttributeNames: {
  3017. acceptCharset: 'accept-charset',
  3018. className: 'class',
  3019. htmlFor: 'for',
  3020. httpEquiv: 'http-equiv'
  3021. },
  3022. DOMPropertyNames: {
  3023. autoComplete: 'autocomplete',
  3024. autoFocus: 'autofocus',
  3025. autoPlay: 'autoplay',
  3026. autoSave: 'autosave',
  3027. // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
  3028. // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
  3029. encType: 'encoding',
  3030. hrefLang: 'hreflang',
  3031. radioGroup: 'radiogroup',
  3032. spellCheck: 'spellcheck',
  3033. srcDoc: 'srcdoc',
  3034. srcSet: 'srcset'
  3035. }
  3036. };
  3037. module.exports = HTMLDOMPropertyConfig;
  3038. },{"10":10,"147":147}],22:[function(_dereq_,module,exports){
  3039. /**
  3040. * Copyright 2013-2015, Facebook, Inc.
  3041. * All rights reserved.
  3042. *
  3043. * This source code is licensed under the BSD-style license found in the
  3044. * LICENSE file in the root directory of this source tree. An additional grant
  3045. * of patent rights can be found in the PATENTS file in the same directory.
  3046. *
  3047. * @providesModule LinkedStateMixin
  3048. * @typechecks static-only
  3049. */
  3050. 'use strict';
  3051. var ReactLink = _dereq_(70);
  3052. var ReactStateSetters = _dereq_(90);
  3053. /**
  3054. * A simple mixin around ReactLink.forState().
  3055. */
  3056. var LinkedStateMixin = {
  3057. /**
  3058. * Create a ReactLink that's linked to part of this component's state. The
  3059. * ReactLink will have the current value of this.state[key] and will call
  3060. * setState() when a change is requested.
  3061. *
  3062. * @param {string} key state key to update. Note: you may want to use keyOf()
  3063. * if you're using Google Closure Compiler advanced mode.
  3064. * @return {ReactLink} ReactLink instance linking to the state.
  3065. */
  3066. linkState: function (key) {
  3067. return new ReactLink(this.state[key], ReactStateSetters.createStateKeySetter(this, key));
  3068. }
  3069. };
  3070. module.exports = LinkedStateMixin;
  3071. },{"70":70,"90":90}],23:[function(_dereq_,module,exports){
  3072. /**
  3073. * Copyright 2013-2015, Facebook, Inc.
  3074. * All rights reserved.
  3075. *
  3076. * This source code is licensed under the BSD-style license found in the
  3077. * LICENSE file in the root directory of this source tree. An additional grant
  3078. * of patent rights can be found in the PATENTS file in the same directory.
  3079. *
  3080. * @providesModule LinkedValueUtils
  3081. * @typechecks static-only
  3082. */
  3083. 'use strict';
  3084. var ReactPropTypes = _dereq_(82);
  3085. var ReactPropTypeLocations = _dereq_(81);
  3086. var invariant = _dereq_(161);
  3087. var warning = _dereq_(173);
  3088. var hasReadOnlyValue = {
  3089. 'button': true,
  3090. 'checkbox': true,
  3091. 'image': true,
  3092. 'hidden': true,
  3093. 'radio': true,
  3094. 'reset': true,
  3095. 'submit': true
  3096. };
  3097. function _assertSingleLink(inputProps) {
  3098. !(inputProps.checkedLink == null || inputProps.valueLink == null) ? "production" !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
  3099. }
  3100. function _assertValueLink(inputProps) {
  3101. _assertSingleLink(inputProps);
  3102. !(inputProps.value == null && inputProps.onChange == null) ? "production" !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
  3103. }
  3104. function _assertCheckedLink(inputProps) {
  3105. _assertSingleLink(inputProps);
  3106. !(inputProps.checked == null && inputProps.onChange == null) ? "production" !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
  3107. }
  3108. var propTypes = {
  3109. value: function (props, propName, componentName) {
  3110. if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
  3111. return null;
  3112. }
  3113. return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
  3114. },
  3115. checked: function (props, propName, componentName) {
  3116. if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
  3117. return null;
  3118. }
  3119. return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
  3120. },
  3121. onChange: ReactPropTypes.func
  3122. };
  3123. var loggedTypeFailures = {};
  3124. function getDeclarationErrorAddendum(owner) {
  3125. if (owner) {
  3126. var name = owner.getName();
  3127. if (name) {
  3128. return ' Check the render method of `' + name + '`.';
  3129. }
  3130. }
  3131. return '';
  3132. }
  3133. /**
  3134. * Provide a linked `value` attribute for controlled forms. You should not use
  3135. * this outside of the ReactDOM controlled form components.
  3136. */
  3137. var LinkedValueUtils = {
  3138. checkPropTypes: function (tagName, props, owner) {
  3139. for (var propName in propTypes) {
  3140. if (propTypes.hasOwnProperty(propName)) {
  3141. var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop);
  3142. }
  3143. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  3144. // Only monitor this failure once because there tends to be a lot of the
  3145. // same error.
  3146. loggedTypeFailures[error.message] = true;
  3147. var addendum = getDeclarationErrorAddendum(owner);
  3148. "production" !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
  3149. }
  3150. }
  3151. },
  3152. /**
  3153. * @param {object} inputProps Props for form component
  3154. * @return {*} current value of the input either from value prop or link.
  3155. */
  3156. getValue: function (inputProps) {
  3157. if (inputProps.valueLink) {
  3158. _assertValueLink(inputProps);
  3159. return inputProps.valueLink.value;
  3160. }
  3161. return inputProps.value;
  3162. },
  3163. /**
  3164. * @param {object} inputProps Props for form component
  3165. * @return {*} current checked status of the input either from checked prop
  3166. * or link.
  3167. */
  3168. getChecked: function (inputProps) {
  3169. if (inputProps.checkedLink) {
  3170. _assertCheckedLink(inputProps);
  3171. return inputProps.checkedLink.value;
  3172. }
  3173. return inputProps.checked;
  3174. },
  3175. /**
  3176. * @param {object} inputProps Props for form component
  3177. * @param {SyntheticEvent} event change event to handle
  3178. */
  3179. executeOnChange: function (inputProps, event) {
  3180. if (inputProps.valueLink) {
  3181. _assertValueLink(inputProps);
  3182. return inputProps.valueLink.requestChange(event.target.value);
  3183. } else if (inputProps.checkedLink) {
  3184. _assertCheckedLink(inputProps);
  3185. return inputProps.checkedLink.requestChange(event.target.checked);
  3186. } else if (inputProps.onChange) {
  3187. return inputProps.onChange.call(undefined, event);
  3188. }
  3189. }
  3190. };
  3191. module.exports = LinkedValueUtils;
  3192. },{"161":161,"173":173,"81":81,"82":82}],24:[function(_dereq_,module,exports){
  3193. /**
  3194. * Copyright 2014-2015, Facebook, Inc.
  3195. * All rights reserved.
  3196. *
  3197. * This source code is licensed under the BSD-style license found in the
  3198. * LICENSE file in the root directory of this source tree. An additional grant
  3199. * of patent rights can be found in the PATENTS file in the same directory.
  3200. *
  3201. * @providesModule Object.assign
  3202. */
  3203. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
  3204. 'use strict';
  3205. function assign(target, sources) {
  3206. if (target == null) {
  3207. throw new TypeError('Object.assign target cannot be null or undefined');
  3208. }
  3209. var to = Object(target);
  3210. var hasOwnProperty = Object.prototype.hasOwnProperty;
  3211. for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
  3212. var nextSource = arguments[nextIndex];
  3213. if (nextSource == null) {
  3214. continue;
  3215. }
  3216. var from = Object(nextSource);
  3217. // We don't currently support accessors nor proxies. Therefore this
  3218. // copy cannot throw. If we ever supported this then we must handle
  3219. // exceptions and side-effects. We don't support symbols so they won't
  3220. // be transferred.
  3221. for (var key in from) {
  3222. if (hasOwnProperty.call(from, key)) {
  3223. to[key] = from[key];
  3224. }
  3225. }
  3226. }
  3227. return to;
  3228. }
  3229. module.exports = assign;
  3230. },{}],25:[function(_dereq_,module,exports){
  3231. /**
  3232. * Copyright 2013-2015, Facebook, Inc.
  3233. * All rights reserved.
  3234. *
  3235. * This source code is licensed under the BSD-style license found in the
  3236. * LICENSE file in the root directory of this source tree. An additional grant
  3237. * of patent rights can be found in the PATENTS file in the same directory.
  3238. *
  3239. * @providesModule PooledClass
  3240. */
  3241. 'use strict';
  3242. var invariant = _dereq_(161);
  3243. /**
  3244. * Static poolers. Several custom versions for each potential number of
  3245. * arguments. A completely generic pooler is easy to implement, but would
  3246. * require accessing the `arguments` object. In each of these, `this` refers to
  3247. * the Class itself, not an instance. If any others are needed, simply add them
  3248. * here, or in their own files.
  3249. */
  3250. var oneArgumentPooler = function (copyFieldsFrom) {
  3251. var Klass = this;
  3252. if (Klass.instancePool.length) {
  3253. var instance = Klass.instancePool.pop();
  3254. Klass.call(instance, copyFieldsFrom);
  3255. return instance;
  3256. } else {
  3257. return new Klass(copyFieldsFrom);
  3258. }
  3259. };
  3260. var twoArgumentPooler = function (a1, a2) {
  3261. var Klass = this;
  3262. if (Klass.instancePool.length) {
  3263. var instance = Klass.instancePool.pop();
  3264. Klass.call(instance, a1, a2);
  3265. return instance;
  3266. } else {
  3267. return new Klass(a1, a2);
  3268. }
  3269. };
  3270. var threeArgumentPooler = function (a1, a2, a3) {
  3271. var Klass = this;
  3272. if (Klass.instancePool.length) {
  3273. var instance = Klass.instancePool.pop();
  3274. Klass.call(instance, a1, a2, a3);
  3275. return instance;
  3276. } else {
  3277. return new Klass(a1, a2, a3);
  3278. }
  3279. };
  3280. var fourArgumentPooler = function (a1, a2, a3, a4) {
  3281. var Klass = this;
  3282. if (Klass.instancePool.length) {
  3283. var instance = Klass.instancePool.pop();
  3284. Klass.call(instance, a1, a2, a3, a4);
  3285. return instance;
  3286. } else {
  3287. return new Klass(a1, a2, a3, a4);
  3288. }
  3289. };
  3290. var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
  3291. var Klass = this;
  3292. if (Klass.instancePool.length) {
  3293. var instance = Klass.instancePool.pop();
  3294. Klass.call(instance, a1, a2, a3, a4, a5);
  3295. return instance;
  3296. } else {
  3297. return new Klass(a1, a2, a3, a4, a5);
  3298. }
  3299. };
  3300. var standardReleaser = function (instance) {
  3301. var Klass = this;
  3302. !(instance instanceof Klass) ? "production" !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined;
  3303. instance.destructor();
  3304. if (Klass.instancePool.length < Klass.poolSize) {
  3305. Klass.instancePool.push(instance);
  3306. }
  3307. };
  3308. var DEFAULT_POOL_SIZE = 10;
  3309. var DEFAULT_POOLER = oneArgumentPooler;
  3310. /**
  3311. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  3312. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  3313. * you give this may have a `poolSize` property, and will look for a
  3314. * prototypical `destructor` on instances (optional).
  3315. *
  3316. * @param {Function} CopyConstructor Constructor that can be used to reset.
  3317. * @param {Function} pooler Customizable pooler.
  3318. */
  3319. var addPoolingTo = function (CopyConstructor, pooler) {
  3320. var NewKlass = CopyConstructor;
  3321. NewKlass.instancePool = [];
  3322. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  3323. if (!NewKlass.poolSize) {
  3324. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  3325. }
  3326. NewKlass.release = standardReleaser;
  3327. return NewKlass;
  3328. };
  3329. var PooledClass = {
  3330. addPoolingTo: addPoolingTo,
  3331. oneArgumentPooler: oneArgumentPooler,
  3332. twoArgumentPooler: twoArgumentPooler,
  3333. threeArgumentPooler: threeArgumentPooler,
  3334. fourArgumentPooler: fourArgumentPooler,
  3335. fiveArgumentPooler: fiveArgumentPooler
  3336. };
  3337. module.exports = PooledClass;
  3338. },{"161":161}],26:[function(_dereq_,module,exports){
  3339. /**
  3340. * Copyright 2013-2015, Facebook, Inc.
  3341. * All rights reserved.
  3342. *
  3343. * This source code is licensed under the BSD-style license found in the
  3344. * LICENSE file in the root directory of this source tree. An additional grant
  3345. * of patent rights can be found in the PATENTS file in the same directory.
  3346. *
  3347. * @providesModule React
  3348. */
  3349. 'use strict';
  3350. var ReactDOM = _dereq_(40);
  3351. var ReactDOMServer = _dereq_(50);
  3352. var ReactIsomorphic = _dereq_(69);
  3353. var assign = _dereq_(24);
  3354. var deprecated = _dereq_(120);
  3355. // `version` will be added here by ReactIsomorphic.
  3356. var React = {};
  3357. assign(React, ReactIsomorphic);
  3358. assign(React, {
  3359. // ReactDOM
  3360. findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode),
  3361. render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render),
  3362. unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode),
  3363. // ReactDOMServer
  3364. renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString),
  3365. renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup)
  3366. });
  3367. React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
  3368. React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer;
  3369. module.exports = React;
  3370. },{"120":120,"24":24,"40":40,"50":50,"69":69}],27:[function(_dereq_,module,exports){
  3371. /**
  3372. * Copyright 2013-2015, Facebook, Inc.
  3373. * All rights reserved.
  3374. *
  3375. * This source code is licensed under the BSD-style license found in the
  3376. * LICENSE file in the root directory of this source tree. An additional grant
  3377. * of patent rights can be found in the PATENTS file in the same directory.
  3378. *
  3379. * @providesModule ReactBrowserComponentMixin
  3380. */
  3381. 'use strict';
  3382. var ReactInstanceMap = _dereq_(68);
  3383. var findDOMNode = _dereq_(122);
  3384. var warning = _dereq_(173);
  3385. var didWarnKey = '_getDOMNodeDidWarn';
  3386. var ReactBrowserComponentMixin = {
  3387. /**
  3388. * Returns the DOM node rendered by this component.
  3389. *
  3390. * @return {DOMElement} The root node of this component.
  3391. * @final
  3392. * @protected
  3393. */
  3394. getDOMNode: function () {
  3395. "production" !== 'production' ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'ReactDOM.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined;
  3396. this.constructor[didWarnKey] = true;
  3397. return findDOMNode(this);
  3398. }
  3399. };
  3400. module.exports = ReactBrowserComponentMixin;
  3401. },{"122":122,"173":173,"68":68}],28:[function(_dereq_,module,exports){
  3402. /**
  3403. * Copyright 2013-2015, Facebook, Inc.
  3404. * All rights reserved.
  3405. *
  3406. * This source code is licensed under the BSD-style license found in the
  3407. * LICENSE file in the root directory of this source tree. An additional grant
  3408. * of patent rights can be found in the PATENTS file in the same directory.
  3409. *
  3410. * @providesModule ReactBrowserEventEmitter
  3411. * @typechecks static-only
  3412. */
  3413. 'use strict';
  3414. var EventConstants = _dereq_(15);
  3415. var EventPluginHub = _dereq_(16);
  3416. var EventPluginRegistry = _dereq_(17);
  3417. var ReactEventEmitterMixin = _dereq_(62);
  3418. var ReactPerf = _dereq_(78);
  3419. var ViewportMetrics = _dereq_(114);
  3420. var assign = _dereq_(24);
  3421. var isEventSupported = _dereq_(133);
  3422. /**
  3423. * Summary of `ReactBrowserEventEmitter` event handling:
  3424. *
  3425. * - Top-level delegation is used to trap most native browser events. This
  3426. * may only occur in the main thread and is the responsibility of
  3427. * ReactEventListener, which is injected and can therefore support pluggable
  3428. * event sources. This is the only work that occurs in the main thread.
  3429. *
  3430. * - We normalize and de-duplicate events to account for browser quirks. This
  3431. * may be done in the worker thread.
  3432. *
  3433. * - Forward these native events (with the associated top-level type used to
  3434. * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
  3435. * to extract any synthetic events.
  3436. *
  3437. * - The `EventPluginHub` will then process each event by annotating them with
  3438. * "dispatches", a sequence of listeners and IDs that care about that event.
  3439. *
  3440. * - The `EventPluginHub` then dispatches the events.
  3441. *
  3442. * Overview of React and the event system:
  3443. *
  3444. * +------------+ .
  3445. * | DOM | .
  3446. * +------------+ .
  3447. * | .
  3448. * v .
  3449. * +------------+ .
  3450. * | ReactEvent | .
  3451. * | Listener | .
  3452. * +------------+ . +-----------+
  3453. * | . +--------+|SimpleEvent|
  3454. * | . | |Plugin |
  3455. * +-----|------+ . v +-----------+
  3456. * | | | . +--------------+ +------------+
  3457. * | +-----------.--->|EventPluginHub| | Event |
  3458. * | | . | | +-----------+ | Propagators|
  3459. * | ReactEvent | . | | |TapEvent | |------------|
  3460. * | Emitter | . | |<---+|Plugin | |other plugin|
  3461. * | | . | | +-----------+ | utilities |
  3462. * | +-----------.--->| | +------------+
  3463. * | | | . +--------------+
  3464. * +-----|------+ . ^ +-----------+
  3465. * | . | |Enter/Leave|
  3466. * + . +-------+|Plugin |
  3467. * +-------------+ . +-----------+
  3468. * | application | .
  3469. * |-------------| .
  3470. * | | .
  3471. * | | .
  3472. * +-------------+ .
  3473. * .
  3474. * React Core . General Purpose Event Plugin System
  3475. */
  3476. var alreadyListeningTo = {};
  3477. var isMonitoringScrollValue = false;
  3478. var reactTopListenersCounter = 0;
  3479. // For events like 'submit' which don't consistently bubble (which we trap at a
  3480. // lower node than `document`), binding at `document` would cause duplicate
  3481. // events so we don't include them here
  3482. var topEventMapping = {
  3483. topAbort: 'abort',
  3484. topBlur: 'blur',
  3485. topCanPlay: 'canplay',
  3486. topCanPlayThrough: 'canplaythrough',
  3487. topChange: 'change',
  3488. topClick: 'click',
  3489. topCompositionEnd: 'compositionend',
  3490. topCompositionStart: 'compositionstart',
  3491. topCompositionUpdate: 'compositionupdate',
  3492. topContextMenu: 'contextmenu',
  3493. topCopy: 'copy',
  3494. topCut: 'cut',
  3495. topDoubleClick: 'dblclick',
  3496. topDrag: 'drag',
  3497. topDragEnd: 'dragend',
  3498. topDragEnter: 'dragenter',
  3499. topDragExit: 'dragexit',
  3500. topDragLeave: 'dragleave',
  3501. topDragOver: 'dragover',
  3502. topDragStart: 'dragstart',
  3503. topDrop: 'drop',
  3504. topDurationChange: 'durationchange',
  3505. topEmptied: 'emptied',
  3506. topEncrypted: 'encrypted',
  3507. topEnded: 'ended',
  3508. topError: 'error',
  3509. topFocus: 'focus',
  3510. topInput: 'input',
  3511. topKeyDown: 'keydown',
  3512. topKeyPress: 'keypress',
  3513. topKeyUp: 'keyup',
  3514. topLoadedData: 'loadeddata',
  3515. topLoadedMetadata: 'loadedmetadata',
  3516. topLoadStart: 'loadstart',
  3517. topMouseDown: 'mousedown',
  3518. topMouseMove: 'mousemove',
  3519. topMouseOut: 'mouseout',
  3520. topMouseOver: 'mouseover',
  3521. topMouseUp: 'mouseup',
  3522. topPaste: 'paste',
  3523. topPause: 'pause',
  3524. topPlay: 'play',
  3525. topPlaying: 'playing',
  3526. topProgress: 'progress',
  3527. topRateChange: 'ratechange',
  3528. topScroll: 'scroll',
  3529. topSeeked: 'seeked',
  3530. topSeeking: 'seeking',
  3531. topSelectionChange: 'selectionchange',
  3532. topStalled: 'stalled',
  3533. topSuspend: 'suspend',
  3534. topTextInput: 'textInput',
  3535. topTimeUpdate: 'timeupdate',
  3536. topTouchCancel: 'touchcancel',
  3537. topTouchEnd: 'touchend',
  3538. topTouchMove: 'touchmove',
  3539. topTouchStart: 'touchstart',
  3540. topVolumeChange: 'volumechange',
  3541. topWaiting: 'waiting',
  3542. topWheel: 'wheel'
  3543. };
  3544. /**
  3545. * To ensure no conflicts with other potential React instances on the page
  3546. */
  3547. var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
  3548. function getListeningForDocument(mountAt) {
  3549. // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
  3550. // directly.
  3551. if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
  3552. mountAt[topListenersIDKey] = reactTopListenersCounter++;
  3553. alreadyListeningTo[mountAt[topListenersIDKey]] = {};
  3554. }
  3555. return alreadyListeningTo[mountAt[topListenersIDKey]];
  3556. }
  3557. /**
  3558. * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
  3559. * example:
  3560. *
  3561. * ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction);
  3562. *
  3563. * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
  3564. *
  3565. * @internal
  3566. */
  3567. var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
  3568. /**
  3569. * Injectable event backend
  3570. */
  3571. ReactEventListener: null,
  3572. injection: {
  3573. /**
  3574. * @param {object} ReactEventListener
  3575. */
  3576. injectReactEventListener: function (ReactEventListener) {
  3577. ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
  3578. ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
  3579. }
  3580. },
  3581. /**
  3582. * Sets whether or not any created callbacks should be enabled.
  3583. *
  3584. * @param {boolean} enabled True if callbacks should be enabled.
  3585. */
  3586. setEnabled: function (enabled) {
  3587. if (ReactBrowserEventEmitter.ReactEventListener) {
  3588. ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
  3589. }
  3590. },
  3591. /**
  3592. * @return {boolean} True if callbacks are enabled.
  3593. */
  3594. isEnabled: function () {
  3595. return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
  3596. },
  3597. /**
  3598. * We listen for bubbled touch events on the document object.
  3599. *
  3600. * Firefox v8.01 (and possibly others) exhibited strange behavior when
  3601. * mounting `onmousemove` events at some node that was not the document
  3602. * element. The symptoms were that if your mouse is not moving over something
  3603. * contained within that mount point (for example on the background) the
  3604. * top-level listeners for `onmousemove` won't be called. However, if you
  3605. * register the `mousemove` on the document object, then it will of course
  3606. * catch all `mousemove`s. This along with iOS quirks, justifies restricting
  3607. * top-level listeners to the document object only, at least for these
  3608. * movement types of events and possibly all events.
  3609. *
  3610. * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  3611. *
  3612. * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
  3613. * they bubble to document.
  3614. *
  3615. * @param {string} registrationName Name of listener (e.g. `onClick`).
  3616. * @param {object} contentDocumentHandle Document which owns the container
  3617. */
  3618. listenTo: function (registrationName, contentDocumentHandle) {
  3619. var mountAt = contentDocumentHandle;
  3620. var isListening = getListeningForDocument(mountAt);
  3621. var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
  3622. var topLevelTypes = EventConstants.topLevelTypes;
  3623. for (var i = 0; i < dependencies.length; i++) {
  3624. var dependency = dependencies[i];
  3625. if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
  3626. if (dependency === topLevelTypes.topWheel) {
  3627. if (isEventSupported('wheel')) {
  3628. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);
  3629. } else if (isEventSupported('mousewheel')) {
  3630. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);
  3631. } else {
  3632. // Firefox needs to capture a different mouse scroll event.
  3633. // @see http://www.quirksmode.org/dom/events/tests/scroll.html
  3634. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);
  3635. }
  3636. } else if (dependency === topLevelTypes.topScroll) {
  3637. if (isEventSupported('scroll', true)) {
  3638. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);
  3639. } else {
  3640. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
  3641. }
  3642. } else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) {
  3643. if (isEventSupported('focus', true)) {
  3644. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);
  3645. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt);
  3646. } else if (isEventSupported('focusin')) {
  3647. // IE has `focusin` and `focusout` events which bubble.
  3648. // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
  3649. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);
  3650. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);
  3651. }
  3652. // to make sure blur and focus event listeners are only attached once
  3653. isListening[topLevelTypes.topBlur] = true;
  3654. isListening[topLevelTypes.topFocus] = true;
  3655. } else if (topEventMapping.hasOwnProperty(dependency)) {
  3656. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
  3657. }
  3658. isListening[dependency] = true;
  3659. }
  3660. }
  3661. },
  3662. trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
  3663. return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
  3664. },
  3665. trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
  3666. return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
  3667. },
  3668. /**
  3669. * Listens to window scroll and resize events. We cache scroll values so that
  3670. * application code can access them without triggering reflows.
  3671. *
  3672. * NOTE: Scroll events do not bubble.
  3673. *
  3674. * @see http://www.quirksmode.org/dom/events/scroll.html
  3675. */
  3676. ensureScrollValueMonitoring: function () {
  3677. if (!isMonitoringScrollValue) {
  3678. var refresh = ViewportMetrics.refreshScrollValues;
  3679. ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
  3680. isMonitoringScrollValue = true;
  3681. }
  3682. },
  3683. eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
  3684. registrationNameModules: EventPluginHub.registrationNameModules,
  3685. putListener: EventPluginHub.putListener,
  3686. getListener: EventPluginHub.getListener,
  3687. deleteListener: EventPluginHub.deleteListener,
  3688. deleteAllListeners: EventPluginHub.deleteAllListeners
  3689. });
  3690. ReactPerf.measureMethods(ReactBrowserEventEmitter, 'ReactBrowserEventEmitter', {
  3691. putListener: 'putListener',
  3692. deleteListener: 'deleteListener'
  3693. });
  3694. module.exports = ReactBrowserEventEmitter;
  3695. },{"114":114,"133":133,"15":15,"16":16,"17":17,"24":24,"62":62,"78":78}],29:[function(_dereq_,module,exports){
  3696. /**
  3697. * Copyright 2013-2015, Facebook, Inc.
  3698. * All rights reserved.
  3699. *
  3700. * This source code is licensed under the BSD-style license found in the
  3701. * LICENSE file in the root directory of this source tree. An additional grant
  3702. * of patent rights can be found in the PATENTS file in the same directory.
  3703. *
  3704. * @typechecks
  3705. * @providesModule ReactCSSTransitionGroup
  3706. */
  3707. 'use strict';
  3708. var React = _dereq_(26);
  3709. var assign = _dereq_(24);
  3710. var ReactTransitionGroup = _dereq_(94);
  3711. var ReactCSSTransitionGroupChild = _dereq_(30);
  3712. function createTransitionTimeoutPropValidator(transitionType) {
  3713. var timeoutPropName = 'transition' + transitionType + 'Timeout';
  3714. var enabledPropName = 'transition' + transitionType;
  3715. return function (props) {
  3716. // If the transition is enabled
  3717. if (props[enabledPropName]) {
  3718. // If no timeout duration is provided
  3719. if (props[timeoutPropName] == null) {
  3720. return new Error(timeoutPropName + ' wasn\'t supplied to ReactCSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.');
  3721. // If the duration isn't a number
  3722. } else if (typeof props[timeoutPropName] !== 'number') {
  3723. return new Error(timeoutPropName + ' must be a number (in milliseconds)');
  3724. }
  3725. }
  3726. };
  3727. }
  3728. var ReactCSSTransitionGroup = React.createClass({
  3729. displayName: 'ReactCSSTransitionGroup',
  3730. propTypes: {
  3731. transitionName: ReactCSSTransitionGroupChild.propTypes.name,
  3732. transitionAppear: React.PropTypes.bool,
  3733. transitionEnter: React.PropTypes.bool,
  3734. transitionLeave: React.PropTypes.bool,
  3735. transitionAppearTimeout: createTransitionTimeoutPropValidator('Appear'),
  3736. transitionEnterTimeout: createTransitionTimeoutPropValidator('Enter'),
  3737. transitionLeaveTimeout: createTransitionTimeoutPropValidator('Leave')
  3738. },
  3739. getDefaultProps: function () {
  3740. return {
  3741. transitionAppear: false,
  3742. transitionEnter: true,
  3743. transitionLeave: true
  3744. };
  3745. },
  3746. _wrapChild: function (child) {
  3747. // We need to provide this childFactory so that
  3748. // ReactCSSTransitionGroupChild can receive updates to name, enter, and
  3749. // leave while it is leaving.
  3750. return React.createElement(ReactCSSTransitionGroupChild, {
  3751. name: this.props.transitionName,
  3752. appear: this.props.transitionAppear,
  3753. enter: this.props.transitionEnter,
  3754. leave: this.props.transitionLeave,
  3755. appearTimeout: this.props.transitionAppearTimeout,
  3756. enterTimeout: this.props.transitionEnterTimeout,
  3757. leaveTimeout: this.props.transitionLeaveTimeout
  3758. }, child);
  3759. },
  3760. render: function () {
  3761. return React.createElement(ReactTransitionGroup, assign({}, this.props, { childFactory: this._wrapChild }));
  3762. }
  3763. });
  3764. module.exports = ReactCSSTransitionGroup;
  3765. },{"24":24,"26":26,"30":30,"94":94}],30:[function(_dereq_,module,exports){
  3766. /**
  3767. * Copyright 2013-2015, Facebook, Inc.
  3768. * All rights reserved.
  3769. *
  3770. * This source code is licensed under the BSD-style license found in the
  3771. * LICENSE file in the root directory of this source tree. An additional grant
  3772. * of patent rights can be found in the PATENTS file in the same directory.
  3773. *
  3774. * @typechecks
  3775. * @providesModule ReactCSSTransitionGroupChild
  3776. */
  3777. 'use strict';
  3778. var React = _dereq_(26);
  3779. var ReactDOM = _dereq_(40);
  3780. var CSSCore = _dereq_(145);
  3781. var ReactTransitionEvents = _dereq_(93);
  3782. var onlyChild = _dereq_(135);
  3783. // We don't remove the element from the DOM until we receive an animationend or
  3784. // transitionend event. If the user screws up and forgets to add an animation
  3785. // their node will be stuck in the DOM forever, so we detect if an animation
  3786. // does not start and if it doesn't, we just call the end listener immediately.
  3787. var TICK = 17;
  3788. var ReactCSSTransitionGroupChild = React.createClass({
  3789. displayName: 'ReactCSSTransitionGroupChild',
  3790. propTypes: {
  3791. name: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.shape({
  3792. enter: React.PropTypes.string,
  3793. leave: React.PropTypes.string,
  3794. active: React.PropTypes.string
  3795. }), React.PropTypes.shape({
  3796. enter: React.PropTypes.string,
  3797. enterActive: React.PropTypes.string,
  3798. leave: React.PropTypes.string,
  3799. leaveActive: React.PropTypes.string,
  3800. appear: React.PropTypes.string,
  3801. appearActive: React.PropTypes.string
  3802. })]).isRequired,
  3803. // Once we require timeouts to be specified, we can remove the
  3804. // boolean flags (appear etc.) and just accept a number
  3805. // or a bool for the timeout flags (appearTimeout etc.)
  3806. appear: React.PropTypes.bool,
  3807. enter: React.PropTypes.bool,
  3808. leave: React.PropTypes.bool,
  3809. appearTimeout: React.PropTypes.number,
  3810. enterTimeout: React.PropTypes.number,
  3811. leaveTimeout: React.PropTypes.number
  3812. },
  3813. transition: function (animationType, finishCallback, userSpecifiedDelay) {
  3814. var node = ReactDOM.findDOMNode(this);
  3815. if (!node) {
  3816. if (finishCallback) {
  3817. finishCallback();
  3818. }
  3819. return;
  3820. }
  3821. var className = this.props.name[animationType] || this.props.name + '-' + animationType;
  3822. var activeClassName = this.props.name[animationType + 'Active'] || className + '-active';
  3823. var timeout = null;
  3824. var endListener = function (e) {
  3825. if (e && e.target !== node) {
  3826. return;
  3827. }
  3828. clearTimeout(timeout);
  3829. CSSCore.removeClass(node, className);
  3830. CSSCore.removeClass(node, activeClassName);
  3831. ReactTransitionEvents.removeEndEventListener(node, endListener);
  3832. // Usually this optional callback is used for informing an owner of
  3833. // a leave animation and telling it to remove the child.
  3834. if (finishCallback) {
  3835. finishCallback();
  3836. }
  3837. };
  3838. CSSCore.addClass(node, className);
  3839. // Need to do this to actually trigger a transition.
  3840. this.queueClass(activeClassName);
  3841. // If the user specified a timeout delay.
  3842. if (userSpecifiedDelay) {
  3843. // Clean-up the animation after the specified delay
  3844. timeout = setTimeout(endListener, userSpecifiedDelay);
  3845. this.transitionTimeouts.push(timeout);
  3846. } else {
  3847. // DEPRECATED: this listener will be removed in a future version of react
  3848. ReactTransitionEvents.addEndEventListener(node, endListener);
  3849. }
  3850. },
  3851. queueClass: function (className) {
  3852. this.classNameQueue.push(className);
  3853. if (!this.timeout) {
  3854. this.timeout = setTimeout(this.flushClassNameQueue, TICK);
  3855. }
  3856. },
  3857. flushClassNameQueue: function () {
  3858. if (this.isMounted()) {
  3859. this.classNameQueue.forEach(CSSCore.addClass.bind(CSSCore, ReactDOM.findDOMNode(this)));
  3860. }
  3861. this.classNameQueue.length = 0;
  3862. this.timeout = null;
  3863. },
  3864. componentWillMount: function () {
  3865. this.classNameQueue = [];
  3866. this.transitionTimeouts = [];
  3867. },
  3868. componentWillUnmount: function () {
  3869. if (this.timeout) {
  3870. clearTimeout(this.timeout);
  3871. }
  3872. this.transitionTimeouts.forEach(function (timeout) {
  3873. clearTimeout(timeout);
  3874. });
  3875. },
  3876. componentWillAppear: function (done) {
  3877. if (this.props.appear) {
  3878. this.transition('appear', done, this.props.appearTimeout);
  3879. } else {
  3880. done();
  3881. }
  3882. },
  3883. componentWillEnter: function (done) {
  3884. if (this.props.enter) {
  3885. this.transition('enter', done, this.props.enterTimeout);
  3886. } else {
  3887. done();
  3888. }
  3889. },
  3890. componentWillLeave: function (done) {
  3891. if (this.props.leave) {
  3892. this.transition('leave', done, this.props.leaveTimeout);
  3893. } else {
  3894. done();
  3895. }
  3896. },
  3897. render: function () {
  3898. return onlyChild(this.props.children);
  3899. }
  3900. });
  3901. module.exports = ReactCSSTransitionGroupChild;
  3902. },{"135":135,"145":145,"26":26,"40":40,"93":93}],31:[function(_dereq_,module,exports){
  3903. /**
  3904. * Copyright 2014-2015, Facebook, Inc.
  3905. * All rights reserved.
  3906. *
  3907. * This source code is licensed under the BSD-style license found in the
  3908. * LICENSE file in the root directory of this source tree. An additional grant
  3909. * of patent rights can be found in the PATENTS file in the same directory.
  3910. *
  3911. * @providesModule ReactChildReconciler
  3912. * @typechecks static-only
  3913. */
  3914. 'use strict';
  3915. var ReactReconciler = _dereq_(84);
  3916. var instantiateReactComponent = _dereq_(132);
  3917. var shouldUpdateReactComponent = _dereq_(141);
  3918. var traverseAllChildren = _dereq_(142);
  3919. var warning = _dereq_(173);
  3920. function instantiateChild(childInstances, child, name) {
  3921. // We found a component instance.
  3922. var keyUnique = childInstances[name] === undefined;
  3923. if ("production" !== 'production') {
  3924. "production" !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
  3925. }
  3926. if (child != null && keyUnique) {
  3927. childInstances[name] = instantiateReactComponent(child, null);
  3928. }
  3929. }
  3930. /**
  3931. * ReactChildReconciler provides helpers for initializing or updating a set of
  3932. * children. Its output is suitable for passing it onto ReactMultiChild which
  3933. * does diffed reordering and insertion.
  3934. */
  3935. var ReactChildReconciler = {
  3936. /**
  3937. * Generates a "mount image" for each of the supplied children. In the case
  3938. * of `ReactDOMComponent`, a mount image is a string of markup.
  3939. *
  3940. * @param {?object} nestedChildNodes Nested child maps.
  3941. * @return {?object} A set of child instances.
  3942. * @internal
  3943. */
  3944. instantiateChildren: function (nestedChildNodes, transaction, context) {
  3945. if (nestedChildNodes == null) {
  3946. return null;
  3947. }
  3948. var childInstances = {};
  3949. traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
  3950. return childInstances;
  3951. },
  3952. /**
  3953. * Updates the rendered children and returns a new set of children.
  3954. *
  3955. * @param {?object} prevChildren Previously initialized set of children.
  3956. * @param {?object} nextChildren Flat child element maps.
  3957. * @param {ReactReconcileTransaction} transaction
  3958. * @param {object} context
  3959. * @return {?object} A new set of child instances.
  3960. * @internal
  3961. */
  3962. updateChildren: function (prevChildren, nextChildren, transaction, context) {
  3963. // We currently don't have a way to track moves here but if we use iterators
  3964. // instead of for..in we can zip the iterators and check if an item has
  3965. // moved.
  3966. // TODO: If nothing has changed, return the prevChildren object so that we
  3967. // can quickly bailout if nothing has changed.
  3968. if (!nextChildren && !prevChildren) {
  3969. return null;
  3970. }
  3971. var name;
  3972. for (name in nextChildren) {
  3973. if (!nextChildren.hasOwnProperty(name)) {
  3974. continue;
  3975. }
  3976. var prevChild = prevChildren && prevChildren[name];
  3977. var prevElement = prevChild && prevChild._currentElement;
  3978. var nextElement = nextChildren[name];
  3979. if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
  3980. ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
  3981. nextChildren[name] = prevChild;
  3982. } else {
  3983. if (prevChild) {
  3984. ReactReconciler.unmountComponent(prevChild, name);
  3985. }
  3986. // The child must be instantiated before it's mounted.
  3987. var nextChildInstance = instantiateReactComponent(nextElement, null);
  3988. nextChildren[name] = nextChildInstance;
  3989. }
  3990. }
  3991. // Unmount children that are no longer present.
  3992. for (name in prevChildren) {
  3993. if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
  3994. ReactReconciler.unmountComponent(prevChildren[name]);
  3995. }
  3996. }
  3997. return nextChildren;
  3998. },
  3999. /**
  4000. * Unmounts all rendered children. This should be used to clean up children
  4001. * when this component is unmounted.
  4002. *
  4003. * @param {?object} renderedChildren Previously initialized set of children.
  4004. * @internal
  4005. */
  4006. unmountChildren: function (renderedChildren) {
  4007. for (var name in renderedChildren) {
  4008. if (renderedChildren.hasOwnProperty(name)) {
  4009. var renderedChild = renderedChildren[name];
  4010. ReactReconciler.unmountComponent(renderedChild);
  4011. }
  4012. }
  4013. }
  4014. };
  4015. module.exports = ReactChildReconciler;
  4016. },{"132":132,"141":141,"142":142,"173":173,"84":84}],32:[function(_dereq_,module,exports){
  4017. /**
  4018. * Copyright 2013-2015, Facebook, Inc.
  4019. * All rights reserved.
  4020. *
  4021. * This source code is licensed under the BSD-style license found in the
  4022. * LICENSE file in the root directory of this source tree. An additional grant
  4023. * of patent rights can be found in the PATENTS file in the same directory.
  4024. *
  4025. * @providesModule ReactChildren
  4026. */
  4027. 'use strict';
  4028. var PooledClass = _dereq_(25);
  4029. var ReactElement = _dereq_(57);
  4030. var emptyFunction = _dereq_(153);
  4031. var traverseAllChildren = _dereq_(142);
  4032. var twoArgumentPooler = PooledClass.twoArgumentPooler;
  4033. var fourArgumentPooler = PooledClass.fourArgumentPooler;
  4034. var userProvidedKeyEscapeRegex = /\/(?!\/)/g;
  4035. function escapeUserProvidedKey(text) {
  4036. return ('' + text).replace(userProvidedKeyEscapeRegex, '//');
  4037. }
  4038. /**
  4039. * PooledClass representing the bookkeeping associated with performing a child
  4040. * traversal. Allows avoiding binding callbacks.
  4041. *
  4042. * @constructor ForEachBookKeeping
  4043. * @param {!function} forEachFunction Function to perform traversal with.
  4044. * @param {?*} forEachContext Context to perform context with.
  4045. */
  4046. function ForEachBookKeeping(forEachFunction, forEachContext) {
  4047. this.func = forEachFunction;
  4048. this.context = forEachContext;
  4049. this.count = 0;
  4050. }
  4051. ForEachBookKeeping.prototype.destructor = function () {
  4052. this.func = null;
  4053. this.context = null;
  4054. this.count = 0;
  4055. };
  4056. PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
  4057. function forEachSingleChild(bookKeeping, child, name) {
  4058. var func = bookKeeping.func;
  4059. var context = bookKeeping.context;
  4060. func.call(context, child, bookKeeping.count++);
  4061. }
  4062. /**
  4063. * Iterates through children that are typically specified as `props.children`.
  4064. *
  4065. * The provided forEachFunc(child, index) will be called for each
  4066. * leaf child.
  4067. *
  4068. * @param {?*} children Children tree container.
  4069. * @param {function(*, int)} forEachFunc
  4070. * @param {*} forEachContext Context for forEachContext.
  4071. */
  4072. function forEachChildren(children, forEachFunc, forEachContext) {
  4073. if (children == null) {
  4074. return children;
  4075. }
  4076. var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
  4077. traverseAllChildren(children, forEachSingleChild, traverseContext);
  4078. ForEachBookKeeping.release(traverseContext);
  4079. }
  4080. /**
  4081. * PooledClass representing the bookkeeping associated with performing a child
  4082. * mapping. Allows avoiding binding callbacks.
  4083. *
  4084. * @constructor MapBookKeeping
  4085. * @param {!*} mapResult Object containing the ordered map of results.
  4086. * @param {!function} mapFunction Function to perform mapping with.
  4087. * @param {?*} mapContext Context to perform mapping with.
  4088. */
  4089. function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
  4090. this.result = mapResult;
  4091. this.keyPrefix = keyPrefix;
  4092. this.func = mapFunction;
  4093. this.context = mapContext;
  4094. this.count = 0;
  4095. }
  4096. MapBookKeeping.prototype.destructor = function () {
  4097. this.result = null;
  4098. this.keyPrefix = null;
  4099. this.func = null;
  4100. this.context = null;
  4101. this.count = 0;
  4102. };
  4103. PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
  4104. function mapSingleChildIntoContext(bookKeeping, child, childKey) {
  4105. var result = bookKeeping.result;
  4106. var keyPrefix = bookKeeping.keyPrefix;
  4107. var func = bookKeeping.func;
  4108. var context = bookKeeping.context;
  4109. var mappedChild = func.call(context, child, bookKeeping.count++);
  4110. if (Array.isArray(mappedChild)) {
  4111. mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
  4112. } else if (mappedChild != null) {
  4113. if (ReactElement.isValidElement(mappedChild)) {
  4114. mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
  4115. // Keep both the (mapped) and old keys if they differ, just as
  4116. // traverseAllChildren used to do for objects as children
  4117. keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey);
  4118. }
  4119. result.push(mappedChild);
  4120. }
  4121. }
  4122. function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
  4123. var escapedPrefix = '';
  4124. if (prefix != null) {
  4125. escapedPrefix = escapeUserProvidedKey(prefix) + '/';
  4126. }
  4127. var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
  4128. traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
  4129. MapBookKeeping.release(traverseContext);
  4130. }
  4131. /**
  4132. * Maps children that are typically specified as `props.children`.
  4133. *
  4134. * The provided mapFunction(child, key, index) will be called for each
  4135. * leaf child.
  4136. *
  4137. * @param {?*} children Children tree container.
  4138. * @param {function(*, int)} func The map function.
  4139. * @param {*} context Context for mapFunction.
  4140. * @return {object} Object containing the ordered map of results.
  4141. */
  4142. function mapChildren(children, func, context) {
  4143. if (children == null) {
  4144. return children;
  4145. }
  4146. var result = [];
  4147. mapIntoWithKeyPrefixInternal(children, result, null, func, context);
  4148. return result;
  4149. }
  4150. function forEachSingleChildDummy(traverseContext, child, name) {
  4151. return null;
  4152. }
  4153. /**
  4154. * Count the number of children that are typically specified as
  4155. * `props.children`.
  4156. *
  4157. * @param {?*} children Children tree container.
  4158. * @return {number} The number of children.
  4159. */
  4160. function countChildren(children, context) {
  4161. return traverseAllChildren(children, forEachSingleChildDummy, null);
  4162. }
  4163. /**
  4164. * Flatten a children object (typically specified as `props.children`) and
  4165. * return an array with appropriately re-keyed children.
  4166. */
  4167. function toArray(children) {
  4168. var result = [];
  4169. mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
  4170. return result;
  4171. }
  4172. var ReactChildren = {
  4173. forEach: forEachChildren,
  4174. map: mapChildren,
  4175. mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
  4176. count: countChildren,
  4177. toArray: toArray
  4178. };
  4179. module.exports = ReactChildren;
  4180. },{"142":142,"153":153,"25":25,"57":57}],33:[function(_dereq_,module,exports){
  4181. /**
  4182. * Copyright 2013-2015, Facebook, Inc.
  4183. * All rights reserved.
  4184. *
  4185. * This source code is licensed under the BSD-style license found in the
  4186. * LICENSE file in the root directory of this source tree. An additional grant
  4187. * of patent rights can be found in the PATENTS file in the same directory.
  4188. *
  4189. * @providesModule ReactClass
  4190. */
  4191. 'use strict';
  4192. var ReactComponent = _dereq_(34);
  4193. var ReactElement = _dereq_(57);
  4194. var ReactPropTypeLocations = _dereq_(81);
  4195. var ReactPropTypeLocationNames = _dereq_(80);
  4196. var ReactNoopUpdateQueue = _dereq_(76);
  4197. var assign = _dereq_(24);
  4198. var emptyObject = _dereq_(154);
  4199. var invariant = _dereq_(161);
  4200. var keyMirror = _dereq_(165);
  4201. var keyOf = _dereq_(166);
  4202. var warning = _dereq_(173);
  4203. var MIXINS_KEY = keyOf({ mixins: null });
  4204. /**
  4205. * Policies that describe methods in `ReactClassInterface`.
  4206. */
  4207. var SpecPolicy = keyMirror({
  4208. /**
  4209. * These methods may be defined only once by the class specification or mixin.
  4210. */
  4211. DEFINE_ONCE: null,
  4212. /**
  4213. * These methods may be defined by both the class specification and mixins.
  4214. * Subsequent definitions will be chained. These methods must return void.
  4215. */
  4216. DEFINE_MANY: null,
  4217. /**
  4218. * These methods are overriding the base class.
  4219. */
  4220. OVERRIDE_BASE: null,
  4221. /**
  4222. * These methods are similar to DEFINE_MANY, except we assume they return
  4223. * objects. We try to merge the keys of the return values of all the mixed in
  4224. * functions. If there is a key conflict we throw.
  4225. */
  4226. DEFINE_MANY_MERGED: null
  4227. });
  4228. var injectedMixins = [];
  4229. var warnedSetProps = false;
  4230. function warnSetProps() {
  4231. if (!warnedSetProps) {
  4232. warnedSetProps = true;
  4233. "production" !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined;
  4234. }
  4235. }
  4236. /**
  4237. * Composite components are higher-level components that compose other composite
  4238. * or native components.
  4239. *
  4240. * To create a new type of `ReactClass`, pass a specification of
  4241. * your new class to `React.createClass`. The only requirement of your class
  4242. * specification is that you implement a `render` method.
  4243. *
  4244. * var MyComponent = React.createClass({
  4245. * render: function() {
  4246. * return <div>Hello World</div>;
  4247. * }
  4248. * });
  4249. *
  4250. * The class specification supports a specific protocol of methods that have
  4251. * special meaning (e.g. `render`). See `ReactClassInterface` for
  4252. * more the comprehensive protocol. Any other properties and methods in the
  4253. * class specification will be available on the prototype.
  4254. *
  4255. * @interface ReactClassInterface
  4256. * @internal
  4257. */
  4258. var ReactClassInterface = {
  4259. /**
  4260. * An array of Mixin objects to include when defining your component.
  4261. *
  4262. * @type {array}
  4263. * @optional
  4264. */
  4265. mixins: SpecPolicy.DEFINE_MANY,
  4266. /**
  4267. * An object containing properties and methods that should be defined on
  4268. * the component's constructor instead of its prototype (static methods).
  4269. *
  4270. * @type {object}
  4271. * @optional
  4272. */
  4273. statics: SpecPolicy.DEFINE_MANY,
  4274. /**
  4275. * Definition of prop types for this component.
  4276. *
  4277. * @type {object}
  4278. * @optional
  4279. */
  4280. propTypes: SpecPolicy.DEFINE_MANY,
  4281. /**
  4282. * Definition of context types for this component.
  4283. *
  4284. * @type {object}
  4285. * @optional
  4286. */
  4287. contextTypes: SpecPolicy.DEFINE_MANY,
  4288. /**
  4289. * Definition of context types this component sets for its children.
  4290. *
  4291. * @type {object}
  4292. * @optional
  4293. */
  4294. childContextTypes: SpecPolicy.DEFINE_MANY,
  4295. // ==== Definition methods ====
  4296. /**
  4297. * Invoked when the component is mounted. Values in the mapping will be set on
  4298. * `this.props` if that prop is not specified (i.e. using an `in` check).
  4299. *
  4300. * This method is invoked before `getInitialState` and therefore cannot rely
  4301. * on `this.state` or use `this.setState`.
  4302. *
  4303. * @return {object}
  4304. * @optional
  4305. */
  4306. getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,
  4307. /**
  4308. * Invoked once before the component is mounted. The return value will be used
  4309. * as the initial value of `this.state`.
  4310. *
  4311. * getInitialState: function() {
  4312. * return {
  4313. * isOn: false,
  4314. * fooBaz: new BazFoo()
  4315. * }
  4316. * }
  4317. *
  4318. * @return {object}
  4319. * @optional
  4320. */
  4321. getInitialState: SpecPolicy.DEFINE_MANY_MERGED,
  4322. /**
  4323. * @return {object}
  4324. * @optional
  4325. */
  4326. getChildContext: SpecPolicy.DEFINE_MANY_MERGED,
  4327. /**
  4328. * Uses props from `this.props` and state from `this.state` to render the
  4329. * structure of the component.
  4330. *
  4331. * No guarantees are made about when or how often this method is invoked, so
  4332. * it must not have side effects.
  4333. *
  4334. * render: function() {
  4335. * var name = this.props.name;
  4336. * return <div>Hello, {name}!</div>;
  4337. * }
  4338. *
  4339. * @return {ReactComponent}
  4340. * @nosideeffects
  4341. * @required
  4342. */
  4343. render: SpecPolicy.DEFINE_ONCE,
  4344. // ==== Delegate methods ====
  4345. /**
  4346. * Invoked when the component is initially created and about to be mounted.
  4347. * This may have side effects, but any external subscriptions or data created
  4348. * by this method must be cleaned up in `componentWillUnmount`.
  4349. *
  4350. * @optional
  4351. */
  4352. componentWillMount: SpecPolicy.DEFINE_MANY,
  4353. /**
  4354. * Invoked when the component has been mounted and has a DOM representation.
  4355. * However, there is no guarantee that the DOM node is in the document.
  4356. *
  4357. * Use this as an opportunity to operate on the DOM when the component has
  4358. * been mounted (initialized and rendered) for the first time.
  4359. *
  4360. * @param {DOMElement} rootNode DOM element representing the component.
  4361. * @optional
  4362. */
  4363. componentDidMount: SpecPolicy.DEFINE_MANY,
  4364. /**
  4365. * Invoked before the component receives new props.
  4366. *
  4367. * Use this as an opportunity to react to a prop transition by updating the
  4368. * state using `this.setState`. Current props are accessed via `this.props`.
  4369. *
  4370. * componentWillReceiveProps: function(nextProps, nextContext) {
  4371. * this.setState({
  4372. * likesIncreasing: nextProps.likeCount > this.props.likeCount
  4373. * });
  4374. * }
  4375. *
  4376. * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
  4377. * transition may cause a state change, but the opposite is not true. If you
  4378. * need it, you are probably looking for `componentWillUpdate`.
  4379. *
  4380. * @param {object} nextProps
  4381. * @optional
  4382. */
  4383. componentWillReceiveProps: SpecPolicy.DEFINE_MANY,
  4384. /**
  4385. * Invoked while deciding if the component should be updated as a result of
  4386. * receiving new props, state and/or context.
  4387. *
  4388. * Use this as an opportunity to `return false` when you're certain that the
  4389. * transition to the new props/state/context will not require a component
  4390. * update.
  4391. *
  4392. * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
  4393. * return !equal(nextProps, this.props) ||
  4394. * !equal(nextState, this.state) ||
  4395. * !equal(nextContext, this.context);
  4396. * }
  4397. *
  4398. * @param {object} nextProps
  4399. * @param {?object} nextState
  4400. * @param {?object} nextContext
  4401. * @return {boolean} True if the component should update.
  4402. * @optional
  4403. */
  4404. shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,
  4405. /**
  4406. * Invoked when the component is about to update due to a transition from
  4407. * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
  4408. * and `nextContext`.
  4409. *
  4410. * Use this as an opportunity to perform preparation before an update occurs.
  4411. *
  4412. * NOTE: You **cannot** use `this.setState()` in this method.
  4413. *
  4414. * @param {object} nextProps
  4415. * @param {?object} nextState
  4416. * @param {?object} nextContext
  4417. * @param {ReactReconcileTransaction} transaction
  4418. * @optional
  4419. */
  4420. componentWillUpdate: SpecPolicy.DEFINE_MANY,
  4421. /**
  4422. * Invoked when the component's DOM representation has been updated.
  4423. *
  4424. * Use this as an opportunity to operate on the DOM when the component has
  4425. * been updated.
  4426. *
  4427. * @param {object} prevProps
  4428. * @param {?object} prevState
  4429. * @param {?object} prevContext
  4430. * @param {DOMElement} rootNode DOM element representing the component.
  4431. * @optional
  4432. */
  4433. componentDidUpdate: SpecPolicy.DEFINE_MANY,
  4434. /**
  4435. * Invoked when the component is about to be removed from its parent and have
  4436. * its DOM representation destroyed.
  4437. *
  4438. * Use this as an opportunity to deallocate any external resources.
  4439. *
  4440. * NOTE: There is no `componentDidUnmount` since your component will have been
  4441. * destroyed by that point.
  4442. *
  4443. * @optional
  4444. */
  4445. componentWillUnmount: SpecPolicy.DEFINE_MANY,
  4446. // ==== Advanced methods ====
  4447. /**
  4448. * Updates the component's currently mounted DOM representation.
  4449. *
  4450. * By default, this implements React's rendering and reconciliation algorithm.
  4451. * Sophisticated clients may wish to override this.
  4452. *
  4453. * @param {ReactReconcileTransaction} transaction
  4454. * @internal
  4455. * @overridable
  4456. */
  4457. updateComponent: SpecPolicy.OVERRIDE_BASE
  4458. };
  4459. /**
  4460. * Mapping from class specification keys to special processing functions.
  4461. *
  4462. * Although these are declared like instance properties in the specification
  4463. * when defining classes using `React.createClass`, they are actually static
  4464. * and are accessible on the constructor instead of the prototype. Despite
  4465. * being static, they must be defined outside of the "statics" key under
  4466. * which all other static methods are defined.
  4467. */
  4468. var RESERVED_SPEC_KEYS = {
  4469. displayName: function (Constructor, displayName) {
  4470. Constructor.displayName = displayName;
  4471. },
  4472. mixins: function (Constructor, mixins) {
  4473. if (mixins) {
  4474. for (var i = 0; i < mixins.length; i++) {
  4475. mixSpecIntoComponent(Constructor, mixins[i]);
  4476. }
  4477. }
  4478. },
  4479. childContextTypes: function (Constructor, childContextTypes) {
  4480. if ("production" !== 'production') {
  4481. validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
  4482. }
  4483. Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes);
  4484. },
  4485. contextTypes: function (Constructor, contextTypes) {
  4486. if ("production" !== 'production') {
  4487. validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
  4488. }
  4489. Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes);
  4490. },
  4491. /**
  4492. * Special case getDefaultProps which should move into statics but requires
  4493. * automatic merging.
  4494. */
  4495. getDefaultProps: function (Constructor, getDefaultProps) {
  4496. if (Constructor.getDefaultProps) {
  4497. Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
  4498. } else {
  4499. Constructor.getDefaultProps = getDefaultProps;
  4500. }
  4501. },
  4502. propTypes: function (Constructor, propTypes) {
  4503. if ("production" !== 'production') {
  4504. validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
  4505. }
  4506. Constructor.propTypes = assign({}, Constructor.propTypes, propTypes);
  4507. },
  4508. statics: function (Constructor, statics) {
  4509. mixStaticSpecIntoComponent(Constructor, statics);
  4510. },
  4511. autobind: function () {} };
  4512. // noop
  4513. function validateTypeDef(Constructor, typeDef, location) {
  4514. for (var propName in typeDef) {
  4515. if (typeDef.hasOwnProperty(propName)) {
  4516. // use a warning instead of an invariant so components
  4517. // don't show up in prod but not in __DEV__
  4518. "production" !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : undefined;
  4519. }
  4520. }
  4521. }
  4522. function validateMethodOverride(proto, name) {
  4523. var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
  4524. // Disallow overriding of base class methods unless explicitly allowed.
  4525. if (ReactClassMixin.hasOwnProperty(name)) {
  4526. !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? "production" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : undefined;
  4527. }
  4528. // Disallow defining methods more than once unless explicitly allowed.
  4529. if (proto.hasOwnProperty(name)) {
  4530. !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? "production" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : undefined;
  4531. }
  4532. }
  4533. /**
  4534. * Mixin helper which handles policy validation and reserved
  4535. * specification keys when building React classses.
  4536. */
  4537. function mixSpecIntoComponent(Constructor, spec) {
  4538. if (!spec) {
  4539. return;
  4540. }
  4541. !(typeof spec !== 'function') ? "production" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
  4542. !!ReactElement.isValidElement(spec) ? "production" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
  4543. var proto = Constructor.prototype;
  4544. // By handling mixins before any other properties, we ensure the same
  4545. // chaining order is applied to methods with DEFINE_MANY policy, whether
  4546. // mixins are listed before or after these methods in the spec.
  4547. if (spec.hasOwnProperty(MIXINS_KEY)) {
  4548. RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
  4549. }
  4550. for (var name in spec) {
  4551. if (!spec.hasOwnProperty(name)) {
  4552. continue;
  4553. }
  4554. if (name === MIXINS_KEY) {
  4555. // We have already handled mixins in a special case above.
  4556. continue;
  4557. }
  4558. var property = spec[name];
  4559. validateMethodOverride(proto, name);
  4560. if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
  4561. RESERVED_SPEC_KEYS[name](Constructor, property);
  4562. } else {
  4563. // Setup methods on prototype:
  4564. // The following member methods should not be automatically bound:
  4565. // 1. Expected ReactClass methods (in the "interface").
  4566. // 2. Overridden methods (that were mixed in).
  4567. var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
  4568. var isAlreadyDefined = proto.hasOwnProperty(name);
  4569. var isFunction = typeof property === 'function';
  4570. var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
  4571. if (shouldAutoBind) {
  4572. if (!proto.__reactAutoBindMap) {
  4573. proto.__reactAutoBindMap = {};
  4574. }
  4575. proto.__reactAutoBindMap[name] = property;
  4576. proto[name] = property;
  4577. } else {
  4578. if (isAlreadyDefined) {
  4579. var specPolicy = ReactClassInterface[name];
  4580. // These cases should already be caught by validateMethodOverride.
  4581. !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? "production" !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : undefined;
  4582. // For methods which are defined more than once, call the existing
  4583. // methods before calling the new property, merging if appropriate.
  4584. if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {
  4585. proto[name] = createMergedResultFunction(proto[name], property);
  4586. } else if (specPolicy === SpecPolicy.DEFINE_MANY) {
  4587. proto[name] = createChainedFunction(proto[name], property);
  4588. }
  4589. } else {
  4590. proto[name] = property;
  4591. if ("production" !== 'production') {
  4592. // Add verbose displayName to the function, which helps when looking
  4593. // at profiling tools.
  4594. if (typeof property === 'function' && spec.displayName) {
  4595. proto[name].displayName = spec.displayName + '_' + name;
  4596. }
  4597. }
  4598. }
  4599. }
  4600. }
  4601. }
  4602. }
  4603. function mixStaticSpecIntoComponent(Constructor, statics) {
  4604. if (!statics) {
  4605. return;
  4606. }
  4607. for (var name in statics) {
  4608. var property = statics[name];
  4609. if (!statics.hasOwnProperty(name)) {
  4610. continue;
  4611. }
  4612. var isReserved = (name in RESERVED_SPEC_KEYS);
  4613. !!isReserved ? "production" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : undefined;
  4614. var isInherited = (name in Constructor);
  4615. !!isInherited ? "production" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : undefined;
  4616. Constructor[name] = property;
  4617. }
  4618. }
  4619. /**
  4620. * Merge two objects, but throw if both contain the same key.
  4621. *
  4622. * @param {object} one The first object, which is mutated.
  4623. * @param {object} two The second object
  4624. * @return {object} one after it has been mutated to contain everything in two.
  4625. */
  4626. function mergeIntoWithNoDuplicateKeys(one, two) {
  4627. !(one && two && typeof one === 'object' && typeof two === 'object') ? "production" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
  4628. for (var key in two) {
  4629. if (two.hasOwnProperty(key)) {
  4630. !(one[key] === undefined) ? "production" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : undefined;
  4631. one[key] = two[key];
  4632. }
  4633. }
  4634. return one;
  4635. }
  4636. /**
  4637. * Creates a function that invokes two functions and merges their return values.
  4638. *
  4639. * @param {function} one Function to invoke first.
  4640. * @param {function} two Function to invoke second.
  4641. * @return {function} Function that invokes the two argument functions.
  4642. * @private
  4643. */
  4644. function createMergedResultFunction(one, two) {
  4645. return function mergedResult() {
  4646. var a = one.apply(this, arguments);
  4647. var b = two.apply(this, arguments);
  4648. if (a == null) {
  4649. return b;
  4650. } else if (b == null) {
  4651. return a;
  4652. }
  4653. var c = {};
  4654. mergeIntoWithNoDuplicateKeys(c, a);
  4655. mergeIntoWithNoDuplicateKeys(c, b);
  4656. return c;
  4657. };
  4658. }
  4659. /**
  4660. * Creates a function that invokes two functions and ignores their return vales.
  4661. *
  4662. * @param {function} one Function to invoke first.
  4663. * @param {function} two Function to invoke second.
  4664. * @return {function} Function that invokes the two argument functions.
  4665. * @private
  4666. */
  4667. function createChainedFunction(one, two) {
  4668. return function chainedFunction() {
  4669. one.apply(this, arguments);
  4670. two.apply(this, arguments);
  4671. };
  4672. }
  4673. /**
  4674. * Binds a method to the component.
  4675. *
  4676. * @param {object} component Component whose method is going to be bound.
  4677. * @param {function} method Method to be bound.
  4678. * @return {function} The bound method.
  4679. */
  4680. function bindAutoBindMethod(component, method) {
  4681. var boundMethod = method.bind(component);
  4682. if ("production" !== 'production') {
  4683. boundMethod.__reactBoundContext = component;
  4684. boundMethod.__reactBoundMethod = method;
  4685. boundMethod.__reactBoundArguments = null;
  4686. var componentName = component.constructor.displayName;
  4687. var _bind = boundMethod.bind;
  4688. /* eslint-disable block-scoped-var, no-undef */
  4689. boundMethod.bind = function (newThis) {
  4690. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  4691. args[_key - 1] = arguments[_key];
  4692. }
  4693. // User is trying to bind() an autobound method; we effectively will
  4694. // ignore the value of "this" that the user is trying to use, so
  4695. // let's warn.
  4696. if (newThis !== component && newThis !== null) {
  4697. "production" !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
  4698. } else if (!args.length) {
  4699. "production" !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : undefined;
  4700. return boundMethod;
  4701. }
  4702. var reboundMethod = _bind.apply(boundMethod, arguments);
  4703. reboundMethod.__reactBoundContext = component;
  4704. reboundMethod.__reactBoundMethod = method;
  4705. reboundMethod.__reactBoundArguments = args;
  4706. return reboundMethod;
  4707. /* eslint-enable */
  4708. };
  4709. }
  4710. return boundMethod;
  4711. }
  4712. /**
  4713. * Binds all auto-bound methods in a component.
  4714. *
  4715. * @param {object} component Component whose method is going to be bound.
  4716. */
  4717. function bindAutoBindMethods(component) {
  4718. for (var autoBindKey in component.__reactAutoBindMap) {
  4719. if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
  4720. var method = component.__reactAutoBindMap[autoBindKey];
  4721. component[autoBindKey] = bindAutoBindMethod(component, method);
  4722. }
  4723. }
  4724. }
  4725. /**
  4726. * Add more to the ReactClass base class. These are all legacy features and
  4727. * therefore not already part of the modern ReactComponent.
  4728. */
  4729. var ReactClassMixin = {
  4730. /**
  4731. * TODO: This will be deprecated because state should always keep a consistent
  4732. * type signature and the only use case for this, is to avoid that.
  4733. */
  4734. replaceState: function (newState, callback) {
  4735. this.updater.enqueueReplaceState(this, newState);
  4736. if (callback) {
  4737. this.updater.enqueueCallback(this, callback);
  4738. }
  4739. },
  4740. /**
  4741. * Checks whether or not this composite component is mounted.
  4742. * @return {boolean} True if mounted, false otherwise.
  4743. * @protected
  4744. * @final
  4745. */
  4746. isMounted: function () {
  4747. return this.updater.isMounted(this);
  4748. },
  4749. /**
  4750. * Sets a subset of the props.
  4751. *
  4752. * @param {object} partialProps Subset of the next props.
  4753. * @param {?function} callback Called after props are updated.
  4754. * @final
  4755. * @public
  4756. * @deprecated
  4757. */
  4758. setProps: function (partialProps, callback) {
  4759. if ("production" !== 'production') {
  4760. warnSetProps();
  4761. }
  4762. this.updater.enqueueSetProps(this, partialProps);
  4763. if (callback) {
  4764. this.updater.enqueueCallback(this, callback);
  4765. }
  4766. },
  4767. /**
  4768. * Replace all the props.
  4769. *
  4770. * @param {object} newProps Subset of the next props.
  4771. * @param {?function} callback Called after props are updated.
  4772. * @final
  4773. * @public
  4774. * @deprecated
  4775. */
  4776. replaceProps: function (newProps, callback) {
  4777. if ("production" !== 'production') {
  4778. warnSetProps();
  4779. }
  4780. this.updater.enqueueReplaceProps(this, newProps);
  4781. if (callback) {
  4782. this.updater.enqueueCallback(this, callback);
  4783. }
  4784. }
  4785. };
  4786. var ReactClassComponent = function () {};
  4787. assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
  4788. /**
  4789. * Module for creating composite components.
  4790. *
  4791. * @class ReactClass
  4792. */
  4793. var ReactClass = {
  4794. /**
  4795. * Creates a composite component class given a class specification.
  4796. *
  4797. * @param {object} spec Class specification (which must define `render`).
  4798. * @return {function} Component constructor function.
  4799. * @public
  4800. */
  4801. createClass: function (spec) {
  4802. var Constructor = function (props, context, updater) {
  4803. // This constructor is overridden by mocks. The argument is used
  4804. // by mocks to assert on what gets mounted.
  4805. if ("production" !== 'production') {
  4806. "production" !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
  4807. }
  4808. // Wire up auto-binding
  4809. if (this.__reactAutoBindMap) {
  4810. bindAutoBindMethods(this);
  4811. }
  4812. this.props = props;
  4813. this.context = context;
  4814. this.refs = emptyObject;
  4815. this.updater = updater || ReactNoopUpdateQueue;
  4816. this.state = null;
  4817. // ReactClasses doesn't have constructors. Instead, they use the
  4818. // getInitialState and componentWillMount methods for initialization.
  4819. var initialState = this.getInitialState ? this.getInitialState() : null;
  4820. if ("production" !== 'production') {
  4821. // We allow auto-mocks to proceed as if they're returning null.
  4822. if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
  4823. // This is probably bad practice. Consider warning here and
  4824. // deprecating this convenience.
  4825. initialState = null;
  4826. }
  4827. }
  4828. !(typeof initialState === 'object' && !Array.isArray(initialState)) ? "production" !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined;
  4829. this.state = initialState;
  4830. };
  4831. Constructor.prototype = new ReactClassComponent();
  4832. Constructor.prototype.constructor = Constructor;
  4833. injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
  4834. mixSpecIntoComponent(Constructor, spec);
  4835. // Initialize the defaultProps property after all mixins have been merged.
  4836. if (Constructor.getDefaultProps) {
  4837. Constructor.defaultProps = Constructor.getDefaultProps();
  4838. }
  4839. if ("production" !== 'production') {
  4840. // This is a tag to indicate that the use of these method names is ok,
  4841. // since it's used with createClass. If it's not, then it's likely a
  4842. // mistake so we'll warn you to use the static property, property
  4843. // initializer or constructor respectively.
  4844. if (Constructor.getDefaultProps) {
  4845. Constructor.getDefaultProps.isReactClassApproved = {};
  4846. }
  4847. if (Constructor.prototype.getInitialState) {
  4848. Constructor.prototype.getInitialState.isReactClassApproved = {};
  4849. }
  4850. }
  4851. !Constructor.prototype.render ? "production" !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
  4852. if ("production" !== 'production') {
  4853. "production" !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : undefined;
  4854. "production" !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
  4855. }
  4856. // Reduce time spent doing lookups by setting these on the prototype.
  4857. for (var methodName in ReactClassInterface) {
  4858. if (!Constructor.prototype[methodName]) {
  4859. Constructor.prototype[methodName] = null;
  4860. }
  4861. }
  4862. return Constructor;
  4863. },
  4864. injection: {
  4865. injectMixin: function (mixin) {
  4866. injectedMixins.push(mixin);
  4867. }
  4868. }
  4869. };
  4870. module.exports = ReactClass;
  4871. },{"154":154,"161":161,"165":165,"166":166,"173":173,"24":24,"34":34,"57":57,"76":76,"80":80,"81":81}],34:[function(_dereq_,module,exports){
  4872. /**
  4873. * Copyright 2013-2015, Facebook, Inc.
  4874. * All rights reserved.
  4875. *
  4876. * This source code is licensed under the BSD-style license found in the
  4877. * LICENSE file in the root directory of this source tree. An additional grant
  4878. * of patent rights can be found in the PATENTS file in the same directory.
  4879. *
  4880. * @providesModule ReactComponent
  4881. */
  4882. 'use strict';
  4883. var ReactNoopUpdateQueue = _dereq_(76);
  4884. var canDefineProperty = _dereq_(117);
  4885. var emptyObject = _dereq_(154);
  4886. var invariant = _dereq_(161);
  4887. var warning = _dereq_(173);
  4888. /**
  4889. * Base class helpers for the updating state of a component.
  4890. */
  4891. function ReactComponent(props, context, updater) {
  4892. this.props = props;
  4893. this.context = context;
  4894. this.refs = emptyObject;
  4895. // We initialize the default updater but the real one gets injected by the
  4896. // renderer.
  4897. this.updater = updater || ReactNoopUpdateQueue;
  4898. }
  4899. ReactComponent.prototype.isReactComponent = {};
  4900. /**
  4901. * Sets a subset of the state. Always use this to mutate
  4902. * state. You should treat `this.state` as immutable.
  4903. *
  4904. * There is no guarantee that `this.state` will be immediately updated, so
  4905. * accessing `this.state` after calling this method may return the old value.
  4906. *
  4907. * There is no guarantee that calls to `setState` will run synchronously,
  4908. * as they may eventually be batched together. You can provide an optional
  4909. * callback that will be executed when the call to setState is actually
  4910. * completed.
  4911. *
  4912. * When a function is provided to setState, it will be called at some point in
  4913. * the future (not synchronously). It will be called with the up to date
  4914. * component arguments (state, props, context). These values can be different
  4915. * from this.* because your function may be called after receiveProps but before
  4916. * shouldComponentUpdate, and this new state, props, and context will not yet be
  4917. * assigned to this.
  4918. *
  4919. * @param {object|function} partialState Next partial state or function to
  4920. * produce next partial state to be merged with current state.
  4921. * @param {?function} callback Called after state is updated.
  4922. * @final
  4923. * @protected
  4924. */
  4925. ReactComponent.prototype.setState = function (partialState, callback) {
  4926. !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? "production" !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : undefined;
  4927. if ("production" !== 'production') {
  4928. "production" !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
  4929. }
  4930. this.updater.enqueueSetState(this, partialState);
  4931. if (callback) {
  4932. this.updater.enqueueCallback(this, callback);
  4933. }
  4934. };
  4935. /**
  4936. * Forces an update. This should only be invoked when it is known with
  4937. * certainty that we are **not** in a DOM transaction.
  4938. *
  4939. * You may want to call this when you know that some deeper aspect of the
  4940. * component's state has changed but `setState` was not called.
  4941. *
  4942. * This will not invoke `shouldComponentUpdate`, but it will invoke
  4943. * `componentWillUpdate` and `componentDidUpdate`.
  4944. *
  4945. * @param {?function} callback Called after update is complete.
  4946. * @final
  4947. * @protected
  4948. */
  4949. ReactComponent.prototype.forceUpdate = function (callback) {
  4950. this.updater.enqueueForceUpdate(this);
  4951. if (callback) {
  4952. this.updater.enqueueCallback(this, callback);
  4953. }
  4954. };
  4955. /**
  4956. * Deprecated APIs. These APIs used to exist on classic React classes but since
  4957. * we would like to deprecate them, we're not going to move them over to this
  4958. * modern base class. Instead, we define a getter that warns if it's accessed.
  4959. */
  4960. if ("production" !== 'production') {
  4961. var deprecatedAPIs = {
  4962. getDOMNode: ['getDOMNode', 'Use ReactDOM.findDOMNode(component) instead.'],
  4963. isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
  4964. replaceProps: ['replaceProps', 'Instead, call render again at the top level.'],
  4965. replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'],
  4966. setProps: ['setProps', 'Instead, call render again at the top level.']
  4967. };
  4968. var defineDeprecationWarning = function (methodName, info) {
  4969. if (canDefineProperty) {
  4970. Object.defineProperty(ReactComponent.prototype, methodName, {
  4971. get: function () {
  4972. "production" !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
  4973. return undefined;
  4974. }
  4975. });
  4976. }
  4977. };
  4978. for (var fnName in deprecatedAPIs) {
  4979. if (deprecatedAPIs.hasOwnProperty(fnName)) {
  4980. defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
  4981. }
  4982. }
  4983. }
  4984. module.exports = ReactComponent;
  4985. },{"117":117,"154":154,"161":161,"173":173,"76":76}],35:[function(_dereq_,module,exports){
  4986. /**
  4987. * Copyright 2013-2015, Facebook, Inc.
  4988. * All rights reserved.
  4989. *
  4990. * This source code is licensed under the BSD-style license found in the
  4991. * LICENSE file in the root directory of this source tree. An additional grant
  4992. * of patent rights can be found in the PATENTS file in the same directory.
  4993. *
  4994. * @providesModule ReactComponentBrowserEnvironment
  4995. */
  4996. 'use strict';
  4997. var ReactDOMIDOperations = _dereq_(45);
  4998. var ReactMount = _dereq_(72);
  4999. /**
  5000. * Abstracts away all functionality of the reconciler that requires knowledge of
  5001. * the browser context. TODO: These callers should be refactored to avoid the
  5002. * need for this injection.
  5003. */
  5004. var ReactComponentBrowserEnvironment = {
  5005. processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
  5006. replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
  5007. /**
  5008. * If a particular environment requires that some resources be cleaned up,
  5009. * specify this in the injected Mixin. In the DOM, we would likely want to
  5010. * purge any cached node ID lookups.
  5011. *
  5012. * @private
  5013. */
  5014. unmountIDFromEnvironment: function (rootNodeID) {
  5015. ReactMount.purgeID(rootNodeID);
  5016. }
  5017. };
  5018. module.exports = ReactComponentBrowserEnvironment;
  5019. },{"45":45,"72":72}],36:[function(_dereq_,module,exports){
  5020. /**
  5021. * Copyright 2014-2015, Facebook, Inc.
  5022. * All rights reserved.
  5023. *
  5024. * This source code is licensed under the BSD-style license found in the
  5025. * LICENSE file in the root directory of this source tree. An additional grant
  5026. * of patent rights can be found in the PATENTS file in the same directory.
  5027. *
  5028. * @providesModule ReactComponentEnvironment
  5029. */
  5030. 'use strict';
  5031. var invariant = _dereq_(161);
  5032. var injected = false;
  5033. var ReactComponentEnvironment = {
  5034. /**
  5035. * Optionally injectable environment dependent cleanup hook. (server vs.
  5036. * browser etc). Example: A browser system caches DOM nodes based on component
  5037. * ID and must remove that cache entry when this instance is unmounted.
  5038. */
  5039. unmountIDFromEnvironment: null,
  5040. /**
  5041. * Optionally injectable hook for swapping out mount images in the middle of
  5042. * the tree.
  5043. */
  5044. replaceNodeWithMarkupByID: null,
  5045. /**
  5046. * Optionally injectable hook for processing a queue of child updates. Will
  5047. * later move into MultiChildComponents.
  5048. */
  5049. processChildrenUpdates: null,
  5050. injection: {
  5051. injectEnvironment: function (environment) {
  5052. !!injected ? "production" !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined;
  5053. ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
  5054. ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID;
  5055. ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
  5056. injected = true;
  5057. }
  5058. }
  5059. };
  5060. module.exports = ReactComponentEnvironment;
  5061. },{"161":161}],37:[function(_dereq_,module,exports){
  5062. /**
  5063. * Copyright 2013-2015, Facebook, Inc.
  5064. * All rights reserved.
  5065. *
  5066. * This source code is licensed under the BSD-style license found in the
  5067. * LICENSE file in the root directory of this source tree. An additional grant
  5068. * of patent rights can be found in the PATENTS file in the same directory.
  5069. *
  5070. * @providesModule ReactComponentWithPureRenderMixin
  5071. */
  5072. 'use strict';
  5073. var shallowCompare = _dereq_(140);
  5074. /**
  5075. * If your React component's render function is "pure", e.g. it will render the
  5076. * same result given the same props and state, provide this Mixin for a
  5077. * considerable performance boost.
  5078. *
  5079. * Most React components have pure render functions.
  5080. *
  5081. * Example:
  5082. *
  5083. * var ReactComponentWithPureRenderMixin =
  5084. * require('ReactComponentWithPureRenderMixin');
  5085. * React.createClass({
  5086. * mixins: [ReactComponentWithPureRenderMixin],
  5087. *
  5088. * render: function() {
  5089. * return <div className={this.props.className}>foo</div>;
  5090. * }
  5091. * });
  5092. *
  5093. * Note: This only checks shallow equality for props and state. If these contain
  5094. * complex data structures this mixin may have false-negatives for deeper
  5095. * differences. Only mixin to components which have simple props and state, or
  5096. * use `forceUpdate()` when you know deep data structures have changed.
  5097. */
  5098. var ReactComponentWithPureRenderMixin = {
  5099. shouldComponentUpdate: function (nextProps, nextState) {
  5100. return shallowCompare(this, nextProps, nextState);
  5101. }
  5102. };
  5103. module.exports = ReactComponentWithPureRenderMixin;
  5104. },{"140":140}],38:[function(_dereq_,module,exports){
  5105. /**
  5106. * Copyright 2013-2015, Facebook, Inc.
  5107. * All rights reserved.
  5108. *
  5109. * This source code is licensed under the BSD-style license found in the
  5110. * LICENSE file in the root directory of this source tree. An additional grant
  5111. * of patent rights can be found in the PATENTS file in the same directory.
  5112. *
  5113. * @providesModule ReactCompositeComponent
  5114. */
  5115. 'use strict';
  5116. var ReactComponentEnvironment = _dereq_(36);
  5117. var ReactCurrentOwner = _dereq_(39);
  5118. var ReactElement = _dereq_(57);
  5119. var ReactInstanceMap = _dereq_(68);
  5120. var ReactPerf = _dereq_(78);
  5121. var ReactPropTypeLocations = _dereq_(81);
  5122. var ReactPropTypeLocationNames = _dereq_(80);
  5123. var ReactReconciler = _dereq_(84);
  5124. var ReactUpdateQueue = _dereq_(95);
  5125. var assign = _dereq_(24);
  5126. var emptyObject = _dereq_(154);
  5127. var invariant = _dereq_(161);
  5128. var shouldUpdateReactComponent = _dereq_(141);
  5129. var warning = _dereq_(173);
  5130. function getDeclarationErrorAddendum(component) {
  5131. var owner = component._currentElement._owner || null;
  5132. if (owner) {
  5133. var name = owner.getName();
  5134. if (name) {
  5135. return ' Check the render method of `' + name + '`.';
  5136. }
  5137. }
  5138. return '';
  5139. }
  5140. function StatelessComponent(Component) {}
  5141. StatelessComponent.prototype.render = function () {
  5142. var Component = ReactInstanceMap.get(this)._currentElement.type;
  5143. return Component(this.props, this.context, this.updater);
  5144. };
  5145. /**
  5146. * ------------------ The Life-Cycle of a Composite Component ------------------
  5147. *
  5148. * - constructor: Initialization of state. The instance is now retained.
  5149. * - componentWillMount
  5150. * - render
  5151. * - [children's constructors]
  5152. * - [children's componentWillMount and render]
  5153. * - [children's componentDidMount]
  5154. * - componentDidMount
  5155. *
  5156. * Update Phases:
  5157. * - componentWillReceiveProps (only called if parent updated)
  5158. * - shouldComponentUpdate
  5159. * - componentWillUpdate
  5160. * - render
  5161. * - [children's constructors or receive props phases]
  5162. * - componentDidUpdate
  5163. *
  5164. * - componentWillUnmount
  5165. * - [children's componentWillUnmount]
  5166. * - [children destroyed]
  5167. * - (destroyed): The instance is now blank, released by React and ready for GC.
  5168. *
  5169. * -----------------------------------------------------------------------------
  5170. */
  5171. /**
  5172. * An incrementing ID assigned to each component when it is mounted. This is
  5173. * used to enforce the order in which `ReactUpdates` updates dirty components.
  5174. *
  5175. * @private
  5176. */
  5177. var nextMountID = 1;
  5178. /**
  5179. * @lends {ReactCompositeComponent.prototype}
  5180. */
  5181. var ReactCompositeComponentMixin = {
  5182. /**
  5183. * Base constructor for all composite component.
  5184. *
  5185. * @param {ReactElement} element
  5186. * @final
  5187. * @internal
  5188. */
  5189. construct: function (element) {
  5190. this._currentElement = element;
  5191. this._rootNodeID = null;
  5192. this._instance = null;
  5193. // See ReactUpdateQueue
  5194. this._pendingElement = null;
  5195. this._pendingStateQueue = null;
  5196. this._pendingReplaceState = false;
  5197. this._pendingForceUpdate = false;
  5198. this._renderedComponent = null;
  5199. this._context = null;
  5200. this._mountOrder = 0;
  5201. this._topLevelWrapper = null;
  5202. // See ReactUpdates and ReactUpdateQueue.
  5203. this._pendingCallbacks = null;
  5204. },
  5205. /**
  5206. * Initializes the component, renders markup, and registers event listeners.
  5207. *
  5208. * @param {string} rootID DOM ID of the root node.
  5209. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  5210. * @return {?string} Rendered markup to be inserted into the DOM.
  5211. * @final
  5212. * @internal
  5213. */
  5214. mountComponent: function (rootID, transaction, context) {
  5215. this._context = context;
  5216. this._mountOrder = nextMountID++;
  5217. this._rootNodeID = rootID;
  5218. var publicProps = this._processProps(this._currentElement.props);
  5219. var publicContext = this._processContext(context);
  5220. var Component = this._currentElement.type;
  5221. // Initialize the public class
  5222. var inst;
  5223. var renderedElement;
  5224. // This is a way to detect if Component is a stateless arrow function
  5225. // component, which is not newable. It might not be 100% reliable but is
  5226. // something we can do until we start detecting that Component extends
  5227. // React.Component. We already assume that typeof Component === 'function'.
  5228. var canInstantiate = ('prototype' in Component);
  5229. if (canInstantiate) {
  5230. if ("production" !== 'production') {
  5231. ReactCurrentOwner.current = this;
  5232. try {
  5233. inst = new Component(publicProps, publicContext, ReactUpdateQueue);
  5234. } finally {
  5235. ReactCurrentOwner.current = null;
  5236. }
  5237. } else {
  5238. inst = new Component(publicProps, publicContext, ReactUpdateQueue);
  5239. }
  5240. }
  5241. if (!canInstantiate || inst === null || inst === false || ReactElement.isValidElement(inst)) {
  5242. renderedElement = inst;
  5243. inst = new StatelessComponent(Component);
  5244. }
  5245. if ("production" !== 'production') {
  5246. // This will throw later in _renderValidatedComponent, but add an early
  5247. // warning now to help debugging
  5248. if (inst.render == null) {
  5249. "production" !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`, returned ' + 'null/false from a stateless component, or tried to render an ' + 'element whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : undefined;
  5250. } else {
  5251. // We support ES6 inheriting from React.Component, the module pattern,
  5252. // and stateless components, but not ES6 classes that don't extend
  5253. "production" !== 'production' ? warning(Component.prototype && Component.prototype.isReactComponent || !canInstantiate || !(inst instanceof Component), '%s(...): React component classes must extend React.Component.', Component.displayName || Component.name || 'Component') : undefined;
  5254. }
  5255. }
  5256. // These should be set up in the constructor, but as a convenience for
  5257. // simpler class abstractions, we set them up after the fact.
  5258. inst.props = publicProps;
  5259. inst.context = publicContext;
  5260. inst.refs = emptyObject;
  5261. inst.updater = ReactUpdateQueue;
  5262. this._instance = inst;
  5263. // Store a reference from the instance back to the internal representation
  5264. ReactInstanceMap.set(inst, this);
  5265. if ("production" !== 'production') {
  5266. // Since plain JS classes are defined without any special initialization
  5267. // logic, we can not catch common errors early. Therefore, we have to
  5268. // catch them here, at initialization time, instead.
  5269. "production" !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : undefined;
  5270. "production" !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : undefined;
  5271. "production" !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : undefined;
  5272. "production" !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : undefined;
  5273. "production" !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : undefined;
  5274. "production" !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : undefined;
  5275. "production" !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : undefined;
  5276. }
  5277. var initialState = inst.state;
  5278. if (initialState === undefined) {
  5279. inst.state = initialState = null;
  5280. }
  5281. !(typeof initialState === 'object' && !Array.isArray(initialState)) ? "production" !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
  5282. this._pendingStateQueue = null;
  5283. this._pendingReplaceState = false;
  5284. this._pendingForceUpdate = false;
  5285. if (inst.componentWillMount) {
  5286. inst.componentWillMount();
  5287. // When mounting, calls to `setState` by `componentWillMount` will set
  5288. // `this._pendingStateQueue` without triggering a re-render.
  5289. if (this._pendingStateQueue) {
  5290. inst.state = this._processPendingState(inst.props, inst.context);
  5291. }
  5292. }
  5293. // If not a stateless component, we now render
  5294. if (renderedElement === undefined) {
  5295. renderedElement = this._renderValidatedComponent();
  5296. }
  5297. this._renderedComponent = this._instantiateReactComponent(renderedElement);
  5298. var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context));
  5299. if (inst.componentDidMount) {
  5300. transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
  5301. }
  5302. return markup;
  5303. },
  5304. /**
  5305. * Releases any resources allocated by `mountComponent`.
  5306. *
  5307. * @final
  5308. * @internal
  5309. */
  5310. unmountComponent: function () {
  5311. var inst = this._instance;
  5312. if (inst.componentWillUnmount) {
  5313. inst.componentWillUnmount();
  5314. }
  5315. ReactReconciler.unmountComponent(this._renderedComponent);
  5316. this._renderedComponent = null;
  5317. this._instance = null;
  5318. // Reset pending fields
  5319. // Even if this component is scheduled for another update in ReactUpdates,
  5320. // it would still be ignored because these fields are reset.
  5321. this._pendingStateQueue = null;
  5322. this._pendingReplaceState = false;
  5323. this._pendingForceUpdate = false;
  5324. this._pendingCallbacks = null;
  5325. this._pendingElement = null;
  5326. // These fields do not really need to be reset since this object is no
  5327. // longer accessible.
  5328. this._context = null;
  5329. this._rootNodeID = null;
  5330. this._topLevelWrapper = null;
  5331. // Delete the reference from the instance to this internal representation
  5332. // which allow the internals to be properly cleaned up even if the user
  5333. // leaks a reference to the public instance.
  5334. ReactInstanceMap.remove(inst);
  5335. // Some existing components rely on inst.props even after they've been
  5336. // destroyed (in event handlers).
  5337. // TODO: inst.props = null;
  5338. // TODO: inst.state = null;
  5339. // TODO: inst.context = null;
  5340. },
  5341. /**
  5342. * Filters the context object to only contain keys specified in
  5343. * `contextTypes`
  5344. *
  5345. * @param {object} context
  5346. * @return {?object}
  5347. * @private
  5348. */
  5349. _maskContext: function (context) {
  5350. var maskedContext = null;
  5351. var Component = this._currentElement.type;
  5352. var contextTypes = Component.contextTypes;
  5353. if (!contextTypes) {
  5354. return emptyObject;
  5355. }
  5356. maskedContext = {};
  5357. for (var contextName in contextTypes) {
  5358. maskedContext[contextName] = context[contextName];
  5359. }
  5360. return maskedContext;
  5361. },
  5362. /**
  5363. * Filters the context object to only contain keys specified in
  5364. * `contextTypes`, and asserts that they are valid.
  5365. *
  5366. * @param {object} context
  5367. * @return {?object}
  5368. * @private
  5369. */
  5370. _processContext: function (context) {
  5371. var maskedContext = this._maskContext(context);
  5372. if ("production" !== 'production') {
  5373. var Component = this._currentElement.type;
  5374. if (Component.contextTypes) {
  5375. this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context);
  5376. }
  5377. }
  5378. return maskedContext;
  5379. },
  5380. /**
  5381. * @param {object} currentContext
  5382. * @return {object}
  5383. * @private
  5384. */
  5385. _processChildContext: function (currentContext) {
  5386. var Component = this._currentElement.type;
  5387. var inst = this._instance;
  5388. var childContext = inst.getChildContext && inst.getChildContext();
  5389. if (childContext) {
  5390. !(typeof Component.childContextTypes === 'object') ? "production" !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
  5391. if ("production" !== 'production') {
  5392. this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext);
  5393. }
  5394. for (var name in childContext) {
  5395. !(name in Component.childContextTypes) ? "production" !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : undefined;
  5396. }
  5397. return assign({}, currentContext, childContext);
  5398. }
  5399. return currentContext;
  5400. },
  5401. /**
  5402. * Processes props by setting default values for unspecified props and
  5403. * asserting that the props are valid. Does not mutate its argument; returns
  5404. * a new props object with defaults merged in.
  5405. *
  5406. * @param {object} newProps
  5407. * @return {object}
  5408. * @private
  5409. */
  5410. _processProps: function (newProps) {
  5411. if ("production" !== 'production') {
  5412. var Component = this._currentElement.type;
  5413. if (Component.propTypes) {
  5414. this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop);
  5415. }
  5416. }
  5417. return newProps;
  5418. },
  5419. /**
  5420. * Assert that the props are valid
  5421. *
  5422. * @param {object} propTypes Map of prop name to a ReactPropType
  5423. * @param {object} props
  5424. * @param {string} location e.g. "prop", "context", "child context"
  5425. * @private
  5426. */
  5427. _checkPropTypes: function (propTypes, props, location) {
  5428. // TODO: Stop validating prop types here and only use the element
  5429. // validation.
  5430. var componentName = this.getName();
  5431. for (var propName in propTypes) {
  5432. if (propTypes.hasOwnProperty(propName)) {
  5433. var error;
  5434. try {
  5435. // This is intentionally an invariant that gets caught. It's the same
  5436. // behavior as without this statement except with a better message.
  5437. !(typeof propTypes[propName] === 'function') ? "production" !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
  5438. error = propTypes[propName](props, propName, componentName, location);
  5439. } catch (ex) {
  5440. error = ex;
  5441. }
  5442. if (error instanceof Error) {
  5443. // We may want to extend this logic for similar errors in
  5444. // top-level render calls, so I'm abstracting it away into
  5445. // a function to minimize refactoring in the future
  5446. var addendum = getDeclarationErrorAddendum(this);
  5447. if (location === ReactPropTypeLocations.prop) {
  5448. // Preface gives us something to blacklist in warning module
  5449. "production" !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined;
  5450. } else {
  5451. "production" !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined;
  5452. }
  5453. }
  5454. }
  5455. }
  5456. },
  5457. receiveComponent: function (nextElement, transaction, nextContext) {
  5458. var prevElement = this._currentElement;
  5459. var prevContext = this._context;
  5460. this._pendingElement = null;
  5461. this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
  5462. },
  5463. /**
  5464. * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
  5465. * is set, update the component.
  5466. *
  5467. * @param {ReactReconcileTransaction} transaction
  5468. * @internal
  5469. */
  5470. performUpdateIfNecessary: function (transaction) {
  5471. if (this._pendingElement != null) {
  5472. ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context);
  5473. }
  5474. if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
  5475. this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
  5476. }
  5477. },
  5478. /**
  5479. * Perform an update to a mounted component. The componentWillReceiveProps and
  5480. * shouldComponentUpdate methods are called, then (assuming the update isn't
  5481. * skipped) the remaining update lifecycle methods are called and the DOM
  5482. * representation is updated.
  5483. *
  5484. * By default, this implements React's rendering and reconciliation algorithm.
  5485. * Sophisticated clients may wish to override this.
  5486. *
  5487. * @param {ReactReconcileTransaction} transaction
  5488. * @param {ReactElement} prevParentElement
  5489. * @param {ReactElement} nextParentElement
  5490. * @internal
  5491. * @overridable
  5492. */
  5493. updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
  5494. var inst = this._instance;
  5495. var nextContext = this._context === nextUnmaskedContext ? inst.context : this._processContext(nextUnmaskedContext);
  5496. var nextProps;
  5497. // Distinguish between a props update versus a simple state update
  5498. if (prevParentElement === nextParentElement) {
  5499. // Skip checking prop types again -- we don't read inst.props to avoid
  5500. // warning for DOM component props in this upgrade
  5501. nextProps = nextParentElement.props;
  5502. } else {
  5503. nextProps = this._processProps(nextParentElement.props);
  5504. // An update here will schedule an update but immediately set
  5505. // _pendingStateQueue which will ensure that any state updates gets
  5506. // immediately reconciled instead of waiting for the next batch.
  5507. if (inst.componentWillReceiveProps) {
  5508. inst.componentWillReceiveProps(nextProps, nextContext);
  5509. }
  5510. }
  5511. var nextState = this._processPendingState(nextProps, nextContext);
  5512. var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  5513. if ("production" !== 'production') {
  5514. "production" !== 'production' ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : undefined;
  5515. }
  5516. if (shouldUpdate) {
  5517. this._pendingForceUpdate = false;
  5518. // Will set `this.props`, `this.state` and `this.context`.
  5519. this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
  5520. } else {
  5521. // If it's determined that a component should not update, we still want
  5522. // to set props and state but we shortcut the rest of the update.
  5523. this._currentElement = nextParentElement;
  5524. this._context = nextUnmaskedContext;
  5525. inst.props = nextProps;
  5526. inst.state = nextState;
  5527. inst.context = nextContext;
  5528. }
  5529. },
  5530. _processPendingState: function (props, context) {
  5531. var inst = this._instance;
  5532. var queue = this._pendingStateQueue;
  5533. var replace = this._pendingReplaceState;
  5534. this._pendingReplaceState = false;
  5535. this._pendingStateQueue = null;
  5536. if (!queue) {
  5537. return inst.state;
  5538. }
  5539. if (replace && queue.length === 1) {
  5540. return queue[0];
  5541. }
  5542. var nextState = assign({}, replace ? queue[0] : inst.state);
  5543. for (var i = replace ? 1 : 0; i < queue.length; i++) {
  5544. var partial = queue[i];
  5545. assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
  5546. }
  5547. return nextState;
  5548. },
  5549. /**
  5550. * Merges new props and state, notifies delegate methods of update and
  5551. * performs update.
  5552. *
  5553. * @param {ReactElement} nextElement Next element
  5554. * @param {object} nextProps Next public object to set as properties.
  5555. * @param {?object} nextState Next object to set as state.
  5556. * @param {?object} nextContext Next public object to set as context.
  5557. * @param {ReactReconcileTransaction} transaction
  5558. * @param {?object} unmaskedContext
  5559. * @private
  5560. */
  5561. _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
  5562. var inst = this._instance;
  5563. var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
  5564. var prevProps;
  5565. var prevState;
  5566. var prevContext;
  5567. if (hasComponentDidUpdate) {
  5568. prevProps = inst.props;
  5569. prevState = inst.state;
  5570. prevContext = inst.context;
  5571. }
  5572. if (inst.componentWillUpdate) {
  5573. inst.componentWillUpdate(nextProps, nextState, nextContext);
  5574. }
  5575. this._currentElement = nextElement;
  5576. this._context = unmaskedContext;
  5577. inst.props = nextProps;
  5578. inst.state = nextState;
  5579. inst.context = nextContext;
  5580. this._updateRenderedComponent(transaction, unmaskedContext);
  5581. if (hasComponentDidUpdate) {
  5582. transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
  5583. }
  5584. },
  5585. /**
  5586. * Call the component's `render` method and update the DOM accordingly.
  5587. *
  5588. * @param {ReactReconcileTransaction} transaction
  5589. * @internal
  5590. */
  5591. _updateRenderedComponent: function (transaction, context) {
  5592. var prevComponentInstance = this._renderedComponent;
  5593. var prevRenderedElement = prevComponentInstance._currentElement;
  5594. var nextRenderedElement = this._renderValidatedComponent();
  5595. if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
  5596. ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
  5597. } else {
  5598. // These two IDs are actually the same! But nothing should rely on that.
  5599. var thisID = this._rootNodeID;
  5600. var prevComponentID = prevComponentInstance._rootNodeID;
  5601. ReactReconciler.unmountComponent(prevComponentInstance);
  5602. this._renderedComponent = this._instantiateReactComponent(nextRenderedElement);
  5603. var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context));
  5604. this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
  5605. }
  5606. },
  5607. /**
  5608. * @protected
  5609. */
  5610. _replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) {
  5611. ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
  5612. },
  5613. /**
  5614. * @protected
  5615. */
  5616. _renderValidatedComponentWithoutOwnerOrContext: function () {
  5617. var inst = this._instance;
  5618. var renderedComponent = inst.render();
  5619. if ("production" !== 'production') {
  5620. // We allow auto-mocks to proceed as if they're returning null.
  5621. if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) {
  5622. // This is probably bad practice. Consider warning here and
  5623. // deprecating this convenience.
  5624. renderedComponent = null;
  5625. }
  5626. }
  5627. return renderedComponent;
  5628. },
  5629. /**
  5630. * @private
  5631. */
  5632. _renderValidatedComponent: function () {
  5633. var renderedComponent;
  5634. ReactCurrentOwner.current = this;
  5635. try {
  5636. renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext();
  5637. } finally {
  5638. ReactCurrentOwner.current = null;
  5639. }
  5640. !(
  5641. // TODO: An `isValidNode` function would probably be more appropriate
  5642. renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? "production" !== 'production' ? invariant(false, '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
  5643. return renderedComponent;
  5644. },
  5645. /**
  5646. * Lazily allocates the refs object and stores `component` as `ref`.
  5647. *
  5648. * @param {string} ref Reference name.
  5649. * @param {component} component Component to store as `ref`.
  5650. * @final
  5651. * @private
  5652. */
  5653. attachRef: function (ref, component) {
  5654. var inst = this.getPublicInstance();
  5655. !(inst != null) ? "production" !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : undefined;
  5656. var publicComponentInstance = component.getPublicInstance();
  5657. if ("production" !== 'production') {
  5658. var componentName = component && component.getName ? component.getName() : 'a component';
  5659. "production" !== 'production' ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : undefined;
  5660. }
  5661. var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
  5662. refs[ref] = publicComponentInstance;
  5663. },
  5664. /**
  5665. * Detaches a reference name.
  5666. *
  5667. * @param {string} ref Name to dereference.
  5668. * @final
  5669. * @private
  5670. */
  5671. detachRef: function (ref) {
  5672. var refs = this.getPublicInstance().refs;
  5673. delete refs[ref];
  5674. },
  5675. /**
  5676. * Get a text description of the component that can be used to identify it
  5677. * in error messages.
  5678. * @return {string} The name or null.
  5679. * @internal
  5680. */
  5681. getName: function () {
  5682. var type = this._currentElement.type;
  5683. var constructor = this._instance && this._instance.constructor;
  5684. return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
  5685. },
  5686. /**
  5687. * Get the publicly accessible representation of this component - i.e. what
  5688. * is exposed by refs and returned by render. Can be null for stateless
  5689. * components.
  5690. *
  5691. * @return {ReactComponent} the public component instance.
  5692. * @internal
  5693. */
  5694. getPublicInstance: function () {
  5695. var inst = this._instance;
  5696. if (inst instanceof StatelessComponent) {
  5697. return null;
  5698. }
  5699. return inst;
  5700. },
  5701. // Stub
  5702. _instantiateReactComponent: null
  5703. };
  5704. ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', {
  5705. mountComponent: 'mountComponent',
  5706. updateComponent: 'updateComponent',
  5707. _renderValidatedComponent: '_renderValidatedComponent'
  5708. });
  5709. var ReactCompositeComponent = {
  5710. Mixin: ReactCompositeComponentMixin
  5711. };
  5712. module.exports = ReactCompositeComponent;
  5713. },{"141":141,"154":154,"161":161,"173":173,"24":24,"36":36,"39":39,"57":57,"68":68,"78":78,"80":80,"81":81,"84":84,"95":95}],39:[function(_dereq_,module,exports){
  5714. /**
  5715. * Copyright 2013-2015, Facebook, Inc.
  5716. * All rights reserved.
  5717. *
  5718. * This source code is licensed under the BSD-style license found in the
  5719. * LICENSE file in the root directory of this source tree. An additional grant
  5720. * of patent rights can be found in the PATENTS file in the same directory.
  5721. *
  5722. * @providesModule ReactCurrentOwner
  5723. */
  5724. 'use strict';
  5725. /**
  5726. * Keeps track of the current owner.
  5727. *
  5728. * The current owner is the component who should own any components that are
  5729. * currently being constructed.
  5730. */
  5731. var ReactCurrentOwner = {
  5732. /**
  5733. * @internal
  5734. * @type {ReactComponent}
  5735. */
  5736. current: null
  5737. };
  5738. module.exports = ReactCurrentOwner;
  5739. },{}],40:[function(_dereq_,module,exports){
  5740. /**
  5741. * Copyright 2013-2015, Facebook, Inc.
  5742. * All rights reserved.
  5743. *
  5744. * This source code is licensed under the BSD-style license found in the
  5745. * LICENSE file in the root directory of this source tree. An additional grant
  5746. * of patent rights can be found in the PATENTS file in the same directory.
  5747. *
  5748. * @providesModule ReactDOM
  5749. */
  5750. /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
  5751. 'use strict';
  5752. var ReactCurrentOwner = _dereq_(39);
  5753. var ReactDOMTextComponent = _dereq_(51);
  5754. var ReactDefaultInjection = _dereq_(54);
  5755. var ReactInstanceHandles = _dereq_(67);
  5756. var ReactMount = _dereq_(72);
  5757. var ReactPerf = _dereq_(78);
  5758. var ReactReconciler = _dereq_(84);
  5759. var ReactUpdates = _dereq_(96);
  5760. var ReactVersion = _dereq_(97);
  5761. var findDOMNode = _dereq_(122);
  5762. var renderSubtreeIntoContainer = _dereq_(137);
  5763. var warning = _dereq_(173);
  5764. ReactDefaultInjection.inject();
  5765. var render = ReactPerf.measure('React', 'render', ReactMount.render);
  5766. var React = {
  5767. findDOMNode: findDOMNode,
  5768. render: render,
  5769. unmountComponentAtNode: ReactMount.unmountComponentAtNode,
  5770. version: ReactVersion,
  5771. /* eslint-disable camelcase */
  5772. unstable_batchedUpdates: ReactUpdates.batchedUpdates,
  5773. unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
  5774. };
  5775. // Inject the runtime into a devtools global hook regardless of browser.
  5776. // Allows for debugging when the hook is injected on the page.
  5777. /* eslint-enable camelcase */
  5778. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
  5779. __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
  5780. CurrentOwner: ReactCurrentOwner,
  5781. InstanceHandles: ReactInstanceHandles,
  5782. Mount: ReactMount,
  5783. Reconciler: ReactReconciler,
  5784. TextComponent: ReactDOMTextComponent
  5785. });
  5786. }
  5787. if ("production" !== 'production') {
  5788. var ExecutionEnvironment = _dereq_(147);
  5789. if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
  5790. // First check if devtools is not installed
  5791. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
  5792. // If we're in Chrome or Firefox, provide a download link if not installed.
  5793. if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
  5794. console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');
  5795. }
  5796. }
  5797. // If we're in IE8, check to see if we are in compatibility mode and provide
  5798. // information on preventing compatibility mode
  5799. var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
  5800. "production" !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined;
  5801. var expectedFeatures = [
  5802. // shims
  5803. Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
  5804. // shams
  5805. Object.create, Object.freeze];
  5806. for (var i = 0; i < expectedFeatures.length; i++) {
  5807. if (!expectedFeatures[i]) {
  5808. console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
  5809. break;
  5810. }
  5811. }
  5812. }
  5813. }
  5814. module.exports = React;
  5815. },{"122":122,"137":137,"147":147,"173":173,"39":39,"51":51,"54":54,"67":67,"72":72,"78":78,"84":84,"96":96,"97":97}],41:[function(_dereq_,module,exports){
  5816. /**
  5817. * Copyright 2013-2015, Facebook, Inc.
  5818. * All rights reserved.
  5819. *
  5820. * This source code is licensed under the BSD-style license found in the
  5821. * LICENSE file in the root directory of this source tree. An additional grant
  5822. * of patent rights can be found in the PATENTS file in the same directory.
  5823. *
  5824. * @providesModule ReactDOMButton
  5825. */
  5826. 'use strict';
  5827. var mouseListenerNames = {
  5828. onClick: true,
  5829. onDoubleClick: true,
  5830. onMouseDown: true,
  5831. onMouseMove: true,
  5832. onMouseUp: true,
  5833. onClickCapture: true,
  5834. onDoubleClickCapture: true,
  5835. onMouseDownCapture: true,
  5836. onMouseMoveCapture: true,
  5837. onMouseUpCapture: true
  5838. };
  5839. /**
  5840. * Implements a <button> native component that does not receive mouse events
  5841. * when `disabled` is set.
  5842. */
  5843. var ReactDOMButton = {
  5844. getNativeProps: function (inst, props, context) {
  5845. if (!props.disabled) {
  5846. return props;
  5847. }
  5848. // Copy the props, except the mouse listeners
  5849. var nativeProps = {};
  5850. for (var key in props) {
  5851. if (props.hasOwnProperty(key) && !mouseListenerNames[key]) {
  5852. nativeProps[key] = props[key];
  5853. }
  5854. }
  5855. return nativeProps;
  5856. }
  5857. };
  5858. module.exports = ReactDOMButton;
  5859. },{}],42:[function(_dereq_,module,exports){
  5860. /**
  5861. * Copyright 2013-2015, Facebook, Inc.
  5862. * All rights reserved.
  5863. *
  5864. * This source code is licensed under the BSD-style license found in the
  5865. * LICENSE file in the root directory of this source tree. An additional grant
  5866. * of patent rights can be found in the PATENTS file in the same directory.
  5867. *
  5868. * @providesModule ReactDOMComponent
  5869. * @typechecks static-only
  5870. */
  5871. /* global hasOwnProperty:true */
  5872. 'use strict';
  5873. var AutoFocusUtils = _dereq_(2);
  5874. var CSSPropertyOperations = _dereq_(5);
  5875. var DOMProperty = _dereq_(10);
  5876. var DOMPropertyOperations = _dereq_(11);
  5877. var EventConstants = _dereq_(15);
  5878. var ReactBrowserEventEmitter = _dereq_(28);
  5879. var ReactComponentBrowserEnvironment = _dereq_(35);
  5880. var ReactDOMButton = _dereq_(41);
  5881. var ReactDOMInput = _dereq_(46);
  5882. var ReactDOMOption = _dereq_(47);
  5883. var ReactDOMSelect = _dereq_(48);
  5884. var ReactDOMTextarea = _dereq_(52);
  5885. var ReactMount = _dereq_(72);
  5886. var ReactMultiChild = _dereq_(73);
  5887. var ReactPerf = _dereq_(78);
  5888. var ReactUpdateQueue = _dereq_(95);
  5889. var assign = _dereq_(24);
  5890. var canDefineProperty = _dereq_(117);
  5891. var escapeTextContentForBrowser = _dereq_(121);
  5892. var invariant = _dereq_(161);
  5893. var isEventSupported = _dereq_(133);
  5894. var keyOf = _dereq_(166);
  5895. var setInnerHTML = _dereq_(138);
  5896. var setTextContent = _dereq_(139);
  5897. var shallowEqual = _dereq_(171);
  5898. var validateDOMNesting = _dereq_(144);
  5899. var warning = _dereq_(173);
  5900. var deleteListener = ReactBrowserEventEmitter.deleteListener;
  5901. var listenTo = ReactBrowserEventEmitter.listenTo;
  5902. var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
  5903. // For quickly matching children type, to test if can be treated as content.
  5904. var CONTENT_TYPES = { 'string': true, 'number': true };
  5905. var CHILDREN = keyOf({ children: null });
  5906. var STYLE = keyOf({ style: null });
  5907. var HTML = keyOf({ __html: null });
  5908. var ELEMENT_NODE_TYPE = 1;
  5909. function getDeclarationErrorAddendum(internalInstance) {
  5910. if (internalInstance) {
  5911. var owner = internalInstance._currentElement._owner || null;
  5912. if (owner) {
  5913. var name = owner.getName();
  5914. if (name) {
  5915. return ' This DOM node was rendered by `' + name + '`.';
  5916. }
  5917. }
  5918. }
  5919. return '';
  5920. }
  5921. var legacyPropsDescriptor;
  5922. if ("production" !== 'production') {
  5923. legacyPropsDescriptor = {
  5924. props: {
  5925. enumerable: false,
  5926. get: function () {
  5927. var component = this._reactInternalComponent;
  5928. "production" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined;
  5929. return component._currentElement.props;
  5930. }
  5931. }
  5932. };
  5933. }
  5934. function legacyGetDOMNode() {
  5935. if ("production" !== 'production') {
  5936. var component = this._reactInternalComponent;
  5937. "production" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined;
  5938. }
  5939. return this;
  5940. }
  5941. function legacyIsMounted() {
  5942. var component = this._reactInternalComponent;
  5943. if ("production" !== 'production') {
  5944. "production" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined;
  5945. }
  5946. return !!component;
  5947. }
  5948. function legacySetStateEtc() {
  5949. if ("production" !== 'production') {
  5950. var component = this._reactInternalComponent;
  5951. "production" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined;
  5952. }
  5953. }
  5954. function legacySetProps(partialProps, callback) {
  5955. var component = this._reactInternalComponent;
  5956. if ("production" !== 'production') {
  5957. "production" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
  5958. }
  5959. if (!component) {
  5960. return;
  5961. }
  5962. ReactUpdateQueue.enqueueSetPropsInternal(component, partialProps);
  5963. if (callback) {
  5964. ReactUpdateQueue.enqueueCallbackInternal(component, callback);
  5965. }
  5966. }
  5967. function legacyReplaceProps(partialProps, callback) {
  5968. var component = this._reactInternalComponent;
  5969. if ("production" !== 'production') {
  5970. "production" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
  5971. }
  5972. if (!component) {
  5973. return;
  5974. }
  5975. ReactUpdateQueue.enqueueReplacePropsInternal(component, partialProps);
  5976. if (callback) {
  5977. ReactUpdateQueue.enqueueCallbackInternal(component, callback);
  5978. }
  5979. }
  5980. function friendlyStringify(obj) {
  5981. if (typeof obj === 'object') {
  5982. if (Array.isArray(obj)) {
  5983. return '[' + obj.map(friendlyStringify).join(', ') + ']';
  5984. } else {
  5985. var pairs = [];
  5986. for (var key in obj) {
  5987. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  5988. var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
  5989. pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
  5990. }
  5991. }
  5992. return '{' + pairs.join(', ') + '}';
  5993. }
  5994. } else if (typeof obj === 'string') {
  5995. return JSON.stringify(obj);
  5996. } else if (typeof obj === 'function') {
  5997. return '[function object]';
  5998. }
  5999. // Differs from JSON.stringify in that undefined becauses undefined and that
  6000. // inf and nan don't become null
  6001. return String(obj);
  6002. }
  6003. var styleMutationWarning = {};
  6004. function checkAndWarnForMutatedStyle(style1, style2, component) {
  6005. if (style1 == null || style2 == null) {
  6006. return;
  6007. }
  6008. if (shallowEqual(style1, style2)) {
  6009. return;
  6010. }
  6011. var componentName = component._tag;
  6012. var owner = component._currentElement._owner;
  6013. var ownerName;
  6014. if (owner) {
  6015. ownerName = owner.getName();
  6016. }
  6017. var hash = ownerName + '|' + componentName;
  6018. if (styleMutationWarning.hasOwnProperty(hash)) {
  6019. return;
  6020. }
  6021. styleMutationWarning[hash] = true;
  6022. "production" !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : undefined;
  6023. }
  6024. /**
  6025. * @param {object} component
  6026. * @param {?object} props
  6027. */
  6028. function assertValidProps(component, props) {
  6029. if (!props) {
  6030. return;
  6031. }
  6032. // Note the use of `==` which checks for null or undefined.
  6033. if ("production" !== 'production') {
  6034. if (voidElementTags[component._tag]) {
  6035. "production" !== 'production' ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined;
  6036. }
  6037. }
  6038. if (props.dangerouslySetInnerHTML != null) {
  6039. !(props.children == null) ? "production" !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
  6040. !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? "production" !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : undefined;
  6041. }
  6042. if ("production" !== 'production') {
  6043. "production" !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
  6044. "production" !== 'production' ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined;
  6045. }
  6046. !(props.style == null || typeof props.style === 'object') ? "production" !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : undefined;
  6047. }
  6048. function enqueuePutListener(id, registrationName, listener, transaction) {
  6049. if ("production" !== 'production') {
  6050. // IE8 has no API for event capturing and the `onScroll` event doesn't
  6051. // bubble.
  6052. "production" !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
  6053. }
  6054. var container = ReactMount.findReactContainerForID(id);
  6055. if (container) {
  6056. var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container;
  6057. listenTo(registrationName, doc);
  6058. }
  6059. transaction.getReactMountReady().enqueue(putListener, {
  6060. id: id,
  6061. registrationName: registrationName,
  6062. listener: listener
  6063. });
  6064. }
  6065. function putListener() {
  6066. var listenerToPut = this;
  6067. ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener);
  6068. }
  6069. // There are so many media events, it makes sense to just
  6070. // maintain a list rather than create a `trapBubbledEvent` for each
  6071. var mediaEvents = {
  6072. topAbort: 'abort',
  6073. topCanPlay: 'canplay',
  6074. topCanPlayThrough: 'canplaythrough',
  6075. topDurationChange: 'durationchange',
  6076. topEmptied: 'emptied',
  6077. topEncrypted: 'encrypted',
  6078. topEnded: 'ended',
  6079. topError: 'error',
  6080. topLoadedData: 'loadeddata',
  6081. topLoadedMetadata: 'loadedmetadata',
  6082. topLoadStart: 'loadstart',
  6083. topPause: 'pause',
  6084. topPlay: 'play',
  6085. topPlaying: 'playing',
  6086. topProgress: 'progress',
  6087. topRateChange: 'ratechange',
  6088. topSeeked: 'seeked',
  6089. topSeeking: 'seeking',
  6090. topStalled: 'stalled',
  6091. topSuspend: 'suspend',
  6092. topTimeUpdate: 'timeupdate',
  6093. topVolumeChange: 'volumechange',
  6094. topWaiting: 'waiting'
  6095. };
  6096. function trapBubbledEventsLocal() {
  6097. var inst = this;
  6098. // If a component renders to null or if another component fatals and causes
  6099. // the state of the tree to be corrupted, `node` here can be null.
  6100. !inst._rootNodeID ? "production" !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined;
  6101. var node = ReactMount.getNode(inst._rootNodeID);
  6102. !node ? "production" !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined;
  6103. switch (inst._tag) {
  6104. case 'iframe':
  6105. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
  6106. break;
  6107. case 'video':
  6108. case 'audio':
  6109. inst._wrapperState.listeners = [];
  6110. // create listener for each media event
  6111. for (var event in mediaEvents) {
  6112. if (mediaEvents.hasOwnProperty(event)) {
  6113. inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node));
  6114. }
  6115. }
  6116. break;
  6117. case 'img':
  6118. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
  6119. break;
  6120. case 'form':
  6121. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)];
  6122. break;
  6123. }
  6124. }
  6125. function mountReadyInputWrapper() {
  6126. ReactDOMInput.mountReadyWrapper(this);
  6127. }
  6128. function postUpdateSelectWrapper() {
  6129. ReactDOMSelect.postUpdateWrapper(this);
  6130. }
  6131. // For HTML, certain tags should omit their close tag. We keep a whitelist for
  6132. // those special cased tags.
  6133. var omittedCloseTags = {
  6134. 'area': true,
  6135. 'base': true,
  6136. 'br': true,
  6137. 'col': true,
  6138. 'embed': true,
  6139. 'hr': true,
  6140. 'img': true,
  6141. 'input': true,
  6142. 'keygen': true,
  6143. 'link': true,
  6144. 'meta': true,
  6145. 'param': true,
  6146. 'source': true,
  6147. 'track': true,
  6148. 'wbr': true
  6149. };
  6150. // NOTE: menuitem's close tag should be omitted, but that causes problems.
  6151. var newlineEatingTags = {
  6152. 'listing': true,
  6153. 'pre': true,
  6154. 'textarea': true
  6155. };
  6156. // For HTML, certain tags cannot have children. This has the same purpose as
  6157. // `omittedCloseTags` except that `menuitem` should still have its closing tag.
  6158. var voidElementTags = assign({
  6159. 'menuitem': true
  6160. }, omittedCloseTags);
  6161. // We accept any tag to be rendered but since this gets injected into arbitrary
  6162. // HTML, we want to make sure that it's a safe tag.
  6163. // http://www.w3.org/TR/REC-xml/#NT-Name
  6164. var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
  6165. var validatedTagCache = {};
  6166. var hasOwnProperty = ({}).hasOwnProperty;
  6167. function validateDangerousTag(tag) {
  6168. if (!hasOwnProperty.call(validatedTagCache, tag)) {
  6169. !VALID_TAG_REGEX.test(tag) ? "production" !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
  6170. validatedTagCache[tag] = true;
  6171. }
  6172. }
  6173. function processChildContextDev(context, inst) {
  6174. // Pass down our tag name to child components for validation purposes
  6175. context = assign({}, context);
  6176. var info = context[validateDOMNesting.ancestorInfoContextKey];
  6177. context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, inst._tag, inst);
  6178. return context;
  6179. }
  6180. function isCustomComponent(tagName, props) {
  6181. return tagName.indexOf('-') >= 0 || props.is != null;
  6182. }
  6183. /**
  6184. * Creates a new React class that is idempotent and capable of containing other
  6185. * React components. It accepts event listeners and DOM properties that are
  6186. * valid according to `DOMProperty`.
  6187. *
  6188. * - Event listeners: `onClick`, `onMouseDown`, etc.
  6189. * - DOM properties: `className`, `name`, `title`, etc.
  6190. *
  6191. * The `style` property functions differently from the DOM API. It accepts an
  6192. * object mapping of style properties to values.
  6193. *
  6194. * @constructor ReactDOMComponent
  6195. * @extends ReactMultiChild
  6196. */
  6197. function ReactDOMComponent(tag) {
  6198. validateDangerousTag(tag);
  6199. this._tag = tag.toLowerCase();
  6200. this._renderedChildren = null;
  6201. this._previousStyle = null;
  6202. this._previousStyleCopy = null;
  6203. this._rootNodeID = null;
  6204. this._wrapperState = null;
  6205. this._topLevelWrapper = null;
  6206. this._nodeWithLegacyProperties = null;
  6207. if ("production" !== 'production') {
  6208. this._unprocessedContextDev = null;
  6209. this._processedContextDev = null;
  6210. }
  6211. }
  6212. ReactDOMComponent.displayName = 'ReactDOMComponent';
  6213. ReactDOMComponent.Mixin = {
  6214. construct: function (element) {
  6215. this._currentElement = element;
  6216. },
  6217. /**
  6218. * Generates root tag markup then recurses. This method has side effects and
  6219. * is not idempotent.
  6220. *
  6221. * @internal
  6222. * @param {string} rootID The root DOM ID for this node.
  6223. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  6224. * @param {object} context
  6225. * @return {string} The computed markup.
  6226. */
  6227. mountComponent: function (rootID, transaction, context) {
  6228. this._rootNodeID = rootID;
  6229. var props = this._currentElement.props;
  6230. switch (this._tag) {
  6231. case 'iframe':
  6232. case 'img':
  6233. case 'form':
  6234. case 'video':
  6235. case 'audio':
  6236. this._wrapperState = {
  6237. listeners: null
  6238. };
  6239. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  6240. break;
  6241. case 'button':
  6242. props = ReactDOMButton.getNativeProps(this, props, context);
  6243. break;
  6244. case 'input':
  6245. ReactDOMInput.mountWrapper(this, props, context);
  6246. props = ReactDOMInput.getNativeProps(this, props, context);
  6247. break;
  6248. case 'option':
  6249. ReactDOMOption.mountWrapper(this, props, context);
  6250. props = ReactDOMOption.getNativeProps(this, props, context);
  6251. break;
  6252. case 'select':
  6253. ReactDOMSelect.mountWrapper(this, props, context);
  6254. props = ReactDOMSelect.getNativeProps(this, props, context);
  6255. context = ReactDOMSelect.processChildContext(this, props, context);
  6256. break;
  6257. case 'textarea':
  6258. ReactDOMTextarea.mountWrapper(this, props, context);
  6259. props = ReactDOMTextarea.getNativeProps(this, props, context);
  6260. break;
  6261. }
  6262. assertValidProps(this, props);
  6263. if ("production" !== 'production') {
  6264. if (context[validateDOMNesting.ancestorInfoContextKey]) {
  6265. validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]);
  6266. }
  6267. }
  6268. if ("production" !== 'production') {
  6269. this._unprocessedContextDev = context;
  6270. this._processedContextDev = processChildContextDev(context, this);
  6271. context = this._processedContextDev;
  6272. }
  6273. var mountImage;
  6274. if (transaction.useCreateElement) {
  6275. var ownerDocument = context[ReactMount.ownerDocumentContextKey];
  6276. var el = ownerDocument.createElementNS('http://www.w3.org/1999/xhtml', this._currentElement.type);
  6277. DOMPropertyOperations.setAttributeForID(el, this._rootNodeID);
  6278. // Populate node cache
  6279. ReactMount.getID(el);
  6280. this._updateDOMProperties({}, props, transaction, el);
  6281. this._createInitialChildren(transaction, props, context, el);
  6282. mountImage = el;
  6283. } else {
  6284. var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
  6285. var tagContent = this._createContentMarkup(transaction, props, context);
  6286. if (!tagContent && omittedCloseTags[this._tag]) {
  6287. mountImage = tagOpen + '/>';
  6288. } else {
  6289. mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
  6290. }
  6291. }
  6292. switch (this._tag) {
  6293. case 'input':
  6294. transaction.getReactMountReady().enqueue(mountReadyInputWrapper, this);
  6295. // falls through
  6296. case 'button':
  6297. case 'select':
  6298. case 'textarea':
  6299. if (props.autoFocus) {
  6300. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  6301. }
  6302. break;
  6303. }
  6304. return mountImage;
  6305. },
  6306. /**
  6307. * Creates markup for the open tag and all attributes.
  6308. *
  6309. * This method has side effects because events get registered.
  6310. *
  6311. * Iterating over object properties is faster than iterating over arrays.
  6312. * @see http://jsperf.com/obj-vs-arr-iteration
  6313. *
  6314. * @private
  6315. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  6316. * @param {object} props
  6317. * @return {string} Markup of opening tag.
  6318. */
  6319. _createOpenTagMarkupAndPutListeners: function (transaction, props) {
  6320. var ret = '<' + this._currentElement.type;
  6321. for (var propKey in props) {
  6322. if (!props.hasOwnProperty(propKey)) {
  6323. continue;
  6324. }
  6325. var propValue = props[propKey];
  6326. if (propValue == null) {
  6327. continue;
  6328. }
  6329. if (registrationNameModules.hasOwnProperty(propKey)) {
  6330. if (propValue) {
  6331. enqueuePutListener(this._rootNodeID, propKey, propValue, transaction);
  6332. }
  6333. } else {
  6334. if (propKey === STYLE) {
  6335. if (propValue) {
  6336. if ("production" !== 'production') {
  6337. // See `_updateDOMProperties`. style block
  6338. this._previousStyle = propValue;
  6339. }
  6340. propValue = this._previousStyleCopy = assign({}, props.style);
  6341. }
  6342. propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
  6343. }
  6344. var markup = null;
  6345. if (this._tag != null && isCustomComponent(this._tag, props)) {
  6346. if (propKey !== CHILDREN) {
  6347. markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
  6348. }
  6349. } else {
  6350. markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
  6351. }
  6352. if (markup) {
  6353. ret += ' ' + markup;
  6354. }
  6355. }
  6356. }
  6357. // For static pages, no need to put React ID and checksum. Saves lots of
  6358. // bytes.
  6359. if (transaction.renderToStaticMarkup) {
  6360. return ret;
  6361. }
  6362. var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
  6363. return ret + ' ' + markupForID;
  6364. },
  6365. /**
  6366. * Creates markup for the content between the tags.
  6367. *
  6368. * @private
  6369. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  6370. * @param {object} props
  6371. * @param {object} context
  6372. * @return {string} Content markup.
  6373. */
  6374. _createContentMarkup: function (transaction, props, context) {
  6375. var ret = '';
  6376. // Intentional use of != to avoid catching zero/false.
  6377. var innerHTML = props.dangerouslySetInnerHTML;
  6378. if (innerHTML != null) {
  6379. if (innerHTML.__html != null) {
  6380. ret = innerHTML.__html;
  6381. }
  6382. } else {
  6383. var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
  6384. var childrenToUse = contentToUse != null ? null : props.children;
  6385. if (contentToUse != null) {
  6386. // TODO: Validate that text is allowed as a child of this node
  6387. ret = escapeTextContentForBrowser(contentToUse);
  6388. } else if (childrenToUse != null) {
  6389. var mountImages = this.mountChildren(childrenToUse, transaction, context);
  6390. ret = mountImages.join('');
  6391. }
  6392. }
  6393. if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
  6394. // text/html ignores the first character in these tags if it's a newline
  6395. // Prefer to break application/xml over text/html (for now) by adding
  6396. // a newline specifically to get eaten by the parser. (Alternately for
  6397. // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
  6398. // \r is normalized out by HTMLTextAreaElement#value.)
  6399. // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
  6400. // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
  6401. // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
  6402. // See: Parsing of "textarea" "listing" and "pre" elements
  6403. // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
  6404. return '\n' + ret;
  6405. } else {
  6406. return ret;
  6407. }
  6408. },
  6409. _createInitialChildren: function (transaction, props, context, el) {
  6410. // Intentional use of != to avoid catching zero/false.
  6411. var innerHTML = props.dangerouslySetInnerHTML;
  6412. if (innerHTML != null) {
  6413. if (innerHTML.__html != null) {
  6414. setInnerHTML(el, innerHTML.__html);
  6415. }
  6416. } else {
  6417. var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
  6418. var childrenToUse = contentToUse != null ? null : props.children;
  6419. if (contentToUse != null) {
  6420. // TODO: Validate that text is allowed as a child of this node
  6421. setTextContent(el, contentToUse);
  6422. } else if (childrenToUse != null) {
  6423. var mountImages = this.mountChildren(childrenToUse, transaction, context);
  6424. for (var i = 0; i < mountImages.length; i++) {
  6425. el.appendChild(mountImages[i]);
  6426. }
  6427. }
  6428. }
  6429. },
  6430. /**
  6431. * Receives a next element and updates the component.
  6432. *
  6433. * @internal
  6434. * @param {ReactElement} nextElement
  6435. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  6436. * @param {object} context
  6437. */
  6438. receiveComponent: function (nextElement, transaction, context) {
  6439. var prevElement = this._currentElement;
  6440. this._currentElement = nextElement;
  6441. this.updateComponent(transaction, prevElement, nextElement, context);
  6442. },
  6443. /**
  6444. * Updates a native DOM component after it has already been allocated and
  6445. * attached to the DOM. Reconciles the root DOM node, then recurses.
  6446. *
  6447. * @param {ReactReconcileTransaction} transaction
  6448. * @param {ReactElement} prevElement
  6449. * @param {ReactElement} nextElement
  6450. * @internal
  6451. * @overridable
  6452. */
  6453. updateComponent: function (transaction, prevElement, nextElement, context) {
  6454. var lastProps = prevElement.props;
  6455. var nextProps = this._currentElement.props;
  6456. switch (this._tag) {
  6457. case 'button':
  6458. lastProps = ReactDOMButton.getNativeProps(this, lastProps);
  6459. nextProps = ReactDOMButton.getNativeProps(this, nextProps);
  6460. break;
  6461. case 'input':
  6462. ReactDOMInput.updateWrapper(this);
  6463. lastProps = ReactDOMInput.getNativeProps(this, lastProps);
  6464. nextProps = ReactDOMInput.getNativeProps(this, nextProps);
  6465. break;
  6466. case 'option':
  6467. lastProps = ReactDOMOption.getNativeProps(this, lastProps);
  6468. nextProps = ReactDOMOption.getNativeProps(this, nextProps);
  6469. break;
  6470. case 'select':
  6471. lastProps = ReactDOMSelect.getNativeProps(this, lastProps);
  6472. nextProps = ReactDOMSelect.getNativeProps(this, nextProps);
  6473. break;
  6474. case 'textarea':
  6475. ReactDOMTextarea.updateWrapper(this);
  6476. lastProps = ReactDOMTextarea.getNativeProps(this, lastProps);
  6477. nextProps = ReactDOMTextarea.getNativeProps(this, nextProps);
  6478. break;
  6479. }
  6480. if ("production" !== 'production') {
  6481. // If the context is reference-equal to the old one, pass down the same
  6482. // processed object so the update bailout in ReactReconciler behaves
  6483. // correctly (and identically in dev and prod). See #5005.
  6484. if (this._unprocessedContextDev !== context) {
  6485. this._unprocessedContextDev = context;
  6486. this._processedContextDev = processChildContextDev(context, this);
  6487. }
  6488. context = this._processedContextDev;
  6489. }
  6490. assertValidProps(this, nextProps);
  6491. this._updateDOMProperties(lastProps, nextProps, transaction, null);
  6492. this._updateDOMChildren(lastProps, nextProps, transaction, context);
  6493. if (!canDefineProperty && this._nodeWithLegacyProperties) {
  6494. this._nodeWithLegacyProperties.props = nextProps;
  6495. }
  6496. if (this._tag === 'select') {
  6497. // <select> value update needs to occur after <option> children
  6498. // reconciliation
  6499. transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
  6500. }
  6501. },
  6502. /**
  6503. * Reconciles the properties by detecting differences in property values and
  6504. * updating the DOM as necessary. This function is probably the single most
  6505. * critical path for performance optimization.
  6506. *
  6507. * TODO: Benchmark whether checking for changed values in memory actually
  6508. * improves performance (especially statically positioned elements).
  6509. * TODO: Benchmark the effects of putting this at the top since 99% of props
  6510. * do not change for a given reconciliation.
  6511. * TODO: Benchmark areas that can be improved with caching.
  6512. *
  6513. * @private
  6514. * @param {object} lastProps
  6515. * @param {object} nextProps
  6516. * @param {ReactReconcileTransaction} transaction
  6517. * @param {?DOMElement} node
  6518. */
  6519. _updateDOMProperties: function (lastProps, nextProps, transaction, node) {
  6520. var propKey;
  6521. var styleName;
  6522. var styleUpdates;
  6523. for (propKey in lastProps) {
  6524. if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) {
  6525. continue;
  6526. }
  6527. if (propKey === STYLE) {
  6528. var lastStyle = this._previousStyleCopy;
  6529. for (styleName in lastStyle) {
  6530. if (lastStyle.hasOwnProperty(styleName)) {
  6531. styleUpdates = styleUpdates || {};
  6532. styleUpdates[styleName] = '';
  6533. }
  6534. }
  6535. this._previousStyleCopy = null;
  6536. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  6537. if (lastProps[propKey]) {
  6538. // Only call deleteListener if there was a listener previously or
  6539. // else willDeleteListener gets called when there wasn't actually a
  6540. // listener (e.g., onClick={null})
  6541. deleteListener(this._rootNodeID, propKey);
  6542. }
  6543. } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
  6544. if (!node) {
  6545. node = ReactMount.getNode(this._rootNodeID);
  6546. }
  6547. DOMPropertyOperations.deleteValueForProperty(node, propKey);
  6548. }
  6549. }
  6550. for (propKey in nextProps) {
  6551. var nextProp = nextProps[propKey];
  6552. var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey];
  6553. if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
  6554. continue;
  6555. }
  6556. if (propKey === STYLE) {
  6557. if (nextProp) {
  6558. if ("production" !== 'production') {
  6559. checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
  6560. this._previousStyle = nextProp;
  6561. }
  6562. nextProp = this._previousStyleCopy = assign({}, nextProp);
  6563. } else {
  6564. this._previousStyleCopy = null;
  6565. }
  6566. if (lastProp) {
  6567. // Unset styles on `lastProp` but not on `nextProp`.
  6568. for (styleName in lastProp) {
  6569. if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
  6570. styleUpdates = styleUpdates || {};
  6571. styleUpdates[styleName] = '';
  6572. }
  6573. }
  6574. // Update styles that changed since `lastProp`.
  6575. for (styleName in nextProp) {
  6576. if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
  6577. styleUpdates = styleUpdates || {};
  6578. styleUpdates[styleName] = nextProp[styleName];
  6579. }
  6580. }
  6581. } else {
  6582. // Relies on `updateStylesByID` not mutating `styleUpdates`.
  6583. styleUpdates = nextProp;
  6584. }
  6585. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  6586. if (nextProp) {
  6587. enqueuePutListener(this._rootNodeID, propKey, nextProp, transaction);
  6588. } else if (lastProp) {
  6589. deleteListener(this._rootNodeID, propKey);
  6590. }
  6591. } else if (isCustomComponent(this._tag, nextProps)) {
  6592. if (!node) {
  6593. node = ReactMount.getNode(this._rootNodeID);
  6594. }
  6595. if (propKey === CHILDREN) {
  6596. nextProp = null;
  6597. }
  6598. DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp);
  6599. } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
  6600. if (!node) {
  6601. node = ReactMount.getNode(this._rootNodeID);
  6602. }
  6603. // If we're updating to null or undefined, we should remove the property
  6604. // from the DOM node instead of inadvertantly setting to a string. This
  6605. // brings us in line with the same behavior we have on initial render.
  6606. if (nextProp != null) {
  6607. DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
  6608. } else {
  6609. DOMPropertyOperations.deleteValueForProperty(node, propKey);
  6610. }
  6611. }
  6612. }
  6613. if (styleUpdates) {
  6614. if (!node) {
  6615. node = ReactMount.getNode(this._rootNodeID);
  6616. }
  6617. CSSPropertyOperations.setValueForStyles(node, styleUpdates);
  6618. }
  6619. },
  6620. /**
  6621. * Reconciles the children with the various properties that affect the
  6622. * children content.
  6623. *
  6624. * @param {object} lastProps
  6625. * @param {object} nextProps
  6626. * @param {ReactReconcileTransaction} transaction
  6627. * @param {object} context
  6628. */
  6629. _updateDOMChildren: function (lastProps, nextProps, transaction, context) {
  6630. var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
  6631. var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
  6632. var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
  6633. var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
  6634. // Note the use of `!=` which checks for null or undefined.
  6635. var lastChildren = lastContent != null ? null : lastProps.children;
  6636. var nextChildren = nextContent != null ? null : nextProps.children;
  6637. // If we're switching from children to content/html or vice versa, remove
  6638. // the old content
  6639. var lastHasContentOrHtml = lastContent != null || lastHtml != null;
  6640. var nextHasContentOrHtml = nextContent != null || nextHtml != null;
  6641. if (lastChildren != null && nextChildren == null) {
  6642. this.updateChildren(null, transaction, context);
  6643. } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
  6644. this.updateTextContent('');
  6645. }
  6646. if (nextContent != null) {
  6647. if (lastContent !== nextContent) {
  6648. this.updateTextContent('' + nextContent);
  6649. }
  6650. } else if (nextHtml != null) {
  6651. if (lastHtml !== nextHtml) {
  6652. this.updateMarkup('' + nextHtml);
  6653. }
  6654. } else if (nextChildren != null) {
  6655. this.updateChildren(nextChildren, transaction, context);
  6656. }
  6657. },
  6658. /**
  6659. * Destroys all event registrations for this instance. Does not remove from
  6660. * the DOM. That must be done by the parent.
  6661. *
  6662. * @internal
  6663. */
  6664. unmountComponent: function () {
  6665. switch (this._tag) {
  6666. case 'iframe':
  6667. case 'img':
  6668. case 'form':
  6669. case 'video':
  6670. case 'audio':
  6671. var listeners = this._wrapperState.listeners;
  6672. if (listeners) {
  6673. for (var i = 0; i < listeners.length; i++) {
  6674. listeners[i].remove();
  6675. }
  6676. }
  6677. break;
  6678. case 'input':
  6679. ReactDOMInput.unmountWrapper(this);
  6680. break;
  6681. case 'html':
  6682. case 'head':
  6683. case 'body':
  6684. /**
  6685. * Components like <html> <head> and <body> can't be removed or added
  6686. * easily in a cross-browser way, however it's valuable to be able to
  6687. * take advantage of React's reconciliation for styling and <title>
  6688. * management. So we just document it and throw in dangerous cases.
  6689. */
  6690. !false ? "production" !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : undefined;
  6691. break;
  6692. }
  6693. this.unmountChildren();
  6694. ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
  6695. ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
  6696. this._rootNodeID = null;
  6697. this._wrapperState = null;
  6698. if (this._nodeWithLegacyProperties) {
  6699. var node = this._nodeWithLegacyProperties;
  6700. node._reactInternalComponent = null;
  6701. this._nodeWithLegacyProperties = null;
  6702. }
  6703. },
  6704. getPublicInstance: function () {
  6705. if (!this._nodeWithLegacyProperties) {
  6706. var node = ReactMount.getNode(this._rootNodeID);
  6707. node._reactInternalComponent = this;
  6708. node.getDOMNode = legacyGetDOMNode;
  6709. node.isMounted = legacyIsMounted;
  6710. node.setState = legacySetStateEtc;
  6711. node.replaceState = legacySetStateEtc;
  6712. node.forceUpdate = legacySetStateEtc;
  6713. node.setProps = legacySetProps;
  6714. node.replaceProps = legacyReplaceProps;
  6715. if ("production" !== 'production') {
  6716. if (canDefineProperty) {
  6717. Object.defineProperties(node, legacyPropsDescriptor);
  6718. } else {
  6719. // updateComponent will update this property on subsequent renders
  6720. node.props = this._currentElement.props;
  6721. }
  6722. } else {
  6723. // updateComponent will update this property on subsequent renders
  6724. node.props = this._currentElement.props;
  6725. }
  6726. this._nodeWithLegacyProperties = node;
  6727. }
  6728. return this._nodeWithLegacyProperties;
  6729. }
  6730. };
  6731. ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', {
  6732. mountComponent: 'mountComponent',
  6733. updateComponent: 'updateComponent'
  6734. });
  6735. assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
  6736. module.exports = ReactDOMComponent;
  6737. },{"10":10,"11":11,"117":117,"121":121,"133":133,"138":138,"139":139,"144":144,"15":15,"161":161,"166":166,"171":171,"173":173,"2":2,"24":24,"28":28,"35":35,"41":41,"46":46,"47":47,"48":48,"5":5,"52":52,"72":72,"73":73,"78":78,"95":95}],43:[function(_dereq_,module,exports){
  6738. /**
  6739. * Copyright 2013-2015, Facebook, Inc.
  6740. * All rights reserved.
  6741. *
  6742. * This source code is licensed under the BSD-style license found in the
  6743. * LICENSE file in the root directory of this source tree. An additional grant
  6744. * of patent rights can be found in the PATENTS file in the same directory.
  6745. *
  6746. * @providesModule ReactDOMFactories
  6747. * @typechecks static-only
  6748. */
  6749. 'use strict';
  6750. var ReactElement = _dereq_(57);
  6751. var ReactElementValidator = _dereq_(58);
  6752. var mapObject = _dereq_(167);
  6753. /**
  6754. * Create a factory that creates HTML tag elements.
  6755. *
  6756. * @param {string} tag Tag name (e.g. `div`).
  6757. * @private
  6758. */
  6759. function createDOMFactory(tag) {
  6760. if ("production" !== 'production') {
  6761. return ReactElementValidator.createFactory(tag);
  6762. }
  6763. return ReactElement.createFactory(tag);
  6764. }
  6765. /**
  6766. * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
  6767. * This is also accessible via `React.DOM`.
  6768. *
  6769. * @public
  6770. */
  6771. var ReactDOMFactories = mapObject({
  6772. a: 'a',
  6773. abbr: 'abbr',
  6774. address: 'address',
  6775. area: 'area',
  6776. article: 'article',
  6777. aside: 'aside',
  6778. audio: 'audio',
  6779. b: 'b',
  6780. base: 'base',
  6781. bdi: 'bdi',
  6782. bdo: 'bdo',
  6783. big: 'big',
  6784. blockquote: 'blockquote',
  6785. body: 'body',
  6786. br: 'br',
  6787. button: 'button',
  6788. canvas: 'canvas',
  6789. caption: 'caption',
  6790. cite: 'cite',
  6791. code: 'code',
  6792. col: 'col',
  6793. colgroup: 'colgroup',
  6794. data: 'data',
  6795. datalist: 'datalist',
  6796. dd: 'dd',
  6797. del: 'del',
  6798. details: 'details',
  6799. dfn: 'dfn',
  6800. dialog: 'dialog',
  6801. div: 'div',
  6802. dl: 'dl',
  6803. dt: 'dt',
  6804. em: 'em',
  6805. embed: 'embed',
  6806. fieldset: 'fieldset',
  6807. figcaption: 'figcaption',
  6808. figure: 'figure',
  6809. footer: 'footer',
  6810. form: 'form',
  6811. h1: 'h1',
  6812. h2: 'h2',
  6813. h3: 'h3',
  6814. h4: 'h4',
  6815. h5: 'h5',
  6816. h6: 'h6',
  6817. head: 'head',
  6818. header: 'header',
  6819. hgroup: 'hgroup',
  6820. hr: 'hr',
  6821. html: 'html',
  6822. i: 'i',
  6823. iframe: 'iframe',
  6824. img: 'img',
  6825. input: 'input',
  6826. ins: 'ins',
  6827. kbd: 'kbd',
  6828. keygen: 'keygen',
  6829. label: 'label',
  6830. legend: 'legend',
  6831. li: 'li',
  6832. link: 'link',
  6833. main: 'main',
  6834. map: 'map',
  6835. mark: 'mark',
  6836. menu: 'menu',
  6837. menuitem: 'menuitem',
  6838. meta: 'meta',
  6839. meter: 'meter',
  6840. nav: 'nav',
  6841. noscript: 'noscript',
  6842. object: 'object',
  6843. ol: 'ol',
  6844. optgroup: 'optgroup',
  6845. option: 'option',
  6846. output: 'output',
  6847. p: 'p',
  6848. param: 'param',
  6849. picture: 'picture',
  6850. pre: 'pre',
  6851. progress: 'progress',
  6852. q: 'q',
  6853. rp: 'rp',
  6854. rt: 'rt',
  6855. ruby: 'ruby',
  6856. s: 's',
  6857. samp: 'samp',
  6858. script: 'script',
  6859. section: 'section',
  6860. select: 'select',
  6861. small: 'small',
  6862. source: 'source',
  6863. span: 'span',
  6864. strong: 'strong',
  6865. style: 'style',
  6866. sub: 'sub',
  6867. summary: 'summary',
  6868. sup: 'sup',
  6869. table: 'table',
  6870. tbody: 'tbody',
  6871. td: 'td',
  6872. textarea: 'textarea',
  6873. tfoot: 'tfoot',
  6874. th: 'th',
  6875. thead: 'thead',
  6876. time: 'time',
  6877. title: 'title',
  6878. tr: 'tr',
  6879. track: 'track',
  6880. u: 'u',
  6881. ul: 'ul',
  6882. 'var': 'var',
  6883. video: 'video',
  6884. wbr: 'wbr',
  6885. // SVG
  6886. circle: 'circle',
  6887. clipPath: 'clipPath',
  6888. defs: 'defs',
  6889. ellipse: 'ellipse',
  6890. g: 'g',
  6891. image: 'image',
  6892. line: 'line',
  6893. linearGradient: 'linearGradient',
  6894. mask: 'mask',
  6895. path: 'path',
  6896. pattern: 'pattern',
  6897. polygon: 'polygon',
  6898. polyline: 'polyline',
  6899. radialGradient: 'radialGradient',
  6900. rect: 'rect',
  6901. stop: 'stop',
  6902. svg: 'svg',
  6903. text: 'text',
  6904. tspan: 'tspan'
  6905. }, createDOMFactory);
  6906. module.exports = ReactDOMFactories;
  6907. },{"167":167,"57":57,"58":58}],44:[function(_dereq_,module,exports){
  6908. /**
  6909. * Copyright 2013-2015, Facebook, Inc.
  6910. * All rights reserved.
  6911. *
  6912. * This source code is licensed under the BSD-style license found in the
  6913. * LICENSE file in the root directory of this source tree. An additional grant
  6914. * of patent rights can be found in the PATENTS file in the same directory.
  6915. *
  6916. * @providesModule ReactDOMFeatureFlags
  6917. */
  6918. 'use strict';
  6919. var ReactDOMFeatureFlags = {
  6920. useCreateElement: false
  6921. };
  6922. module.exports = ReactDOMFeatureFlags;
  6923. },{}],45:[function(_dereq_,module,exports){
  6924. /**
  6925. * Copyright 2013-2015, Facebook, Inc.
  6926. * All rights reserved.
  6927. *
  6928. * This source code is licensed under the BSD-style license found in the
  6929. * LICENSE file in the root directory of this source tree. An additional grant
  6930. * of patent rights can be found in the PATENTS file in the same directory.
  6931. *
  6932. * @providesModule ReactDOMIDOperations
  6933. * @typechecks static-only
  6934. */
  6935. 'use strict';
  6936. var DOMChildrenOperations = _dereq_(9);
  6937. var DOMPropertyOperations = _dereq_(11);
  6938. var ReactMount = _dereq_(72);
  6939. var ReactPerf = _dereq_(78);
  6940. var invariant = _dereq_(161);
  6941. /**
  6942. * Errors for properties that should not be updated with `updatePropertyByID()`.
  6943. *
  6944. * @type {object}
  6945. * @private
  6946. */
  6947. var INVALID_PROPERTY_ERRORS = {
  6948. dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
  6949. style: '`style` must be set using `updateStylesByID()`.'
  6950. };
  6951. /**
  6952. * Operations used to process updates to DOM nodes.
  6953. */
  6954. var ReactDOMIDOperations = {
  6955. /**
  6956. * Updates a DOM node with new property values. This should only be used to
  6957. * update DOM properties in `DOMProperty`.
  6958. *
  6959. * @param {string} id ID of the node to update.
  6960. * @param {string} name A valid property name, see `DOMProperty`.
  6961. * @param {*} value New value of the property.
  6962. * @internal
  6963. */
  6964. updatePropertyByID: function (id, name, value) {
  6965. var node = ReactMount.getNode(id);
  6966. !!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? "production" !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
  6967. // If we're updating to null or undefined, we should remove the property
  6968. // from the DOM node instead of inadvertantly setting to a string. This
  6969. // brings us in line with the same behavior we have on initial render.
  6970. if (value != null) {
  6971. DOMPropertyOperations.setValueForProperty(node, name, value);
  6972. } else {
  6973. DOMPropertyOperations.deleteValueForProperty(node, name);
  6974. }
  6975. },
  6976. /**
  6977. * Replaces a DOM node that exists in the document with markup.
  6978. *
  6979. * @param {string} id ID of child to be replaced.
  6980. * @param {string} markup Dangerous markup to inject in place of child.
  6981. * @internal
  6982. * @see {Danger.dangerouslyReplaceNodeWithMarkup}
  6983. */
  6984. dangerouslyReplaceNodeWithMarkupByID: function (id, markup) {
  6985. var node = ReactMount.getNode(id);
  6986. DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
  6987. },
  6988. /**
  6989. * Updates a component's children by processing a series of updates.
  6990. *
  6991. * @param {array<object>} updates List of update configurations.
  6992. * @param {array<string>} markup List of markup strings.
  6993. * @internal
  6994. */
  6995. dangerouslyProcessChildrenUpdates: function (updates, markup) {
  6996. for (var i = 0; i < updates.length; i++) {
  6997. updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
  6998. }
  6999. DOMChildrenOperations.processUpdates(updates, markup);
  7000. }
  7001. };
  7002. ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
  7003. dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
  7004. dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
  7005. });
  7006. module.exports = ReactDOMIDOperations;
  7007. },{"11":11,"161":161,"72":72,"78":78,"9":9}],46:[function(_dereq_,module,exports){
  7008. /**
  7009. * Copyright 2013-2015, Facebook, Inc.
  7010. * All rights reserved.
  7011. *
  7012. * This source code is licensed under the BSD-style license found in the
  7013. * LICENSE file in the root directory of this source tree. An additional grant
  7014. * of patent rights can be found in the PATENTS file in the same directory.
  7015. *
  7016. * @providesModule ReactDOMInput
  7017. */
  7018. 'use strict';
  7019. var ReactDOMIDOperations = _dereq_(45);
  7020. var LinkedValueUtils = _dereq_(23);
  7021. var ReactMount = _dereq_(72);
  7022. var ReactUpdates = _dereq_(96);
  7023. var assign = _dereq_(24);
  7024. var invariant = _dereq_(161);
  7025. var instancesByReactID = {};
  7026. function forceUpdateIfMounted() {
  7027. if (this._rootNodeID) {
  7028. // DOM component is still mounted; update
  7029. ReactDOMInput.updateWrapper(this);
  7030. }
  7031. }
  7032. /**
  7033. * Implements an <input> native component that allows setting these optional
  7034. * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
  7035. *
  7036. * If `checked` or `value` are not supplied (or null/undefined), user actions
  7037. * that affect the checked state or value will trigger updates to the element.
  7038. *
  7039. * If they are supplied (and not null/undefined), the rendered element will not
  7040. * trigger updates to the element. Instead, the props must change in order for
  7041. * the rendered element to be updated.
  7042. *
  7043. * The rendered element will be initialized as unchecked (or `defaultChecked`)
  7044. * with an empty value (or `defaultValue`).
  7045. *
  7046. * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
  7047. */
  7048. var ReactDOMInput = {
  7049. getNativeProps: function (inst, props, context) {
  7050. var value = LinkedValueUtils.getValue(props);
  7051. var checked = LinkedValueUtils.getChecked(props);
  7052. var nativeProps = assign({}, props, {
  7053. defaultChecked: undefined,
  7054. defaultValue: undefined,
  7055. value: value != null ? value : inst._wrapperState.initialValue,
  7056. checked: checked != null ? checked : inst._wrapperState.initialChecked,
  7057. onChange: inst._wrapperState.onChange
  7058. });
  7059. return nativeProps;
  7060. },
  7061. mountWrapper: function (inst, props) {
  7062. if ("production" !== 'production') {
  7063. LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
  7064. }
  7065. var defaultValue = props.defaultValue;
  7066. inst._wrapperState = {
  7067. initialChecked: props.defaultChecked || false,
  7068. initialValue: defaultValue != null ? defaultValue : null,
  7069. onChange: _handleChange.bind(inst)
  7070. };
  7071. },
  7072. mountReadyWrapper: function (inst) {
  7073. // Can't be in mountWrapper or else server rendering leaks.
  7074. instancesByReactID[inst._rootNodeID] = inst;
  7075. },
  7076. unmountWrapper: function (inst) {
  7077. delete instancesByReactID[inst._rootNodeID];
  7078. },
  7079. updateWrapper: function (inst) {
  7080. var props = inst._currentElement.props;
  7081. // TODO: Shouldn't this be getChecked(props)?
  7082. var checked = props.checked;
  7083. if (checked != null) {
  7084. ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'checked', checked || false);
  7085. }
  7086. var value = LinkedValueUtils.getValue(props);
  7087. if (value != null) {
  7088. // Cast `value` to a string to ensure the value is set correctly. While
  7089. // browsers typically do this as necessary, jsdom doesn't.
  7090. ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
  7091. }
  7092. }
  7093. };
  7094. function _handleChange(event) {
  7095. var props = this._currentElement.props;
  7096. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  7097. // Here we use asap to wait until all updates have propagated, which
  7098. // is important when using controlled components within layers:
  7099. // https://github.com/facebook/react/issues/1698
  7100. ReactUpdates.asap(forceUpdateIfMounted, this);
  7101. var name = props.name;
  7102. if (props.type === 'radio' && name != null) {
  7103. var rootNode = ReactMount.getNode(this._rootNodeID);
  7104. var queryRoot = rootNode;
  7105. while (queryRoot.parentNode) {
  7106. queryRoot = queryRoot.parentNode;
  7107. }
  7108. // If `rootNode.form` was non-null, then we could try `form.elements`,
  7109. // but that sometimes behaves strangely in IE8. We could also try using
  7110. // `form.getElementsByName`, but that will only return direct children
  7111. // and won't include inputs that use the HTML5 `form=` attribute. Since
  7112. // the input might not even be in a form, let's just use the global
  7113. // `querySelectorAll` to ensure we don't miss anything.
  7114. var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
  7115. for (var i = 0; i < group.length; i++) {
  7116. var otherNode = group[i];
  7117. if (otherNode === rootNode || otherNode.form !== rootNode.form) {
  7118. continue;
  7119. }
  7120. // This will throw if radio buttons rendered by different copies of React
  7121. // and the same name are rendered into the same form (same as #1939).
  7122. // That's probably okay; we don't support it just as we don't support
  7123. // mixing React with non-React.
  7124. var otherID = ReactMount.getID(otherNode);
  7125. !otherID ? "production" !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : undefined;
  7126. var otherInstance = instancesByReactID[otherID];
  7127. !otherInstance ? "production" !== 'production' ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : invariant(false) : undefined;
  7128. // If this is a controlled radio button group, forcing the input that
  7129. // was previously checked to update will cause it to be come re-checked
  7130. // as appropriate.
  7131. ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
  7132. }
  7133. }
  7134. return returnValue;
  7135. }
  7136. module.exports = ReactDOMInput;
  7137. },{"161":161,"23":23,"24":24,"45":45,"72":72,"96":96}],47:[function(_dereq_,module,exports){
  7138. /**
  7139. * Copyright 2013-2015, Facebook, Inc.
  7140. * All rights reserved.
  7141. *
  7142. * This source code is licensed under the BSD-style license found in the
  7143. * LICENSE file in the root directory of this source tree. An additional grant
  7144. * of patent rights can be found in the PATENTS file in the same directory.
  7145. *
  7146. * @providesModule ReactDOMOption
  7147. */
  7148. 'use strict';
  7149. var ReactChildren = _dereq_(32);
  7150. var ReactDOMSelect = _dereq_(48);
  7151. var assign = _dereq_(24);
  7152. var warning = _dereq_(173);
  7153. var valueContextKey = ReactDOMSelect.valueContextKey;
  7154. /**
  7155. * Implements an <option> native component that warns when `selected` is set.
  7156. */
  7157. var ReactDOMOption = {
  7158. mountWrapper: function (inst, props, context) {
  7159. // TODO (yungsters): Remove support for `selected` in <option>.
  7160. if ("production" !== 'production') {
  7161. "production" !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined;
  7162. }
  7163. // Look up whether this option is 'selected' via context
  7164. var selectValue = context[valueContextKey];
  7165. // If context key is null (e.g., no specified value or after initial mount)
  7166. // or missing (e.g., for <datalist>), we don't change props.selected
  7167. var selected = null;
  7168. if (selectValue != null) {
  7169. selected = false;
  7170. if (Array.isArray(selectValue)) {
  7171. // multiple
  7172. for (var i = 0; i < selectValue.length; i++) {
  7173. if ('' + selectValue[i] === '' + props.value) {
  7174. selected = true;
  7175. break;
  7176. }
  7177. }
  7178. } else {
  7179. selected = '' + selectValue === '' + props.value;
  7180. }
  7181. }
  7182. inst._wrapperState = { selected: selected };
  7183. },
  7184. getNativeProps: function (inst, props, context) {
  7185. var nativeProps = assign({ selected: undefined, children: undefined }, props);
  7186. // Read state only from initial mount because <select> updates value
  7187. // manually; we need the initial state only for server rendering
  7188. if (inst._wrapperState.selected != null) {
  7189. nativeProps.selected = inst._wrapperState.selected;
  7190. }
  7191. var content = '';
  7192. // Flatten children and warn if they aren't strings or numbers;
  7193. // invalid types are ignored.
  7194. ReactChildren.forEach(props.children, function (child) {
  7195. if (child == null) {
  7196. return;
  7197. }
  7198. if (typeof child === 'string' || typeof child === 'number') {
  7199. content += child;
  7200. } else {
  7201. "production" !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined;
  7202. }
  7203. });
  7204. nativeProps.children = content;
  7205. return nativeProps;
  7206. }
  7207. };
  7208. module.exports = ReactDOMOption;
  7209. },{"173":173,"24":24,"32":32,"48":48}],48:[function(_dereq_,module,exports){
  7210. /**
  7211. * Copyright 2013-2015, Facebook, Inc.
  7212. * All rights reserved.
  7213. *
  7214. * This source code is licensed under the BSD-style license found in the
  7215. * LICENSE file in the root directory of this source tree. An additional grant
  7216. * of patent rights can be found in the PATENTS file in the same directory.
  7217. *
  7218. * @providesModule ReactDOMSelect
  7219. */
  7220. 'use strict';
  7221. var LinkedValueUtils = _dereq_(23);
  7222. var ReactMount = _dereq_(72);
  7223. var ReactUpdates = _dereq_(96);
  7224. var assign = _dereq_(24);
  7225. var warning = _dereq_(173);
  7226. var valueContextKey = '__ReactDOMSelect_value$' + Math.random().toString(36).slice(2);
  7227. function updateOptionsIfPendingUpdateAndMounted() {
  7228. if (this._rootNodeID && this._wrapperState.pendingUpdate) {
  7229. this._wrapperState.pendingUpdate = false;
  7230. var props = this._currentElement.props;
  7231. var value = LinkedValueUtils.getValue(props);
  7232. if (value != null) {
  7233. updateOptions(this, Boolean(props.multiple), value);
  7234. }
  7235. }
  7236. }
  7237. function getDeclarationErrorAddendum(owner) {
  7238. if (owner) {
  7239. var name = owner.getName();
  7240. if (name) {
  7241. return ' Check the render method of `' + name + '`.';
  7242. }
  7243. }
  7244. return '';
  7245. }
  7246. var valuePropNames = ['value', 'defaultValue'];
  7247. /**
  7248. * Validation function for `value` and `defaultValue`.
  7249. * @private
  7250. */
  7251. function checkSelectPropTypes(inst, props) {
  7252. var owner = inst._currentElement._owner;
  7253. LinkedValueUtils.checkPropTypes('select', props, owner);
  7254. for (var i = 0; i < valuePropNames.length; i++) {
  7255. var propName = valuePropNames[i];
  7256. if (props[propName] == null) {
  7257. continue;
  7258. }
  7259. if (props.multiple) {
  7260. "production" !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
  7261. } else {
  7262. "production" !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
  7263. }
  7264. }
  7265. }
  7266. /**
  7267. * @param {ReactDOMComponent} inst
  7268. * @param {boolean} multiple
  7269. * @param {*} propValue A stringable (with `multiple`, a list of stringables).
  7270. * @private
  7271. */
  7272. function updateOptions(inst, multiple, propValue) {
  7273. var selectedValue, i;
  7274. var options = ReactMount.getNode(inst._rootNodeID).options;
  7275. if (multiple) {
  7276. selectedValue = {};
  7277. for (i = 0; i < propValue.length; i++) {
  7278. selectedValue['' + propValue[i]] = true;
  7279. }
  7280. for (i = 0; i < options.length; i++) {
  7281. var selected = selectedValue.hasOwnProperty(options[i].value);
  7282. if (options[i].selected !== selected) {
  7283. options[i].selected = selected;
  7284. }
  7285. }
  7286. } else {
  7287. // Do not set `select.value` as exact behavior isn't consistent across all
  7288. // browsers for all cases.
  7289. selectedValue = '' + propValue;
  7290. for (i = 0; i < options.length; i++) {
  7291. if (options[i].value === selectedValue) {
  7292. options[i].selected = true;
  7293. return;
  7294. }
  7295. }
  7296. if (options.length) {
  7297. options[0].selected = true;
  7298. }
  7299. }
  7300. }
  7301. /**
  7302. * Implements a <select> native component that allows optionally setting the
  7303. * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
  7304. * stringable. If `multiple` is true, the prop must be an array of stringables.
  7305. *
  7306. * If `value` is not supplied (or null/undefined), user actions that change the
  7307. * selected option will trigger updates to the rendered options.
  7308. *
  7309. * If it is supplied (and not null/undefined), the rendered options will not
  7310. * update in response to user actions. Instead, the `value` prop must change in
  7311. * order for the rendered options to update.
  7312. *
  7313. * If `defaultValue` is provided, any options with the supplied values will be
  7314. * selected.
  7315. */
  7316. var ReactDOMSelect = {
  7317. valueContextKey: valueContextKey,
  7318. getNativeProps: function (inst, props, context) {
  7319. return assign({}, props, {
  7320. onChange: inst._wrapperState.onChange,
  7321. value: undefined
  7322. });
  7323. },
  7324. mountWrapper: function (inst, props) {
  7325. if ("production" !== 'production') {
  7326. checkSelectPropTypes(inst, props);
  7327. }
  7328. var value = LinkedValueUtils.getValue(props);
  7329. inst._wrapperState = {
  7330. pendingUpdate: false,
  7331. initialValue: value != null ? value : props.defaultValue,
  7332. onChange: _handleChange.bind(inst),
  7333. wasMultiple: Boolean(props.multiple)
  7334. };
  7335. },
  7336. processChildContext: function (inst, props, context) {
  7337. // Pass down initial value so initial generated markup has correct
  7338. // `selected` attributes
  7339. var childContext = assign({}, context);
  7340. childContext[valueContextKey] = inst._wrapperState.initialValue;
  7341. return childContext;
  7342. },
  7343. postUpdateWrapper: function (inst) {
  7344. var props = inst._currentElement.props;
  7345. // After the initial mount, we control selected-ness manually so don't pass
  7346. // the context value down
  7347. inst._wrapperState.initialValue = undefined;
  7348. var wasMultiple = inst._wrapperState.wasMultiple;
  7349. inst._wrapperState.wasMultiple = Boolean(props.multiple);
  7350. var value = LinkedValueUtils.getValue(props);
  7351. if (value != null) {
  7352. inst._wrapperState.pendingUpdate = false;
  7353. updateOptions(inst, Boolean(props.multiple), value);
  7354. } else if (wasMultiple !== Boolean(props.multiple)) {
  7355. // For simplicity, reapply `defaultValue` if `multiple` is toggled.
  7356. if (props.defaultValue != null) {
  7357. updateOptions(inst, Boolean(props.multiple), props.defaultValue);
  7358. } else {
  7359. // Revert the select back to its default unselected state.
  7360. updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
  7361. }
  7362. }
  7363. }
  7364. };
  7365. function _handleChange(event) {
  7366. var props = this._currentElement.props;
  7367. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  7368. this._wrapperState.pendingUpdate = true;
  7369. ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
  7370. return returnValue;
  7371. }
  7372. module.exports = ReactDOMSelect;
  7373. },{"173":173,"23":23,"24":24,"72":72,"96":96}],49:[function(_dereq_,module,exports){
  7374. /**
  7375. * Copyright 2013-2015, Facebook, Inc.
  7376. * All rights reserved.
  7377. *
  7378. * This source code is licensed under the BSD-style license found in the
  7379. * LICENSE file in the root directory of this source tree. An additional grant
  7380. * of patent rights can be found in the PATENTS file in the same directory.
  7381. *
  7382. * @providesModule ReactDOMSelection
  7383. */
  7384. 'use strict';
  7385. var ExecutionEnvironment = _dereq_(147);
  7386. var getNodeForCharacterOffset = _dereq_(130);
  7387. var getTextContentAccessor = _dereq_(131);
  7388. /**
  7389. * While `isCollapsed` is available on the Selection object and `collapsed`
  7390. * is available on the Range object, IE11 sometimes gets them wrong.
  7391. * If the anchor/focus nodes and offsets are the same, the range is collapsed.
  7392. */
  7393. function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
  7394. return anchorNode === focusNode && anchorOffset === focusOffset;
  7395. }
  7396. /**
  7397. * Get the appropriate anchor and focus node/offset pairs for IE.
  7398. *
  7399. * The catch here is that IE's selection API doesn't provide information
  7400. * about whether the selection is forward or backward, so we have to
  7401. * behave as though it's always forward.
  7402. *
  7403. * IE text differs from modern selection in that it behaves as though
  7404. * block elements end with a new line. This means character offsets will
  7405. * differ between the two APIs.
  7406. *
  7407. * @param {DOMElement} node
  7408. * @return {object}
  7409. */
  7410. function getIEOffsets(node) {
  7411. var selection = document.selection;
  7412. var selectedRange = selection.createRange();
  7413. var selectedLength = selectedRange.text.length;
  7414. // Duplicate selection so we can move range without breaking user selection.
  7415. var fromStart = selectedRange.duplicate();
  7416. fromStart.moveToElementText(node);
  7417. fromStart.setEndPoint('EndToStart', selectedRange);
  7418. var startOffset = fromStart.text.length;
  7419. var endOffset = startOffset + selectedLength;
  7420. return {
  7421. start: startOffset,
  7422. end: endOffset
  7423. };
  7424. }
  7425. /**
  7426. * @param {DOMElement} node
  7427. * @return {?object}
  7428. */
  7429. function getModernOffsets(node) {
  7430. var selection = window.getSelection && window.getSelection();
  7431. if (!selection || selection.rangeCount === 0) {
  7432. return null;
  7433. }
  7434. var anchorNode = selection.anchorNode;
  7435. var anchorOffset = selection.anchorOffset;
  7436. var focusNode = selection.focusNode;
  7437. var focusOffset = selection.focusOffset;
  7438. var currentRange = selection.getRangeAt(0);
  7439. // In Firefox, range.startContainer and range.endContainer can be "anonymous
  7440. // divs", e.g. the up/down buttons on an <input type="number">. Anonymous
  7441. // divs do not seem to expose properties, triggering a "Permission denied
  7442. // error" if any of its properties are accessed. The only seemingly possible
  7443. // way to avoid erroring is to access a property that typically works for
  7444. // non-anonymous divs and catch any error that may otherwise arise. See
  7445. // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
  7446. try {
  7447. /* eslint-disable no-unused-expressions */
  7448. currentRange.startContainer.nodeType;
  7449. currentRange.endContainer.nodeType;
  7450. /* eslint-enable no-unused-expressions */
  7451. } catch (e) {
  7452. return null;
  7453. }
  7454. // If the node and offset values are the same, the selection is collapsed.
  7455. // `Selection.isCollapsed` is available natively, but IE sometimes gets
  7456. // this value wrong.
  7457. var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
  7458. var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
  7459. var tempRange = currentRange.cloneRange();
  7460. tempRange.selectNodeContents(node);
  7461. tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
  7462. var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
  7463. var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
  7464. var end = start + rangeLength;
  7465. // Detect whether the selection is backward.
  7466. var detectionRange = document.createRange();
  7467. detectionRange.setStart(anchorNode, anchorOffset);
  7468. detectionRange.setEnd(focusNode, focusOffset);
  7469. var isBackward = detectionRange.collapsed;
  7470. return {
  7471. start: isBackward ? end : start,
  7472. end: isBackward ? start : end
  7473. };
  7474. }
  7475. /**
  7476. * @param {DOMElement|DOMTextNode} node
  7477. * @param {object} offsets
  7478. */
  7479. function setIEOffsets(node, offsets) {
  7480. var range = document.selection.createRange().duplicate();
  7481. var start, end;
  7482. if (typeof offsets.end === 'undefined') {
  7483. start = offsets.start;
  7484. end = start;
  7485. } else if (offsets.start > offsets.end) {
  7486. start = offsets.end;
  7487. end = offsets.start;
  7488. } else {
  7489. start = offsets.start;
  7490. end = offsets.end;
  7491. }
  7492. range.moveToElementText(node);
  7493. range.moveStart('character', start);
  7494. range.setEndPoint('EndToStart', range);
  7495. range.moveEnd('character', end - start);
  7496. range.select();
  7497. }
  7498. /**
  7499. * In modern non-IE browsers, we can support both forward and backward
  7500. * selections.
  7501. *
  7502. * Note: IE10+ supports the Selection object, but it does not support
  7503. * the `extend` method, which means that even in modern IE, it's not possible
  7504. * to programatically create a backward selection. Thus, for all IE
  7505. * versions, we use the old IE API to create our selections.
  7506. *
  7507. * @param {DOMElement|DOMTextNode} node
  7508. * @param {object} offsets
  7509. */
  7510. function setModernOffsets(node, offsets) {
  7511. if (!window.getSelection) {
  7512. return;
  7513. }
  7514. var selection = window.getSelection();
  7515. var length = node[getTextContentAccessor()].length;
  7516. var start = Math.min(offsets.start, length);
  7517. var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length);
  7518. // IE 11 uses modern selection, but doesn't support the extend method.
  7519. // Flip backward selections, so we can set with a single range.
  7520. if (!selection.extend && start > end) {
  7521. var temp = end;
  7522. end = start;
  7523. start = temp;
  7524. }
  7525. var startMarker = getNodeForCharacterOffset(node, start);
  7526. var endMarker = getNodeForCharacterOffset(node, end);
  7527. if (startMarker && endMarker) {
  7528. var range = document.createRange();
  7529. range.setStart(startMarker.node, startMarker.offset);
  7530. selection.removeAllRanges();
  7531. if (start > end) {
  7532. selection.addRange(range);
  7533. selection.extend(endMarker.node, endMarker.offset);
  7534. } else {
  7535. range.setEnd(endMarker.node, endMarker.offset);
  7536. selection.addRange(range);
  7537. }
  7538. }
  7539. }
  7540. var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
  7541. var ReactDOMSelection = {
  7542. /**
  7543. * @param {DOMElement} node
  7544. */
  7545. getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
  7546. /**
  7547. * @param {DOMElement|DOMTextNode} node
  7548. * @param {object} offsets
  7549. */
  7550. setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
  7551. };
  7552. module.exports = ReactDOMSelection;
  7553. },{"130":130,"131":131,"147":147}],50:[function(_dereq_,module,exports){
  7554. /**
  7555. * Copyright 2013-2015, Facebook, Inc.
  7556. * All rights reserved.
  7557. *
  7558. * This source code is licensed under the BSD-style license found in the
  7559. * LICENSE file in the root directory of this source tree. An additional grant
  7560. * of patent rights can be found in the PATENTS file in the same directory.
  7561. *
  7562. * @providesModule ReactDOMServer
  7563. */
  7564. 'use strict';
  7565. var ReactDefaultInjection = _dereq_(54);
  7566. var ReactServerRendering = _dereq_(88);
  7567. var ReactVersion = _dereq_(97);
  7568. ReactDefaultInjection.inject();
  7569. var ReactDOMServer = {
  7570. renderToString: ReactServerRendering.renderToString,
  7571. renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
  7572. version: ReactVersion
  7573. };
  7574. module.exports = ReactDOMServer;
  7575. },{"54":54,"88":88,"97":97}],51:[function(_dereq_,module,exports){
  7576. /**
  7577. * Copyright 2013-2015, Facebook, Inc.
  7578. * All rights reserved.
  7579. *
  7580. * This source code is licensed under the BSD-style license found in the
  7581. * LICENSE file in the root directory of this source tree. An additional grant
  7582. * of patent rights can be found in the PATENTS file in the same directory.
  7583. *
  7584. * @providesModule ReactDOMTextComponent
  7585. * @typechecks static-only
  7586. */
  7587. 'use strict';
  7588. var DOMChildrenOperations = _dereq_(9);
  7589. var DOMPropertyOperations = _dereq_(11);
  7590. var ReactComponentBrowserEnvironment = _dereq_(35);
  7591. var ReactMount = _dereq_(72);
  7592. var assign = _dereq_(24);
  7593. var escapeTextContentForBrowser = _dereq_(121);
  7594. var setTextContent = _dereq_(139);
  7595. var validateDOMNesting = _dereq_(144);
  7596. /**
  7597. * Text nodes violate a couple assumptions that React makes about components:
  7598. *
  7599. * - When mounting text into the DOM, adjacent text nodes are merged.
  7600. * - Text nodes cannot be assigned a React root ID.
  7601. *
  7602. * This component is used to wrap strings in elements so that they can undergo
  7603. * the same reconciliation that is applied to elements.
  7604. *
  7605. * TODO: Investigate representing React components in the DOM with text nodes.
  7606. *
  7607. * @class ReactDOMTextComponent
  7608. * @extends ReactComponent
  7609. * @internal
  7610. */
  7611. var ReactDOMTextComponent = function (props) {
  7612. // This constructor and its argument is currently used by mocks.
  7613. };
  7614. assign(ReactDOMTextComponent.prototype, {
  7615. /**
  7616. * @param {ReactText} text
  7617. * @internal
  7618. */
  7619. construct: function (text) {
  7620. // TODO: This is really a ReactText (ReactNode), not a ReactElement
  7621. this._currentElement = text;
  7622. this._stringText = '' + text;
  7623. // Properties
  7624. this._rootNodeID = null;
  7625. this._mountIndex = 0;
  7626. },
  7627. /**
  7628. * Creates the markup for this text node. This node is not intended to have
  7629. * any features besides containing text content.
  7630. *
  7631. * @param {string} rootID DOM ID of the root node.
  7632. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  7633. * @return {string} Markup for this text node.
  7634. * @internal
  7635. */
  7636. mountComponent: function (rootID, transaction, context) {
  7637. if ("production" !== 'production') {
  7638. if (context[validateDOMNesting.ancestorInfoContextKey]) {
  7639. validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]);
  7640. }
  7641. }
  7642. this._rootNodeID = rootID;
  7643. if (transaction.useCreateElement) {
  7644. var ownerDocument = context[ReactMount.ownerDocumentContextKey];
  7645. var el = ownerDocument.createElementNS('http://www.w3.org/1999/xhtml', 'span');
  7646. DOMPropertyOperations.setAttributeForID(el, rootID);
  7647. // Populate node cache
  7648. ReactMount.getID(el);
  7649. setTextContent(el, this._stringText);
  7650. return el;
  7651. } else {
  7652. var escapedText = escapeTextContentForBrowser(this._stringText);
  7653. if (transaction.renderToStaticMarkup) {
  7654. // Normally we'd wrap this in a `span` for the reasons stated above, but
  7655. // since this is a situation where React won't take over (static pages),
  7656. // we can simply return the text as it is.
  7657. return escapedText;
  7658. }
  7659. return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>';
  7660. }
  7661. },
  7662. /**
  7663. * Updates this component by updating the text content.
  7664. *
  7665. * @param {ReactText} nextText The next text content
  7666. * @param {ReactReconcileTransaction} transaction
  7667. * @internal
  7668. */
  7669. receiveComponent: function (nextText, transaction) {
  7670. if (nextText !== this._currentElement) {
  7671. this._currentElement = nextText;
  7672. var nextStringText = '' + nextText;
  7673. if (nextStringText !== this._stringText) {
  7674. // TODO: Save this as pending props and use performUpdateIfNecessary
  7675. // and/or updateComponent to do the actual update for consistency with
  7676. // other component types?
  7677. this._stringText = nextStringText;
  7678. var node = ReactMount.getNode(this._rootNodeID);
  7679. DOMChildrenOperations.updateTextContent(node, nextStringText);
  7680. }
  7681. }
  7682. },
  7683. unmountComponent: function () {
  7684. ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
  7685. }
  7686. });
  7687. module.exports = ReactDOMTextComponent;
  7688. },{"11":11,"121":121,"139":139,"144":144,"24":24,"35":35,"72":72,"9":9}],52:[function(_dereq_,module,exports){
  7689. /**
  7690. * Copyright 2013-2015, Facebook, Inc.
  7691. * All rights reserved.
  7692. *
  7693. * This source code is licensed under the BSD-style license found in the
  7694. * LICENSE file in the root directory of this source tree. An additional grant
  7695. * of patent rights can be found in the PATENTS file in the same directory.
  7696. *
  7697. * @providesModule ReactDOMTextarea
  7698. */
  7699. 'use strict';
  7700. var LinkedValueUtils = _dereq_(23);
  7701. var ReactDOMIDOperations = _dereq_(45);
  7702. var ReactUpdates = _dereq_(96);
  7703. var assign = _dereq_(24);
  7704. var invariant = _dereq_(161);
  7705. var warning = _dereq_(173);
  7706. function forceUpdateIfMounted() {
  7707. if (this._rootNodeID) {
  7708. // DOM component is still mounted; update
  7709. ReactDOMTextarea.updateWrapper(this);
  7710. }
  7711. }
  7712. /**
  7713. * Implements a <textarea> native component that allows setting `value`, and
  7714. * `defaultValue`. This differs from the traditional DOM API because value is
  7715. * usually set as PCDATA children.
  7716. *
  7717. * If `value` is not supplied (or null/undefined), user actions that affect the
  7718. * value will trigger updates to the element.
  7719. *
  7720. * If `value` is supplied (and not null/undefined), the rendered element will
  7721. * not trigger updates to the element. Instead, the `value` prop must change in
  7722. * order for the rendered element to be updated.
  7723. *
  7724. * The rendered element will be initialized with an empty value, the prop
  7725. * `defaultValue` if specified, or the children content (deprecated).
  7726. */
  7727. var ReactDOMTextarea = {
  7728. getNativeProps: function (inst, props, context) {
  7729. !(props.dangerouslySetInnerHTML == null) ? "production" !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined;
  7730. // Always set children to the same thing. In IE9, the selection range will
  7731. // get reset if `textContent` is mutated.
  7732. var nativeProps = assign({}, props, {
  7733. defaultValue: undefined,
  7734. value: undefined,
  7735. children: inst._wrapperState.initialValue,
  7736. onChange: inst._wrapperState.onChange
  7737. });
  7738. return nativeProps;
  7739. },
  7740. mountWrapper: function (inst, props) {
  7741. if ("production" !== 'production') {
  7742. LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
  7743. }
  7744. var defaultValue = props.defaultValue;
  7745. // TODO (yungsters): Remove support for children content in <textarea>.
  7746. var children = props.children;
  7747. if (children != null) {
  7748. if ("production" !== 'production') {
  7749. "production" !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined;
  7750. }
  7751. !(defaultValue == null) ? "production" !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined;
  7752. if (Array.isArray(children)) {
  7753. !(children.length <= 1) ? "production" !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined;
  7754. children = children[0];
  7755. }
  7756. defaultValue = '' + children;
  7757. }
  7758. if (defaultValue == null) {
  7759. defaultValue = '';
  7760. }
  7761. var value = LinkedValueUtils.getValue(props);
  7762. inst._wrapperState = {
  7763. // We save the initial value so that `ReactDOMComponent` doesn't update
  7764. // `textContent` (unnecessary since we update value).
  7765. // The initial value can be a boolean or object so that's why it's
  7766. // forced to be a string.
  7767. initialValue: '' + (value != null ? value : defaultValue),
  7768. onChange: _handleChange.bind(inst)
  7769. };
  7770. },
  7771. updateWrapper: function (inst) {
  7772. var props = inst._currentElement.props;
  7773. var value = LinkedValueUtils.getValue(props);
  7774. if (value != null) {
  7775. // Cast `value` to a string to ensure the value is set correctly. While
  7776. // browsers typically do this as necessary, jsdom doesn't.
  7777. ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
  7778. }
  7779. }
  7780. };
  7781. function _handleChange(event) {
  7782. var props = this._currentElement.props;
  7783. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  7784. ReactUpdates.asap(forceUpdateIfMounted, this);
  7785. return returnValue;
  7786. }
  7787. module.exports = ReactDOMTextarea;
  7788. },{"161":161,"173":173,"23":23,"24":24,"45":45,"96":96}],53:[function(_dereq_,module,exports){
  7789. /**
  7790. * Copyright 2013-2015, Facebook, Inc.
  7791. * All rights reserved.
  7792. *
  7793. * This source code is licensed under the BSD-style license found in the
  7794. * LICENSE file in the root directory of this source tree. An additional grant
  7795. * of patent rights can be found in the PATENTS file in the same directory.
  7796. *
  7797. * @providesModule ReactDefaultBatchingStrategy
  7798. */
  7799. 'use strict';
  7800. var ReactUpdates = _dereq_(96);
  7801. var Transaction = _dereq_(113);
  7802. var assign = _dereq_(24);
  7803. var emptyFunction = _dereq_(153);
  7804. var RESET_BATCHED_UPDATES = {
  7805. initialize: emptyFunction,
  7806. close: function () {
  7807. ReactDefaultBatchingStrategy.isBatchingUpdates = false;
  7808. }
  7809. };
  7810. var FLUSH_BATCHED_UPDATES = {
  7811. initialize: emptyFunction,
  7812. close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
  7813. };
  7814. var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
  7815. function ReactDefaultBatchingStrategyTransaction() {
  7816. this.reinitializeTransaction();
  7817. }
  7818. assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
  7819. getTransactionWrappers: function () {
  7820. return TRANSACTION_WRAPPERS;
  7821. }
  7822. });
  7823. var transaction = new ReactDefaultBatchingStrategyTransaction();
  7824. var ReactDefaultBatchingStrategy = {
  7825. isBatchingUpdates: false,
  7826. /**
  7827. * Call the provided function in a context within which calls to `setState`
  7828. * and friends are batched such that components aren't updated unnecessarily.
  7829. */
  7830. batchedUpdates: function (callback, a, b, c, d, e) {
  7831. var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
  7832. ReactDefaultBatchingStrategy.isBatchingUpdates = true;
  7833. // The code is written this way to avoid extra allocations
  7834. if (alreadyBatchingUpdates) {
  7835. callback(a, b, c, d, e);
  7836. } else {
  7837. transaction.perform(callback, null, a, b, c, d, e);
  7838. }
  7839. }
  7840. };
  7841. module.exports = ReactDefaultBatchingStrategy;
  7842. },{"113":113,"153":153,"24":24,"96":96}],54:[function(_dereq_,module,exports){
  7843. /**
  7844. * Copyright 2013-2015, Facebook, Inc.
  7845. * All rights reserved.
  7846. *
  7847. * This source code is licensed under the BSD-style license found in the
  7848. * LICENSE file in the root directory of this source tree. An additional grant
  7849. * of patent rights can be found in the PATENTS file in the same directory.
  7850. *
  7851. * @providesModule ReactDefaultInjection
  7852. */
  7853. 'use strict';
  7854. var BeforeInputEventPlugin = _dereq_(3);
  7855. var ChangeEventPlugin = _dereq_(7);
  7856. var ClientReactRootIndex = _dereq_(8);
  7857. var DefaultEventPluginOrder = _dereq_(13);
  7858. var EnterLeaveEventPlugin = _dereq_(14);
  7859. var ExecutionEnvironment = _dereq_(147);
  7860. var HTMLDOMPropertyConfig = _dereq_(21);
  7861. var ReactBrowserComponentMixin = _dereq_(27);
  7862. var ReactComponentBrowserEnvironment = _dereq_(35);
  7863. var ReactDefaultBatchingStrategy = _dereq_(53);
  7864. var ReactDOMComponent = _dereq_(42);
  7865. var ReactDOMTextComponent = _dereq_(51);
  7866. var ReactEventListener = _dereq_(63);
  7867. var ReactInjection = _dereq_(65);
  7868. var ReactInstanceHandles = _dereq_(67);
  7869. var ReactMount = _dereq_(72);
  7870. var ReactReconcileTransaction = _dereq_(83);
  7871. var SelectEventPlugin = _dereq_(99);
  7872. var ServerReactRootIndex = _dereq_(100);
  7873. var SimpleEventPlugin = _dereq_(101);
  7874. var SVGDOMPropertyConfig = _dereq_(98);
  7875. var alreadyInjected = false;
  7876. function inject() {
  7877. if (alreadyInjected) {
  7878. // TODO: This is currently true because these injections are shared between
  7879. // the client and the server package. They should be built independently
  7880. // and not share any injection state. Then this problem will be solved.
  7881. return;
  7882. }
  7883. alreadyInjected = true;
  7884. ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
  7885. /**
  7886. * Inject modules for resolving DOM hierarchy and plugin ordering.
  7887. */
  7888. ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
  7889. ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
  7890. ReactInjection.EventPluginHub.injectMount(ReactMount);
  7891. /**
  7892. * Some important event plugins included by default (without having to require
  7893. * them).
  7894. */
  7895. ReactInjection.EventPluginHub.injectEventPluginsByName({
  7896. SimpleEventPlugin: SimpleEventPlugin,
  7897. EnterLeaveEventPlugin: EnterLeaveEventPlugin,
  7898. ChangeEventPlugin: ChangeEventPlugin,
  7899. SelectEventPlugin: SelectEventPlugin,
  7900. BeforeInputEventPlugin: BeforeInputEventPlugin
  7901. });
  7902. ReactInjection.NativeComponent.injectGenericComponentClass(ReactDOMComponent);
  7903. ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent);
  7904. ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
  7905. ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
  7906. ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
  7907. ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
  7908. ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
  7909. ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
  7910. ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex);
  7911. ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
  7912. if ("production" !== 'production') {
  7913. var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
  7914. if (/[?&]react_perf\b/.test(url)) {
  7915. var ReactDefaultPerf = _dereq_(55);
  7916. ReactDefaultPerf.start();
  7917. }
  7918. }
  7919. }
  7920. module.exports = {
  7921. inject: inject
  7922. };
  7923. },{"100":100,"101":101,"13":13,"14":14,"147":147,"21":21,"27":27,"3":3,"35":35,"42":42,"51":51,"53":53,"55":55,"63":63,"65":65,"67":67,"7":7,"72":72,"8":8,"83":83,"98":98,"99":99}],55:[function(_dereq_,module,exports){
  7924. /**
  7925. * Copyright 2013-2015, Facebook, Inc.
  7926. * All rights reserved.
  7927. *
  7928. * This source code is licensed under the BSD-style license found in the
  7929. * LICENSE file in the root directory of this source tree. An additional grant
  7930. * of patent rights can be found in the PATENTS file in the same directory.
  7931. *
  7932. * @providesModule ReactDefaultPerf
  7933. * @typechecks static-only
  7934. */
  7935. 'use strict';
  7936. var DOMProperty = _dereq_(10);
  7937. var ReactDefaultPerfAnalysis = _dereq_(56);
  7938. var ReactMount = _dereq_(72);
  7939. var ReactPerf = _dereq_(78);
  7940. var performanceNow = _dereq_(170);
  7941. function roundFloat(val) {
  7942. return Math.floor(val * 100) / 100;
  7943. }
  7944. function addValue(obj, key, val) {
  7945. obj[key] = (obj[key] || 0) + val;
  7946. }
  7947. var ReactDefaultPerf = {
  7948. _allMeasurements: [], // last item in the list is the current one
  7949. _mountStack: [0],
  7950. _injected: false,
  7951. start: function () {
  7952. if (!ReactDefaultPerf._injected) {
  7953. ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
  7954. }
  7955. ReactDefaultPerf._allMeasurements.length = 0;
  7956. ReactPerf.enableMeasure = true;
  7957. },
  7958. stop: function () {
  7959. ReactPerf.enableMeasure = false;
  7960. },
  7961. getLastMeasurements: function () {
  7962. return ReactDefaultPerf._allMeasurements;
  7963. },
  7964. printExclusive: function (measurements) {
  7965. measurements = measurements || ReactDefaultPerf._allMeasurements;
  7966. var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
  7967. console.table(summary.map(function (item) {
  7968. return {
  7969. 'Component class name': item.componentName,
  7970. 'Total inclusive time (ms)': roundFloat(item.inclusive),
  7971. 'Exclusive mount time (ms)': roundFloat(item.exclusive),
  7972. 'Exclusive render time (ms)': roundFloat(item.render),
  7973. 'Mount time per instance (ms)': roundFloat(item.exclusive / item.count),
  7974. 'Render time per instance (ms)': roundFloat(item.render / item.count),
  7975. 'Instances': item.count
  7976. };
  7977. }));
  7978. // TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct
  7979. // number.
  7980. },
  7981. printInclusive: function (measurements) {
  7982. measurements = measurements || ReactDefaultPerf._allMeasurements;
  7983. var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
  7984. console.table(summary.map(function (item) {
  7985. return {
  7986. 'Owner > component': item.componentName,
  7987. 'Inclusive time (ms)': roundFloat(item.time),
  7988. 'Instances': item.count
  7989. };
  7990. }));
  7991. console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
  7992. },
  7993. getMeasurementsSummaryMap: function (measurements) {
  7994. var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true);
  7995. return summary.map(function (item) {
  7996. return {
  7997. 'Owner > component': item.componentName,
  7998. 'Wasted time (ms)': item.time,
  7999. 'Instances': item.count
  8000. };
  8001. });
  8002. },
  8003. printWasted: function (measurements) {
  8004. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8005. console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
  8006. console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
  8007. },
  8008. printDOM: function (measurements) {
  8009. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8010. var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
  8011. console.table(summary.map(function (item) {
  8012. var result = {};
  8013. result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
  8014. result.type = item.type;
  8015. result.args = JSON.stringify(item.args);
  8016. return result;
  8017. }));
  8018. console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
  8019. },
  8020. _recordWrite: function (id, fnName, totalTime, args) {
  8021. // TODO: totalTime isn't that useful since it doesn't count paints/reflows
  8022. var writes = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].writes;
  8023. writes[id] = writes[id] || [];
  8024. writes[id].push({
  8025. type: fnName,
  8026. time: totalTime,
  8027. args: args
  8028. });
  8029. },
  8030. measure: function (moduleName, fnName, func) {
  8031. return function () {
  8032. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  8033. args[_key] = arguments[_key];
  8034. }
  8035. var totalTime;
  8036. var rv;
  8037. var start;
  8038. if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') {
  8039. // A "measurement" is a set of metrics recorded for each flush. We want
  8040. // to group the metrics for a given flush together so we can look at the
  8041. // components that rendered and the DOM operations that actually
  8042. // happened to determine the amount of "wasted work" performed.
  8043. ReactDefaultPerf._allMeasurements.push({
  8044. exclusive: {},
  8045. inclusive: {},
  8046. render: {},
  8047. counts: {},
  8048. writes: {},
  8049. displayNames: {},
  8050. totalTime: 0,
  8051. created: {}
  8052. });
  8053. start = performanceNow();
  8054. rv = func.apply(this, args);
  8055. ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start;
  8056. return rv;
  8057. } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') {
  8058. start = performanceNow();
  8059. rv = func.apply(this, args);
  8060. totalTime = performanceNow() - start;
  8061. if (fnName === '_mountImageIntoNode') {
  8062. var mountID = ReactMount.getID(args[1]);
  8063. ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
  8064. } else if (fnName === 'dangerouslyProcessChildrenUpdates') {
  8065. // special format
  8066. args[0].forEach(function (update) {
  8067. var writeArgs = {};
  8068. if (update.fromIndex !== null) {
  8069. writeArgs.fromIndex = update.fromIndex;
  8070. }
  8071. if (update.toIndex !== null) {
  8072. writeArgs.toIndex = update.toIndex;
  8073. }
  8074. if (update.textContent !== null) {
  8075. writeArgs.textContent = update.textContent;
  8076. }
  8077. if (update.markupIndex !== null) {
  8078. writeArgs.markup = args[1][update.markupIndex];
  8079. }
  8080. ReactDefaultPerf._recordWrite(update.parentID, update.type, totalTime, writeArgs);
  8081. });
  8082. } else {
  8083. // basic format
  8084. var id = args[0];
  8085. if (typeof id === 'object') {
  8086. id = ReactMount.getID(args[0]);
  8087. }
  8088. ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1));
  8089. }
  8090. return rv;
  8091. } else if (moduleName === 'ReactCompositeComponent' && (fnName === 'mountComponent' || fnName === 'updateComponent' || // TODO: receiveComponent()?
  8092. fnName === '_renderValidatedComponent')) {
  8093. if (this._currentElement.type === ReactMount.TopLevelWrapper) {
  8094. return func.apply(this, args);
  8095. }
  8096. var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID;
  8097. var isRender = fnName === '_renderValidatedComponent';
  8098. var isMount = fnName === 'mountComponent';
  8099. var mountStack = ReactDefaultPerf._mountStack;
  8100. var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
  8101. if (isRender) {
  8102. addValue(entry.counts, rootNodeID, 1);
  8103. } else if (isMount) {
  8104. entry.created[rootNodeID] = true;
  8105. mountStack.push(0);
  8106. }
  8107. start = performanceNow();
  8108. rv = func.apply(this, args);
  8109. totalTime = performanceNow() - start;
  8110. if (isRender) {
  8111. addValue(entry.render, rootNodeID, totalTime);
  8112. } else if (isMount) {
  8113. var subMountTime = mountStack.pop();
  8114. mountStack[mountStack.length - 1] += totalTime;
  8115. addValue(entry.exclusive, rootNodeID, totalTime - subMountTime);
  8116. addValue(entry.inclusive, rootNodeID, totalTime);
  8117. } else {
  8118. addValue(entry.inclusive, rootNodeID, totalTime);
  8119. }
  8120. entry.displayNames[rootNodeID] = {
  8121. current: this.getName(),
  8122. owner: this._currentElement._owner ? this._currentElement._owner.getName() : '<root>'
  8123. };
  8124. return rv;
  8125. } else {
  8126. return func.apply(this, args);
  8127. }
  8128. };
  8129. }
  8130. };
  8131. module.exports = ReactDefaultPerf;
  8132. },{"10":10,"170":170,"56":56,"72":72,"78":78}],56:[function(_dereq_,module,exports){
  8133. /**
  8134. * Copyright 2013-2015, Facebook, Inc.
  8135. * All rights reserved.
  8136. *
  8137. * This source code is licensed under the BSD-style license found in the
  8138. * LICENSE file in the root directory of this source tree. An additional grant
  8139. * of patent rights can be found in the PATENTS file in the same directory.
  8140. *
  8141. * @providesModule ReactDefaultPerfAnalysis
  8142. */
  8143. 'use strict';
  8144. var assign = _dereq_(24);
  8145. // Don't try to save users less than 1.2ms (a number I made up)
  8146. var DONT_CARE_THRESHOLD = 1.2;
  8147. var DOM_OPERATION_TYPES = {
  8148. '_mountImageIntoNode': 'set innerHTML',
  8149. INSERT_MARKUP: 'set innerHTML',
  8150. MOVE_EXISTING: 'move',
  8151. REMOVE_NODE: 'remove',
  8152. SET_MARKUP: 'set innerHTML',
  8153. TEXT_CONTENT: 'set textContent',
  8154. 'setValueForProperty': 'update attribute',
  8155. 'setValueForAttribute': 'update attribute',
  8156. 'deleteValueForProperty': 'remove attribute',
  8157. 'setValueForStyles': 'update styles',
  8158. 'replaceNodeWithMarkup': 'replace',
  8159. 'updateTextContent': 'set textContent'
  8160. };
  8161. function getTotalTime(measurements) {
  8162. // TODO: return number of DOM ops? could be misleading.
  8163. // TODO: measure dropped frames after reconcile?
  8164. // TODO: log total time of each reconcile and the top-level component
  8165. // class that triggered it.
  8166. var totalTime = 0;
  8167. for (var i = 0; i < measurements.length; i++) {
  8168. var measurement = measurements[i];
  8169. totalTime += measurement.totalTime;
  8170. }
  8171. return totalTime;
  8172. }
  8173. function getDOMSummary(measurements) {
  8174. var items = [];
  8175. measurements.forEach(function (measurement) {
  8176. Object.keys(measurement.writes).forEach(function (id) {
  8177. measurement.writes[id].forEach(function (write) {
  8178. items.push({
  8179. id: id,
  8180. type: DOM_OPERATION_TYPES[write.type] || write.type,
  8181. args: write.args
  8182. });
  8183. });
  8184. });
  8185. });
  8186. return items;
  8187. }
  8188. function getExclusiveSummary(measurements) {
  8189. var candidates = {};
  8190. var displayName;
  8191. for (var i = 0; i < measurements.length; i++) {
  8192. var measurement = measurements[i];
  8193. var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
  8194. for (var id in allIDs) {
  8195. displayName = measurement.displayNames[id].current;
  8196. candidates[displayName] = candidates[displayName] || {
  8197. componentName: displayName,
  8198. inclusive: 0,
  8199. exclusive: 0,
  8200. render: 0,
  8201. count: 0
  8202. };
  8203. if (measurement.render[id]) {
  8204. candidates[displayName].render += measurement.render[id];
  8205. }
  8206. if (measurement.exclusive[id]) {
  8207. candidates[displayName].exclusive += measurement.exclusive[id];
  8208. }
  8209. if (measurement.inclusive[id]) {
  8210. candidates[displayName].inclusive += measurement.inclusive[id];
  8211. }
  8212. if (measurement.counts[id]) {
  8213. candidates[displayName].count += measurement.counts[id];
  8214. }
  8215. }
  8216. }
  8217. // Now make a sorted array with the results.
  8218. var arr = [];
  8219. for (displayName in candidates) {
  8220. if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {
  8221. arr.push(candidates[displayName]);
  8222. }
  8223. }
  8224. arr.sort(function (a, b) {
  8225. return b.exclusive - a.exclusive;
  8226. });
  8227. return arr;
  8228. }
  8229. function getInclusiveSummary(measurements, onlyClean) {
  8230. var candidates = {};
  8231. var inclusiveKey;
  8232. for (var i = 0; i < measurements.length; i++) {
  8233. var measurement = measurements[i];
  8234. var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
  8235. var cleanComponents;
  8236. if (onlyClean) {
  8237. cleanComponents = getUnchangedComponents(measurement);
  8238. }
  8239. for (var id in allIDs) {
  8240. if (onlyClean && !cleanComponents[id]) {
  8241. continue;
  8242. }
  8243. var displayName = measurement.displayNames[id];
  8244. // Inclusive time is not useful for many components without knowing where
  8245. // they are instantiated. So we aggregate inclusive time with both the
  8246. // owner and current displayName as the key.
  8247. inclusiveKey = displayName.owner + ' > ' + displayName.current;
  8248. candidates[inclusiveKey] = candidates[inclusiveKey] || {
  8249. componentName: inclusiveKey,
  8250. time: 0,
  8251. count: 0
  8252. };
  8253. if (measurement.inclusive[id]) {
  8254. candidates[inclusiveKey].time += measurement.inclusive[id];
  8255. }
  8256. if (measurement.counts[id]) {
  8257. candidates[inclusiveKey].count += measurement.counts[id];
  8258. }
  8259. }
  8260. }
  8261. // Now make a sorted array with the results.
  8262. var arr = [];
  8263. for (inclusiveKey in candidates) {
  8264. if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {
  8265. arr.push(candidates[inclusiveKey]);
  8266. }
  8267. }
  8268. arr.sort(function (a, b) {
  8269. return b.time - a.time;
  8270. });
  8271. return arr;
  8272. }
  8273. function getUnchangedComponents(measurement) {
  8274. // For a given reconcile, look at which components did not actually
  8275. // render anything to the DOM and return a mapping of their ID to
  8276. // the amount of time it took to render the entire subtree.
  8277. var cleanComponents = {};
  8278. var dirtyLeafIDs = Object.keys(measurement.writes);
  8279. var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
  8280. for (var id in allIDs) {
  8281. var isDirty = false;
  8282. // For each component that rendered, see if a component that triggered
  8283. // a DOM op is in its subtree.
  8284. for (var i = 0; i < dirtyLeafIDs.length; i++) {
  8285. if (dirtyLeafIDs[i].indexOf(id) === 0) {
  8286. isDirty = true;
  8287. break;
  8288. }
  8289. }
  8290. // check if component newly created
  8291. if (measurement.created[id]) {
  8292. isDirty = true;
  8293. }
  8294. if (!isDirty && measurement.counts[id] > 0) {
  8295. cleanComponents[id] = true;
  8296. }
  8297. }
  8298. return cleanComponents;
  8299. }
  8300. var ReactDefaultPerfAnalysis = {
  8301. getExclusiveSummary: getExclusiveSummary,
  8302. getInclusiveSummary: getInclusiveSummary,
  8303. getDOMSummary: getDOMSummary,
  8304. getTotalTime: getTotalTime
  8305. };
  8306. module.exports = ReactDefaultPerfAnalysis;
  8307. },{"24":24}],57:[function(_dereq_,module,exports){
  8308. /**
  8309. * Copyright 2014-2015, Facebook, Inc.
  8310. * All rights reserved.
  8311. *
  8312. * This source code is licensed under the BSD-style license found in the
  8313. * LICENSE file in the root directory of this source tree. An additional grant
  8314. * of patent rights can be found in the PATENTS file in the same directory.
  8315. *
  8316. * @providesModule ReactElement
  8317. */
  8318. 'use strict';
  8319. var ReactCurrentOwner = _dereq_(39);
  8320. var assign = _dereq_(24);
  8321. var canDefineProperty = _dereq_(117);
  8322. // The Symbol used to tag the ReactElement type. If there is no native Symbol
  8323. // nor polyfill, then a plain number is used for performance.
  8324. var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
  8325. var RESERVED_PROPS = {
  8326. key: true,
  8327. ref: true,
  8328. __self: true,
  8329. __source: true
  8330. };
  8331. /**
  8332. * Base constructor for all React elements. This is only used to make this
  8333. * work with a dynamic instanceof check. Nothing should live on this prototype.
  8334. *
  8335. * @param {*} type
  8336. * @param {*} key
  8337. * @param {string|object} ref
  8338. * @param {*} self A *temporary* helper to detect places where `this` is
  8339. * different from the `owner` when React.createElement is called, so that we
  8340. * can warn. We want to get rid of owner and replace string `ref`s with arrow
  8341. * functions, and as long as `this` and owner are the same, there will be no
  8342. * change in behavior.
  8343. * @param {*} source An annotation object (added by a transpiler or otherwise)
  8344. * indicating filename, line number, and/or other information.
  8345. * @param {*} owner
  8346. * @param {*} props
  8347. * @internal
  8348. */
  8349. var ReactElement = function (type, key, ref, self, source, owner, props) {
  8350. var element = {
  8351. // This tag allow us to uniquely identify this as a React Element
  8352. $$typeof: REACT_ELEMENT_TYPE,
  8353. // Built-in properties that belong on the element
  8354. type: type,
  8355. key: key,
  8356. ref: ref,
  8357. props: props,
  8358. // Record the component responsible for creating this element.
  8359. _owner: owner
  8360. };
  8361. if ("production" !== 'production') {
  8362. // The validation flag is currently mutative. We put it on
  8363. // an external backing store so that we can freeze the whole object.
  8364. // This can be replaced with a WeakMap once they are implemented in
  8365. // commonly used development environments.
  8366. element._store = {};
  8367. // To make comparing ReactElements easier for testing purposes, we make
  8368. // the validation flag non-enumerable (where possible, which should
  8369. // include every environment we run tests in), so the test framework
  8370. // ignores it.
  8371. if (canDefineProperty) {
  8372. Object.defineProperty(element._store, 'validated', {
  8373. configurable: false,
  8374. enumerable: false,
  8375. writable: true,
  8376. value: false
  8377. });
  8378. // self and source are DEV only properties.
  8379. Object.defineProperty(element, '_self', {
  8380. configurable: false,
  8381. enumerable: false,
  8382. writable: false,
  8383. value: self
  8384. });
  8385. // Two elements created in two different places should be considered
  8386. // equal for testing purposes and therefore we hide it from enumeration.
  8387. Object.defineProperty(element, '_source', {
  8388. configurable: false,
  8389. enumerable: false,
  8390. writable: false,
  8391. value: source
  8392. });
  8393. } else {
  8394. element._store.validated = false;
  8395. element._self = self;
  8396. element._source = source;
  8397. }
  8398. Object.freeze(element.props);
  8399. Object.freeze(element);
  8400. }
  8401. return element;
  8402. };
  8403. ReactElement.createElement = function (type, config, children) {
  8404. var propName;
  8405. // Reserved names are extracted
  8406. var props = {};
  8407. var key = null;
  8408. var ref = null;
  8409. var self = null;
  8410. var source = null;
  8411. if (config != null) {
  8412. ref = config.ref === undefined ? null : config.ref;
  8413. key = config.key === undefined ? null : '' + config.key;
  8414. self = config.__self === undefined ? null : config.__self;
  8415. source = config.__source === undefined ? null : config.__source;
  8416. // Remaining properties are added to a new props object
  8417. for (propName in config) {
  8418. if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  8419. props[propName] = config[propName];
  8420. }
  8421. }
  8422. }
  8423. // Children can be more than one argument, and those are transferred onto
  8424. // the newly allocated props object.
  8425. var childrenLength = arguments.length - 2;
  8426. if (childrenLength === 1) {
  8427. props.children = children;
  8428. } else if (childrenLength > 1) {
  8429. var childArray = Array(childrenLength);
  8430. for (var i = 0; i < childrenLength; i++) {
  8431. childArray[i] = arguments[i + 2];
  8432. }
  8433. props.children = childArray;
  8434. }
  8435. // Resolve default props
  8436. if (type && type.defaultProps) {
  8437. var defaultProps = type.defaultProps;
  8438. for (propName in defaultProps) {
  8439. if (typeof props[propName] === 'undefined') {
  8440. props[propName] = defaultProps[propName];
  8441. }
  8442. }
  8443. }
  8444. return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
  8445. };
  8446. ReactElement.createFactory = function (type) {
  8447. var factory = ReactElement.createElement.bind(null, type);
  8448. // Expose the type on the factory and the prototype so that it can be
  8449. // easily accessed on elements. E.g. `<Foo />.type === Foo`.
  8450. // This should not be named `constructor` since this may not be the function
  8451. // that created the element, and it may not even be a constructor.
  8452. // Legacy hook TODO: Warn if this is accessed
  8453. factory.type = type;
  8454. return factory;
  8455. };
  8456. ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
  8457. var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
  8458. return newElement;
  8459. };
  8460. ReactElement.cloneAndReplaceProps = function (oldElement, newProps) {
  8461. var newElement = ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, newProps);
  8462. if ("production" !== 'production') {
  8463. // If the key on the original is valid, then the clone is valid
  8464. newElement._store.validated = oldElement._store.validated;
  8465. }
  8466. return newElement;
  8467. };
  8468. ReactElement.cloneElement = function (element, config, children) {
  8469. var propName;
  8470. // Original props are copied
  8471. var props = assign({}, element.props);
  8472. // Reserved names are extracted
  8473. var key = element.key;
  8474. var ref = element.ref;
  8475. // Self is preserved since the owner is preserved.
  8476. var self = element._self;
  8477. // Source is preserved since cloneElement is unlikely to be targeted by a
  8478. // transpiler, and the original source is probably a better indicator of the
  8479. // true owner.
  8480. var source = element._source;
  8481. // Owner will be preserved, unless ref is overridden
  8482. var owner = element._owner;
  8483. if (config != null) {
  8484. if (config.ref !== undefined) {
  8485. // Silently steal the ref from the parent.
  8486. ref = config.ref;
  8487. owner = ReactCurrentOwner.current;
  8488. }
  8489. if (config.key !== undefined) {
  8490. key = '' + config.key;
  8491. }
  8492. // Remaining properties override existing props
  8493. for (propName in config) {
  8494. if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  8495. props[propName] = config[propName];
  8496. }
  8497. }
  8498. }
  8499. // Children can be more than one argument, and those are transferred onto
  8500. // the newly allocated props object.
  8501. var childrenLength = arguments.length - 2;
  8502. if (childrenLength === 1) {
  8503. props.children = children;
  8504. } else if (childrenLength > 1) {
  8505. var childArray = Array(childrenLength);
  8506. for (var i = 0; i < childrenLength; i++) {
  8507. childArray[i] = arguments[i + 2];
  8508. }
  8509. props.children = childArray;
  8510. }
  8511. return ReactElement(element.type, key, ref, self, source, owner, props);
  8512. };
  8513. /**
  8514. * @param {?object} object
  8515. * @return {boolean} True if `object` is a valid component.
  8516. * @final
  8517. */
  8518. ReactElement.isValidElement = function (object) {
  8519. return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  8520. };
  8521. module.exports = ReactElement;
  8522. },{"117":117,"24":24,"39":39}],58:[function(_dereq_,module,exports){
  8523. /**
  8524. * Copyright 2014-2015, Facebook, Inc.
  8525. * All rights reserved.
  8526. *
  8527. * This source code is licensed under the BSD-style license found in the
  8528. * LICENSE file in the root directory of this source tree. An additional grant
  8529. * of patent rights can be found in the PATENTS file in the same directory.
  8530. *
  8531. * @providesModule ReactElementValidator
  8532. */
  8533. /**
  8534. * ReactElementValidator provides a wrapper around a element factory
  8535. * which validates the props passed to the element. This is intended to be
  8536. * used only in DEV and could be replaced by a static type checker for languages
  8537. * that support it.
  8538. */
  8539. 'use strict';
  8540. var ReactElement = _dereq_(57);
  8541. var ReactPropTypeLocations = _dereq_(81);
  8542. var ReactPropTypeLocationNames = _dereq_(80);
  8543. var ReactCurrentOwner = _dereq_(39);
  8544. var canDefineProperty = _dereq_(117);
  8545. var getIteratorFn = _dereq_(129);
  8546. var invariant = _dereq_(161);
  8547. var warning = _dereq_(173);
  8548. function getDeclarationErrorAddendum() {
  8549. if (ReactCurrentOwner.current) {
  8550. var name = ReactCurrentOwner.current.getName();
  8551. if (name) {
  8552. return ' Check the render method of `' + name + '`.';
  8553. }
  8554. }
  8555. return '';
  8556. }
  8557. /**
  8558. * Warn if there's no key explicitly set on dynamic arrays of children or
  8559. * object keys are not valid. This allows us to keep track of children between
  8560. * updates.
  8561. */
  8562. var ownerHasKeyUseWarning = {};
  8563. var loggedTypeFailures = {};
  8564. /**
  8565. * Warn if the element doesn't have an explicit key assigned to it.
  8566. * This element is in an array. The array could grow and shrink or be
  8567. * reordered. All children that haven't already been validated are required to
  8568. * have a "key" property assigned to it.
  8569. *
  8570. * @internal
  8571. * @param {ReactElement} element Element that requires a key.
  8572. * @param {*} parentType element's parent's type.
  8573. */
  8574. function validateExplicitKey(element, parentType) {
  8575. if (!element._store || element._store.validated || element.key != null) {
  8576. return;
  8577. }
  8578. element._store.validated = true;
  8579. var addenda = getAddendaForKeyUse('uniqueKey', element, parentType);
  8580. if (addenda === null) {
  8581. // we already showed the warning
  8582. return;
  8583. }
  8584. "production" !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined;
  8585. }
  8586. /**
  8587. * Shared warning and monitoring code for the key warnings.
  8588. *
  8589. * @internal
  8590. * @param {string} messageType A key used for de-duping warnings.
  8591. * @param {ReactElement} element Component that requires a key.
  8592. * @param {*} parentType element's parent's type.
  8593. * @returns {?object} A set of addenda to use in the warning message, or null
  8594. * if the warning has already been shown before (and shouldn't be shown again).
  8595. */
  8596. function getAddendaForKeyUse(messageType, element, parentType) {
  8597. var addendum = getDeclarationErrorAddendum();
  8598. if (!addendum) {
  8599. var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
  8600. if (parentName) {
  8601. addendum = ' Check the top-level render call using <' + parentName + '>.';
  8602. }
  8603. }
  8604. var memoizer = ownerHasKeyUseWarning[messageType] || (ownerHasKeyUseWarning[messageType] = {});
  8605. if (memoizer[addendum]) {
  8606. return null;
  8607. }
  8608. memoizer[addendum] = true;
  8609. var addenda = {
  8610. parentOrOwner: addendum,
  8611. url: ' See https://fb.me/react-warning-keys for more information.',
  8612. childOwner: null
  8613. };
  8614. // Usually the current owner is the offender, but if it accepts children as a
  8615. // property, it may be the creator of the child that's responsible for
  8616. // assigning it a key.
  8617. if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
  8618. // Give the component that originally created this child.
  8619. addenda.childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
  8620. }
  8621. return addenda;
  8622. }
  8623. /**
  8624. * Ensure that every element either is passed in a static location, in an
  8625. * array with an explicit keys property defined, or in an object literal
  8626. * with valid key property.
  8627. *
  8628. * @internal
  8629. * @param {ReactNode} node Statically passed child of any type.
  8630. * @param {*} parentType node's parent's type.
  8631. */
  8632. function validateChildKeys(node, parentType) {
  8633. if (typeof node !== 'object') {
  8634. return;
  8635. }
  8636. if (Array.isArray(node)) {
  8637. for (var i = 0; i < node.length; i++) {
  8638. var child = node[i];
  8639. if (ReactElement.isValidElement(child)) {
  8640. validateExplicitKey(child, parentType);
  8641. }
  8642. }
  8643. } else if (ReactElement.isValidElement(node)) {
  8644. // This element was passed in a valid location.
  8645. if (node._store) {
  8646. node._store.validated = true;
  8647. }
  8648. } else if (node) {
  8649. var iteratorFn = getIteratorFn(node);
  8650. // Entry iterators provide implicit keys.
  8651. if (iteratorFn) {
  8652. if (iteratorFn !== node.entries) {
  8653. var iterator = iteratorFn.call(node);
  8654. var step;
  8655. while (!(step = iterator.next()).done) {
  8656. if (ReactElement.isValidElement(step.value)) {
  8657. validateExplicitKey(step.value, parentType);
  8658. }
  8659. }
  8660. }
  8661. }
  8662. }
  8663. }
  8664. /**
  8665. * Assert that the props are valid
  8666. *
  8667. * @param {string} componentName Name of the component for error messages.
  8668. * @param {object} propTypes Map of prop name to a ReactPropType
  8669. * @param {object} props
  8670. * @param {string} location e.g. "prop", "context", "child context"
  8671. * @private
  8672. */
  8673. function checkPropTypes(componentName, propTypes, props, location) {
  8674. for (var propName in propTypes) {
  8675. if (propTypes.hasOwnProperty(propName)) {
  8676. var error;
  8677. // Prop type validation may throw. In case they do, we don't want to
  8678. // fail the render phase where it didn't fail before. So we log it.
  8679. // After these have been cleaned up, we'll let them throw.
  8680. try {
  8681. // This is intentionally an invariant that gets caught. It's the same
  8682. // behavior as without this statement except with a better message.
  8683. !(typeof propTypes[propName] === 'function') ? "production" !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
  8684. error = propTypes[propName](props, propName, componentName, location);
  8685. } catch (ex) {
  8686. error = ex;
  8687. }
  8688. "production" !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : undefined;
  8689. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  8690. // Only monitor this failure once because there tends to be a lot of the
  8691. // same error.
  8692. loggedTypeFailures[error.message] = true;
  8693. var addendum = getDeclarationErrorAddendum();
  8694. "production" !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined;
  8695. }
  8696. }
  8697. }
  8698. }
  8699. /**
  8700. * Given an element, validate that its props follow the propTypes definition,
  8701. * provided by the type.
  8702. *
  8703. * @param {ReactElement} element
  8704. */
  8705. function validatePropTypes(element) {
  8706. var componentClass = element.type;
  8707. if (typeof componentClass !== 'function') {
  8708. return;
  8709. }
  8710. var name = componentClass.displayName || componentClass.name;
  8711. if (componentClass.propTypes) {
  8712. checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop);
  8713. }
  8714. if (typeof componentClass.getDefaultProps === 'function') {
  8715. "production" !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : undefined;
  8716. }
  8717. }
  8718. var ReactElementValidator = {
  8719. createElement: function (type, props, children) {
  8720. var validType = typeof type === 'string' || typeof type === 'function';
  8721. // We warn in this case but don't throw. We expect the element creation to
  8722. // succeed and there will likely be errors in render.
  8723. "production" !== 'production' ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined;
  8724. var element = ReactElement.createElement.apply(this, arguments);
  8725. // The result can be nullish if a mock or a custom function is used.
  8726. // TODO: Drop this when these are no longer allowed as the type argument.
  8727. if (element == null) {
  8728. return element;
  8729. }
  8730. // Skip key warning if the type isn't valid since our key validation logic
  8731. // doesn't expect a non-string/function type and can throw confusing errors.
  8732. // We don't want exception behavior to differ between dev and prod.
  8733. // (Rendering will throw with a helpful message and as soon as the type is
  8734. // fixed, the key warnings will appear.)
  8735. if (validType) {
  8736. for (var i = 2; i < arguments.length; i++) {
  8737. validateChildKeys(arguments[i], type);
  8738. }
  8739. }
  8740. validatePropTypes(element);
  8741. return element;
  8742. },
  8743. createFactory: function (type) {
  8744. var validatedFactory = ReactElementValidator.createElement.bind(null, type);
  8745. // Legacy hook TODO: Warn if this is accessed
  8746. validatedFactory.type = type;
  8747. if ("production" !== 'production') {
  8748. if (canDefineProperty) {
  8749. Object.defineProperty(validatedFactory, 'type', {
  8750. enumerable: false,
  8751. get: function () {
  8752. "production" !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined;
  8753. Object.defineProperty(this, 'type', {
  8754. value: type
  8755. });
  8756. return type;
  8757. }
  8758. });
  8759. }
  8760. }
  8761. return validatedFactory;
  8762. },
  8763. cloneElement: function (element, props, children) {
  8764. var newElement = ReactElement.cloneElement.apply(this, arguments);
  8765. for (var i = 2; i < arguments.length; i++) {
  8766. validateChildKeys(arguments[i], newElement.type);
  8767. }
  8768. validatePropTypes(newElement);
  8769. return newElement;
  8770. }
  8771. };
  8772. module.exports = ReactElementValidator;
  8773. },{"117":117,"129":129,"161":161,"173":173,"39":39,"57":57,"80":80,"81":81}],59:[function(_dereq_,module,exports){
  8774. /**
  8775. * Copyright 2014-2015, Facebook, Inc.
  8776. * All rights reserved.
  8777. *
  8778. * This source code is licensed under the BSD-style license found in the
  8779. * LICENSE file in the root directory of this source tree. An additional grant
  8780. * of patent rights can be found in the PATENTS file in the same directory.
  8781. *
  8782. * @providesModule ReactEmptyComponent
  8783. */
  8784. 'use strict';
  8785. var ReactElement = _dereq_(57);
  8786. var ReactEmptyComponentRegistry = _dereq_(60);
  8787. var ReactReconciler = _dereq_(84);
  8788. var assign = _dereq_(24);
  8789. var placeholderElement;
  8790. var ReactEmptyComponentInjection = {
  8791. injectEmptyComponent: function (component) {
  8792. placeholderElement = ReactElement.createElement(component);
  8793. }
  8794. };
  8795. var ReactEmptyComponent = function (instantiate) {
  8796. this._currentElement = null;
  8797. this._rootNodeID = null;
  8798. this._renderedComponent = instantiate(placeholderElement);
  8799. };
  8800. assign(ReactEmptyComponent.prototype, {
  8801. construct: function (element) {},
  8802. mountComponent: function (rootID, transaction, context) {
  8803. ReactEmptyComponentRegistry.registerNullComponentID(rootID);
  8804. this._rootNodeID = rootID;
  8805. return ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, context);
  8806. },
  8807. receiveComponent: function () {},
  8808. unmountComponent: function (rootID, transaction, context) {
  8809. ReactReconciler.unmountComponent(this._renderedComponent);
  8810. ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID);
  8811. this._rootNodeID = null;
  8812. this._renderedComponent = null;
  8813. }
  8814. });
  8815. ReactEmptyComponent.injection = ReactEmptyComponentInjection;
  8816. module.exports = ReactEmptyComponent;
  8817. },{"24":24,"57":57,"60":60,"84":84}],60:[function(_dereq_,module,exports){
  8818. /**
  8819. * Copyright 2014-2015, Facebook, Inc.
  8820. * All rights reserved.
  8821. *
  8822. * This source code is licensed under the BSD-style license found in the
  8823. * LICENSE file in the root directory of this source tree. An additional grant
  8824. * of patent rights can be found in the PATENTS file in the same directory.
  8825. *
  8826. * @providesModule ReactEmptyComponentRegistry
  8827. */
  8828. 'use strict';
  8829. // This registry keeps track of the React IDs of the components that rendered to
  8830. // `null` (in reality a placeholder such as `noscript`)
  8831. var nullComponentIDsRegistry = {};
  8832. /**
  8833. * @param {string} id Component's `_rootNodeID`.
  8834. * @return {boolean} True if the component is rendered to null.
  8835. */
  8836. function isNullComponentID(id) {
  8837. return !!nullComponentIDsRegistry[id];
  8838. }
  8839. /**
  8840. * Mark the component as having rendered to null.
  8841. * @param {string} id Component's `_rootNodeID`.
  8842. */
  8843. function registerNullComponentID(id) {
  8844. nullComponentIDsRegistry[id] = true;
  8845. }
  8846. /**
  8847. * Unmark the component as having rendered to null: it renders to something now.
  8848. * @param {string} id Component's `_rootNodeID`.
  8849. */
  8850. function deregisterNullComponentID(id) {
  8851. delete nullComponentIDsRegistry[id];
  8852. }
  8853. var ReactEmptyComponentRegistry = {
  8854. isNullComponentID: isNullComponentID,
  8855. registerNullComponentID: registerNullComponentID,
  8856. deregisterNullComponentID: deregisterNullComponentID
  8857. };
  8858. module.exports = ReactEmptyComponentRegistry;
  8859. },{}],61:[function(_dereq_,module,exports){
  8860. /**
  8861. * Copyright 2013-2015, Facebook, Inc.
  8862. * All rights reserved.
  8863. *
  8864. * This source code is licensed under the BSD-style license found in the
  8865. * LICENSE file in the root directory of this source tree. An additional grant
  8866. * of patent rights can be found in the PATENTS file in the same directory.
  8867. *
  8868. * @providesModule ReactErrorUtils
  8869. * @typechecks
  8870. */
  8871. 'use strict';
  8872. var caughtError = null;
  8873. /**
  8874. * Call a function while guarding against errors that happens within it.
  8875. *
  8876. * @param {?String} name of the guard to use for logging or debugging
  8877. * @param {Function} func The function to invoke
  8878. * @param {*} a First argument
  8879. * @param {*} b Second argument
  8880. */
  8881. function invokeGuardedCallback(name, func, a, b) {
  8882. try {
  8883. return func(a, b);
  8884. } catch (x) {
  8885. if (caughtError === null) {
  8886. caughtError = x;
  8887. }
  8888. return undefined;
  8889. }
  8890. }
  8891. var ReactErrorUtils = {
  8892. invokeGuardedCallback: invokeGuardedCallback,
  8893. /**
  8894. * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
  8895. * handler are sure to be rethrown by rethrowCaughtError.
  8896. */
  8897. invokeGuardedCallbackWithCatch: invokeGuardedCallback,
  8898. /**
  8899. * During execution of guarded functions we will capture the first error which
  8900. * we will rethrow to be handled by the top level error handler.
  8901. */
  8902. rethrowCaughtError: function () {
  8903. if (caughtError) {
  8904. var error = caughtError;
  8905. caughtError = null;
  8906. throw error;
  8907. }
  8908. }
  8909. };
  8910. if ("production" !== 'production') {
  8911. /**
  8912. * To help development we can get better devtools integration by simulating a
  8913. * real browser event.
  8914. */
  8915. if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
  8916. var fakeNode = document.createElementNS('http://www.w3.org/1999/xhtml', 'react');
  8917. ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) {
  8918. var boundFunc = func.bind(null, a, b);
  8919. var evtType = 'react-' + name;
  8920. fakeNode.addEventListener(evtType, boundFunc, false);
  8921. var evt = document.createEvent('Event');
  8922. evt.initEvent(evtType, false, false);
  8923. fakeNode.dispatchEvent(evt);
  8924. fakeNode.removeEventListener(evtType, boundFunc, false);
  8925. };
  8926. }
  8927. }
  8928. module.exports = ReactErrorUtils;
  8929. },{}],62:[function(_dereq_,module,exports){
  8930. /**
  8931. * Copyright 2013-2015, Facebook, Inc.
  8932. * All rights reserved.
  8933. *
  8934. * This source code is licensed under the BSD-style license found in the
  8935. * LICENSE file in the root directory of this source tree. An additional grant
  8936. * of patent rights can be found in the PATENTS file in the same directory.
  8937. *
  8938. * @providesModule ReactEventEmitterMixin
  8939. */
  8940. 'use strict';
  8941. var EventPluginHub = _dereq_(16);
  8942. function runEventQueueInBatch(events) {
  8943. EventPluginHub.enqueueEvents(events);
  8944. EventPluginHub.processEventQueue(false);
  8945. }
  8946. var ReactEventEmitterMixin = {
  8947. /**
  8948. * Streams a fired top-level event to `EventPluginHub` where plugins have the
  8949. * opportunity to create `ReactEvent`s to be dispatched.
  8950. *
  8951. * @param {string} topLevelType Record from `EventConstants`.
  8952. * @param {object} topLevelTarget The listening component root node.
  8953. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  8954. * @param {object} nativeEvent Native environment event.
  8955. */
  8956. handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
  8957. var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
  8958. runEventQueueInBatch(events);
  8959. }
  8960. };
  8961. module.exports = ReactEventEmitterMixin;
  8962. },{"16":16}],63:[function(_dereq_,module,exports){
  8963. /**
  8964. * Copyright 2013-2015, Facebook, Inc.
  8965. * All rights reserved.
  8966. *
  8967. * This source code is licensed under the BSD-style license found in the
  8968. * LICENSE file in the root directory of this source tree. An additional grant
  8969. * of patent rights can be found in the PATENTS file in the same directory.
  8970. *
  8971. * @providesModule ReactEventListener
  8972. * @typechecks static-only
  8973. */
  8974. 'use strict';
  8975. var EventListener = _dereq_(146);
  8976. var ExecutionEnvironment = _dereq_(147);
  8977. var PooledClass = _dereq_(25);
  8978. var ReactInstanceHandles = _dereq_(67);
  8979. var ReactMount = _dereq_(72);
  8980. var ReactUpdates = _dereq_(96);
  8981. var assign = _dereq_(24);
  8982. var getEventTarget = _dereq_(128);
  8983. var getUnboundedScrollPosition = _dereq_(158);
  8984. var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
  8985. /**
  8986. * Finds the parent React component of `node`.
  8987. *
  8988. * @param {*} node
  8989. * @return {?DOMEventTarget} Parent container, or `null` if the specified node
  8990. * is not nested.
  8991. */
  8992. function findParent(node) {
  8993. // TODO: It may be a good idea to cache this to prevent unnecessary DOM
  8994. // traversal, but caching is difficult to do correctly without using a
  8995. // mutation observer to listen for all DOM changes.
  8996. var nodeID = ReactMount.getID(node);
  8997. var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
  8998. var container = ReactMount.findReactContainerForID(rootID);
  8999. var parent = ReactMount.getFirstReactDOM(container);
  9000. return parent;
  9001. }
  9002. // Used to store ancestor hierarchy in top level callback
  9003. function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
  9004. this.topLevelType = topLevelType;
  9005. this.nativeEvent = nativeEvent;
  9006. this.ancestors = [];
  9007. }
  9008. assign(TopLevelCallbackBookKeeping.prototype, {
  9009. destructor: function () {
  9010. this.topLevelType = null;
  9011. this.nativeEvent = null;
  9012. this.ancestors.length = 0;
  9013. }
  9014. });
  9015. PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
  9016. function handleTopLevelImpl(bookKeeping) {
  9017. // TODO: Re-enable event.path handling
  9018. //
  9019. // if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) {
  9020. // // New browsers have a path attribute on native events
  9021. // handleTopLevelWithPath(bookKeeping);
  9022. // } else {
  9023. // // Legacy browsers don't have a path attribute on native events
  9024. // handleTopLevelWithoutPath(bookKeeping);
  9025. // }
  9026. void handleTopLevelWithPath; // temporarily unused
  9027. handleTopLevelWithoutPath(bookKeeping);
  9028. }
  9029. // Legacy browsers don't have a path attribute on native events
  9030. function handleTopLevelWithoutPath(bookKeeping) {
  9031. var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window;
  9032. // Loop through the hierarchy, in case there's any nested components.
  9033. // It's important that we build the array of ancestors before calling any
  9034. // event handlers, because event handlers can modify the DOM, leading to
  9035. // inconsistencies with ReactMount's node cache. See #1105.
  9036. var ancestor = topLevelTarget;
  9037. while (ancestor) {
  9038. bookKeeping.ancestors.push(ancestor);
  9039. ancestor = findParent(ancestor);
  9040. }
  9041. for (var i = 0; i < bookKeeping.ancestors.length; i++) {
  9042. topLevelTarget = bookKeeping.ancestors[i];
  9043. var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
  9044. ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
  9045. }
  9046. }
  9047. // New browsers have a path attribute on native events
  9048. function handleTopLevelWithPath(bookKeeping) {
  9049. var path = bookKeeping.nativeEvent.path;
  9050. var currentNativeTarget = path[0];
  9051. var eventsFired = 0;
  9052. for (var i = 0; i < path.length; i++) {
  9053. var currentPathElement = path[i];
  9054. if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
  9055. currentNativeTarget = path[i + 1];
  9056. }
  9057. // TODO: slow
  9058. var reactParent = ReactMount.getFirstReactDOM(currentPathElement);
  9059. if (reactParent === currentPathElement) {
  9060. var currentPathElementID = ReactMount.getID(currentPathElement);
  9061. var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);
  9062. bookKeeping.ancestors.push(currentPathElement);
  9063. var topLevelTargetID = ReactMount.getID(currentPathElement) || '';
  9064. eventsFired++;
  9065. ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget);
  9066. // Jump to the root of this React render tree
  9067. while (currentPathElementID !== newRootID) {
  9068. i++;
  9069. currentPathElement = path[i];
  9070. currentPathElementID = ReactMount.getID(currentPathElement);
  9071. }
  9072. }
  9073. }
  9074. if (eventsFired === 0) {
  9075. ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
  9076. }
  9077. }
  9078. function scrollValueMonitor(cb) {
  9079. var scrollPosition = getUnboundedScrollPosition(window);
  9080. cb(scrollPosition);
  9081. }
  9082. var ReactEventListener = {
  9083. _enabled: true,
  9084. _handleTopLevel: null,
  9085. WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
  9086. setHandleTopLevel: function (handleTopLevel) {
  9087. ReactEventListener._handleTopLevel = handleTopLevel;
  9088. },
  9089. setEnabled: function (enabled) {
  9090. ReactEventListener._enabled = !!enabled;
  9091. },
  9092. isEnabled: function () {
  9093. return ReactEventListener._enabled;
  9094. },
  9095. /**
  9096. * Traps top-level events by using event bubbling.
  9097. *
  9098. * @param {string} topLevelType Record from `EventConstants`.
  9099. * @param {string} handlerBaseName Event name (e.g. "click").
  9100. * @param {object} handle Element on which to attach listener.
  9101. * @return {?object} An object with a remove function which will forcefully
  9102. * remove the listener.
  9103. * @internal
  9104. */
  9105. trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
  9106. var element = handle;
  9107. if (!element) {
  9108. return null;
  9109. }
  9110. return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
  9111. },
  9112. /**
  9113. * Traps a top-level event by using event capturing.
  9114. *
  9115. * @param {string} topLevelType Record from `EventConstants`.
  9116. * @param {string} handlerBaseName Event name (e.g. "click").
  9117. * @param {object} handle Element on which to attach listener.
  9118. * @return {?object} An object with a remove function which will forcefully
  9119. * remove the listener.
  9120. * @internal
  9121. */
  9122. trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
  9123. var element = handle;
  9124. if (!element) {
  9125. return null;
  9126. }
  9127. return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
  9128. },
  9129. monitorScrollValue: function (refresh) {
  9130. var callback = scrollValueMonitor.bind(null, refresh);
  9131. EventListener.listen(window, 'scroll', callback);
  9132. },
  9133. dispatchEvent: function (topLevelType, nativeEvent) {
  9134. if (!ReactEventListener._enabled) {
  9135. return;
  9136. }
  9137. var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
  9138. try {
  9139. // Event queue being processed in the same cycle allows
  9140. // `preventDefault`.
  9141. ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
  9142. } finally {
  9143. TopLevelCallbackBookKeeping.release(bookKeeping);
  9144. }
  9145. }
  9146. };
  9147. module.exports = ReactEventListener;
  9148. },{"128":128,"146":146,"147":147,"158":158,"24":24,"25":25,"67":67,"72":72,"96":96}],64:[function(_dereq_,module,exports){
  9149. /**
  9150. * Copyright 2015, Facebook, Inc.
  9151. * All rights reserved.
  9152. *
  9153. * This source code is licensed under the BSD-style license found in the
  9154. * LICENSE file in the root directory of this source tree. An additional grant
  9155. * of patent rights can be found in the PATENTS file in the same directory.
  9156. *
  9157. * @providesModule ReactFragment
  9158. */
  9159. 'use strict';
  9160. var ReactChildren = _dereq_(32);
  9161. var ReactElement = _dereq_(57);
  9162. var emptyFunction = _dereq_(153);
  9163. var invariant = _dereq_(161);
  9164. var warning = _dereq_(173);
  9165. /**
  9166. * We used to allow keyed objects to serve as a collection of ReactElements,
  9167. * or nested sets. This allowed us a way to explicitly key a set a fragment of
  9168. * components. This is now being replaced with an opaque data structure.
  9169. * The upgrade path is to call React.addons.createFragment({ key: value }) to
  9170. * create a keyed fragment. The resulting data structure is an array.
  9171. */
  9172. var numericPropertyRegex = /^\d+$/;
  9173. var warnedAboutNumeric = false;
  9174. var ReactFragment = {
  9175. // Wrap a keyed object in an opaque proxy that warns you if you access any
  9176. // of its properties.
  9177. create: function (object) {
  9178. if (typeof object !== 'object' || !object || Array.isArray(object)) {
  9179. "production" !== 'production' ? warning(false, 'React.addons.createFragment only accepts a single object. Got: %s', object) : undefined;
  9180. return object;
  9181. }
  9182. if (ReactElement.isValidElement(object)) {
  9183. "production" !== 'production' ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : undefined;
  9184. return object;
  9185. }
  9186. !(object.nodeType !== 1) ? "production" !== 'production' ? invariant(false, 'React.addons.createFragment(...): Encountered an invalid child; DOM ' + 'elements are not valid children of React components.') : invariant(false) : undefined;
  9187. var result = [];
  9188. for (var key in object) {
  9189. if ("production" !== 'production') {
  9190. if (!warnedAboutNumeric && numericPropertyRegex.test(key)) {
  9191. "production" !== 'production' ? warning(false, 'React.addons.createFragment(...): Child objects should have ' + 'non-numeric keys so ordering is preserved.') : undefined;
  9192. warnedAboutNumeric = true;
  9193. }
  9194. }
  9195. ReactChildren.mapIntoWithKeyPrefixInternal(object[key], result, key, emptyFunction.thatReturnsArgument);
  9196. }
  9197. return result;
  9198. }
  9199. };
  9200. module.exports = ReactFragment;
  9201. },{"153":153,"161":161,"173":173,"32":32,"57":57}],65:[function(_dereq_,module,exports){
  9202. /**
  9203. * Copyright 2013-2015, Facebook, Inc.
  9204. * All rights reserved.
  9205. *
  9206. * This source code is licensed under the BSD-style license found in the
  9207. * LICENSE file in the root directory of this source tree. An additional grant
  9208. * of patent rights can be found in the PATENTS file in the same directory.
  9209. *
  9210. * @providesModule ReactInjection
  9211. */
  9212. 'use strict';
  9213. var DOMProperty = _dereq_(10);
  9214. var EventPluginHub = _dereq_(16);
  9215. var ReactComponentEnvironment = _dereq_(36);
  9216. var ReactClass = _dereq_(33);
  9217. var ReactEmptyComponent = _dereq_(59);
  9218. var ReactBrowserEventEmitter = _dereq_(28);
  9219. var ReactNativeComponent = _dereq_(75);
  9220. var ReactPerf = _dereq_(78);
  9221. var ReactRootIndex = _dereq_(86);
  9222. var ReactUpdates = _dereq_(96);
  9223. var ReactInjection = {
  9224. Component: ReactComponentEnvironment.injection,
  9225. Class: ReactClass.injection,
  9226. DOMProperty: DOMProperty.injection,
  9227. EmptyComponent: ReactEmptyComponent.injection,
  9228. EventPluginHub: EventPluginHub.injection,
  9229. EventEmitter: ReactBrowserEventEmitter.injection,
  9230. NativeComponent: ReactNativeComponent.injection,
  9231. Perf: ReactPerf.injection,
  9232. RootIndex: ReactRootIndex.injection,
  9233. Updates: ReactUpdates.injection
  9234. };
  9235. module.exports = ReactInjection;
  9236. },{"10":10,"16":16,"28":28,"33":33,"36":36,"59":59,"75":75,"78":78,"86":86,"96":96}],66:[function(_dereq_,module,exports){
  9237. /**
  9238. * Copyright 2013-2015, Facebook, Inc.
  9239. * All rights reserved.
  9240. *
  9241. * This source code is licensed under the BSD-style license found in the
  9242. * LICENSE file in the root directory of this source tree. An additional grant
  9243. * of patent rights can be found in the PATENTS file in the same directory.
  9244. *
  9245. * @providesModule ReactInputSelection
  9246. */
  9247. 'use strict';
  9248. var ReactDOMSelection = _dereq_(49);
  9249. var containsNode = _dereq_(150);
  9250. var focusNode = _dereq_(155);
  9251. var getActiveElement = _dereq_(156);
  9252. function isInDocument(node) {
  9253. return containsNode(document.documentElement, node);
  9254. }
  9255. /**
  9256. * @ReactInputSelection: React input selection module. Based on Selection.js,
  9257. * but modified to be suitable for react and has a couple of bug fixes (doesn't
  9258. * assume buttons have range selections allowed).
  9259. * Input selection module for React.
  9260. */
  9261. var ReactInputSelection = {
  9262. hasSelectionCapabilities: function (elem) {
  9263. var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
  9264. return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
  9265. },
  9266. getSelectionInformation: function () {
  9267. var focusedElem = getActiveElement();
  9268. return {
  9269. focusedElem: focusedElem,
  9270. selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
  9271. };
  9272. },
  9273. /**
  9274. * @restoreSelection: If any selection information was potentially lost,
  9275. * restore it. This is useful when performing operations that could remove dom
  9276. * nodes and place them back in, resulting in focus being lost.
  9277. */
  9278. restoreSelection: function (priorSelectionInformation) {
  9279. var curFocusedElem = getActiveElement();
  9280. var priorFocusedElem = priorSelectionInformation.focusedElem;
  9281. var priorSelectionRange = priorSelectionInformation.selectionRange;
  9282. if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
  9283. if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
  9284. ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
  9285. }
  9286. focusNode(priorFocusedElem);
  9287. }
  9288. },
  9289. /**
  9290. * @getSelection: Gets the selection bounds of a focused textarea, input or
  9291. * contentEditable node.
  9292. * -@input: Look up selection bounds of this input
  9293. * -@return {start: selectionStart, end: selectionEnd}
  9294. */
  9295. getSelection: function (input) {
  9296. var selection;
  9297. if ('selectionStart' in input) {
  9298. // Modern browser with input or textarea.
  9299. selection = {
  9300. start: input.selectionStart,
  9301. end: input.selectionEnd
  9302. };
  9303. } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
  9304. // IE8 input.
  9305. var range = document.selection.createRange();
  9306. // There can only be one selection per document in IE, so it must
  9307. // be in our element.
  9308. if (range.parentElement() === input) {
  9309. selection = {
  9310. start: -range.moveStart('character', -input.value.length),
  9311. end: -range.moveEnd('character', -input.value.length)
  9312. };
  9313. }
  9314. } else {
  9315. // Content editable or old IE textarea.
  9316. selection = ReactDOMSelection.getOffsets(input);
  9317. }
  9318. return selection || { start: 0, end: 0 };
  9319. },
  9320. /**
  9321. * @setSelection: Sets the selection bounds of a textarea or input and focuses
  9322. * the input.
  9323. * -@input Set selection bounds of this input or textarea
  9324. * -@offsets Object of same form that is returned from get*
  9325. */
  9326. setSelection: function (input, offsets) {
  9327. var start = offsets.start;
  9328. var end = offsets.end;
  9329. if (typeof end === 'undefined') {
  9330. end = start;
  9331. }
  9332. if ('selectionStart' in input) {
  9333. input.selectionStart = start;
  9334. input.selectionEnd = Math.min(end, input.value.length);
  9335. } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
  9336. var range = input.createTextRange();
  9337. range.collapse(true);
  9338. range.moveStart('character', start);
  9339. range.moveEnd('character', end - start);
  9340. range.select();
  9341. } else {
  9342. ReactDOMSelection.setOffsets(input, offsets);
  9343. }
  9344. }
  9345. };
  9346. module.exports = ReactInputSelection;
  9347. },{"150":150,"155":155,"156":156,"49":49}],67:[function(_dereq_,module,exports){
  9348. /**
  9349. * Copyright 2013-2015, Facebook, Inc.
  9350. * All rights reserved.
  9351. *
  9352. * This source code is licensed under the BSD-style license found in the
  9353. * LICENSE file in the root directory of this source tree. An additional grant
  9354. * of patent rights can be found in the PATENTS file in the same directory.
  9355. *
  9356. * @providesModule ReactInstanceHandles
  9357. * @typechecks static-only
  9358. */
  9359. 'use strict';
  9360. var ReactRootIndex = _dereq_(86);
  9361. var invariant = _dereq_(161);
  9362. var SEPARATOR = '.';
  9363. var SEPARATOR_LENGTH = SEPARATOR.length;
  9364. /**
  9365. * Maximum depth of traversals before we consider the possibility of a bad ID.
  9366. */
  9367. var MAX_TREE_DEPTH = 10000;
  9368. /**
  9369. * Creates a DOM ID prefix to use when mounting React components.
  9370. *
  9371. * @param {number} index A unique integer
  9372. * @return {string} React root ID.
  9373. * @internal
  9374. */
  9375. function getReactRootIDString(index) {
  9376. return SEPARATOR + index.toString(36);
  9377. }
  9378. /**
  9379. * Checks if a character in the supplied ID is a separator or the end.
  9380. *
  9381. * @param {string} id A React DOM ID.
  9382. * @param {number} index Index of the character to check.
  9383. * @return {boolean} True if the character is a separator or end of the ID.
  9384. * @private
  9385. */
  9386. function isBoundary(id, index) {
  9387. return id.charAt(index) === SEPARATOR || index === id.length;
  9388. }
  9389. /**
  9390. * Checks if the supplied string is a valid React DOM ID.
  9391. *
  9392. * @param {string} id A React DOM ID, maybe.
  9393. * @return {boolean} True if the string is a valid React DOM ID.
  9394. * @private
  9395. */
  9396. function isValidID(id) {
  9397. return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR;
  9398. }
  9399. /**
  9400. * Checks if the first ID is an ancestor of or equal to the second ID.
  9401. *
  9402. * @param {string} ancestorID
  9403. * @param {string} descendantID
  9404. * @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.
  9405. * @internal
  9406. */
  9407. function isAncestorIDOf(ancestorID, descendantID) {
  9408. return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length);
  9409. }
  9410. /**
  9411. * Gets the parent ID of the supplied React DOM ID, `id`.
  9412. *
  9413. * @param {string} id ID of a component.
  9414. * @return {string} ID of the parent, or an empty string.
  9415. * @private
  9416. */
  9417. function getParentID(id) {
  9418. return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';
  9419. }
  9420. /**
  9421. * Gets the next DOM ID on the tree path from the supplied `ancestorID` to the
  9422. * supplied `destinationID`. If they are equal, the ID is returned.
  9423. *
  9424. * @param {string} ancestorID ID of an ancestor node of `destinationID`.
  9425. * @param {string} destinationID ID of the destination node.
  9426. * @return {string} Next ID on the path from `ancestorID` to `destinationID`.
  9427. * @private
  9428. */
  9429. function getNextDescendantID(ancestorID, destinationID) {
  9430. !(isValidID(ancestorID) && isValidID(destinationID)) ? "production" !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined;
  9431. !isAncestorIDOf(ancestorID, destinationID) ? "production" !== 'production' ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined;
  9432. if (ancestorID === destinationID) {
  9433. return ancestorID;
  9434. }
  9435. // Skip over the ancestor and the immediate separator. Traverse until we hit
  9436. // another separator or we reach the end of `destinationID`.
  9437. var start = ancestorID.length + SEPARATOR_LENGTH;
  9438. var i;
  9439. for (i = start; i < destinationID.length; i++) {
  9440. if (isBoundary(destinationID, i)) {
  9441. break;
  9442. }
  9443. }
  9444. return destinationID.substr(0, i);
  9445. }
  9446. /**
  9447. * Gets the nearest common ancestor ID of two IDs.
  9448. *
  9449. * Using this ID scheme, the nearest common ancestor ID is the longest common
  9450. * prefix of the two IDs that immediately preceded a "marker" in both strings.
  9451. *
  9452. * @param {string} oneID
  9453. * @param {string} twoID
  9454. * @return {string} Nearest common ancestor ID, or the empty string if none.
  9455. * @private
  9456. */
  9457. function getFirstCommonAncestorID(oneID, twoID) {
  9458. var minLength = Math.min(oneID.length, twoID.length);
  9459. if (minLength === 0) {
  9460. return '';
  9461. }
  9462. var lastCommonMarkerIndex = 0;
  9463. // Use `<=` to traverse until the "EOL" of the shorter string.
  9464. for (var i = 0; i <= minLength; i++) {
  9465. if (isBoundary(oneID, i) && isBoundary(twoID, i)) {
  9466. lastCommonMarkerIndex = i;
  9467. } else if (oneID.charAt(i) !== twoID.charAt(i)) {
  9468. break;
  9469. }
  9470. }
  9471. var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
  9472. !isValidID(longestCommonID) ? "production" !== 'production' ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined;
  9473. return longestCommonID;
  9474. }
  9475. /**
  9476. * Traverses the parent path between two IDs (either up or down). The IDs must
  9477. * not be the same, and there must exist a parent path between them. If the
  9478. * callback returns `false`, traversal is stopped.
  9479. *
  9480. * @param {?string} start ID at which to start traversal.
  9481. * @param {?string} stop ID at which to end traversal.
  9482. * @param {function} cb Callback to invoke each ID with.
  9483. * @param {*} arg Argument to invoke the callback with.
  9484. * @param {?boolean} skipFirst Whether or not to skip the first node.
  9485. * @param {?boolean} skipLast Whether or not to skip the last node.
  9486. * @private
  9487. */
  9488. function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
  9489. start = start || '';
  9490. stop = stop || '';
  9491. !(start !== stop) ? "production" !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined;
  9492. var traverseUp = isAncestorIDOf(stop, start);
  9493. !(traverseUp || isAncestorIDOf(start, stop)) ? "production" !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined;
  9494. // Traverse from `start` to `stop` one depth at a time.
  9495. var depth = 0;
  9496. var traverse = traverseUp ? getParentID : getNextDescendantID;
  9497. for (var id = start;; /* until break */id = traverse(id, stop)) {
  9498. var ret;
  9499. if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
  9500. ret = cb(id, traverseUp, arg);
  9501. }
  9502. if (ret === false || id === stop) {
  9503. // Only break //after// visiting `stop`.
  9504. break;
  9505. }
  9506. !(depth++ < MAX_TREE_DEPTH) ? "production" !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : invariant(false) : undefined;
  9507. }
  9508. }
  9509. /**
  9510. * Manages the IDs assigned to DOM representations of React components. This
  9511. * uses a specific scheme in order to traverse the DOM efficiently (e.g. in
  9512. * order to simulate events).
  9513. *
  9514. * @internal
  9515. */
  9516. var ReactInstanceHandles = {
  9517. /**
  9518. * Constructs a React root ID
  9519. * @return {string} A React root ID.
  9520. */
  9521. createReactRootID: function () {
  9522. return getReactRootIDString(ReactRootIndex.createReactRootIndex());
  9523. },
  9524. /**
  9525. * Constructs a React ID by joining a root ID with a name.
  9526. *
  9527. * @param {string} rootID Root ID of a parent component.
  9528. * @param {string} name A component's name (as flattened children).
  9529. * @return {string} A React ID.
  9530. * @internal
  9531. */
  9532. createReactID: function (rootID, name) {
  9533. return rootID + name;
  9534. },
  9535. /**
  9536. * Gets the DOM ID of the React component that is the root of the tree that
  9537. * contains the React component with the supplied DOM ID.
  9538. *
  9539. * @param {string} id DOM ID of a React component.
  9540. * @return {?string} DOM ID of the React component that is the root.
  9541. * @internal
  9542. */
  9543. getReactRootIDFromNodeID: function (id) {
  9544. if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
  9545. var index = id.indexOf(SEPARATOR, 1);
  9546. return index > -1 ? id.substr(0, index) : id;
  9547. }
  9548. return null;
  9549. },
  9550. /**
  9551. * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
  9552. * should would receive a `mouseEnter` or `mouseLeave` event.
  9553. *
  9554. * NOTE: Does not invoke the callback on the nearest common ancestor because
  9555. * nothing "entered" or "left" that element.
  9556. *
  9557. * @param {string} leaveID ID being left.
  9558. * @param {string} enterID ID being entered.
  9559. * @param {function} cb Callback to invoke on each entered/left ID.
  9560. * @param {*} upArg Argument to invoke the callback with on left IDs.
  9561. * @param {*} downArg Argument to invoke the callback with on entered IDs.
  9562. * @internal
  9563. */
  9564. traverseEnterLeave: function (leaveID, enterID, cb, upArg, downArg) {
  9565. var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
  9566. if (ancestorID !== leaveID) {
  9567. traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
  9568. }
  9569. if (ancestorID !== enterID) {
  9570. traverseParentPath(ancestorID, enterID, cb, downArg, true, false);
  9571. }
  9572. },
  9573. /**
  9574. * Simulates the traversal of a two-phase, capture/bubble event dispatch.
  9575. *
  9576. * NOTE: This traversal happens on IDs without touching the DOM.
  9577. *
  9578. * @param {string} targetID ID of the target node.
  9579. * @param {function} cb Callback to invoke.
  9580. * @param {*} arg Argument to invoke the callback with.
  9581. * @internal
  9582. */
  9583. traverseTwoPhase: function (targetID, cb, arg) {
  9584. if (targetID) {
  9585. traverseParentPath('', targetID, cb, arg, true, false);
  9586. traverseParentPath(targetID, '', cb, arg, false, true);
  9587. }
  9588. },
  9589. /**
  9590. * Same as `traverseTwoPhase` but skips the `targetID`.
  9591. */
  9592. traverseTwoPhaseSkipTarget: function (targetID, cb, arg) {
  9593. if (targetID) {
  9594. traverseParentPath('', targetID, cb, arg, true, true);
  9595. traverseParentPath(targetID, '', cb, arg, true, true);
  9596. }
  9597. },
  9598. /**
  9599. * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
  9600. * example, passing `.0.$row-0.1` would result in `cb` getting called
  9601. * with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
  9602. *
  9603. * NOTE: This traversal happens on IDs without touching the DOM.
  9604. *
  9605. * @param {string} targetID ID of the target node.
  9606. * @param {function} cb Callback to invoke.
  9607. * @param {*} arg Argument to invoke the callback with.
  9608. * @internal
  9609. */
  9610. traverseAncestors: function (targetID, cb, arg) {
  9611. traverseParentPath('', targetID, cb, arg, true, false);
  9612. },
  9613. getFirstCommonAncestorID: getFirstCommonAncestorID,
  9614. /**
  9615. * Exposed for unit testing.
  9616. * @private
  9617. */
  9618. _getNextDescendantID: getNextDescendantID,
  9619. isAncestorIDOf: isAncestorIDOf,
  9620. SEPARATOR: SEPARATOR
  9621. };
  9622. module.exports = ReactInstanceHandles;
  9623. },{"161":161,"86":86}],68:[function(_dereq_,module,exports){
  9624. /**
  9625. * Copyright 2013-2015, Facebook, Inc.
  9626. * All rights reserved.
  9627. *
  9628. * This source code is licensed under the BSD-style license found in the
  9629. * LICENSE file in the root directory of this source tree. An additional grant
  9630. * of patent rights can be found in the PATENTS file in the same directory.
  9631. *
  9632. * @providesModule ReactInstanceMap
  9633. */
  9634. 'use strict';
  9635. /**
  9636. * `ReactInstanceMap` maintains a mapping from a public facing stateful
  9637. * instance (key) and the internal representation (value). This allows public
  9638. * methods to accept the user facing instance as an argument and map them back
  9639. * to internal methods.
  9640. */
  9641. // TODO: Replace this with ES6: var ReactInstanceMap = new Map();
  9642. var ReactInstanceMap = {
  9643. /**
  9644. * This API should be called `delete` but we'd have to make sure to always
  9645. * transform these to strings for IE support. When this transform is fully
  9646. * supported we can rename it.
  9647. */
  9648. remove: function (key) {
  9649. key._reactInternalInstance = undefined;
  9650. },
  9651. get: function (key) {
  9652. return key._reactInternalInstance;
  9653. },
  9654. has: function (key) {
  9655. return key._reactInternalInstance !== undefined;
  9656. },
  9657. set: function (key, value) {
  9658. key._reactInternalInstance = value;
  9659. }
  9660. };
  9661. module.exports = ReactInstanceMap;
  9662. },{}],69:[function(_dereq_,module,exports){
  9663. /**
  9664. * Copyright 2013-2015, Facebook, Inc.
  9665. * All rights reserved.
  9666. *
  9667. * This source code is licensed under the BSD-style license found in the
  9668. * LICENSE file in the root directory of this source tree. An additional grant
  9669. * of patent rights can be found in the PATENTS file in the same directory.
  9670. *
  9671. * @providesModule ReactIsomorphic
  9672. */
  9673. 'use strict';
  9674. var ReactChildren = _dereq_(32);
  9675. var ReactComponent = _dereq_(34);
  9676. var ReactClass = _dereq_(33);
  9677. var ReactDOMFactories = _dereq_(43);
  9678. var ReactElement = _dereq_(57);
  9679. var ReactElementValidator = _dereq_(58);
  9680. var ReactPropTypes = _dereq_(82);
  9681. var ReactVersion = _dereq_(97);
  9682. var assign = _dereq_(24);
  9683. var onlyChild = _dereq_(135);
  9684. var createElement = ReactElement.createElement;
  9685. var createFactory = ReactElement.createFactory;
  9686. var cloneElement = ReactElement.cloneElement;
  9687. if ("production" !== 'production') {
  9688. createElement = ReactElementValidator.createElement;
  9689. createFactory = ReactElementValidator.createFactory;
  9690. cloneElement = ReactElementValidator.cloneElement;
  9691. }
  9692. var React = {
  9693. // Modern
  9694. Children: {
  9695. map: ReactChildren.map,
  9696. forEach: ReactChildren.forEach,
  9697. count: ReactChildren.count,
  9698. toArray: ReactChildren.toArray,
  9699. only: onlyChild
  9700. },
  9701. Component: ReactComponent,
  9702. createElement: createElement,
  9703. cloneElement: cloneElement,
  9704. isValidElement: ReactElement.isValidElement,
  9705. // Classic
  9706. PropTypes: ReactPropTypes,
  9707. createClass: ReactClass.createClass,
  9708. createFactory: createFactory,
  9709. createMixin: function (mixin) {
  9710. // Currently a noop. Will be used to validate and trace mixins.
  9711. return mixin;
  9712. },
  9713. // This looks DOM specific but these are actually isomorphic helpers
  9714. // since they are just generating DOM strings.
  9715. DOM: ReactDOMFactories,
  9716. version: ReactVersion,
  9717. // Hook for JSX spread, don't use this for anything else.
  9718. __spread: assign
  9719. };
  9720. module.exports = React;
  9721. },{"135":135,"24":24,"32":32,"33":33,"34":34,"43":43,"57":57,"58":58,"82":82,"97":97}],70:[function(_dereq_,module,exports){
  9722. /**
  9723. * Copyright 2013-2015, Facebook, Inc.
  9724. * All rights reserved.
  9725. *
  9726. * This source code is licensed under the BSD-style license found in the
  9727. * LICENSE file in the root directory of this source tree. An additional grant
  9728. * of patent rights can be found in the PATENTS file in the same directory.
  9729. *
  9730. * @providesModule ReactLink
  9731. * @typechecks static-only
  9732. */
  9733. 'use strict';
  9734. /**
  9735. * ReactLink encapsulates a common pattern in which a component wants to modify
  9736. * a prop received from its parent. ReactLink allows the parent to pass down a
  9737. * value coupled with a callback that, when invoked, expresses an intent to
  9738. * modify that value. For example:
  9739. *
  9740. * React.createClass({
  9741. * getInitialState: function() {
  9742. * return {value: ''};
  9743. * },
  9744. * render: function() {
  9745. * var valueLink = new ReactLink(this.state.value, this._handleValueChange);
  9746. * return <input valueLink={valueLink} />;
  9747. * },
  9748. * _handleValueChange: function(newValue) {
  9749. * this.setState({value: newValue});
  9750. * }
  9751. * });
  9752. *
  9753. * We have provided some sugary mixins to make the creation and
  9754. * consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
  9755. */
  9756. var React = _dereq_(26);
  9757. /**
  9758. * @param {*} value current value of the link
  9759. * @param {function} requestChange callback to request a change
  9760. */
  9761. function ReactLink(value, requestChange) {
  9762. this.value = value;
  9763. this.requestChange = requestChange;
  9764. }
  9765. /**
  9766. * Creates a PropType that enforces the ReactLink API and optionally checks the
  9767. * type of the value being passed inside the link. Example:
  9768. *
  9769. * MyComponent.propTypes = {
  9770. * tabIndexLink: ReactLink.PropTypes.link(React.PropTypes.number)
  9771. * }
  9772. */
  9773. function createLinkTypeChecker(linkType) {
  9774. var shapes = {
  9775. value: typeof linkType === 'undefined' ? React.PropTypes.any.isRequired : linkType.isRequired,
  9776. requestChange: React.PropTypes.func.isRequired
  9777. };
  9778. return React.PropTypes.shape(shapes);
  9779. }
  9780. ReactLink.PropTypes = {
  9781. link: createLinkTypeChecker
  9782. };
  9783. module.exports = ReactLink;
  9784. },{"26":26}],71:[function(_dereq_,module,exports){
  9785. /**
  9786. * Copyright 2013-2015, Facebook, Inc.
  9787. * All rights reserved.
  9788. *
  9789. * This source code is licensed under the BSD-style license found in the
  9790. * LICENSE file in the root directory of this source tree. An additional grant
  9791. * of patent rights can be found in the PATENTS file in the same directory.
  9792. *
  9793. * @providesModule ReactMarkupChecksum
  9794. */
  9795. 'use strict';
  9796. var adler32 = _dereq_(116);
  9797. var TAG_END = /\/?>/;
  9798. var ReactMarkupChecksum = {
  9799. CHECKSUM_ATTR_NAME: 'data-react-checksum',
  9800. /**
  9801. * @param {string} markup Markup string
  9802. * @return {string} Markup string with checksum attribute attached
  9803. */
  9804. addChecksumToMarkup: function (markup) {
  9805. var checksum = adler32(markup);
  9806. // Add checksum (handle both parent tags and self-closing tags)
  9807. return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
  9808. },
  9809. /**
  9810. * @param {string} markup to use
  9811. * @param {DOMElement} element root React element
  9812. * @returns {boolean} whether or not the markup is the same
  9813. */
  9814. canReuseMarkup: function (markup, element) {
  9815. var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  9816. existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
  9817. var markupChecksum = adler32(markup);
  9818. return markupChecksum === existingChecksum;
  9819. }
  9820. };
  9821. module.exports = ReactMarkupChecksum;
  9822. },{"116":116}],72:[function(_dereq_,module,exports){
  9823. /**
  9824. * Copyright 2013-2015, Facebook, Inc.
  9825. * All rights reserved.
  9826. *
  9827. * This source code is licensed under the BSD-style license found in the
  9828. * LICENSE file in the root directory of this source tree. An additional grant
  9829. * of patent rights can be found in the PATENTS file in the same directory.
  9830. *
  9831. * @providesModule ReactMount
  9832. */
  9833. 'use strict';
  9834. var DOMProperty = _dereq_(10);
  9835. var ReactBrowserEventEmitter = _dereq_(28);
  9836. var ReactCurrentOwner = _dereq_(39);
  9837. var ReactDOMFeatureFlags = _dereq_(44);
  9838. var ReactElement = _dereq_(57);
  9839. var ReactEmptyComponentRegistry = _dereq_(60);
  9840. var ReactInstanceHandles = _dereq_(67);
  9841. var ReactInstanceMap = _dereq_(68);
  9842. var ReactMarkupChecksum = _dereq_(71);
  9843. var ReactPerf = _dereq_(78);
  9844. var ReactReconciler = _dereq_(84);
  9845. var ReactUpdateQueue = _dereq_(95);
  9846. var ReactUpdates = _dereq_(96);
  9847. var assign = _dereq_(24);
  9848. var emptyObject = _dereq_(154);
  9849. var containsNode = _dereq_(150);
  9850. var instantiateReactComponent = _dereq_(132);
  9851. var invariant = _dereq_(161);
  9852. var setInnerHTML = _dereq_(138);
  9853. var shouldUpdateReactComponent = _dereq_(141);
  9854. var validateDOMNesting = _dereq_(144);
  9855. var warning = _dereq_(173);
  9856. var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
  9857. var nodeCache = {};
  9858. var ELEMENT_NODE_TYPE = 1;
  9859. var DOC_NODE_TYPE = 9;
  9860. var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
  9861. var ownerDocumentContextKey = '__ReactMount_ownerDocument$' + Math.random().toString(36).slice(2);
  9862. /** Mapping from reactRootID to React component instance. */
  9863. var instancesByReactRootID = {};
  9864. /** Mapping from reactRootID to `container` nodes. */
  9865. var containersByReactRootID = {};
  9866. if ("production" !== 'production') {
  9867. /** __DEV__-only mapping from reactRootID to root elements. */
  9868. var rootElementsByReactRootID = {};
  9869. }
  9870. // Used to store breadth-first search state in findComponentRoot.
  9871. var findComponentRootReusableArray = [];
  9872. /**
  9873. * Finds the index of the first character
  9874. * that's not common between the two given strings.
  9875. *
  9876. * @return {number} the index of the character where the strings diverge
  9877. */
  9878. function firstDifferenceIndex(string1, string2) {
  9879. var minLen = Math.min(string1.length, string2.length);
  9880. for (var i = 0; i < minLen; i++) {
  9881. if (string1.charAt(i) !== string2.charAt(i)) {
  9882. return i;
  9883. }
  9884. }
  9885. return string1.length === string2.length ? -1 : minLen;
  9886. }
  9887. /**
  9888. * @param {DOMElement|DOMDocument} container DOM element that may contain
  9889. * a React component
  9890. * @return {?*} DOM element that may have the reactRoot ID, or null.
  9891. */
  9892. function getReactRootElementInContainer(container) {
  9893. if (!container) {
  9894. return null;
  9895. }
  9896. if (container.nodeType === DOC_NODE_TYPE) {
  9897. return container.documentElement;
  9898. } else {
  9899. return container.firstChild;
  9900. }
  9901. }
  9902. /**
  9903. * @param {DOMElement} container DOM element that may contain a React component.
  9904. * @return {?string} A "reactRoot" ID, if a React component is rendered.
  9905. */
  9906. function getReactRootID(container) {
  9907. var rootElement = getReactRootElementInContainer(container);
  9908. return rootElement && ReactMount.getID(rootElement);
  9909. }
  9910. /**
  9911. * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form
  9912. * element can return its control whose name or ID equals ATTR_NAME. All
  9913. * DOM nodes support `getAttributeNode` but this can also get called on
  9914. * other objects so just return '' if we're given something other than a
  9915. * DOM node (such as window).
  9916. *
  9917. * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.
  9918. * @return {string} ID of the supplied `domNode`.
  9919. */
  9920. function getID(node) {
  9921. var id = internalGetID(node);
  9922. if (id) {
  9923. if (nodeCache.hasOwnProperty(id)) {
  9924. var cached = nodeCache[id];
  9925. if (cached !== node) {
  9926. !!isValid(cached, id) ? "production" !== 'production' ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined;
  9927. nodeCache[id] = node;
  9928. }
  9929. } else {
  9930. nodeCache[id] = node;
  9931. }
  9932. }
  9933. return id;
  9934. }
  9935. function internalGetID(node) {
  9936. // If node is something like a window, document, or text node, none of
  9937. // which support attributes or a .getAttribute method, gracefully return
  9938. // the empty string, as if the attribute were missing.
  9939. return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
  9940. }
  9941. /**
  9942. * Sets the React-specific ID of the given node.
  9943. *
  9944. * @param {DOMElement} node The DOM node whose ID will be set.
  9945. * @param {string} id The value of the ID attribute.
  9946. */
  9947. function setID(node, id) {
  9948. var oldID = internalGetID(node);
  9949. if (oldID !== id) {
  9950. delete nodeCache[oldID];
  9951. }
  9952. node.setAttribute(ATTR_NAME, id);
  9953. nodeCache[id] = node;
  9954. }
  9955. /**
  9956. * Finds the node with the supplied React-generated DOM ID.
  9957. *
  9958. * @param {string} id A React-generated DOM ID.
  9959. * @return {DOMElement} DOM node with the suppled `id`.
  9960. * @internal
  9961. */
  9962. function getNode(id) {
  9963. if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
  9964. nodeCache[id] = ReactMount.findReactNodeByID(id);
  9965. }
  9966. return nodeCache[id];
  9967. }
  9968. /**
  9969. * Finds the node with the supplied public React instance.
  9970. *
  9971. * @param {*} instance A public React instance.
  9972. * @return {?DOMElement} DOM node with the suppled `id`.
  9973. * @internal
  9974. */
  9975. function getNodeFromInstance(instance) {
  9976. var id = ReactInstanceMap.get(instance)._rootNodeID;
  9977. if (ReactEmptyComponentRegistry.isNullComponentID(id)) {
  9978. return null;
  9979. }
  9980. if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
  9981. nodeCache[id] = ReactMount.findReactNodeByID(id);
  9982. }
  9983. return nodeCache[id];
  9984. }
  9985. /**
  9986. * A node is "valid" if it is contained by a currently mounted container.
  9987. *
  9988. * This means that the node does not have to be contained by a document in
  9989. * order to be considered valid.
  9990. *
  9991. * @param {?DOMElement} node The candidate DOM node.
  9992. * @param {string} id The expected ID of the node.
  9993. * @return {boolean} Whether the node is contained by a mounted container.
  9994. */
  9995. function isValid(node, id) {
  9996. if (node) {
  9997. !(internalGetID(node) === id) ? "production" !== 'production' ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined;
  9998. var container = ReactMount.findReactContainerForID(id);
  9999. if (container && containsNode(container, node)) {
  10000. return true;
  10001. }
  10002. }
  10003. return false;
  10004. }
  10005. /**
  10006. * Causes the cache to forget about one React-specific ID.
  10007. *
  10008. * @param {string} id The ID to forget.
  10009. */
  10010. function purgeID(id) {
  10011. delete nodeCache[id];
  10012. }
  10013. var deepestNodeSoFar = null;
  10014. function findDeepestCachedAncestorImpl(ancestorID) {
  10015. var ancestor = nodeCache[ancestorID];
  10016. if (ancestor && isValid(ancestor, ancestorID)) {
  10017. deepestNodeSoFar = ancestor;
  10018. } else {
  10019. // This node isn't populated in the cache, so presumably none of its
  10020. // descendants are. Break out of the loop.
  10021. return false;
  10022. }
  10023. }
  10024. /**
  10025. * Return the deepest cached node whose ID is a prefix of `targetID`.
  10026. */
  10027. function findDeepestCachedAncestor(targetID) {
  10028. deepestNodeSoFar = null;
  10029. ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl);
  10030. var foundNode = deepestNodeSoFar;
  10031. deepestNodeSoFar = null;
  10032. return foundNode;
  10033. }
  10034. /**
  10035. * Mounts this component and inserts it into the DOM.
  10036. *
  10037. * @param {ReactComponent} componentInstance The instance to mount.
  10038. * @param {string} rootID DOM ID of the root node.
  10039. * @param {DOMElement} container DOM element to mount into.
  10040. * @param {ReactReconcileTransaction} transaction
  10041. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  10042. */
  10043. function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) {
  10044. if (ReactDOMFeatureFlags.useCreateElement) {
  10045. context = assign({}, context);
  10046. if (container.nodeType === DOC_NODE_TYPE) {
  10047. context[ownerDocumentContextKey] = container;
  10048. } else {
  10049. context[ownerDocumentContextKey] = container.ownerDocument;
  10050. }
  10051. }
  10052. if ("production" !== 'production') {
  10053. if (context === emptyObject) {
  10054. context = {};
  10055. }
  10056. var tag = container.nodeName.toLowerCase();
  10057. context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(null, tag, null);
  10058. }
  10059. var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context);
  10060. componentInstance._renderedComponent._topLevelWrapper = componentInstance;
  10061. ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup, transaction);
  10062. }
  10063. /**
  10064. * Batched mount.
  10065. *
  10066. * @param {ReactComponent} componentInstance The instance to mount.
  10067. * @param {string} rootID DOM ID of the root node.
  10068. * @param {DOMElement} container DOM element to mount into.
  10069. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  10070. */
  10071. function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) {
  10072. var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
  10073. /* forceHTML */shouldReuseMarkup);
  10074. transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context);
  10075. ReactUpdates.ReactReconcileTransaction.release(transaction);
  10076. }
  10077. /**
  10078. * Unmounts a component and removes it from the DOM.
  10079. *
  10080. * @param {ReactComponent} instance React component instance.
  10081. * @param {DOMElement} container DOM element to unmount from.
  10082. * @final
  10083. * @internal
  10084. * @see {ReactMount.unmountComponentAtNode}
  10085. */
  10086. function unmountComponentFromNode(instance, container) {
  10087. ReactReconciler.unmountComponent(instance);
  10088. if (container.nodeType === DOC_NODE_TYPE) {
  10089. container = container.documentElement;
  10090. }
  10091. // http://jsperf.com/emptying-a-node
  10092. while (container.lastChild) {
  10093. container.removeChild(container.lastChild);
  10094. }
  10095. }
  10096. /**
  10097. * True if the supplied DOM node has a direct React-rendered child that is
  10098. * not a React root element. Useful for warning in `render`,
  10099. * `unmountComponentAtNode`, etc.
  10100. *
  10101. * @param {?DOMElement} node The candidate DOM node.
  10102. * @return {boolean} True if the DOM element contains a direct child that was
  10103. * rendered by React but is not a root element.
  10104. * @internal
  10105. */
  10106. function hasNonRootReactChild(node) {
  10107. var reactRootID = getReactRootID(node);
  10108. return reactRootID ? reactRootID !== ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID) : false;
  10109. }
  10110. /**
  10111. * Returns the first (deepest) ancestor of a node which is rendered by this copy
  10112. * of React.
  10113. */
  10114. function findFirstReactDOMImpl(node) {
  10115. // This node might be from another React instance, so we make sure not to
  10116. // examine the node cache here
  10117. for (; node && node.parentNode !== node; node = node.parentNode) {
  10118. if (node.nodeType !== 1) {
  10119. // Not a DOMElement, therefore not a React component
  10120. continue;
  10121. }
  10122. var nodeID = internalGetID(node);
  10123. if (!nodeID) {
  10124. continue;
  10125. }
  10126. var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
  10127. // If containersByReactRootID contains the container we find by crawling up
  10128. // the tree, we know that this instance of React rendered the node.
  10129. // nb. isValid's strategy (with containsNode) does not work because render
  10130. // trees may be nested and we don't want a false positive in that case.
  10131. var current = node;
  10132. var lastID;
  10133. do {
  10134. lastID = internalGetID(current);
  10135. current = current.parentNode;
  10136. if (current == null) {
  10137. // The passed-in node has been detached from the container it was
  10138. // originally rendered into.
  10139. return null;
  10140. }
  10141. } while (lastID !== reactRootID);
  10142. if (current === containersByReactRootID[reactRootID]) {
  10143. return node;
  10144. }
  10145. }
  10146. return null;
  10147. }
  10148. /**
  10149. * Temporary (?) hack so that we can store all top-level pending updates on
  10150. * composites instead of having to worry about different types of components
  10151. * here.
  10152. */
  10153. var TopLevelWrapper = function () {};
  10154. TopLevelWrapper.prototype.isReactComponent = {};
  10155. if ("production" !== 'production') {
  10156. TopLevelWrapper.displayName = 'TopLevelWrapper';
  10157. }
  10158. TopLevelWrapper.prototype.render = function () {
  10159. // this.props is actually a ReactElement
  10160. return this.props;
  10161. };
  10162. /**
  10163. * Mounting is the process of initializing a React component by creating its
  10164. * representative DOM elements and inserting them into a supplied `container`.
  10165. * Any prior content inside `container` is destroyed in the process.
  10166. *
  10167. * ReactMount.render(
  10168. * component,
  10169. * document.getElementById('container')
  10170. * );
  10171. *
  10172. * <div id="container"> <-- Supplied `container`.
  10173. * <div data-reactid=".3"> <-- Rendered reactRoot of React
  10174. * // ... component.
  10175. * </div>
  10176. * </div>
  10177. *
  10178. * Inside of `container`, the first element rendered is the "reactRoot".
  10179. */
  10180. var ReactMount = {
  10181. TopLevelWrapper: TopLevelWrapper,
  10182. /** Exposed for debugging purposes **/
  10183. _instancesByReactRootID: instancesByReactRootID,
  10184. /**
  10185. * This is a hook provided to support rendering React components while
  10186. * ensuring that the apparent scroll position of its `container` does not
  10187. * change.
  10188. *
  10189. * @param {DOMElement} container The `container` being rendered into.
  10190. * @param {function} renderCallback This must be called once to do the render.
  10191. */
  10192. scrollMonitor: function (container, renderCallback) {
  10193. renderCallback();
  10194. },
  10195. /**
  10196. * Take a component that's already mounted into the DOM and replace its props
  10197. * @param {ReactComponent} prevComponent component instance already in the DOM
  10198. * @param {ReactElement} nextElement component instance to render
  10199. * @param {DOMElement} container container to render into
  10200. * @param {?function} callback function triggered on completion
  10201. */
  10202. _updateRootComponent: function (prevComponent, nextElement, container, callback) {
  10203. ReactMount.scrollMonitor(container, function () {
  10204. ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
  10205. if (callback) {
  10206. ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
  10207. }
  10208. });
  10209. if ("production" !== 'production') {
  10210. // Record the root element in case it later gets transplanted.
  10211. rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container);
  10212. }
  10213. return prevComponent;
  10214. },
  10215. /**
  10216. * Register a component into the instance map and starts scroll value
  10217. * monitoring
  10218. * @param {ReactComponent} nextComponent component instance to render
  10219. * @param {DOMElement} container container to render into
  10220. * @return {string} reactRoot ID prefix
  10221. */
  10222. _registerComponent: function (nextComponent, container) {
  10223. !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? "production" !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : undefined;
  10224. ReactBrowserEventEmitter.ensureScrollValueMonitoring();
  10225. var reactRootID = ReactMount.registerContainer(container);
  10226. instancesByReactRootID[reactRootID] = nextComponent;
  10227. return reactRootID;
  10228. },
  10229. /**
  10230. * Render a new component into the DOM.
  10231. * @param {ReactElement} nextElement element to render
  10232. * @param {DOMElement} container container to render into
  10233. * @param {boolean} shouldReuseMarkup if we should skip the markup insertion
  10234. * @return {ReactComponent} nextComponent
  10235. */
  10236. _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
  10237. // Various parts of our code (such as ReactCompositeComponent's
  10238. // _renderValidatedComponent) assume that calls to render aren't nested;
  10239. // verify that that's the case.
  10240. "production" !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
  10241. var componentInstance = instantiateReactComponent(nextElement, null);
  10242. var reactRootID = ReactMount._registerComponent(componentInstance, container);
  10243. // The initial render is synchronous but any updates that happen during
  10244. // rendering, in componentWillMount or componentDidMount, will be batched
  10245. // according to the current batching strategy.
  10246. ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context);
  10247. if ("production" !== 'production') {
  10248. // Record the root element in case it later gets transplanted.
  10249. rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container);
  10250. }
  10251. return componentInstance;
  10252. },
  10253. /**
  10254. * Renders a React component into the DOM in the supplied `container`.
  10255. *
  10256. * If the React component was previously rendered into `container`, this will
  10257. * perform an update on it and only mutate the DOM as necessary to reflect the
  10258. * latest React component.
  10259. *
  10260. * @param {ReactComponent} parentComponent The conceptual parent of this render tree.
  10261. * @param {ReactElement} nextElement Component element to render.
  10262. * @param {DOMElement} container DOM element to render into.
  10263. * @param {?function} callback function triggered on completion
  10264. * @return {ReactComponent} Component instance rendered in `container`.
  10265. */
  10266. renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
  10267. !(parentComponent != null && parentComponent._reactInternalInstance != null) ? "production" !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined;
  10268. return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
  10269. },
  10270. _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
  10271. !ReactElement.isValidElement(nextElement) ? "production" !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' :
  10272. // Check if it quacks like an element
  10273. nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined;
  10274. "production" !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : undefined;
  10275. var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
  10276. var prevComponent = instancesByReactRootID[getReactRootID(container)];
  10277. if (prevComponent) {
  10278. var prevWrappedElement = prevComponent._currentElement;
  10279. var prevElement = prevWrappedElement.props;
  10280. if (shouldUpdateReactComponent(prevElement, nextElement)) {
  10281. var publicInst = prevComponent._renderedComponent.getPublicInstance();
  10282. var updatedCallback = callback && function () {
  10283. callback.call(publicInst);
  10284. };
  10285. ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, updatedCallback);
  10286. return publicInst;
  10287. } else {
  10288. ReactMount.unmountComponentAtNode(container);
  10289. }
  10290. }
  10291. var reactRootElement = getReactRootElementInContainer(container);
  10292. var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
  10293. var containerHasNonRootReactChild = hasNonRootReactChild(container);
  10294. if ("production" !== 'production') {
  10295. "production" !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : undefined;
  10296. if (!containerHasReactMarkup || reactRootElement.nextSibling) {
  10297. var rootElementSibling = reactRootElement;
  10298. while (rootElementSibling) {
  10299. if (internalGetID(rootElementSibling)) {
  10300. "production" !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : undefined;
  10301. break;
  10302. }
  10303. rootElementSibling = rootElementSibling.nextSibling;
  10304. }
  10305. }
  10306. }
  10307. var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
  10308. var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance();
  10309. if (callback) {
  10310. callback.call(component);
  10311. }
  10312. return component;
  10313. },
  10314. /**
  10315. * Renders a React component into the DOM in the supplied `container`.
  10316. *
  10317. * If the React component was previously rendered into `container`, this will
  10318. * perform an update on it and only mutate the DOM as necessary to reflect the
  10319. * latest React component.
  10320. *
  10321. * @param {ReactElement} nextElement Component element to render.
  10322. * @param {DOMElement} container DOM element to render into.
  10323. * @param {?function} callback function triggered on completion
  10324. * @return {ReactComponent} Component instance rendered in `container`.
  10325. */
  10326. render: function (nextElement, container, callback) {
  10327. return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
  10328. },
  10329. /**
  10330. * Registers a container node into which React components will be rendered.
  10331. * This also creates the "reactRoot" ID that will be assigned to the element
  10332. * rendered within.
  10333. *
  10334. * @param {DOMElement} container DOM element to register as a container.
  10335. * @return {string} The "reactRoot" ID of elements rendered within.
  10336. */
  10337. registerContainer: function (container) {
  10338. var reactRootID = getReactRootID(container);
  10339. if (reactRootID) {
  10340. // If one exists, make sure it is a valid "reactRoot" ID.
  10341. reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);
  10342. }
  10343. if (!reactRootID) {
  10344. // No valid "reactRoot" ID found, create one.
  10345. reactRootID = ReactInstanceHandles.createReactRootID();
  10346. }
  10347. containersByReactRootID[reactRootID] = container;
  10348. return reactRootID;
  10349. },
  10350. /**
  10351. * Unmounts and destroys the React component rendered in the `container`.
  10352. *
  10353. * @param {DOMElement} container DOM element containing a React component.
  10354. * @return {boolean} True if a component was found in and unmounted from
  10355. * `container`
  10356. */
  10357. unmountComponentAtNode: function (container) {
  10358. // Various parts of our code (such as ReactCompositeComponent's
  10359. // _renderValidatedComponent) assume that calls to render aren't nested;
  10360. // verify that that's the case. (Strictly speaking, unmounting won't cause a
  10361. // render but we still don't expect to be in a render call here.)
  10362. "production" !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
  10363. !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? "production" !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : undefined;
  10364. var reactRootID = getReactRootID(container);
  10365. var component = instancesByReactRootID[reactRootID];
  10366. if (!component) {
  10367. // Check if the node being unmounted was rendered by React, but isn't a
  10368. // root node.
  10369. var containerHasNonRootReactChild = hasNonRootReactChild(container);
  10370. // Check if the container itself is a React root node.
  10371. var containerID = internalGetID(container);
  10372. var isContainerReactRoot = containerID && containerID === ReactInstanceHandles.getReactRootIDFromNodeID(containerID);
  10373. if ("production" !== 'production') {
  10374. "production" !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : undefined;
  10375. }
  10376. return false;
  10377. }
  10378. ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container);
  10379. delete instancesByReactRootID[reactRootID];
  10380. delete containersByReactRootID[reactRootID];
  10381. if ("production" !== 'production') {
  10382. delete rootElementsByReactRootID[reactRootID];
  10383. }
  10384. return true;
  10385. },
  10386. /**
  10387. * Finds the container DOM element that contains React component to which the
  10388. * supplied DOM `id` belongs.
  10389. *
  10390. * @param {string} id The ID of an element rendered by a React component.
  10391. * @return {?DOMElement} DOM element that contains the `id`.
  10392. */
  10393. findReactContainerForID: function (id) {
  10394. var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
  10395. var container = containersByReactRootID[reactRootID];
  10396. if ("production" !== 'production') {
  10397. var rootElement = rootElementsByReactRootID[reactRootID];
  10398. if (rootElement && rootElement.parentNode !== container) {
  10399. "production" !== 'production' ? warning(
  10400. // Call internalGetID here because getID calls isValid which calls
  10401. // findReactContainerForID (this function).
  10402. internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined;
  10403. var containerChild = container.firstChild;
  10404. if (containerChild && reactRootID === internalGetID(containerChild)) {
  10405. // If the container has a new child with the same ID as the old
  10406. // root element, then rootElementsByReactRootID[reactRootID] is
  10407. // just stale and needs to be updated. The case that deserves a
  10408. // warning is when the container is empty.
  10409. rootElementsByReactRootID[reactRootID] = containerChild;
  10410. } else {
  10411. "production" !== 'production' ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined;
  10412. }
  10413. }
  10414. }
  10415. return container;
  10416. },
  10417. /**
  10418. * Finds an element rendered by React with the supplied ID.
  10419. *
  10420. * @param {string} id ID of a DOM node in the React component.
  10421. * @return {DOMElement} Root DOM node of the React component.
  10422. */
  10423. findReactNodeByID: function (id) {
  10424. var reactRoot = ReactMount.findReactContainerForID(id);
  10425. return ReactMount.findComponentRoot(reactRoot, id);
  10426. },
  10427. /**
  10428. * Traverses up the ancestors of the supplied node to find a node that is a
  10429. * DOM representation of a React component rendered by this copy of React.
  10430. *
  10431. * @param {*} node
  10432. * @return {?DOMEventTarget}
  10433. * @internal
  10434. */
  10435. getFirstReactDOM: function (node) {
  10436. return findFirstReactDOMImpl(node);
  10437. },
  10438. /**
  10439. * Finds a node with the supplied `targetID` inside of the supplied
  10440. * `ancestorNode`. Exploits the ID naming scheme to perform the search
  10441. * quickly.
  10442. *
  10443. * @param {DOMEventTarget} ancestorNode Search from this root.
  10444. * @pararm {string} targetID ID of the DOM representation of the component.
  10445. * @return {DOMEventTarget} DOM node with the supplied `targetID`.
  10446. * @internal
  10447. */
  10448. findComponentRoot: function (ancestorNode, targetID) {
  10449. var firstChildren = findComponentRootReusableArray;
  10450. var childIndex = 0;
  10451. var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
  10452. if ("production" !== 'production') {
  10453. // This will throw on the next line; give an early warning
  10454. "production" !== 'production' ? warning(deepestAncestor != null, 'React can\'t find the root component node for data-reactid value ' + '`%s`. If you\'re seeing this message, it probably means that ' + 'you\'ve loaded two copies of React on the page. At this time, only ' + 'a single copy of React can be loaded at a time.', targetID) : undefined;
  10455. }
  10456. firstChildren[0] = deepestAncestor.firstChild;
  10457. firstChildren.length = 1;
  10458. while (childIndex < firstChildren.length) {
  10459. var child = firstChildren[childIndex++];
  10460. var targetChild;
  10461. while (child) {
  10462. var childID = ReactMount.getID(child);
  10463. if (childID) {
  10464. // Even if we find the node we're looking for, we finish looping
  10465. // through its siblings to ensure they're cached so that we don't have
  10466. // to revisit this node again. Otherwise, we make n^2 calls to getID
  10467. // when visiting the many children of a single node in order.
  10468. if (targetID === childID) {
  10469. targetChild = child;
  10470. } else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) {
  10471. // If we find a child whose ID is an ancestor of the given ID,
  10472. // then we can be sure that we only want to search the subtree
  10473. // rooted at this child, so we can throw out the rest of the
  10474. // search state.
  10475. firstChildren.length = childIndex = 0;
  10476. firstChildren.push(child.firstChild);
  10477. }
  10478. } else {
  10479. // If this child had no ID, then there's a chance that it was
  10480. // injected automatically by the browser, as when a `<table>`
  10481. // element sprouts an extra `<tbody>` child as a side effect of
  10482. // `.innerHTML` parsing. Optimistically continue down this
  10483. // branch, but not before examining the other siblings.
  10484. firstChildren.push(child.firstChild);
  10485. }
  10486. child = child.nextSibling;
  10487. }
  10488. if (targetChild) {
  10489. // Emptying firstChildren/findComponentRootReusableArray is
  10490. // not necessary for correctness, but it helps the GC reclaim
  10491. // any nodes that were left at the end of the search.
  10492. firstChildren.length = 0;
  10493. return targetChild;
  10494. }
  10495. }
  10496. firstChildren.length = 0;
  10497. !false ? "production" !== 'production' ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : invariant(false) : undefined;
  10498. },
  10499. _mountImageIntoNode: function (markup, container, shouldReuseMarkup, transaction) {
  10500. !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? "production" !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined;
  10501. if (shouldReuseMarkup) {
  10502. var rootElement = getReactRootElementInContainer(container);
  10503. if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
  10504. return;
  10505. } else {
  10506. var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  10507. rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  10508. var rootMarkup = rootElement.outerHTML;
  10509. rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
  10510. var normalizedMarkup = markup;
  10511. if ("production" !== 'production') {
  10512. // because rootMarkup is retrieved from the DOM, various normalizations
  10513. // will have occurred which will not be present in `markup`. Here,
  10514. // insert markup into a <div> or <iframe> depending on the container
  10515. // type to perform the same normalizations before comparing.
  10516. var normalizer;
  10517. if (container.nodeType === ELEMENT_NODE_TYPE) {
  10518. normalizer = document.createElementNS('http://www.w3.org/1999/xhtml', 'div');
  10519. normalizer.innerHTML = markup;
  10520. normalizedMarkup = normalizer.innerHTML;
  10521. } else {
  10522. normalizer = document.createElementNS('http://www.w3.org/1999/xhtml', 'iframe');
  10523. document.body.appendChild(normalizer);
  10524. normalizer.contentDocument.write(markup);
  10525. normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
  10526. document.body.removeChild(normalizer);
  10527. }
  10528. }
  10529. var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
  10530. var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
  10531. !(container.nodeType !== DOC_NODE_TYPE) ? "production" !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : invariant(false) : undefined;
  10532. if ("production" !== 'production') {
  10533. "production" !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : undefined;
  10534. }
  10535. }
  10536. }
  10537. !(container.nodeType !== DOC_NODE_TYPE) ? "production" !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
  10538. if (transaction.useCreateElement) {
  10539. while (container.lastChild) {
  10540. container.removeChild(container.lastChild);
  10541. }
  10542. container.appendChild(markup);
  10543. } else {
  10544. setInnerHTML(container, markup);
  10545. }
  10546. },
  10547. ownerDocumentContextKey: ownerDocumentContextKey,
  10548. /**
  10549. * React ID utilities.
  10550. */
  10551. getReactRootID: getReactRootID,
  10552. getID: getID,
  10553. setID: setID,
  10554. getNode: getNode,
  10555. getNodeFromInstance: getNodeFromInstance,
  10556. isValid: isValid,
  10557. purgeID: purgeID
  10558. };
  10559. ReactPerf.measureMethods(ReactMount, 'ReactMount', {
  10560. _renderNewRootComponent: '_renderNewRootComponent',
  10561. _mountImageIntoNode: '_mountImageIntoNode'
  10562. });
  10563. module.exports = ReactMount;
  10564. },{"10":10,"132":132,"138":138,"141":141,"144":144,"150":150,"154":154,"161":161,"173":173,"24":24,"28":28,"39":39,"44":44,"57":57,"60":60,"67":67,"68":68,"71":71,"78":78,"84":84,"95":95,"96":96}],73:[function(_dereq_,module,exports){
  10565. /**
  10566. * Copyright 2013-2015, Facebook, Inc.
  10567. * All rights reserved.
  10568. *
  10569. * This source code is licensed under the BSD-style license found in the
  10570. * LICENSE file in the root directory of this source tree. An additional grant
  10571. * of patent rights can be found in the PATENTS file in the same directory.
  10572. *
  10573. * @providesModule ReactMultiChild
  10574. * @typechecks static-only
  10575. */
  10576. 'use strict';
  10577. var ReactComponentEnvironment = _dereq_(36);
  10578. var ReactMultiChildUpdateTypes = _dereq_(74);
  10579. var ReactCurrentOwner = _dereq_(39);
  10580. var ReactReconciler = _dereq_(84);
  10581. var ReactChildReconciler = _dereq_(31);
  10582. var flattenChildren = _dereq_(123);
  10583. /**
  10584. * Updating children of a component may trigger recursive updates. The depth is
  10585. * used to batch recursive updates to render markup more efficiently.
  10586. *
  10587. * @type {number}
  10588. * @private
  10589. */
  10590. var updateDepth = 0;
  10591. /**
  10592. * Queue of update configuration objects.
  10593. *
  10594. * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
  10595. *
  10596. * @type {array<object>}
  10597. * @private
  10598. */
  10599. var updateQueue = [];
  10600. /**
  10601. * Queue of markup to be rendered.
  10602. *
  10603. * @type {array<string>}
  10604. * @private
  10605. */
  10606. var markupQueue = [];
  10607. /**
  10608. * Enqueues markup to be rendered and inserted at a supplied index.
  10609. *
  10610. * @param {string} parentID ID of the parent component.
  10611. * @param {string} markup Markup that renders into an element.
  10612. * @param {number} toIndex Destination index.
  10613. * @private
  10614. */
  10615. function enqueueInsertMarkup(parentID, markup, toIndex) {
  10616. // NOTE: Null values reduce hidden classes.
  10617. updateQueue.push({
  10618. parentID: parentID,
  10619. parentNode: null,
  10620. type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
  10621. markupIndex: markupQueue.push(markup) - 1,
  10622. content: null,
  10623. fromIndex: null,
  10624. toIndex: toIndex
  10625. });
  10626. }
  10627. /**
  10628. * Enqueues moving an existing element to another index.
  10629. *
  10630. * @param {string} parentID ID of the parent component.
  10631. * @param {number} fromIndex Source index of the existing element.
  10632. * @param {number} toIndex Destination index of the element.
  10633. * @private
  10634. */
  10635. function enqueueMove(parentID, fromIndex, toIndex) {
  10636. // NOTE: Null values reduce hidden classes.
  10637. updateQueue.push({
  10638. parentID: parentID,
  10639. parentNode: null,
  10640. type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
  10641. markupIndex: null,
  10642. content: null,
  10643. fromIndex: fromIndex,
  10644. toIndex: toIndex
  10645. });
  10646. }
  10647. /**
  10648. * Enqueues removing an element at an index.
  10649. *
  10650. * @param {string} parentID ID of the parent component.
  10651. * @param {number} fromIndex Index of the element to remove.
  10652. * @private
  10653. */
  10654. function enqueueRemove(parentID, fromIndex) {
  10655. // NOTE: Null values reduce hidden classes.
  10656. updateQueue.push({
  10657. parentID: parentID,
  10658. parentNode: null,
  10659. type: ReactMultiChildUpdateTypes.REMOVE_NODE,
  10660. markupIndex: null,
  10661. content: null,
  10662. fromIndex: fromIndex,
  10663. toIndex: null
  10664. });
  10665. }
  10666. /**
  10667. * Enqueues setting the markup of a node.
  10668. *
  10669. * @param {string} parentID ID of the parent component.
  10670. * @param {string} markup Markup that renders into an element.
  10671. * @private
  10672. */
  10673. function enqueueSetMarkup(parentID, markup) {
  10674. // NOTE: Null values reduce hidden classes.
  10675. updateQueue.push({
  10676. parentID: parentID,
  10677. parentNode: null,
  10678. type: ReactMultiChildUpdateTypes.SET_MARKUP,
  10679. markupIndex: null,
  10680. content: markup,
  10681. fromIndex: null,
  10682. toIndex: null
  10683. });
  10684. }
  10685. /**
  10686. * Enqueues setting the text content.
  10687. *
  10688. * @param {string} parentID ID of the parent component.
  10689. * @param {string} textContent Text content to set.
  10690. * @private
  10691. */
  10692. function enqueueTextContent(parentID, textContent) {
  10693. // NOTE: Null values reduce hidden classes.
  10694. updateQueue.push({
  10695. parentID: parentID,
  10696. parentNode: null,
  10697. type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
  10698. markupIndex: null,
  10699. content: textContent,
  10700. fromIndex: null,
  10701. toIndex: null
  10702. });
  10703. }
  10704. /**
  10705. * Processes any enqueued updates.
  10706. *
  10707. * @private
  10708. */
  10709. function processQueue() {
  10710. if (updateQueue.length) {
  10711. ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);
  10712. clearQueue();
  10713. }
  10714. }
  10715. /**
  10716. * Clears any enqueued updates.
  10717. *
  10718. * @private
  10719. */
  10720. function clearQueue() {
  10721. updateQueue.length = 0;
  10722. markupQueue.length = 0;
  10723. }
  10724. /**
  10725. * ReactMultiChild are capable of reconciling multiple children.
  10726. *
  10727. * @class ReactMultiChild
  10728. * @internal
  10729. */
  10730. var ReactMultiChild = {
  10731. /**
  10732. * Provides common functionality for components that must reconcile multiple
  10733. * children. This is used by `ReactDOMComponent` to mount, update, and
  10734. * unmount child components.
  10735. *
  10736. * @lends {ReactMultiChild.prototype}
  10737. */
  10738. Mixin: {
  10739. _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
  10740. if ("production" !== 'production') {
  10741. if (this._currentElement) {
  10742. try {
  10743. ReactCurrentOwner.current = this._currentElement._owner;
  10744. return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
  10745. } finally {
  10746. ReactCurrentOwner.current = null;
  10747. }
  10748. }
  10749. }
  10750. return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
  10751. },
  10752. _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) {
  10753. var nextChildren;
  10754. if ("production" !== 'production') {
  10755. if (this._currentElement) {
  10756. try {
  10757. ReactCurrentOwner.current = this._currentElement._owner;
  10758. nextChildren = flattenChildren(nextNestedChildrenElements);
  10759. } finally {
  10760. ReactCurrentOwner.current = null;
  10761. }
  10762. return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
  10763. }
  10764. }
  10765. nextChildren = flattenChildren(nextNestedChildrenElements);
  10766. return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
  10767. },
  10768. /**
  10769. * Generates a "mount image" for each of the supplied children. In the case
  10770. * of `ReactDOMComponent`, a mount image is a string of markup.
  10771. *
  10772. * @param {?object} nestedChildren Nested child maps.
  10773. * @return {array} An array of mounted representations.
  10774. * @internal
  10775. */
  10776. mountChildren: function (nestedChildren, transaction, context) {
  10777. var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
  10778. this._renderedChildren = children;
  10779. var mountImages = [];
  10780. var index = 0;
  10781. for (var name in children) {
  10782. if (children.hasOwnProperty(name)) {
  10783. var child = children[name];
  10784. // Inlined for performance, see `ReactInstanceHandles.createReactID`.
  10785. var rootID = this._rootNodeID + name;
  10786. var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
  10787. child._mountIndex = index++;
  10788. mountImages.push(mountImage);
  10789. }
  10790. }
  10791. return mountImages;
  10792. },
  10793. /**
  10794. * Replaces any rendered children with a text content string.
  10795. *
  10796. * @param {string} nextContent String of content.
  10797. * @internal
  10798. */
  10799. updateTextContent: function (nextContent) {
  10800. updateDepth++;
  10801. var errorThrown = true;
  10802. try {
  10803. var prevChildren = this._renderedChildren;
  10804. // Remove any rendered children.
  10805. ReactChildReconciler.unmountChildren(prevChildren);
  10806. // TODO: The setTextContent operation should be enough
  10807. for (var name in prevChildren) {
  10808. if (prevChildren.hasOwnProperty(name)) {
  10809. this._unmountChild(prevChildren[name]);
  10810. }
  10811. }
  10812. // Set new text content.
  10813. this.setTextContent(nextContent);
  10814. errorThrown = false;
  10815. } finally {
  10816. updateDepth--;
  10817. if (!updateDepth) {
  10818. if (errorThrown) {
  10819. clearQueue();
  10820. } else {
  10821. processQueue();
  10822. }
  10823. }
  10824. }
  10825. },
  10826. /**
  10827. * Replaces any rendered children with a markup string.
  10828. *
  10829. * @param {string} nextMarkup String of markup.
  10830. * @internal
  10831. */
  10832. updateMarkup: function (nextMarkup) {
  10833. updateDepth++;
  10834. var errorThrown = true;
  10835. try {
  10836. var prevChildren = this._renderedChildren;
  10837. // Remove any rendered children.
  10838. ReactChildReconciler.unmountChildren(prevChildren);
  10839. for (var name in prevChildren) {
  10840. if (prevChildren.hasOwnProperty(name)) {
  10841. this._unmountChildByName(prevChildren[name], name);
  10842. }
  10843. }
  10844. this.setMarkup(nextMarkup);
  10845. errorThrown = false;
  10846. } finally {
  10847. updateDepth--;
  10848. if (!updateDepth) {
  10849. if (errorThrown) {
  10850. clearQueue();
  10851. } else {
  10852. processQueue();
  10853. }
  10854. }
  10855. }
  10856. },
  10857. /**
  10858. * Updates the rendered children with new children.
  10859. *
  10860. * @param {?object} nextNestedChildrenElements Nested child element maps.
  10861. * @param {ReactReconcileTransaction} transaction
  10862. * @internal
  10863. */
  10864. updateChildren: function (nextNestedChildrenElements, transaction, context) {
  10865. updateDepth++;
  10866. var errorThrown = true;
  10867. try {
  10868. this._updateChildren(nextNestedChildrenElements, transaction, context);
  10869. errorThrown = false;
  10870. } finally {
  10871. updateDepth--;
  10872. if (!updateDepth) {
  10873. if (errorThrown) {
  10874. clearQueue();
  10875. } else {
  10876. processQueue();
  10877. }
  10878. }
  10879. }
  10880. },
  10881. /**
  10882. * Improve performance by isolating this hot code path from the try/catch
  10883. * block in `updateChildren`.
  10884. *
  10885. * @param {?object} nextNestedChildrenElements Nested child element maps.
  10886. * @param {ReactReconcileTransaction} transaction
  10887. * @final
  10888. * @protected
  10889. */
  10890. _updateChildren: function (nextNestedChildrenElements, transaction, context) {
  10891. var prevChildren = this._renderedChildren;
  10892. var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
  10893. this._renderedChildren = nextChildren;
  10894. if (!nextChildren && !prevChildren) {
  10895. return;
  10896. }
  10897. var name;
  10898. // `nextIndex` will increment for each child in `nextChildren`, but
  10899. // `lastIndex` will be the last index visited in `prevChildren`.
  10900. var lastIndex = 0;
  10901. var nextIndex = 0;
  10902. for (name in nextChildren) {
  10903. if (!nextChildren.hasOwnProperty(name)) {
  10904. continue;
  10905. }
  10906. var prevChild = prevChildren && prevChildren[name];
  10907. var nextChild = nextChildren[name];
  10908. if (prevChild === nextChild) {
  10909. this.moveChild(prevChild, nextIndex, lastIndex);
  10910. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  10911. prevChild._mountIndex = nextIndex;
  10912. } else {
  10913. if (prevChild) {
  10914. // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
  10915. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  10916. this._unmountChild(prevChild);
  10917. }
  10918. // The child must be instantiated before it's mounted.
  10919. this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context);
  10920. }
  10921. nextIndex++;
  10922. }
  10923. // Remove children that are no longer present.
  10924. for (name in prevChildren) {
  10925. if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
  10926. this._unmountChild(prevChildren[name]);
  10927. }
  10928. }
  10929. },
  10930. /**
  10931. * Unmounts all rendered children. This should be used to clean up children
  10932. * when this component is unmounted.
  10933. *
  10934. * @internal
  10935. */
  10936. unmountChildren: function () {
  10937. var renderedChildren = this._renderedChildren;
  10938. ReactChildReconciler.unmountChildren(renderedChildren);
  10939. this._renderedChildren = null;
  10940. },
  10941. /**
  10942. * Moves a child component to the supplied index.
  10943. *
  10944. * @param {ReactComponent} child Component to move.
  10945. * @param {number} toIndex Destination index of the element.
  10946. * @param {number} lastIndex Last index visited of the siblings of `child`.
  10947. * @protected
  10948. */
  10949. moveChild: function (child, toIndex, lastIndex) {
  10950. // If the index of `child` is less than `lastIndex`, then it needs to
  10951. // be moved. Otherwise, we do not need to move it because a child will be
  10952. // inserted or moved before `child`.
  10953. if (child._mountIndex < lastIndex) {
  10954. enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
  10955. }
  10956. },
  10957. /**
  10958. * Creates a child component.
  10959. *
  10960. * @param {ReactComponent} child Component to create.
  10961. * @param {string} mountImage Markup to insert.
  10962. * @protected
  10963. */
  10964. createChild: function (child, mountImage) {
  10965. enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex);
  10966. },
  10967. /**
  10968. * Removes a child component.
  10969. *
  10970. * @param {ReactComponent} child Child to remove.
  10971. * @protected
  10972. */
  10973. removeChild: function (child) {
  10974. enqueueRemove(this._rootNodeID, child._mountIndex);
  10975. },
  10976. /**
  10977. * Sets this text content string.
  10978. *
  10979. * @param {string} textContent Text content to set.
  10980. * @protected
  10981. */
  10982. setTextContent: function (textContent) {
  10983. enqueueTextContent(this._rootNodeID, textContent);
  10984. },
  10985. /**
  10986. * Sets this markup string.
  10987. *
  10988. * @param {string} markup Markup to set.
  10989. * @protected
  10990. */
  10991. setMarkup: function (markup) {
  10992. enqueueSetMarkup(this._rootNodeID, markup);
  10993. },
  10994. /**
  10995. * Mounts a child with the supplied name.
  10996. *
  10997. * NOTE: This is part of `updateChildren` and is here for readability.
  10998. *
  10999. * @param {ReactComponent} child Component to mount.
  11000. * @param {string} name Name of the child.
  11001. * @param {number} index Index at which to insert the child.
  11002. * @param {ReactReconcileTransaction} transaction
  11003. * @private
  11004. */
  11005. _mountChildByNameAtIndex: function (child, name, index, transaction, context) {
  11006. // Inlined for performance, see `ReactInstanceHandles.createReactID`.
  11007. var rootID = this._rootNodeID + name;
  11008. var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
  11009. child._mountIndex = index;
  11010. this.createChild(child, mountImage);
  11011. },
  11012. /**
  11013. * Unmounts a rendered child.
  11014. *
  11015. * NOTE: This is part of `updateChildren` and is here for readability.
  11016. *
  11017. * @param {ReactComponent} child Component to unmount.
  11018. * @private
  11019. */
  11020. _unmountChild: function (child) {
  11021. this.removeChild(child);
  11022. child._mountIndex = null;
  11023. }
  11024. }
  11025. };
  11026. module.exports = ReactMultiChild;
  11027. },{"123":123,"31":31,"36":36,"39":39,"74":74,"84":84}],74:[function(_dereq_,module,exports){
  11028. /**
  11029. * Copyright 2013-2015, Facebook, Inc.
  11030. * All rights reserved.
  11031. *
  11032. * This source code is licensed under the BSD-style license found in the
  11033. * LICENSE file in the root directory of this source tree. An additional grant
  11034. * of patent rights can be found in the PATENTS file in the same directory.
  11035. *
  11036. * @providesModule ReactMultiChildUpdateTypes
  11037. */
  11038. 'use strict';
  11039. var keyMirror = _dereq_(165);
  11040. /**
  11041. * When a component's children are updated, a series of update configuration
  11042. * objects are created in order to batch and serialize the required changes.
  11043. *
  11044. * Enumerates all the possible types of update configurations.
  11045. *
  11046. * @internal
  11047. */
  11048. var ReactMultiChildUpdateTypes = keyMirror({
  11049. INSERT_MARKUP: null,
  11050. MOVE_EXISTING: null,
  11051. REMOVE_NODE: null,
  11052. SET_MARKUP: null,
  11053. TEXT_CONTENT: null
  11054. });
  11055. module.exports = ReactMultiChildUpdateTypes;
  11056. },{"165":165}],75:[function(_dereq_,module,exports){
  11057. /**
  11058. * Copyright 2014-2015, Facebook, Inc.
  11059. * All rights reserved.
  11060. *
  11061. * This source code is licensed under the BSD-style license found in the
  11062. * LICENSE file in the root directory of this source tree. An additional grant
  11063. * of patent rights can be found in the PATENTS file in the same directory.
  11064. *
  11065. * @providesModule ReactNativeComponent
  11066. */
  11067. 'use strict';
  11068. var assign = _dereq_(24);
  11069. var invariant = _dereq_(161);
  11070. var autoGenerateWrapperClass = null;
  11071. var genericComponentClass = null;
  11072. // This registry keeps track of wrapper classes around native tags.
  11073. var tagToComponentClass = {};
  11074. var textComponentClass = null;
  11075. var ReactNativeComponentInjection = {
  11076. // This accepts a class that receives the tag string. This is a catch all
  11077. // that can render any kind of tag.
  11078. injectGenericComponentClass: function (componentClass) {
  11079. genericComponentClass = componentClass;
  11080. },
  11081. // This accepts a text component class that takes the text string to be
  11082. // rendered as props.
  11083. injectTextComponentClass: function (componentClass) {
  11084. textComponentClass = componentClass;
  11085. },
  11086. // This accepts a keyed object with classes as values. Each key represents a
  11087. // tag. That particular tag will use this class instead of the generic one.
  11088. injectComponentClasses: function (componentClasses) {
  11089. assign(tagToComponentClass, componentClasses);
  11090. }
  11091. };
  11092. /**
  11093. * Get a composite component wrapper class for a specific tag.
  11094. *
  11095. * @param {ReactElement} element The tag for which to get the class.
  11096. * @return {function} The React class constructor function.
  11097. */
  11098. function getComponentClassForElement(element) {
  11099. if (typeof element.type === 'function') {
  11100. return element.type;
  11101. }
  11102. var tag = element.type;
  11103. var componentClass = tagToComponentClass[tag];
  11104. if (componentClass == null) {
  11105. tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
  11106. }
  11107. return componentClass;
  11108. }
  11109. /**
  11110. * Get a native internal component class for a specific tag.
  11111. *
  11112. * @param {ReactElement} element The element to create.
  11113. * @return {function} The internal class constructor function.
  11114. */
  11115. function createInternalComponent(element) {
  11116. !genericComponentClass ? "production" !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
  11117. return new genericComponentClass(element.type, element.props);
  11118. }
  11119. /**
  11120. * @param {ReactText} text
  11121. * @return {ReactComponent}
  11122. */
  11123. function createInstanceForText(text) {
  11124. return new textComponentClass(text);
  11125. }
  11126. /**
  11127. * @param {ReactComponent} component
  11128. * @return {boolean}
  11129. */
  11130. function isTextComponent(component) {
  11131. return component instanceof textComponentClass;
  11132. }
  11133. var ReactNativeComponent = {
  11134. getComponentClassForElement: getComponentClassForElement,
  11135. createInternalComponent: createInternalComponent,
  11136. createInstanceForText: createInstanceForText,
  11137. isTextComponent: isTextComponent,
  11138. injection: ReactNativeComponentInjection
  11139. };
  11140. module.exports = ReactNativeComponent;
  11141. },{"161":161,"24":24}],76:[function(_dereq_,module,exports){
  11142. /**
  11143. * Copyright 2015, Facebook, Inc.
  11144. * All rights reserved.
  11145. *
  11146. * This source code is licensed under the BSD-style license found in the
  11147. * LICENSE file in the root directory of this source tree. An additional grant
  11148. * of patent rights can be found in the PATENTS file in the same directory.
  11149. *
  11150. * @providesModule ReactNoopUpdateQueue
  11151. */
  11152. 'use strict';
  11153. var warning = _dereq_(173);
  11154. function warnTDZ(publicInstance, callerName) {
  11155. if ("production" !== 'production') {
  11156. "production" !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined;
  11157. }
  11158. }
  11159. /**
  11160. * This is the abstract API for an update queue.
  11161. */
  11162. var ReactNoopUpdateQueue = {
  11163. /**
  11164. * Checks whether or not this composite component is mounted.
  11165. * @param {ReactClass} publicInstance The instance we want to test.
  11166. * @return {boolean} True if mounted, false otherwise.
  11167. * @protected
  11168. * @final
  11169. */
  11170. isMounted: function (publicInstance) {
  11171. return false;
  11172. },
  11173. /**
  11174. * Enqueue a callback that will be executed after all the pending updates
  11175. * have processed.
  11176. *
  11177. * @param {ReactClass} publicInstance The instance to use as `this` context.
  11178. * @param {?function} callback Called after state is updated.
  11179. * @internal
  11180. */
  11181. enqueueCallback: function (publicInstance, callback) {},
  11182. /**
  11183. * Forces an update. This should only be invoked when it is known with
  11184. * certainty that we are **not** in a DOM transaction.
  11185. *
  11186. * You may want to call this when you know that some deeper aspect of the
  11187. * component's state has changed but `setState` was not called.
  11188. *
  11189. * This will not invoke `shouldComponentUpdate`, but it will invoke
  11190. * `componentWillUpdate` and `componentDidUpdate`.
  11191. *
  11192. * @param {ReactClass} publicInstance The instance that should rerender.
  11193. * @internal
  11194. */
  11195. enqueueForceUpdate: function (publicInstance) {
  11196. warnTDZ(publicInstance, 'forceUpdate');
  11197. },
  11198. /**
  11199. * Replaces all of the state. Always use this or `setState` to mutate state.
  11200. * You should treat `this.state` as immutable.
  11201. *
  11202. * There is no guarantee that `this.state` will be immediately updated, so
  11203. * accessing `this.state` after calling this method may return the old value.
  11204. *
  11205. * @param {ReactClass} publicInstance The instance that should rerender.
  11206. * @param {object} completeState Next state.
  11207. * @internal
  11208. */
  11209. enqueueReplaceState: function (publicInstance, completeState) {
  11210. warnTDZ(publicInstance, 'replaceState');
  11211. },
  11212. /**
  11213. * Sets a subset of the state. This only exists because _pendingState is
  11214. * internal. This provides a merging strategy that is not available to deep
  11215. * properties which is confusing. TODO: Expose pendingState or don't use it
  11216. * during the merge.
  11217. *
  11218. * @param {ReactClass} publicInstance The instance that should rerender.
  11219. * @param {object} partialState Next partial state to be merged with state.
  11220. * @internal
  11221. */
  11222. enqueueSetState: function (publicInstance, partialState) {
  11223. warnTDZ(publicInstance, 'setState');
  11224. },
  11225. /**
  11226. * Sets a subset of the props.
  11227. *
  11228. * @param {ReactClass} publicInstance The instance that should rerender.
  11229. * @param {object} partialProps Subset of the next props.
  11230. * @internal
  11231. */
  11232. enqueueSetProps: function (publicInstance, partialProps) {
  11233. warnTDZ(publicInstance, 'setProps');
  11234. },
  11235. /**
  11236. * Replaces all of the props.
  11237. *
  11238. * @param {ReactClass} publicInstance The instance that should rerender.
  11239. * @param {object} props New props.
  11240. * @internal
  11241. */
  11242. enqueueReplaceProps: function (publicInstance, props) {
  11243. warnTDZ(publicInstance, 'replaceProps');
  11244. }
  11245. };
  11246. module.exports = ReactNoopUpdateQueue;
  11247. },{"173":173}],77:[function(_dereq_,module,exports){
  11248. /**
  11249. * Copyright 2013-2015, Facebook, Inc.
  11250. * All rights reserved.
  11251. *
  11252. * This source code is licensed under the BSD-style license found in the
  11253. * LICENSE file in the root directory of this source tree. An additional grant
  11254. * of patent rights can be found in the PATENTS file in the same directory.
  11255. *
  11256. * @providesModule ReactOwner
  11257. */
  11258. 'use strict';
  11259. var invariant = _dereq_(161);
  11260. /**
  11261. * ReactOwners are capable of storing references to owned components.
  11262. *
  11263. * All components are capable of //being// referenced by owner components, but
  11264. * only ReactOwner components are capable of //referencing// owned components.
  11265. * The named reference is known as a "ref".
  11266. *
  11267. * Refs are available when mounted and updated during reconciliation.
  11268. *
  11269. * var MyComponent = React.createClass({
  11270. * render: function() {
  11271. * return (
  11272. * <div onClick={this.handleClick}>
  11273. * <CustomComponent ref="custom" />
  11274. * </div>
  11275. * );
  11276. * },
  11277. * handleClick: function() {
  11278. * this.refs.custom.handleClick();
  11279. * },
  11280. * componentDidMount: function() {
  11281. * this.refs.custom.initialize();
  11282. * }
  11283. * });
  11284. *
  11285. * Refs should rarely be used. When refs are used, they should only be done to
  11286. * control data that is not handled by React's data flow.
  11287. *
  11288. * @class ReactOwner
  11289. */
  11290. var ReactOwner = {
  11291. /**
  11292. * @param {?object} object
  11293. * @return {boolean} True if `object` is a valid owner.
  11294. * @final
  11295. */
  11296. isValidOwner: function (object) {
  11297. return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
  11298. },
  11299. /**
  11300. * Adds a component by ref to an owner component.
  11301. *
  11302. * @param {ReactComponent} component Component to reference.
  11303. * @param {string} ref Name by which to refer to the component.
  11304. * @param {ReactOwner} owner Component on which to record the ref.
  11305. * @final
  11306. * @internal
  11307. */
  11308. addComponentAsRefTo: function (component, ref, owner) {
  11309. !ReactOwner.isValidOwner(owner) ? "production" !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
  11310. owner.attachRef(ref, component);
  11311. },
  11312. /**
  11313. * Removes a component by ref from an owner component.
  11314. *
  11315. * @param {ReactComponent} component Component to dereference.
  11316. * @param {string} ref Name of the ref to remove.
  11317. * @param {ReactOwner} owner Component on which the ref is recorded.
  11318. * @final
  11319. * @internal
  11320. */
  11321. removeComponentAsRefFrom: function (component, ref, owner) {
  11322. !ReactOwner.isValidOwner(owner) ? "production" !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
  11323. // Check that `component` is still the current ref because we do not want to
  11324. // detach the ref if another component stole it.
  11325. if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
  11326. owner.detachRef(ref);
  11327. }
  11328. }
  11329. };
  11330. module.exports = ReactOwner;
  11331. },{"161":161}],78:[function(_dereq_,module,exports){
  11332. /**
  11333. * Copyright 2013-2015, Facebook, Inc.
  11334. * All rights reserved.
  11335. *
  11336. * This source code is licensed under the BSD-style license found in the
  11337. * LICENSE file in the root directory of this source tree. An additional grant
  11338. * of patent rights can be found in the PATENTS file in the same directory.
  11339. *
  11340. * @providesModule ReactPerf
  11341. * @typechecks static-only
  11342. */
  11343. 'use strict';
  11344. /**
  11345. * ReactPerf is a general AOP system designed to measure performance. This
  11346. * module only has the hooks: see ReactDefaultPerf for the analysis tool.
  11347. */
  11348. var ReactPerf = {
  11349. /**
  11350. * Boolean to enable/disable measurement. Set to false by default to prevent
  11351. * accidental logging and perf loss.
  11352. */
  11353. enableMeasure: false,
  11354. /**
  11355. * Holds onto the measure function in use. By default, don't measure
  11356. * anything, but we'll override this if we inject a measure function.
  11357. */
  11358. storedMeasure: _noMeasure,
  11359. /**
  11360. * @param {object} object
  11361. * @param {string} objectName
  11362. * @param {object<string>} methodNames
  11363. */
  11364. measureMethods: function (object, objectName, methodNames) {
  11365. if ("production" !== 'production') {
  11366. for (var key in methodNames) {
  11367. if (!methodNames.hasOwnProperty(key)) {
  11368. continue;
  11369. }
  11370. object[key] = ReactPerf.measure(objectName, methodNames[key], object[key]);
  11371. }
  11372. }
  11373. },
  11374. /**
  11375. * Use this to wrap methods you want to measure. Zero overhead in production.
  11376. *
  11377. * @param {string} objName
  11378. * @param {string} fnName
  11379. * @param {function} func
  11380. * @return {function}
  11381. */
  11382. measure: function (objName, fnName, func) {
  11383. if ("production" !== 'production') {
  11384. var measuredFunc = null;
  11385. var wrapper = function () {
  11386. if (ReactPerf.enableMeasure) {
  11387. if (!measuredFunc) {
  11388. measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
  11389. }
  11390. return measuredFunc.apply(this, arguments);
  11391. }
  11392. return func.apply(this, arguments);
  11393. };
  11394. wrapper.displayName = objName + '_' + fnName;
  11395. return wrapper;
  11396. }
  11397. return func;
  11398. },
  11399. injection: {
  11400. /**
  11401. * @param {function} measure
  11402. */
  11403. injectMeasure: function (measure) {
  11404. ReactPerf.storedMeasure = measure;
  11405. }
  11406. }
  11407. };
  11408. /**
  11409. * Simply passes through the measured function, without measuring it.
  11410. *
  11411. * @param {string} objName
  11412. * @param {string} fnName
  11413. * @param {function} func
  11414. * @return {function}
  11415. */
  11416. function _noMeasure(objName, fnName, func) {
  11417. return func;
  11418. }
  11419. module.exports = ReactPerf;
  11420. },{}],79:[function(_dereq_,module,exports){
  11421. /**
  11422. * Copyright 2013-2015, Facebook, Inc.
  11423. * All rights reserved.
  11424. *
  11425. * This source code is licensed under the BSD-style license found in the
  11426. * LICENSE file in the root directory of this source tree. An additional grant
  11427. * of patent rights can be found in the PATENTS file in the same directory.
  11428. *
  11429. * @providesModule ReactPropTransferer
  11430. */
  11431. 'use strict';
  11432. var assign = _dereq_(24);
  11433. var emptyFunction = _dereq_(153);
  11434. var joinClasses = _dereq_(164);
  11435. /**
  11436. * Creates a transfer strategy that will merge prop values using the supplied
  11437. * `mergeStrategy`. If a prop was previously unset, this just sets it.
  11438. *
  11439. * @param {function} mergeStrategy
  11440. * @return {function}
  11441. */
  11442. function createTransferStrategy(mergeStrategy) {
  11443. return function (props, key, value) {
  11444. if (!props.hasOwnProperty(key)) {
  11445. props[key] = value;
  11446. } else {
  11447. props[key] = mergeStrategy(props[key], value);
  11448. }
  11449. };
  11450. }
  11451. var transferStrategyMerge = createTransferStrategy(function (a, b) {
  11452. // `merge` overrides the first object's (`props[key]` above) keys using the
  11453. // second object's (`value`) keys. An object's style's existing `propA` would
  11454. // get overridden. Flip the order here.
  11455. return assign({}, b, a);
  11456. });
  11457. /**
  11458. * Transfer strategies dictate how props are transferred by `transferPropsTo`.
  11459. * NOTE: if you add any more exceptions to this list you should be sure to
  11460. * update `cloneWithProps()` accordingly.
  11461. */
  11462. var TransferStrategies = {
  11463. /**
  11464. * Never transfer `children`.
  11465. */
  11466. children: emptyFunction,
  11467. /**
  11468. * Transfer the `className` prop by merging them.
  11469. */
  11470. className: createTransferStrategy(joinClasses),
  11471. /**
  11472. * Transfer the `style` prop (which is an object) by merging them.
  11473. */
  11474. style: transferStrategyMerge
  11475. };
  11476. /**
  11477. * Mutates the first argument by transferring the properties from the second
  11478. * argument.
  11479. *
  11480. * @param {object} props
  11481. * @param {object} newProps
  11482. * @return {object}
  11483. */
  11484. function transferInto(props, newProps) {
  11485. for (var thisKey in newProps) {
  11486. if (!newProps.hasOwnProperty(thisKey)) {
  11487. continue;
  11488. }
  11489. var transferStrategy = TransferStrategies[thisKey];
  11490. if (transferStrategy && TransferStrategies.hasOwnProperty(thisKey)) {
  11491. transferStrategy(props, thisKey, newProps[thisKey]);
  11492. } else if (!props.hasOwnProperty(thisKey)) {
  11493. props[thisKey] = newProps[thisKey];
  11494. }
  11495. }
  11496. return props;
  11497. }
  11498. /**
  11499. * ReactPropTransferer are capable of transferring props to another component
  11500. * using a `transferPropsTo` method.
  11501. *
  11502. * @class ReactPropTransferer
  11503. */
  11504. var ReactPropTransferer = {
  11505. /**
  11506. * Merge two props objects using TransferStrategies.
  11507. *
  11508. * @param {object} oldProps original props (they take precedence)
  11509. * @param {object} newProps new props to merge in
  11510. * @return {object} a new object containing both sets of props merged.
  11511. */
  11512. mergeProps: function (oldProps, newProps) {
  11513. return transferInto(assign({}, oldProps), newProps);
  11514. }
  11515. };
  11516. module.exports = ReactPropTransferer;
  11517. },{"153":153,"164":164,"24":24}],80:[function(_dereq_,module,exports){
  11518. /**
  11519. * Copyright 2013-2015, Facebook, Inc.
  11520. * All rights reserved.
  11521. *
  11522. * This source code is licensed under the BSD-style license found in the
  11523. * LICENSE file in the root directory of this source tree. An additional grant
  11524. * of patent rights can be found in the PATENTS file in the same directory.
  11525. *
  11526. * @providesModule ReactPropTypeLocationNames
  11527. */
  11528. 'use strict';
  11529. var ReactPropTypeLocationNames = {};
  11530. if ("production" !== 'production') {
  11531. ReactPropTypeLocationNames = {
  11532. prop: 'prop',
  11533. context: 'context',
  11534. childContext: 'child context'
  11535. };
  11536. }
  11537. module.exports = ReactPropTypeLocationNames;
  11538. },{}],81:[function(_dereq_,module,exports){
  11539. /**
  11540. * Copyright 2013-2015, Facebook, Inc.
  11541. * All rights reserved.
  11542. *
  11543. * This source code is licensed under the BSD-style license found in the
  11544. * LICENSE file in the root directory of this source tree. An additional grant
  11545. * of patent rights can be found in the PATENTS file in the same directory.
  11546. *
  11547. * @providesModule ReactPropTypeLocations
  11548. */
  11549. 'use strict';
  11550. var keyMirror = _dereq_(165);
  11551. var ReactPropTypeLocations = keyMirror({
  11552. prop: null,
  11553. context: null,
  11554. childContext: null
  11555. });
  11556. module.exports = ReactPropTypeLocations;
  11557. },{"165":165}],82:[function(_dereq_,module,exports){
  11558. /**
  11559. * Copyright 2013-2015, Facebook, Inc.
  11560. * All rights reserved.
  11561. *
  11562. * This source code is licensed under the BSD-style license found in the
  11563. * LICENSE file in the root directory of this source tree. An additional grant
  11564. * of patent rights can be found in the PATENTS file in the same directory.
  11565. *
  11566. * @providesModule ReactPropTypes
  11567. */
  11568. 'use strict';
  11569. var ReactElement = _dereq_(57);
  11570. var ReactPropTypeLocationNames = _dereq_(80);
  11571. var emptyFunction = _dereq_(153);
  11572. var getIteratorFn = _dereq_(129);
  11573. /**
  11574. * Collection of methods that allow declaration and validation of props that are
  11575. * supplied to React components. Example usage:
  11576. *
  11577. * var Props = require('ReactPropTypes');
  11578. * var MyArticle = React.createClass({
  11579. * propTypes: {
  11580. * // An optional string prop named "description".
  11581. * description: Props.string,
  11582. *
  11583. * // A required enum prop named "category".
  11584. * category: Props.oneOf(['News','Photos']).isRequired,
  11585. *
  11586. * // A prop named "dialog" that requires an instance of Dialog.
  11587. * dialog: Props.instanceOf(Dialog).isRequired
  11588. * },
  11589. * render: function() { ... }
  11590. * });
  11591. *
  11592. * A more formal specification of how these methods are used:
  11593. *
  11594. * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
  11595. * decl := ReactPropTypes.{type}(.isRequired)?
  11596. *
  11597. * Each and every declaration produces a function with the same signature. This
  11598. * allows the creation of custom validation functions. For example:
  11599. *
  11600. * var MyLink = React.createClass({
  11601. * propTypes: {
  11602. * // An optional string or URI prop named "href".
  11603. * href: function(props, propName, componentName) {
  11604. * var propValue = props[propName];
  11605. * if (propValue != null && typeof propValue !== 'string' &&
  11606. * !(propValue instanceof URI)) {
  11607. * return new Error(
  11608. * 'Expected a string or an URI for ' + propName + ' in ' +
  11609. * componentName
  11610. * );
  11611. * }
  11612. * }
  11613. * },
  11614. * render: function() {...}
  11615. * });
  11616. *
  11617. * @internal
  11618. */
  11619. var ANONYMOUS = '<<anonymous>>';
  11620. var ReactPropTypes = {
  11621. array: createPrimitiveTypeChecker('array'),
  11622. bool: createPrimitiveTypeChecker('boolean'),
  11623. func: createPrimitiveTypeChecker('function'),
  11624. number: createPrimitiveTypeChecker('number'),
  11625. object: createPrimitiveTypeChecker('object'),
  11626. string: createPrimitiveTypeChecker('string'),
  11627. any: createAnyTypeChecker(),
  11628. arrayOf: createArrayOfTypeChecker,
  11629. element: createElementTypeChecker(),
  11630. instanceOf: createInstanceTypeChecker,
  11631. node: createNodeChecker(),
  11632. objectOf: createObjectOfTypeChecker,
  11633. oneOf: createEnumTypeChecker,
  11634. oneOfType: createUnionTypeChecker,
  11635. shape: createShapeTypeChecker
  11636. };
  11637. function createChainableTypeChecker(validate) {
  11638. function checkType(isRequired, props, propName, componentName, location, propFullName) {
  11639. componentName = componentName || ANONYMOUS;
  11640. propFullName = propFullName || propName;
  11641. if (props[propName] == null) {
  11642. var locationName = ReactPropTypeLocationNames[location];
  11643. if (isRequired) {
  11644. return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.'));
  11645. }
  11646. return null;
  11647. } else {
  11648. return validate(props, propName, componentName, location, propFullName);
  11649. }
  11650. }
  11651. var chainedCheckType = checkType.bind(null, false);
  11652. chainedCheckType.isRequired = checkType.bind(null, true);
  11653. return chainedCheckType;
  11654. }
  11655. function createPrimitiveTypeChecker(expectedType) {
  11656. function validate(props, propName, componentName, location, propFullName) {
  11657. var propValue = props[propName];
  11658. var propType = getPropType(propValue);
  11659. if (propType !== expectedType) {
  11660. var locationName = ReactPropTypeLocationNames[location];
  11661. // `propValue` being instance of, say, date/regexp, pass the 'object'
  11662. // check, but we can offer a more precise error message here rather than
  11663. // 'of type `object`'.
  11664. var preciseType = getPreciseType(propValue);
  11665. return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
  11666. }
  11667. return null;
  11668. }
  11669. return createChainableTypeChecker(validate);
  11670. }
  11671. function createAnyTypeChecker() {
  11672. return createChainableTypeChecker(emptyFunction.thatReturns(null));
  11673. }
  11674. function createArrayOfTypeChecker(typeChecker) {
  11675. function validate(props, propName, componentName, location, propFullName) {
  11676. var propValue = props[propName];
  11677. if (!Array.isArray(propValue)) {
  11678. var locationName = ReactPropTypeLocationNames[location];
  11679. var propType = getPropType(propValue);
  11680. return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
  11681. }
  11682. for (var i = 0; i < propValue.length; i++) {
  11683. var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']');
  11684. if (error instanceof Error) {
  11685. return error;
  11686. }
  11687. }
  11688. return null;
  11689. }
  11690. return createChainableTypeChecker(validate);
  11691. }
  11692. function createElementTypeChecker() {
  11693. function validate(props, propName, componentName, location, propFullName) {
  11694. if (!ReactElement.isValidElement(props[propName])) {
  11695. var locationName = ReactPropTypeLocationNames[location];
  11696. return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.'));
  11697. }
  11698. return null;
  11699. }
  11700. return createChainableTypeChecker(validate);
  11701. }
  11702. function createInstanceTypeChecker(expectedClass) {
  11703. function validate(props, propName, componentName, location, propFullName) {
  11704. if (!(props[propName] instanceof expectedClass)) {
  11705. var locationName = ReactPropTypeLocationNames[location];
  11706. var expectedClassName = expectedClass.name || ANONYMOUS;
  11707. var actualClassName = getClassName(props[propName]);
  11708. return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
  11709. }
  11710. return null;
  11711. }
  11712. return createChainableTypeChecker(validate);
  11713. }
  11714. function createEnumTypeChecker(expectedValues) {
  11715. if (!Array.isArray(expectedValues)) {
  11716. return createChainableTypeChecker(function () {
  11717. return new Error('Invalid argument supplied to oneOf, expected an instance of array.');
  11718. });
  11719. }
  11720. function validate(props, propName, componentName, location, propFullName) {
  11721. var propValue = props[propName];
  11722. for (var i = 0; i < expectedValues.length; i++) {
  11723. if (propValue === expectedValues[i]) {
  11724. return null;
  11725. }
  11726. }
  11727. var locationName = ReactPropTypeLocationNames[location];
  11728. var valuesString = JSON.stringify(expectedValues);
  11729. return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
  11730. }
  11731. return createChainableTypeChecker(validate);
  11732. }
  11733. function createObjectOfTypeChecker(typeChecker) {
  11734. function validate(props, propName, componentName, location, propFullName) {
  11735. var propValue = props[propName];
  11736. var propType = getPropType(propValue);
  11737. if (propType !== 'object') {
  11738. var locationName = ReactPropTypeLocationNames[location];
  11739. return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
  11740. }
  11741. for (var key in propValue) {
  11742. if (propValue.hasOwnProperty(key)) {
  11743. var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key);
  11744. if (error instanceof Error) {
  11745. return error;
  11746. }
  11747. }
  11748. }
  11749. return null;
  11750. }
  11751. return createChainableTypeChecker(validate);
  11752. }
  11753. function createUnionTypeChecker(arrayOfTypeCheckers) {
  11754. if (!Array.isArray(arrayOfTypeCheckers)) {
  11755. return createChainableTypeChecker(function () {
  11756. return new Error('Invalid argument supplied to oneOfType, expected an instance of array.');
  11757. });
  11758. }
  11759. function validate(props, propName, componentName, location, propFullName) {
  11760. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  11761. var checker = arrayOfTypeCheckers[i];
  11762. if (checker(props, propName, componentName, location, propFullName) == null) {
  11763. return null;
  11764. }
  11765. }
  11766. var locationName = ReactPropTypeLocationNames[location];
  11767. return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
  11768. }
  11769. return createChainableTypeChecker(validate);
  11770. }
  11771. function createNodeChecker() {
  11772. function validate(props, propName, componentName, location, propFullName) {
  11773. if (!isNode(props[propName])) {
  11774. var locationName = ReactPropTypeLocationNames[location];
  11775. return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
  11776. }
  11777. return null;
  11778. }
  11779. return createChainableTypeChecker(validate);
  11780. }
  11781. function createShapeTypeChecker(shapeTypes) {
  11782. function validate(props, propName, componentName, location, propFullName) {
  11783. var propValue = props[propName];
  11784. var propType = getPropType(propValue);
  11785. if (propType !== 'object') {
  11786. var locationName = ReactPropTypeLocationNames[location];
  11787. return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
  11788. }
  11789. for (var key in shapeTypes) {
  11790. var checker = shapeTypes[key];
  11791. if (!checker) {
  11792. continue;
  11793. }
  11794. var error = checker(propValue, key, componentName, location, propFullName + '.' + key);
  11795. if (error) {
  11796. return error;
  11797. }
  11798. }
  11799. return null;
  11800. }
  11801. return createChainableTypeChecker(validate);
  11802. }
  11803. function isNode(propValue) {
  11804. switch (typeof propValue) {
  11805. case 'number':
  11806. case 'string':
  11807. case 'undefined':
  11808. return true;
  11809. case 'boolean':
  11810. return !propValue;
  11811. case 'object':
  11812. if (Array.isArray(propValue)) {
  11813. return propValue.every(isNode);
  11814. }
  11815. if (propValue === null || ReactElement.isValidElement(propValue)) {
  11816. return true;
  11817. }
  11818. var iteratorFn = getIteratorFn(propValue);
  11819. if (iteratorFn) {
  11820. var iterator = iteratorFn.call(propValue);
  11821. var step;
  11822. if (iteratorFn !== propValue.entries) {
  11823. while (!(step = iterator.next()).done) {
  11824. if (!isNode(step.value)) {
  11825. return false;
  11826. }
  11827. }
  11828. } else {
  11829. // Iterator will provide entry [k,v] tuples rather than values.
  11830. while (!(step = iterator.next()).done) {
  11831. var entry = step.value;
  11832. if (entry) {
  11833. if (!isNode(entry[1])) {
  11834. return false;
  11835. }
  11836. }
  11837. }
  11838. }
  11839. } else {
  11840. return false;
  11841. }
  11842. return true;
  11843. default:
  11844. return false;
  11845. }
  11846. }
  11847. // Equivalent of `typeof` but with special handling for array and regexp.
  11848. function getPropType(propValue) {
  11849. var propType = typeof propValue;
  11850. if (Array.isArray(propValue)) {
  11851. return 'array';
  11852. }
  11853. if (propValue instanceof RegExp) {
  11854. // Old webkits (at least until Android 4.0) return 'function' rather than
  11855. // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
  11856. // passes PropTypes.object.
  11857. return 'object';
  11858. }
  11859. return propType;
  11860. }
  11861. // This handles more types than `getPropType`. Only used for error messages.
  11862. // See `createPrimitiveTypeChecker`.
  11863. function getPreciseType(propValue) {
  11864. var propType = getPropType(propValue);
  11865. if (propType === 'object') {
  11866. if (propValue instanceof Date) {
  11867. return 'date';
  11868. } else if (propValue instanceof RegExp) {
  11869. return 'regexp';
  11870. }
  11871. }
  11872. return propType;
  11873. }
  11874. // Returns class name of the object, if any.
  11875. function getClassName(propValue) {
  11876. if (!propValue.constructor || !propValue.constructor.name) {
  11877. return '<<anonymous>>';
  11878. }
  11879. return propValue.constructor.name;
  11880. }
  11881. module.exports = ReactPropTypes;
  11882. },{"129":129,"153":153,"57":57,"80":80}],83:[function(_dereq_,module,exports){
  11883. /**
  11884. * Copyright 2013-2015, Facebook, Inc.
  11885. * All rights reserved.
  11886. *
  11887. * This source code is licensed under the BSD-style license found in the
  11888. * LICENSE file in the root directory of this source tree. An additional grant
  11889. * of patent rights can be found in the PATENTS file in the same directory.
  11890. *
  11891. * @providesModule ReactReconcileTransaction
  11892. * @typechecks static-only
  11893. */
  11894. 'use strict';
  11895. var CallbackQueue = _dereq_(6);
  11896. var PooledClass = _dereq_(25);
  11897. var ReactBrowserEventEmitter = _dereq_(28);
  11898. var ReactDOMFeatureFlags = _dereq_(44);
  11899. var ReactInputSelection = _dereq_(66);
  11900. var Transaction = _dereq_(113);
  11901. var assign = _dereq_(24);
  11902. /**
  11903. * Ensures that, when possible, the selection range (currently selected text
  11904. * input) is not disturbed by performing the transaction.
  11905. */
  11906. var SELECTION_RESTORATION = {
  11907. /**
  11908. * @return {Selection} Selection information.
  11909. */
  11910. initialize: ReactInputSelection.getSelectionInformation,
  11911. /**
  11912. * @param {Selection} sel Selection information returned from `initialize`.
  11913. */
  11914. close: ReactInputSelection.restoreSelection
  11915. };
  11916. /**
  11917. * Suppresses events (blur/focus) that could be inadvertently dispatched due to
  11918. * high level DOM manipulations (like temporarily removing a text input from the
  11919. * DOM).
  11920. */
  11921. var EVENT_SUPPRESSION = {
  11922. /**
  11923. * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
  11924. * the reconciliation.
  11925. */
  11926. initialize: function () {
  11927. var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
  11928. ReactBrowserEventEmitter.setEnabled(false);
  11929. return currentlyEnabled;
  11930. },
  11931. /**
  11932. * @param {boolean} previouslyEnabled Enabled status of
  11933. * `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
  11934. * restores the previous value.
  11935. */
  11936. close: function (previouslyEnabled) {
  11937. ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
  11938. }
  11939. };
  11940. /**
  11941. * Provides a queue for collecting `componentDidMount` and
  11942. * `componentDidUpdate` callbacks during the the transaction.
  11943. */
  11944. var ON_DOM_READY_QUEUEING = {
  11945. /**
  11946. * Initializes the internal `onDOMReady` queue.
  11947. */
  11948. initialize: function () {
  11949. this.reactMountReady.reset();
  11950. },
  11951. /**
  11952. * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
  11953. */
  11954. close: function () {
  11955. this.reactMountReady.notifyAll();
  11956. }
  11957. };
  11958. /**
  11959. * Executed within the scope of the `Transaction` instance. Consider these as
  11960. * being member methods, but with an implied ordering while being isolated from
  11961. * each other.
  11962. */
  11963. var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
  11964. /**
  11965. * Currently:
  11966. * - The order that these are listed in the transaction is critical:
  11967. * - Suppresses events.
  11968. * - Restores selection range.
  11969. *
  11970. * Future:
  11971. * - Restore document/overflow scroll positions that were unintentionally
  11972. * modified via DOM insertions above the top viewport boundary.
  11973. * - Implement/integrate with customized constraint based layout system and keep
  11974. * track of which dimensions must be remeasured.
  11975. *
  11976. * @class ReactReconcileTransaction
  11977. */
  11978. function ReactReconcileTransaction(forceHTML) {
  11979. this.reinitializeTransaction();
  11980. // Only server-side rendering really needs this option (see
  11981. // `ReactServerRendering`), but server-side uses
  11982. // `ReactServerRenderingTransaction` instead. This option is here so that it's
  11983. // accessible and defaults to false when `ReactDOMComponent` and
  11984. // `ReactTextComponent` checks it in `mountComponent`.`
  11985. this.renderToStaticMarkup = false;
  11986. this.reactMountReady = CallbackQueue.getPooled(null);
  11987. this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement;
  11988. }
  11989. var Mixin = {
  11990. /**
  11991. * @see Transaction
  11992. * @abstract
  11993. * @final
  11994. * @return {array<object>} List of operation wrap procedures.
  11995. * TODO: convert to array<TransactionWrapper>
  11996. */
  11997. getTransactionWrappers: function () {
  11998. return TRANSACTION_WRAPPERS;
  11999. },
  12000. /**
  12001. * @return {object} The queue to collect `onDOMReady` callbacks with.
  12002. */
  12003. getReactMountReady: function () {
  12004. return this.reactMountReady;
  12005. },
  12006. /**
  12007. * `PooledClass` looks for this, and will invoke this before allowing this
  12008. * instance to be reused.
  12009. */
  12010. destructor: function () {
  12011. CallbackQueue.release(this.reactMountReady);
  12012. this.reactMountReady = null;
  12013. }
  12014. };
  12015. assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
  12016. PooledClass.addPoolingTo(ReactReconcileTransaction);
  12017. module.exports = ReactReconcileTransaction;
  12018. },{"113":113,"24":24,"25":25,"28":28,"44":44,"6":6,"66":66}],84:[function(_dereq_,module,exports){
  12019. /**
  12020. * Copyright 2013-2015, Facebook, Inc.
  12021. * All rights reserved.
  12022. *
  12023. * This source code is licensed under the BSD-style license found in the
  12024. * LICENSE file in the root directory of this source tree. An additional grant
  12025. * of patent rights can be found in the PATENTS file in the same directory.
  12026. *
  12027. * @providesModule ReactReconciler
  12028. */
  12029. 'use strict';
  12030. var ReactRef = _dereq_(85);
  12031. /**
  12032. * Helper to call ReactRef.attachRefs with this composite component, split out
  12033. * to avoid allocations in the transaction mount-ready queue.
  12034. */
  12035. function attachRefs() {
  12036. ReactRef.attachRefs(this, this._currentElement);
  12037. }
  12038. var ReactReconciler = {
  12039. /**
  12040. * Initializes the component, renders markup, and registers event listeners.
  12041. *
  12042. * @param {ReactComponent} internalInstance
  12043. * @param {string} rootID DOM ID of the root node.
  12044. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  12045. * @return {?string} Rendered markup to be inserted into the DOM.
  12046. * @final
  12047. * @internal
  12048. */
  12049. mountComponent: function (internalInstance, rootID, transaction, context) {
  12050. var markup = internalInstance.mountComponent(rootID, transaction, context);
  12051. if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
  12052. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  12053. }
  12054. return markup;
  12055. },
  12056. /**
  12057. * Releases any resources allocated by `mountComponent`.
  12058. *
  12059. * @final
  12060. * @internal
  12061. */
  12062. unmountComponent: function (internalInstance) {
  12063. ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
  12064. internalInstance.unmountComponent();
  12065. },
  12066. /**
  12067. * Update a component using a new element.
  12068. *
  12069. * @param {ReactComponent} internalInstance
  12070. * @param {ReactElement} nextElement
  12071. * @param {ReactReconcileTransaction} transaction
  12072. * @param {object} context
  12073. * @internal
  12074. */
  12075. receiveComponent: function (internalInstance, nextElement, transaction, context) {
  12076. var prevElement = internalInstance._currentElement;
  12077. if (nextElement === prevElement && context === internalInstance._context) {
  12078. // Since elements are immutable after the owner is rendered,
  12079. // we can do a cheap identity compare here to determine if this is a
  12080. // superfluous reconcile. It's possible for state to be mutable but such
  12081. // change should trigger an update of the owner which would recreate
  12082. // the element. We explicitly check for the existence of an owner since
  12083. // it's possible for an element created outside a composite to be
  12084. // deeply mutated and reused.
  12085. // TODO: Bailing out early is just a perf optimization right?
  12086. // TODO: Removing the return statement should affect correctness?
  12087. return;
  12088. }
  12089. var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
  12090. if (refsChanged) {
  12091. ReactRef.detachRefs(internalInstance, prevElement);
  12092. }
  12093. internalInstance.receiveComponent(nextElement, transaction, context);
  12094. if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
  12095. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  12096. }
  12097. },
  12098. /**
  12099. * Flush any dirty changes in a component.
  12100. *
  12101. * @param {ReactComponent} internalInstance
  12102. * @param {ReactReconcileTransaction} transaction
  12103. * @internal
  12104. */
  12105. performUpdateIfNecessary: function (internalInstance, transaction) {
  12106. internalInstance.performUpdateIfNecessary(transaction);
  12107. }
  12108. };
  12109. module.exports = ReactReconciler;
  12110. },{"85":85}],85:[function(_dereq_,module,exports){
  12111. /**
  12112. * Copyright 2013-2015, Facebook, Inc.
  12113. * All rights reserved.
  12114. *
  12115. * This source code is licensed under the BSD-style license found in the
  12116. * LICENSE file in the root directory of this source tree. An additional grant
  12117. * of patent rights can be found in the PATENTS file in the same directory.
  12118. *
  12119. * @providesModule ReactRef
  12120. */
  12121. 'use strict';
  12122. var ReactOwner = _dereq_(77);
  12123. var ReactRef = {};
  12124. function attachRef(ref, component, owner) {
  12125. if (typeof ref === 'function') {
  12126. ref(component.getPublicInstance());
  12127. } else {
  12128. // Legacy ref
  12129. ReactOwner.addComponentAsRefTo(component, ref, owner);
  12130. }
  12131. }
  12132. function detachRef(ref, component, owner) {
  12133. if (typeof ref === 'function') {
  12134. ref(null);
  12135. } else {
  12136. // Legacy ref
  12137. ReactOwner.removeComponentAsRefFrom(component, ref, owner);
  12138. }
  12139. }
  12140. ReactRef.attachRefs = function (instance, element) {
  12141. if (element === null || element === false) {
  12142. return;
  12143. }
  12144. var ref = element.ref;
  12145. if (ref != null) {
  12146. attachRef(ref, instance, element._owner);
  12147. }
  12148. };
  12149. ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
  12150. // If either the owner or a `ref` has changed, make sure the newest owner
  12151. // has stored a reference to `this`, and the previous owner (if different)
  12152. // has forgotten the reference to `this`. We use the element instead
  12153. // of the public this.props because the post processing cannot determine
  12154. // a ref. The ref conceptually lives on the element.
  12155. // TODO: Should this even be possible? The owner cannot change because
  12156. // it's forbidden by shouldUpdateReactComponent. The ref can change
  12157. // if you swap the keys of but not the refs. Reconsider where this check
  12158. // is made. It probably belongs where the key checking and
  12159. // instantiateReactComponent is done.
  12160. var prevEmpty = prevElement === null || prevElement === false;
  12161. var nextEmpty = nextElement === null || nextElement === false;
  12162. return(
  12163. // This has a few false positives w/r/t empty components.
  12164. prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref
  12165. );
  12166. };
  12167. ReactRef.detachRefs = function (instance, element) {
  12168. if (element === null || element === false) {
  12169. return;
  12170. }
  12171. var ref = element.ref;
  12172. if (ref != null) {
  12173. detachRef(ref, instance, element._owner);
  12174. }
  12175. };
  12176. module.exports = ReactRef;
  12177. },{"77":77}],86:[function(_dereq_,module,exports){
  12178. /**
  12179. * Copyright 2013-2015, Facebook, Inc.
  12180. * All rights reserved.
  12181. *
  12182. * This source code is licensed under the BSD-style license found in the
  12183. * LICENSE file in the root directory of this source tree. An additional grant
  12184. * of patent rights can be found in the PATENTS file in the same directory.
  12185. *
  12186. * @providesModule ReactRootIndex
  12187. * @typechecks
  12188. */
  12189. 'use strict';
  12190. var ReactRootIndexInjection = {
  12191. /**
  12192. * @param {function} _createReactRootIndex
  12193. */
  12194. injectCreateReactRootIndex: function (_createReactRootIndex) {
  12195. ReactRootIndex.createReactRootIndex = _createReactRootIndex;
  12196. }
  12197. };
  12198. var ReactRootIndex = {
  12199. createReactRootIndex: null,
  12200. injection: ReactRootIndexInjection
  12201. };
  12202. module.exports = ReactRootIndex;
  12203. },{}],87:[function(_dereq_,module,exports){
  12204. /**
  12205. * Copyright 2014-2015, Facebook, Inc.
  12206. * All rights reserved.
  12207. *
  12208. * This source code is licensed under the BSD-style license found in the
  12209. * LICENSE file in the root directory of this source tree. An additional grant
  12210. * of patent rights can be found in the PATENTS file in the same directory.
  12211. *
  12212. * @providesModule ReactServerBatchingStrategy
  12213. * @typechecks
  12214. */
  12215. 'use strict';
  12216. var ReactServerBatchingStrategy = {
  12217. isBatchingUpdates: false,
  12218. batchedUpdates: function (callback) {
  12219. // Don't do anything here. During the server rendering we don't want to
  12220. // schedule any updates. We will simply ignore them.
  12221. }
  12222. };
  12223. module.exports = ReactServerBatchingStrategy;
  12224. },{}],88:[function(_dereq_,module,exports){
  12225. /**
  12226. * Copyright 2013-2015, Facebook, Inc.
  12227. * All rights reserved.
  12228. *
  12229. * This source code is licensed under the BSD-style license found in the
  12230. * LICENSE file in the root directory of this source tree. An additional grant
  12231. * of patent rights can be found in the PATENTS file in the same directory.
  12232. *
  12233. * @typechecks static-only
  12234. * @providesModule ReactServerRendering
  12235. */
  12236. 'use strict';
  12237. var ReactDefaultBatchingStrategy = _dereq_(53);
  12238. var ReactElement = _dereq_(57);
  12239. var ReactInstanceHandles = _dereq_(67);
  12240. var ReactMarkupChecksum = _dereq_(71);
  12241. var ReactServerBatchingStrategy = _dereq_(87);
  12242. var ReactServerRenderingTransaction = _dereq_(89);
  12243. var ReactUpdates = _dereq_(96);
  12244. var emptyObject = _dereq_(154);
  12245. var instantiateReactComponent = _dereq_(132);
  12246. var invariant = _dereq_(161);
  12247. /**
  12248. * @param {ReactElement} element
  12249. * @return {string} the HTML markup
  12250. */
  12251. function renderToString(element) {
  12252. !ReactElement.isValidElement(element) ? "production" !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
  12253. var transaction;
  12254. try {
  12255. ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
  12256. var id = ReactInstanceHandles.createReactRootID();
  12257. transaction = ReactServerRenderingTransaction.getPooled(false);
  12258. return transaction.perform(function () {
  12259. var componentInstance = instantiateReactComponent(element, null);
  12260. var markup = componentInstance.mountComponent(id, transaction, emptyObject);
  12261. return ReactMarkupChecksum.addChecksumToMarkup(markup);
  12262. }, null);
  12263. } finally {
  12264. ReactServerRenderingTransaction.release(transaction);
  12265. // Revert to the DOM batching strategy since these two renderers
  12266. // currently share these stateful modules.
  12267. ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
  12268. }
  12269. }
  12270. /**
  12271. * @param {ReactElement} element
  12272. * @return {string} the HTML markup, without the extra React ID and checksum
  12273. * (for generating static pages)
  12274. */
  12275. function renderToStaticMarkup(element) {
  12276. !ReactElement.isValidElement(element) ? "production" !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
  12277. var transaction;
  12278. try {
  12279. ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
  12280. var id = ReactInstanceHandles.createReactRootID();
  12281. transaction = ReactServerRenderingTransaction.getPooled(true);
  12282. return transaction.perform(function () {
  12283. var componentInstance = instantiateReactComponent(element, null);
  12284. return componentInstance.mountComponent(id, transaction, emptyObject);
  12285. }, null);
  12286. } finally {
  12287. ReactServerRenderingTransaction.release(transaction);
  12288. // Revert to the DOM batching strategy since these two renderers
  12289. // currently share these stateful modules.
  12290. ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
  12291. }
  12292. }
  12293. module.exports = {
  12294. renderToString: renderToString,
  12295. renderToStaticMarkup: renderToStaticMarkup
  12296. };
  12297. },{"132":132,"154":154,"161":161,"53":53,"57":57,"67":67,"71":71,"87":87,"89":89,"96":96}],89:[function(_dereq_,module,exports){
  12298. /**
  12299. * Copyright 2014-2015, Facebook, Inc.
  12300. * All rights reserved.
  12301. *
  12302. * This source code is licensed under the BSD-style license found in the
  12303. * LICENSE file in the root directory of this source tree. An additional grant
  12304. * of patent rights can be found in the PATENTS file in the same directory.
  12305. *
  12306. * @providesModule ReactServerRenderingTransaction
  12307. * @typechecks
  12308. */
  12309. 'use strict';
  12310. var PooledClass = _dereq_(25);
  12311. var CallbackQueue = _dereq_(6);
  12312. var Transaction = _dereq_(113);
  12313. var assign = _dereq_(24);
  12314. var emptyFunction = _dereq_(153);
  12315. /**
  12316. * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
  12317. * during the performing of the transaction.
  12318. */
  12319. var ON_DOM_READY_QUEUEING = {
  12320. /**
  12321. * Initializes the internal `onDOMReady` queue.
  12322. */
  12323. initialize: function () {
  12324. this.reactMountReady.reset();
  12325. },
  12326. close: emptyFunction
  12327. };
  12328. /**
  12329. * Executed within the scope of the `Transaction` instance. Consider these as
  12330. * being member methods, but with an implied ordering while being isolated from
  12331. * each other.
  12332. */
  12333. var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
  12334. /**
  12335. * @class ReactServerRenderingTransaction
  12336. * @param {boolean} renderToStaticMarkup
  12337. */
  12338. function ReactServerRenderingTransaction(renderToStaticMarkup) {
  12339. this.reinitializeTransaction();
  12340. this.renderToStaticMarkup = renderToStaticMarkup;
  12341. this.reactMountReady = CallbackQueue.getPooled(null);
  12342. this.useCreateElement = false;
  12343. }
  12344. var Mixin = {
  12345. /**
  12346. * @see Transaction
  12347. * @abstract
  12348. * @final
  12349. * @return {array} Empty list of operation wrap procedures.
  12350. */
  12351. getTransactionWrappers: function () {
  12352. return TRANSACTION_WRAPPERS;
  12353. },
  12354. /**
  12355. * @return {object} The queue to collect `onDOMReady` callbacks with.
  12356. */
  12357. getReactMountReady: function () {
  12358. return this.reactMountReady;
  12359. },
  12360. /**
  12361. * `PooledClass` looks for this, and will invoke this before allowing this
  12362. * instance to be reused.
  12363. */
  12364. destructor: function () {
  12365. CallbackQueue.release(this.reactMountReady);
  12366. this.reactMountReady = null;
  12367. }
  12368. };
  12369. assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
  12370. PooledClass.addPoolingTo(ReactServerRenderingTransaction);
  12371. module.exports = ReactServerRenderingTransaction;
  12372. },{"113":113,"153":153,"24":24,"25":25,"6":6}],90:[function(_dereq_,module,exports){
  12373. /**
  12374. * Copyright 2013-2015, Facebook, Inc.
  12375. * All rights reserved.
  12376. *
  12377. * This source code is licensed under the BSD-style license found in the
  12378. * LICENSE file in the root directory of this source tree. An additional grant
  12379. * of patent rights can be found in the PATENTS file in the same directory.
  12380. *
  12381. * @providesModule ReactStateSetters
  12382. */
  12383. 'use strict';
  12384. var ReactStateSetters = {
  12385. /**
  12386. * Returns a function that calls the provided function, and uses the result
  12387. * of that to set the component's state.
  12388. *
  12389. * @param {ReactCompositeComponent} component
  12390. * @param {function} funcReturningState Returned callback uses this to
  12391. * determine how to update state.
  12392. * @return {function} callback that when invoked uses funcReturningState to
  12393. * determined the object literal to setState.
  12394. */
  12395. createStateSetter: function (component, funcReturningState) {
  12396. return function (a, b, c, d, e, f) {
  12397. var partialState = funcReturningState.call(component, a, b, c, d, e, f);
  12398. if (partialState) {
  12399. component.setState(partialState);
  12400. }
  12401. };
  12402. },
  12403. /**
  12404. * Returns a single-argument callback that can be used to update a single
  12405. * key in the component's state.
  12406. *
  12407. * Note: this is memoized function, which makes it inexpensive to call.
  12408. *
  12409. * @param {ReactCompositeComponent} component
  12410. * @param {string} key The key in the state that you should update.
  12411. * @return {function} callback of 1 argument which calls setState() with
  12412. * the provided keyName and callback argument.
  12413. */
  12414. createStateKeySetter: function (component, key) {
  12415. // Memoize the setters.
  12416. var cache = component.__keySetters || (component.__keySetters = {});
  12417. return cache[key] || (cache[key] = createStateKeySetter(component, key));
  12418. }
  12419. };
  12420. function createStateKeySetter(component, key) {
  12421. // Partial state is allocated outside of the function closure so it can be
  12422. // reused with every call, avoiding memory allocation when this function
  12423. // is called.
  12424. var partialState = {};
  12425. return function stateKeySetter(value) {
  12426. partialState[key] = value;
  12427. component.setState(partialState);
  12428. };
  12429. }
  12430. ReactStateSetters.Mixin = {
  12431. /**
  12432. * Returns a function that calls the provided function, and uses the result
  12433. * of that to set the component's state.
  12434. *
  12435. * For example, these statements are equivalent:
  12436. *
  12437. * this.setState({x: 1});
  12438. * this.createStateSetter(function(xValue) {
  12439. * return {x: xValue};
  12440. * })(1);
  12441. *
  12442. * @param {function} funcReturningState Returned callback uses this to
  12443. * determine how to update state.
  12444. * @return {function} callback that when invoked uses funcReturningState to
  12445. * determined the object literal to setState.
  12446. */
  12447. createStateSetter: function (funcReturningState) {
  12448. return ReactStateSetters.createStateSetter(this, funcReturningState);
  12449. },
  12450. /**
  12451. * Returns a single-argument callback that can be used to update a single
  12452. * key in the component's state.
  12453. *
  12454. * For example, these statements are equivalent:
  12455. *
  12456. * this.setState({x: 1});
  12457. * this.createStateKeySetter('x')(1);
  12458. *
  12459. * Note: this is memoized function, which makes it inexpensive to call.
  12460. *
  12461. * @param {string} key The key in the state that you should update.
  12462. * @return {function} callback of 1 argument which calls setState() with
  12463. * the provided keyName and callback argument.
  12464. */
  12465. createStateKeySetter: function (key) {
  12466. return ReactStateSetters.createStateKeySetter(this, key);
  12467. }
  12468. };
  12469. module.exports = ReactStateSetters;
  12470. },{}],91:[function(_dereq_,module,exports){
  12471. /**
  12472. * Copyright 2013-2015, Facebook, Inc.
  12473. * All rights reserved.
  12474. *
  12475. * This source code is licensed under the BSD-style license found in the
  12476. * LICENSE file in the root directory of this source tree. An additional grant
  12477. * of patent rights can be found in the PATENTS file in the same directory.
  12478. *
  12479. * @providesModule ReactTestUtils
  12480. */
  12481. 'use strict';
  12482. var EventConstants = _dereq_(15);
  12483. var EventPluginHub = _dereq_(16);
  12484. var EventPropagators = _dereq_(19);
  12485. var React = _dereq_(26);
  12486. var ReactDOM = _dereq_(40);
  12487. var ReactElement = _dereq_(57);
  12488. var ReactBrowserEventEmitter = _dereq_(28);
  12489. var ReactCompositeComponent = _dereq_(38);
  12490. var ReactInstanceHandles = _dereq_(67);
  12491. var ReactInstanceMap = _dereq_(68);
  12492. var ReactMount = _dereq_(72);
  12493. var ReactUpdates = _dereq_(96);
  12494. var SyntheticEvent = _dereq_(105);
  12495. var assign = _dereq_(24);
  12496. var emptyObject = _dereq_(154);
  12497. var findDOMNode = _dereq_(122);
  12498. var invariant = _dereq_(161);
  12499. var topLevelTypes = EventConstants.topLevelTypes;
  12500. function Event(suffix) {}
  12501. /**
  12502. * @class ReactTestUtils
  12503. */
  12504. function findAllInRenderedTreeInternal(inst, test) {
  12505. if (!inst || !inst.getPublicInstance) {
  12506. return [];
  12507. }
  12508. var publicInst = inst.getPublicInstance();
  12509. var ret = test(publicInst) ? [publicInst] : [];
  12510. var currentElement = inst._currentElement;
  12511. if (ReactTestUtils.isDOMComponent(publicInst)) {
  12512. var renderedChildren = inst._renderedChildren;
  12513. var key;
  12514. for (key in renderedChildren) {
  12515. if (!renderedChildren.hasOwnProperty(key)) {
  12516. continue;
  12517. }
  12518. ret = ret.concat(findAllInRenderedTreeInternal(renderedChildren[key], test));
  12519. }
  12520. } else if (ReactElement.isValidElement(currentElement) && typeof currentElement.type === 'function') {
  12521. ret = ret.concat(findAllInRenderedTreeInternal(inst._renderedComponent, test));
  12522. }
  12523. return ret;
  12524. }
  12525. /**
  12526. * Todo: Support the entire DOM.scry query syntax. For now, these simple
  12527. * utilities will suffice for testing purposes.
  12528. * @lends ReactTestUtils
  12529. */
  12530. var ReactTestUtils = {
  12531. renderIntoDocument: function (instance) {
  12532. var div = document.createElementNS('http://www.w3.org/1999/xhtml', 'div');
  12533. // None of our tests actually require attaching the container to the
  12534. // DOM, and doing so creates a mess that we rely on test isolation to
  12535. // clean up, so we're going to stop honoring the name of this method
  12536. // (and probably rename it eventually) if no problems arise.
  12537. // document.documentElement.appendChild(div);
  12538. return ReactDOM.render(instance, div);
  12539. },
  12540. isElement: function (element) {
  12541. return ReactElement.isValidElement(element);
  12542. },
  12543. isElementOfType: function (inst, convenienceConstructor) {
  12544. return ReactElement.isValidElement(inst) && inst.type === convenienceConstructor;
  12545. },
  12546. isDOMComponent: function (inst) {
  12547. return !!(inst && inst.nodeType === 1 && inst.tagName);
  12548. },
  12549. isDOMComponentElement: function (inst) {
  12550. return !!(inst && ReactElement.isValidElement(inst) && !!inst.tagName);
  12551. },
  12552. isCompositeComponent: function (inst) {
  12553. if (ReactTestUtils.isDOMComponent(inst)) {
  12554. // Accessing inst.setState warns; just return false as that'll be what
  12555. // this returns when we have DOM nodes as refs directly
  12556. return false;
  12557. }
  12558. return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
  12559. },
  12560. isCompositeComponentWithType: function (inst, type) {
  12561. if (!ReactTestUtils.isCompositeComponent(inst)) {
  12562. return false;
  12563. }
  12564. var internalInstance = ReactInstanceMap.get(inst);
  12565. var constructor = internalInstance._currentElement.type;
  12566. return constructor === type;
  12567. },
  12568. isCompositeComponentElement: function (inst) {
  12569. if (!ReactElement.isValidElement(inst)) {
  12570. return false;
  12571. }
  12572. // We check the prototype of the type that will get mounted, not the
  12573. // instance itself. This is a future proof way of duck typing.
  12574. var prototype = inst.type.prototype;
  12575. return typeof prototype.render === 'function' && typeof prototype.setState === 'function';
  12576. },
  12577. isCompositeComponentElementWithType: function (inst, type) {
  12578. var internalInstance = ReactInstanceMap.get(inst);
  12579. var constructor = internalInstance._currentElement.type;
  12580. return !!(ReactTestUtils.isCompositeComponentElement(inst) && constructor === type);
  12581. },
  12582. getRenderedChildOfCompositeComponent: function (inst) {
  12583. if (!ReactTestUtils.isCompositeComponent(inst)) {
  12584. return null;
  12585. }
  12586. var internalInstance = ReactInstanceMap.get(inst);
  12587. return internalInstance._renderedComponent.getPublicInstance();
  12588. },
  12589. findAllInRenderedTree: function (inst, test) {
  12590. if (!inst) {
  12591. return [];
  12592. }
  12593. !ReactTestUtils.isCompositeComponent(inst) ? "production" !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : invariant(false) : undefined;
  12594. return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test);
  12595. },
  12596. /**
  12597. * Finds all instance of components in the rendered tree that are DOM
  12598. * components with the class name matching `className`.
  12599. * @return {array} an array of all the matches.
  12600. */
  12601. scryRenderedDOMComponentsWithClass: function (root, classNames) {
  12602. if (!Array.isArray(classNames)) {
  12603. classNames = classNames.split(/\s+/);
  12604. }
  12605. return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
  12606. if (ReactTestUtils.isDOMComponent(inst)) {
  12607. var className = inst.className;
  12608. if (typeof className !== 'string') {
  12609. // SVG, probably.
  12610. className = inst.getAttribute('class') || '';
  12611. }
  12612. var classList = className.split(/\s+/);
  12613. return classNames.every(function (name) {
  12614. return classList.indexOf(name) !== -1;
  12615. });
  12616. }
  12617. return false;
  12618. });
  12619. },
  12620. /**
  12621. * Like scryRenderedDOMComponentsWithClass but expects there to be one result,
  12622. * and returns that one result, or throws exception if there is any other
  12623. * number of matches besides one.
  12624. * @return {!ReactDOMComponent} The one match.
  12625. */
  12626. findRenderedDOMComponentWithClass: function (root, className) {
  12627. var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
  12628. if (all.length !== 1) {
  12629. throw new Error('Did not find exactly one match ' + '(found: ' + all.length + ') for class:' + className);
  12630. }
  12631. return all[0];
  12632. },
  12633. /**
  12634. * Finds all instance of components in the rendered tree that are DOM
  12635. * components with the tag name matching `tagName`.
  12636. * @return {array} an array of all the matches.
  12637. */
  12638. scryRenderedDOMComponentsWithTag: function (root, tagName) {
  12639. return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
  12640. return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
  12641. });
  12642. },
  12643. /**
  12644. * Like scryRenderedDOMComponentsWithTag but expects there to be one result,
  12645. * and returns that one result, or throws exception if there is any other
  12646. * number of matches besides one.
  12647. * @return {!ReactDOMComponent} The one match.
  12648. */
  12649. findRenderedDOMComponentWithTag: function (root, tagName) {
  12650. var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
  12651. if (all.length !== 1) {
  12652. throw new Error('Did not find exactly one match for tag:' + tagName);
  12653. }
  12654. return all[0];
  12655. },
  12656. /**
  12657. * Finds all instances of components with type equal to `componentType`.
  12658. * @return {array} an array of all the matches.
  12659. */
  12660. scryRenderedComponentsWithType: function (root, componentType) {
  12661. return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
  12662. return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
  12663. });
  12664. },
  12665. /**
  12666. * Same as `scryRenderedComponentsWithType` but expects there to be one result
  12667. * and returns that one result, or throws exception if there is any other
  12668. * number of matches besides one.
  12669. * @return {!ReactComponent} The one match.
  12670. */
  12671. findRenderedComponentWithType: function (root, componentType) {
  12672. var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
  12673. if (all.length !== 1) {
  12674. throw new Error('Did not find exactly one match for componentType:' + componentType + ' (found ' + all.length + ')');
  12675. }
  12676. return all[0];
  12677. },
  12678. /**
  12679. * Pass a mocked component module to this method to augment it with
  12680. * useful methods that allow it to be used as a dummy React component.
  12681. * Instead of rendering as usual, the component will become a simple
  12682. * <div> containing any provided children.
  12683. *
  12684. * @param {object} module the mock function object exported from a
  12685. * module that defines the component to be mocked
  12686. * @param {?string} mockTagName optional dummy root tag name to return
  12687. * from render method (overrides
  12688. * module.mockTagName if provided)
  12689. * @return {object} the ReactTestUtils object (for chaining)
  12690. */
  12691. mockComponent: function (module, mockTagName) {
  12692. mockTagName = mockTagName || module.mockTagName || 'div';
  12693. module.prototype.render.mockImplementation(function () {
  12694. return React.createElement(mockTagName, null, this.props.children);
  12695. });
  12696. return this;
  12697. },
  12698. /**
  12699. * Simulates a top level event being dispatched from a raw event that occurred
  12700. * on an `Element` node.
  12701. * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`
  12702. * @param {!Element} node The dom to simulate an event occurring on.
  12703. * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
  12704. */
  12705. simulateNativeEventOnNode: function (topLevelType, node, fakeNativeEvent) {
  12706. fakeNativeEvent.target = node;
  12707. ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
  12708. },
  12709. /**
  12710. * Simulates a top level event being dispatched from a raw event that occurred
  12711. * on the `ReactDOMComponent` `comp`.
  12712. * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`.
  12713. * @param {!ReactDOMComponent} comp
  12714. * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
  12715. */
  12716. simulateNativeEventOnDOMComponent: function (topLevelType, comp, fakeNativeEvent) {
  12717. ReactTestUtils.simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent);
  12718. },
  12719. nativeTouchData: function (x, y) {
  12720. return {
  12721. touches: [{ pageX: x, pageY: y }]
  12722. };
  12723. },
  12724. createRenderer: function () {
  12725. return new ReactShallowRenderer();
  12726. },
  12727. Simulate: null,
  12728. SimulateNative: {}
  12729. };
  12730. /**
  12731. * @class ReactShallowRenderer
  12732. */
  12733. var ReactShallowRenderer = function () {
  12734. this._instance = null;
  12735. };
  12736. ReactShallowRenderer.prototype.getRenderOutput = function () {
  12737. return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null;
  12738. };
  12739. var NoopInternalComponent = function (element) {
  12740. this._renderedOutput = element;
  12741. this._currentElement = element;
  12742. };
  12743. NoopInternalComponent.prototype = {
  12744. mountComponent: function () {},
  12745. receiveComponent: function (element) {
  12746. this._renderedOutput = element;
  12747. this._currentElement = element;
  12748. },
  12749. unmountComponent: function () {},
  12750. getPublicInstance: function () {
  12751. return null;
  12752. }
  12753. };
  12754. var ShallowComponentWrapper = function () {};
  12755. assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
  12756. _instantiateReactComponent: function (element) {
  12757. return new NoopInternalComponent(element);
  12758. },
  12759. _replaceNodeWithMarkupByID: function () {},
  12760. _renderValidatedComponent: ReactCompositeComponent.Mixin._renderValidatedComponentWithoutOwnerOrContext
  12761. });
  12762. ReactShallowRenderer.prototype.render = function (element, context) {
  12763. !ReactElement.isValidElement(element) ? "production" !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : invariant(false) : undefined;
  12764. !(typeof element.type !== 'string') ? "production" !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom ' + 'components, not primitives (%s). Instead of calling `.render(el)` and ' + 'inspecting the rendered output, look at `el.props` directly instead.', element.type) : invariant(false) : undefined;
  12765. if (!context) {
  12766. context = emptyObject;
  12767. }
  12768. var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(false);
  12769. this._render(element, transaction, context);
  12770. ReactUpdates.ReactReconcileTransaction.release(transaction);
  12771. };
  12772. ReactShallowRenderer.prototype.unmount = function () {
  12773. if (this._instance) {
  12774. this._instance.unmountComponent();
  12775. }
  12776. };
  12777. ReactShallowRenderer.prototype._render = function (element, transaction, context) {
  12778. if (this._instance) {
  12779. this._instance.receiveComponent(element, transaction, context);
  12780. } else {
  12781. var rootID = ReactInstanceHandles.createReactRootID();
  12782. var instance = new ShallowComponentWrapper(element.type);
  12783. instance.construct(element);
  12784. instance.mountComponent(rootID, transaction, context);
  12785. this._instance = instance;
  12786. }
  12787. };
  12788. /**
  12789. * Exports:
  12790. *
  12791. * - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`
  12792. * - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)`
  12793. * - `ReactTestUtils.Simulate.change(Element/ReactDOMComponent)`
  12794. * - ... (All keys from event plugin `eventTypes` objects)
  12795. */
  12796. function makeSimulator(eventType) {
  12797. return function (domComponentOrNode, eventData) {
  12798. var node;
  12799. if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
  12800. node = findDOMNode(domComponentOrNode);
  12801. } else if (domComponentOrNode.tagName) {
  12802. node = domComponentOrNode;
  12803. }
  12804. var dispatchConfig = ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType];
  12805. var fakeNativeEvent = new Event();
  12806. fakeNativeEvent.target = node;
  12807. // We don't use SyntheticEvent.getPooled in order to not have to worry about
  12808. // properly destroying any properties assigned from `eventData` upon release
  12809. var event = new SyntheticEvent(dispatchConfig, ReactMount.getID(node), fakeNativeEvent, node);
  12810. assign(event, eventData);
  12811. if (dispatchConfig.phasedRegistrationNames) {
  12812. EventPropagators.accumulateTwoPhaseDispatches(event);
  12813. } else {
  12814. EventPropagators.accumulateDirectDispatches(event);
  12815. }
  12816. ReactUpdates.batchedUpdates(function () {
  12817. EventPluginHub.enqueueEvents(event);
  12818. EventPluginHub.processEventQueue(true);
  12819. });
  12820. };
  12821. }
  12822. function buildSimulators() {
  12823. ReactTestUtils.Simulate = {};
  12824. var eventType;
  12825. for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) {
  12826. /**
  12827. * @param {!Element|ReactDOMComponent} domComponentOrNode
  12828. * @param {?object} eventData Fake event data to use in SyntheticEvent.
  12829. */
  12830. ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
  12831. }
  12832. }
  12833. // Rebuild ReactTestUtils.Simulate whenever event plugins are injected
  12834. var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder;
  12835. EventPluginHub.injection.injectEventPluginOrder = function () {
  12836. oldInjectEventPluginOrder.apply(this, arguments);
  12837. buildSimulators();
  12838. };
  12839. var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
  12840. EventPluginHub.injection.injectEventPluginsByName = function () {
  12841. oldInjectEventPlugins.apply(this, arguments);
  12842. buildSimulators();
  12843. };
  12844. buildSimulators();
  12845. /**
  12846. * Exports:
  12847. *
  12848. * - `ReactTestUtils.SimulateNative.click(Element/ReactDOMComponent)`
  12849. * - `ReactTestUtils.SimulateNative.mouseMove(Element/ReactDOMComponent)`
  12850. * - `ReactTestUtils.SimulateNative.mouseIn/ReactDOMComponent)`
  12851. * - `ReactTestUtils.SimulateNative.mouseOut(Element/ReactDOMComponent)`
  12852. * - ... (All keys from `EventConstants.topLevelTypes`)
  12853. *
  12854. * Note: Top level event types are a subset of the entire set of handler types
  12855. * (which include a broader set of "synthetic" events). For example, onDragDone
  12856. * is a synthetic event. Except when testing an event plugin or React's event
  12857. * handling code specifically, you probably want to use ReactTestUtils.Simulate
  12858. * to dispatch synthetic events.
  12859. */
  12860. function makeNativeSimulator(eventType) {
  12861. return function (domComponentOrNode, nativeEventData) {
  12862. var fakeNativeEvent = new Event(eventType);
  12863. assign(fakeNativeEvent, nativeEventData);
  12864. if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
  12865. ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent);
  12866. } else if (domComponentOrNode.tagName) {
  12867. // Will allow on actual dom nodes.
  12868. ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent);
  12869. }
  12870. };
  12871. }
  12872. Object.keys(topLevelTypes).forEach(function (eventType) {
  12873. // Event type is stored as 'topClick' - we transform that to 'click'
  12874. var convenienceName = eventType.indexOf('top') === 0 ? eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
  12875. /**
  12876. * @param {!Element|ReactDOMComponent} domComponentOrNode
  12877. * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
  12878. */
  12879. ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType);
  12880. });
  12881. module.exports = ReactTestUtils;
  12882. },{"105":105,"122":122,"15":15,"154":154,"16":16,"161":161,"19":19,"24":24,"26":26,"28":28,"38":38,"40":40,"57":57,"67":67,"68":68,"72":72,"96":96}],92:[function(_dereq_,module,exports){
  12883. /**
  12884. * Copyright 2013-2015, Facebook, Inc.
  12885. * All rights reserved.
  12886. *
  12887. * This source code is licensed under the BSD-style license found in the
  12888. * LICENSE file in the root directory of this source tree. An additional grant
  12889. * of patent rights can be found in the PATENTS file in the same directory.
  12890. *
  12891. * @typechecks static-only
  12892. * @providesModule ReactTransitionChildMapping
  12893. */
  12894. 'use strict';
  12895. var flattenChildren = _dereq_(123);
  12896. var ReactTransitionChildMapping = {
  12897. /**
  12898. * Given `this.props.children`, return an object mapping key to child. Just
  12899. * simple syntactic sugar around flattenChildren().
  12900. *
  12901. * @param {*} children `this.props.children`
  12902. * @return {object} Mapping of key to child
  12903. */
  12904. getChildMapping: function (children) {
  12905. if (!children) {
  12906. return children;
  12907. }
  12908. return flattenChildren(children);
  12909. },
  12910. /**
  12911. * When you're adding or removing children some may be added or removed in the
  12912. * same render pass. We want to show *both* since we want to simultaneously
  12913. * animate elements in and out. This function takes a previous set of keys
  12914. * and a new set of keys and merges them with its best guess of the correct
  12915. * ordering. In the future we may expose some of the utilities in
  12916. * ReactMultiChild to make this easy, but for now React itself does not
  12917. * directly have this concept of the union of prevChildren and nextChildren
  12918. * so we implement it here.
  12919. *
  12920. * @param {object} prev prev children as returned from
  12921. * `ReactTransitionChildMapping.getChildMapping()`.
  12922. * @param {object} next next children as returned from
  12923. * `ReactTransitionChildMapping.getChildMapping()`.
  12924. * @return {object} a key set that contains all keys in `prev` and all keys
  12925. * in `next` in a reasonable order.
  12926. */
  12927. mergeChildMappings: function (prev, next) {
  12928. prev = prev || {};
  12929. next = next || {};
  12930. function getValueForKey(key) {
  12931. if (next.hasOwnProperty(key)) {
  12932. return next[key];
  12933. } else {
  12934. return prev[key];
  12935. }
  12936. }
  12937. // For each key of `next`, the list of keys to insert before that key in
  12938. // the combined list
  12939. var nextKeysPending = {};
  12940. var pendingKeys = [];
  12941. for (var prevKey in prev) {
  12942. if (next.hasOwnProperty(prevKey)) {
  12943. if (pendingKeys.length) {
  12944. nextKeysPending[prevKey] = pendingKeys;
  12945. pendingKeys = [];
  12946. }
  12947. } else {
  12948. pendingKeys.push(prevKey);
  12949. }
  12950. }
  12951. var i;
  12952. var childMapping = {};
  12953. for (var nextKey in next) {
  12954. if (nextKeysPending.hasOwnProperty(nextKey)) {
  12955. for (i = 0; i < nextKeysPending[nextKey].length; i++) {
  12956. var pendingNextKey = nextKeysPending[nextKey][i];
  12957. childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
  12958. }
  12959. }
  12960. childMapping[nextKey] = getValueForKey(nextKey);
  12961. }
  12962. // Finally, add the keys which didn't appear before any key in `next`
  12963. for (i = 0; i < pendingKeys.length; i++) {
  12964. childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
  12965. }
  12966. return childMapping;
  12967. }
  12968. };
  12969. module.exports = ReactTransitionChildMapping;
  12970. },{"123":123}],93:[function(_dereq_,module,exports){
  12971. /**
  12972. * Copyright 2013-2015, Facebook, Inc.
  12973. * All rights reserved.
  12974. *
  12975. * This source code is licensed under the BSD-style license found in the
  12976. * LICENSE file in the root directory of this source tree. An additional grant
  12977. * of patent rights can be found in the PATENTS file in the same directory.
  12978. *
  12979. * @providesModule ReactTransitionEvents
  12980. */
  12981. 'use strict';
  12982. var ExecutionEnvironment = _dereq_(147);
  12983. /**
  12984. * EVENT_NAME_MAP is used to determine which event fired when a
  12985. * transition/animation ends, based on the style property used to
  12986. * define that event.
  12987. */
  12988. var EVENT_NAME_MAP = {
  12989. transitionend: {
  12990. 'transition': 'transitionend',
  12991. 'WebkitTransition': 'webkitTransitionEnd',
  12992. 'MozTransition': 'mozTransitionEnd',
  12993. 'OTransition': 'oTransitionEnd',
  12994. 'msTransition': 'MSTransitionEnd'
  12995. },
  12996. animationend: {
  12997. 'animation': 'animationend',
  12998. 'WebkitAnimation': 'webkitAnimationEnd',
  12999. 'MozAnimation': 'mozAnimationEnd',
  13000. 'OAnimation': 'oAnimationEnd',
  13001. 'msAnimation': 'MSAnimationEnd'
  13002. }
  13003. };
  13004. var endEvents = [];
  13005. function detectEvents() {
  13006. var testEl = document.createElementNS('http://www.w3.org/1999/xhtml', 'div');
  13007. var style = testEl.style;
  13008. // On some platforms, in particular some releases of Android 4.x,
  13009. // the un-prefixed "animation" and "transition" properties are defined on the
  13010. // style object but the events that fire will still be prefixed, so we need
  13011. // to check if the un-prefixed events are useable, and if not remove them
  13012. // from the map
  13013. if (!('AnimationEvent' in window)) {
  13014. delete EVENT_NAME_MAP.animationend.animation;
  13015. }
  13016. if (!('TransitionEvent' in window)) {
  13017. delete EVENT_NAME_MAP.transitionend.transition;
  13018. }
  13019. for (var baseEventName in EVENT_NAME_MAP) {
  13020. var baseEvents = EVENT_NAME_MAP[baseEventName];
  13021. for (var styleName in baseEvents) {
  13022. if (styleName in style) {
  13023. endEvents.push(baseEvents[styleName]);
  13024. break;
  13025. }
  13026. }
  13027. }
  13028. }
  13029. if (ExecutionEnvironment.canUseDOM) {
  13030. detectEvents();
  13031. }
  13032. // We use the raw {add|remove}EventListener() call because EventListener
  13033. // does not know how to remove event listeners and we really should
  13034. // clean up. Also, these events are not triggered in older browsers
  13035. // so we should be A-OK here.
  13036. function addEventListener(node, eventName, eventListener) {
  13037. node.addEventListener(eventName, eventListener, false);
  13038. }
  13039. function removeEventListener(node, eventName, eventListener) {
  13040. node.removeEventListener(eventName, eventListener, false);
  13041. }
  13042. var ReactTransitionEvents = {
  13043. addEndEventListener: function (node, eventListener) {
  13044. if (endEvents.length === 0) {
  13045. // If CSS transitions are not supported, trigger an "end animation"
  13046. // event immediately.
  13047. window.setTimeout(eventListener, 0);
  13048. return;
  13049. }
  13050. endEvents.forEach(function (endEvent) {
  13051. addEventListener(node, endEvent, eventListener);
  13052. });
  13053. },
  13054. removeEndEventListener: function (node, eventListener) {
  13055. if (endEvents.length === 0) {
  13056. return;
  13057. }
  13058. endEvents.forEach(function (endEvent) {
  13059. removeEventListener(node, endEvent, eventListener);
  13060. });
  13061. }
  13062. };
  13063. module.exports = ReactTransitionEvents;
  13064. },{"147":147}],94:[function(_dereq_,module,exports){
  13065. /**
  13066. * Copyright 2013-2015, Facebook, Inc.
  13067. * All rights reserved.
  13068. *
  13069. * This source code is licensed under the BSD-style license found in the
  13070. * LICENSE file in the root directory of this source tree. An additional grant
  13071. * of patent rights can be found in the PATENTS file in the same directory.
  13072. *
  13073. * @providesModule ReactTransitionGroup
  13074. */
  13075. 'use strict';
  13076. var React = _dereq_(26);
  13077. var ReactTransitionChildMapping = _dereq_(92);
  13078. var assign = _dereq_(24);
  13079. var emptyFunction = _dereq_(153);
  13080. var ReactTransitionGroup = React.createClass({
  13081. displayName: 'ReactTransitionGroup',
  13082. propTypes: {
  13083. component: React.PropTypes.any,
  13084. childFactory: React.PropTypes.func
  13085. },
  13086. getDefaultProps: function () {
  13087. return {
  13088. component: 'span',
  13089. childFactory: emptyFunction.thatReturnsArgument
  13090. };
  13091. },
  13092. getInitialState: function () {
  13093. return {
  13094. children: ReactTransitionChildMapping.getChildMapping(this.props.children)
  13095. };
  13096. },
  13097. componentWillMount: function () {
  13098. this.currentlyTransitioningKeys = {};
  13099. this.keysToEnter = [];
  13100. this.keysToLeave = [];
  13101. },
  13102. componentDidMount: function () {
  13103. var initialChildMapping = this.state.children;
  13104. for (var key in initialChildMapping) {
  13105. if (initialChildMapping[key]) {
  13106. this.performAppear(key);
  13107. }
  13108. }
  13109. },
  13110. componentWillReceiveProps: function (nextProps) {
  13111. var nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children);
  13112. var prevChildMapping = this.state.children;
  13113. this.setState({
  13114. children: ReactTransitionChildMapping.mergeChildMappings(prevChildMapping, nextChildMapping)
  13115. });
  13116. var key;
  13117. for (key in nextChildMapping) {
  13118. var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key);
  13119. if (nextChildMapping[key] && !hasPrev && !this.currentlyTransitioningKeys[key]) {
  13120. this.keysToEnter.push(key);
  13121. }
  13122. }
  13123. for (key in prevChildMapping) {
  13124. var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key);
  13125. if (prevChildMapping[key] && !hasNext && !this.currentlyTransitioningKeys[key]) {
  13126. this.keysToLeave.push(key);
  13127. }
  13128. }
  13129. // If we want to someday check for reordering, we could do it here.
  13130. },
  13131. componentDidUpdate: function () {
  13132. var keysToEnter = this.keysToEnter;
  13133. this.keysToEnter = [];
  13134. keysToEnter.forEach(this.performEnter);
  13135. var keysToLeave = this.keysToLeave;
  13136. this.keysToLeave = [];
  13137. keysToLeave.forEach(this.performLeave);
  13138. },
  13139. performAppear: function (key) {
  13140. this.currentlyTransitioningKeys[key] = true;
  13141. var component = this.refs[key];
  13142. if (component.componentWillAppear) {
  13143. component.componentWillAppear(this._handleDoneAppearing.bind(this, key));
  13144. } else {
  13145. this._handleDoneAppearing(key);
  13146. }
  13147. },
  13148. _handleDoneAppearing: function (key) {
  13149. var component = this.refs[key];
  13150. if (component.componentDidAppear) {
  13151. component.componentDidAppear();
  13152. }
  13153. delete this.currentlyTransitioningKeys[key];
  13154. var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
  13155. if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
  13156. // This was removed before it had fully appeared. Remove it.
  13157. this.performLeave(key);
  13158. }
  13159. },
  13160. performEnter: function (key) {
  13161. this.currentlyTransitioningKeys[key] = true;
  13162. var component = this.refs[key];
  13163. if (component.componentWillEnter) {
  13164. component.componentWillEnter(this._handleDoneEntering.bind(this, key));
  13165. } else {
  13166. this._handleDoneEntering(key);
  13167. }
  13168. },
  13169. _handleDoneEntering: function (key) {
  13170. var component = this.refs[key];
  13171. if (component.componentDidEnter) {
  13172. component.componentDidEnter();
  13173. }
  13174. delete this.currentlyTransitioningKeys[key];
  13175. var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
  13176. if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
  13177. // This was removed before it had fully entered. Remove it.
  13178. this.performLeave(key);
  13179. }
  13180. },
  13181. performLeave: function (key) {
  13182. this.currentlyTransitioningKeys[key] = true;
  13183. var component = this.refs[key];
  13184. if (component.componentWillLeave) {
  13185. component.componentWillLeave(this._handleDoneLeaving.bind(this, key));
  13186. } else {
  13187. // Note that this is somewhat dangerous b/c it calls setState()
  13188. // again, effectively mutating the component before all the work
  13189. // is done.
  13190. this._handleDoneLeaving(key);
  13191. }
  13192. },
  13193. _handleDoneLeaving: function (key) {
  13194. var component = this.refs[key];
  13195. if (component.componentDidLeave) {
  13196. component.componentDidLeave();
  13197. }
  13198. delete this.currentlyTransitioningKeys[key];
  13199. var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
  13200. if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
  13201. // This entered again before it fully left. Add it again.
  13202. this.performEnter(key);
  13203. } else {
  13204. this.setState(function (state) {
  13205. var newChildren = assign({}, state.children);
  13206. delete newChildren[key];
  13207. return { children: newChildren };
  13208. });
  13209. }
  13210. },
  13211. render: function () {
  13212. // TODO: we could get rid of the need for the wrapper node
  13213. // by cloning a single child
  13214. var childrenToRender = [];
  13215. for (var key in this.state.children) {
  13216. var child = this.state.children[key];
  13217. if (child) {
  13218. // You may need to apply reactive updates to a child as it is leaving.
  13219. // The normal React way to do it won't work since the child will have
  13220. // already been removed. In case you need this behavior you can provide
  13221. // a childFactory function to wrap every child, even the ones that are
  13222. // leaving.
  13223. childrenToRender.push(React.cloneElement(this.props.childFactory(child), { ref: key, key: key }));
  13224. }
  13225. }
  13226. return React.createElement(this.props.component, this.props, childrenToRender);
  13227. }
  13228. });
  13229. module.exports = ReactTransitionGroup;
  13230. },{"153":153,"24":24,"26":26,"92":92}],95:[function(_dereq_,module,exports){
  13231. /**
  13232. * Copyright 2015, Facebook, Inc.
  13233. * All rights reserved.
  13234. *
  13235. * This source code is licensed under the BSD-style license found in the
  13236. * LICENSE file in the root directory of this source tree. An additional grant
  13237. * of patent rights can be found in the PATENTS file in the same directory.
  13238. *
  13239. * @providesModule ReactUpdateQueue
  13240. */
  13241. 'use strict';
  13242. var ReactCurrentOwner = _dereq_(39);
  13243. var ReactElement = _dereq_(57);
  13244. var ReactInstanceMap = _dereq_(68);
  13245. var ReactUpdates = _dereq_(96);
  13246. var assign = _dereq_(24);
  13247. var invariant = _dereq_(161);
  13248. var warning = _dereq_(173);
  13249. function enqueueUpdate(internalInstance) {
  13250. ReactUpdates.enqueueUpdate(internalInstance);
  13251. }
  13252. function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
  13253. var internalInstance = ReactInstanceMap.get(publicInstance);
  13254. if (!internalInstance) {
  13255. if ("production" !== 'production') {
  13256. // Only warn when we have a callerName. Otherwise we should be silent.
  13257. // We're probably calling from enqueueCallback. We don't want to warn
  13258. // there because we already warned for the corresponding lifecycle method.
  13259. "production" !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : undefined;
  13260. }
  13261. return null;
  13262. }
  13263. if ("production" !== 'production') {
  13264. "production" !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : undefined;
  13265. }
  13266. return internalInstance;
  13267. }
  13268. /**
  13269. * ReactUpdateQueue allows for state updates to be scheduled into a later
  13270. * reconciliation step.
  13271. */
  13272. var ReactUpdateQueue = {
  13273. /**
  13274. * Checks whether or not this composite component is mounted.
  13275. * @param {ReactClass} publicInstance The instance we want to test.
  13276. * @return {boolean} True if mounted, false otherwise.
  13277. * @protected
  13278. * @final
  13279. */
  13280. isMounted: function (publicInstance) {
  13281. if ("production" !== 'production') {
  13282. var owner = ReactCurrentOwner.current;
  13283. if (owner !== null) {
  13284. "production" !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
  13285. owner._warnedAboutRefsInRender = true;
  13286. }
  13287. }
  13288. var internalInstance = ReactInstanceMap.get(publicInstance);
  13289. if (internalInstance) {
  13290. // During componentWillMount and render this will still be null but after
  13291. // that will always render to something. At least for now. So we can use
  13292. // this hack.
  13293. return !!internalInstance._renderedComponent;
  13294. } else {
  13295. return false;
  13296. }
  13297. },
  13298. /**
  13299. * Enqueue a callback that will be executed after all the pending updates
  13300. * have processed.
  13301. *
  13302. * @param {ReactClass} publicInstance The instance to use as `this` context.
  13303. * @param {?function} callback Called after state is updated.
  13304. * @internal
  13305. */
  13306. enqueueCallback: function (publicInstance, callback) {
  13307. !(typeof callback === 'function') ? "production" !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
  13308. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
  13309. // Previously we would throw an error if we didn't have an internal
  13310. // instance. Since we want to make it a no-op instead, we mirror the same
  13311. // behavior we have in other enqueue* methods.
  13312. // We also need to ignore callbacks in componentWillMount. See
  13313. // enqueueUpdates.
  13314. if (!internalInstance) {
  13315. return null;
  13316. }
  13317. if (internalInstance._pendingCallbacks) {
  13318. internalInstance._pendingCallbacks.push(callback);
  13319. } else {
  13320. internalInstance._pendingCallbacks = [callback];
  13321. }
  13322. // TODO: The callback here is ignored when setState is called from
  13323. // componentWillMount. Either fix it or disallow doing so completely in
  13324. // favor of getInitialState. Alternatively, we can disallow
  13325. // componentWillMount during server-side rendering.
  13326. enqueueUpdate(internalInstance);
  13327. },
  13328. enqueueCallbackInternal: function (internalInstance, callback) {
  13329. !(typeof callback === 'function') ? "production" !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
  13330. if (internalInstance._pendingCallbacks) {
  13331. internalInstance._pendingCallbacks.push(callback);
  13332. } else {
  13333. internalInstance._pendingCallbacks = [callback];
  13334. }
  13335. enqueueUpdate(internalInstance);
  13336. },
  13337. /**
  13338. * Forces an update. This should only be invoked when it is known with
  13339. * certainty that we are **not** in a DOM transaction.
  13340. *
  13341. * You may want to call this when you know that some deeper aspect of the
  13342. * component's state has changed but `setState` was not called.
  13343. *
  13344. * This will not invoke `shouldComponentUpdate`, but it will invoke
  13345. * `componentWillUpdate` and `componentDidUpdate`.
  13346. *
  13347. * @param {ReactClass} publicInstance The instance that should rerender.
  13348. * @internal
  13349. */
  13350. enqueueForceUpdate: function (publicInstance) {
  13351. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
  13352. if (!internalInstance) {
  13353. return;
  13354. }
  13355. internalInstance._pendingForceUpdate = true;
  13356. enqueueUpdate(internalInstance);
  13357. },
  13358. /**
  13359. * Replaces all of the state. Always use this or `setState` to mutate state.
  13360. * You should treat `this.state` as immutable.
  13361. *
  13362. * There is no guarantee that `this.state` will be immediately updated, so
  13363. * accessing `this.state` after calling this method may return the old value.
  13364. *
  13365. * @param {ReactClass} publicInstance The instance that should rerender.
  13366. * @param {object} completeState Next state.
  13367. * @internal
  13368. */
  13369. enqueueReplaceState: function (publicInstance, completeState) {
  13370. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
  13371. if (!internalInstance) {
  13372. return;
  13373. }
  13374. internalInstance._pendingStateQueue = [completeState];
  13375. internalInstance._pendingReplaceState = true;
  13376. enqueueUpdate(internalInstance);
  13377. },
  13378. /**
  13379. * Sets a subset of the state. This only exists because _pendingState is
  13380. * internal. This provides a merging strategy that is not available to deep
  13381. * properties which is confusing. TODO: Expose pendingState or don't use it
  13382. * during the merge.
  13383. *
  13384. * @param {ReactClass} publicInstance The instance that should rerender.
  13385. * @param {object} partialState Next partial state to be merged with state.
  13386. * @internal
  13387. */
  13388. enqueueSetState: function (publicInstance, partialState) {
  13389. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
  13390. if (!internalInstance) {
  13391. return;
  13392. }
  13393. var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
  13394. queue.push(partialState);
  13395. enqueueUpdate(internalInstance);
  13396. },
  13397. /**
  13398. * Sets a subset of the props.
  13399. *
  13400. * @param {ReactClass} publicInstance The instance that should rerender.
  13401. * @param {object} partialProps Subset of the next props.
  13402. * @internal
  13403. */
  13404. enqueueSetProps: function (publicInstance, partialProps) {
  13405. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps');
  13406. if (!internalInstance) {
  13407. return;
  13408. }
  13409. ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps);
  13410. },
  13411. enqueueSetPropsInternal: function (internalInstance, partialProps) {
  13412. var topLevelWrapper = internalInstance._topLevelWrapper;
  13413. !topLevelWrapper ? "production" !== 'production' ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
  13414. // Merge with the pending element if it exists, otherwise with existing
  13415. // element props.
  13416. var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
  13417. var element = wrapElement.props;
  13418. var props = assign({}, element.props, partialProps);
  13419. topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
  13420. enqueueUpdate(topLevelWrapper);
  13421. },
  13422. /**
  13423. * Replaces all of the props.
  13424. *
  13425. * @param {ReactClass} publicInstance The instance that should rerender.
  13426. * @param {object} props New props.
  13427. * @internal
  13428. */
  13429. enqueueReplaceProps: function (publicInstance, props) {
  13430. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps');
  13431. if (!internalInstance) {
  13432. return;
  13433. }
  13434. ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props);
  13435. },
  13436. enqueueReplacePropsInternal: function (internalInstance, props) {
  13437. var topLevelWrapper = internalInstance._topLevelWrapper;
  13438. !topLevelWrapper ? "production" !== 'production' ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
  13439. // Merge with the pending element if it exists, otherwise with existing
  13440. // element props.
  13441. var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
  13442. var element = wrapElement.props;
  13443. topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
  13444. enqueueUpdate(topLevelWrapper);
  13445. },
  13446. enqueueElementInternal: function (internalInstance, newElement) {
  13447. internalInstance._pendingElement = newElement;
  13448. enqueueUpdate(internalInstance);
  13449. }
  13450. };
  13451. module.exports = ReactUpdateQueue;
  13452. },{"161":161,"173":173,"24":24,"39":39,"57":57,"68":68,"96":96}],96:[function(_dereq_,module,exports){
  13453. /**
  13454. * Copyright 2013-2015, Facebook, Inc.
  13455. * All rights reserved.
  13456. *
  13457. * This source code is licensed under the BSD-style license found in the
  13458. * LICENSE file in the root directory of this source tree. An additional grant
  13459. * of patent rights can be found in the PATENTS file in the same directory.
  13460. *
  13461. * @providesModule ReactUpdates
  13462. */
  13463. 'use strict';
  13464. var CallbackQueue = _dereq_(6);
  13465. var PooledClass = _dereq_(25);
  13466. var ReactPerf = _dereq_(78);
  13467. var ReactReconciler = _dereq_(84);
  13468. var Transaction = _dereq_(113);
  13469. var assign = _dereq_(24);
  13470. var invariant = _dereq_(161);
  13471. var dirtyComponents = [];
  13472. var asapCallbackQueue = CallbackQueue.getPooled();
  13473. var asapEnqueued = false;
  13474. var batchingStrategy = null;
  13475. function ensureInjected() {
  13476. !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? "production" !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : undefined;
  13477. }
  13478. var NESTED_UPDATES = {
  13479. initialize: function () {
  13480. this.dirtyComponentsLength = dirtyComponents.length;
  13481. },
  13482. close: function () {
  13483. if (this.dirtyComponentsLength !== dirtyComponents.length) {
  13484. // Additional updates were enqueued by componentDidUpdate handlers or
  13485. // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
  13486. // these new updates so that if A's componentDidUpdate calls setState on
  13487. // B, B will update before the callback A's updater provided when calling
  13488. // setState.
  13489. dirtyComponents.splice(0, this.dirtyComponentsLength);
  13490. flushBatchedUpdates();
  13491. } else {
  13492. dirtyComponents.length = 0;
  13493. }
  13494. }
  13495. };
  13496. var UPDATE_QUEUEING = {
  13497. initialize: function () {
  13498. this.callbackQueue.reset();
  13499. },
  13500. close: function () {
  13501. this.callbackQueue.notifyAll();
  13502. }
  13503. };
  13504. var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
  13505. function ReactUpdatesFlushTransaction() {
  13506. this.reinitializeTransaction();
  13507. this.dirtyComponentsLength = null;
  13508. this.callbackQueue = CallbackQueue.getPooled();
  13509. this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */false);
  13510. }
  13511. assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
  13512. getTransactionWrappers: function () {
  13513. return TRANSACTION_WRAPPERS;
  13514. },
  13515. destructor: function () {
  13516. this.dirtyComponentsLength = null;
  13517. CallbackQueue.release(this.callbackQueue);
  13518. this.callbackQueue = null;
  13519. ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
  13520. this.reconcileTransaction = null;
  13521. },
  13522. perform: function (method, scope, a) {
  13523. // Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
  13524. // with this transaction's wrappers around it.
  13525. return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
  13526. }
  13527. });
  13528. PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
  13529. function batchedUpdates(callback, a, b, c, d, e) {
  13530. ensureInjected();
  13531. batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
  13532. }
  13533. /**
  13534. * Array comparator for ReactComponents by mount ordering.
  13535. *
  13536. * @param {ReactComponent} c1 first component you're comparing
  13537. * @param {ReactComponent} c2 second component you're comparing
  13538. * @return {number} Return value usable by Array.prototype.sort().
  13539. */
  13540. function mountOrderComparator(c1, c2) {
  13541. return c1._mountOrder - c2._mountOrder;
  13542. }
  13543. function runBatchedUpdates(transaction) {
  13544. var len = transaction.dirtyComponentsLength;
  13545. !(len === dirtyComponents.length) ? "production" !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : undefined;
  13546. // Since reconciling a component higher in the owner hierarchy usually (not
  13547. // always -- see shouldComponentUpdate()) will reconcile children, reconcile
  13548. // them before their children by sorting the array.
  13549. dirtyComponents.sort(mountOrderComparator);
  13550. for (var i = 0; i < len; i++) {
  13551. // If a component is unmounted before pending changes apply, it will still
  13552. // be here, but we assume that it has cleared its _pendingCallbacks and
  13553. // that performUpdateIfNecessary is a noop.
  13554. var component = dirtyComponents[i];
  13555. // If performUpdateIfNecessary happens to enqueue any new updates, we
  13556. // shouldn't execute the callbacks until the next render happens, so
  13557. // stash the callbacks first
  13558. var callbacks = component._pendingCallbacks;
  13559. component._pendingCallbacks = null;
  13560. ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction);
  13561. if (callbacks) {
  13562. for (var j = 0; j < callbacks.length; j++) {
  13563. transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
  13564. }
  13565. }
  13566. }
  13567. }
  13568. var flushBatchedUpdates = function () {
  13569. // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
  13570. // array and perform any updates enqueued by mount-ready handlers (i.e.,
  13571. // componentDidUpdate) but we need to check here too in order to catch
  13572. // updates enqueued by setState callbacks and asap calls.
  13573. while (dirtyComponents.length || asapEnqueued) {
  13574. if (dirtyComponents.length) {
  13575. var transaction = ReactUpdatesFlushTransaction.getPooled();
  13576. transaction.perform(runBatchedUpdates, null, transaction);
  13577. ReactUpdatesFlushTransaction.release(transaction);
  13578. }
  13579. if (asapEnqueued) {
  13580. asapEnqueued = false;
  13581. var queue = asapCallbackQueue;
  13582. asapCallbackQueue = CallbackQueue.getPooled();
  13583. queue.notifyAll();
  13584. CallbackQueue.release(queue);
  13585. }
  13586. }
  13587. };
  13588. flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates);
  13589. /**
  13590. * Mark a component as needing a rerender, adding an optional callback to a
  13591. * list of functions which will be executed once the rerender occurs.
  13592. */
  13593. function enqueueUpdate(component) {
  13594. ensureInjected();
  13595. // Various parts of our code (such as ReactCompositeComponent's
  13596. // _renderValidatedComponent) assume that calls to render aren't nested;
  13597. // verify that that's the case. (This is called by each top-level update
  13598. // function, like setProps, setState, forceUpdate, etc.; creation and
  13599. // destruction of top-level components is guarded in ReactMount.)
  13600. if (!batchingStrategy.isBatchingUpdates) {
  13601. batchingStrategy.batchedUpdates(enqueueUpdate, component);
  13602. return;
  13603. }
  13604. dirtyComponents.push(component);
  13605. }
  13606. /**
  13607. * Enqueue a callback to be run at the end of the current batching cycle. Throws
  13608. * if no updates are currently being performed.
  13609. */
  13610. function asap(callback, context) {
  13611. !batchingStrategy.isBatchingUpdates ? "production" !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : undefined;
  13612. asapCallbackQueue.enqueue(callback, context);
  13613. asapEnqueued = true;
  13614. }
  13615. var ReactUpdatesInjection = {
  13616. injectReconcileTransaction: function (ReconcileTransaction) {
  13617. !ReconcileTransaction ? "production" !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : undefined;
  13618. ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
  13619. },
  13620. injectBatchingStrategy: function (_batchingStrategy) {
  13621. !_batchingStrategy ? "production" !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : undefined;
  13622. !(typeof _batchingStrategy.batchedUpdates === 'function') ? "production" !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : undefined;
  13623. !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? "production" !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : undefined;
  13624. batchingStrategy = _batchingStrategy;
  13625. }
  13626. };
  13627. var ReactUpdates = {
  13628. /**
  13629. * React references `ReactReconcileTransaction` using this property in order
  13630. * to allow dependency injection.
  13631. *
  13632. * @internal
  13633. */
  13634. ReactReconcileTransaction: null,
  13635. batchedUpdates: batchedUpdates,
  13636. enqueueUpdate: enqueueUpdate,
  13637. flushBatchedUpdates: flushBatchedUpdates,
  13638. injection: ReactUpdatesInjection,
  13639. asap: asap
  13640. };
  13641. module.exports = ReactUpdates;
  13642. },{"113":113,"161":161,"24":24,"25":25,"6":6,"78":78,"84":84}],97:[function(_dereq_,module,exports){
  13643. /**
  13644. * Copyright 2013-2015, Facebook, Inc.
  13645. * All rights reserved.
  13646. *
  13647. * This source code is licensed under the BSD-style license found in the
  13648. * LICENSE file in the root directory of this source tree. An additional grant
  13649. * of patent rights can be found in the PATENTS file in the same directory.
  13650. *
  13651. * @providesModule ReactVersion
  13652. */
  13653. 'use strict';
  13654. module.exports = '0.14.6';
  13655. },{}],98:[function(_dereq_,module,exports){
  13656. /**
  13657. * Copyright 2013-2015, Facebook, Inc.
  13658. * All rights reserved.
  13659. *
  13660. * This source code is licensed under the BSD-style license found in the
  13661. * LICENSE file in the root directory of this source tree. An additional grant
  13662. * of patent rights can be found in the PATENTS file in the same directory.
  13663. *
  13664. * @providesModule SVGDOMPropertyConfig
  13665. */
  13666. 'use strict';
  13667. var DOMProperty = _dereq_(10);
  13668. var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
  13669. var NS = {
  13670. xlink: 'http://www.w3.org/1999/xlink',
  13671. xml: 'http://www.w3.org/XML/1998/namespace'
  13672. };
  13673. var SVGDOMPropertyConfig = {
  13674. Properties: {
  13675. clipPath: MUST_USE_ATTRIBUTE,
  13676. cx: MUST_USE_ATTRIBUTE,
  13677. cy: MUST_USE_ATTRIBUTE,
  13678. d: MUST_USE_ATTRIBUTE,
  13679. dx: MUST_USE_ATTRIBUTE,
  13680. dy: MUST_USE_ATTRIBUTE,
  13681. fill: MUST_USE_ATTRIBUTE,
  13682. fillOpacity: MUST_USE_ATTRIBUTE,
  13683. fontFamily: MUST_USE_ATTRIBUTE,
  13684. fontSize: MUST_USE_ATTRIBUTE,
  13685. fx: MUST_USE_ATTRIBUTE,
  13686. fy: MUST_USE_ATTRIBUTE,
  13687. gradientTransform: MUST_USE_ATTRIBUTE,
  13688. gradientUnits: MUST_USE_ATTRIBUTE,
  13689. markerEnd: MUST_USE_ATTRIBUTE,
  13690. markerMid: MUST_USE_ATTRIBUTE,
  13691. markerStart: MUST_USE_ATTRIBUTE,
  13692. offset: MUST_USE_ATTRIBUTE,
  13693. opacity: MUST_USE_ATTRIBUTE,
  13694. patternContentUnits: MUST_USE_ATTRIBUTE,
  13695. patternUnits: MUST_USE_ATTRIBUTE,
  13696. points: MUST_USE_ATTRIBUTE,
  13697. preserveAspectRatio: MUST_USE_ATTRIBUTE,
  13698. r: MUST_USE_ATTRIBUTE,
  13699. rx: MUST_USE_ATTRIBUTE,
  13700. ry: MUST_USE_ATTRIBUTE,
  13701. spreadMethod: MUST_USE_ATTRIBUTE,
  13702. stopColor: MUST_USE_ATTRIBUTE,
  13703. stopOpacity: MUST_USE_ATTRIBUTE,
  13704. stroke: MUST_USE_ATTRIBUTE,
  13705. strokeDasharray: MUST_USE_ATTRIBUTE,
  13706. strokeLinecap: MUST_USE_ATTRIBUTE,
  13707. strokeOpacity: MUST_USE_ATTRIBUTE,
  13708. strokeWidth: MUST_USE_ATTRIBUTE,
  13709. textAnchor: MUST_USE_ATTRIBUTE,
  13710. transform: MUST_USE_ATTRIBUTE,
  13711. version: MUST_USE_ATTRIBUTE,
  13712. viewBox: MUST_USE_ATTRIBUTE,
  13713. x1: MUST_USE_ATTRIBUTE,
  13714. x2: MUST_USE_ATTRIBUTE,
  13715. x: MUST_USE_ATTRIBUTE,
  13716. xlinkActuate: MUST_USE_ATTRIBUTE,
  13717. xlinkArcrole: MUST_USE_ATTRIBUTE,
  13718. xlinkHref: MUST_USE_ATTRIBUTE,
  13719. xlinkRole: MUST_USE_ATTRIBUTE,
  13720. xlinkShow: MUST_USE_ATTRIBUTE,
  13721. xlinkTitle: MUST_USE_ATTRIBUTE,
  13722. xlinkType: MUST_USE_ATTRIBUTE,
  13723. xmlBase: MUST_USE_ATTRIBUTE,
  13724. xmlLang: MUST_USE_ATTRIBUTE,
  13725. xmlSpace: MUST_USE_ATTRIBUTE,
  13726. y1: MUST_USE_ATTRIBUTE,
  13727. y2: MUST_USE_ATTRIBUTE,
  13728. y: MUST_USE_ATTRIBUTE
  13729. },
  13730. DOMAttributeNamespaces: {
  13731. xlinkActuate: NS.xlink,
  13732. xlinkArcrole: NS.xlink,
  13733. xlinkHref: NS.xlink,
  13734. xlinkRole: NS.xlink,
  13735. xlinkShow: NS.xlink,
  13736. xlinkTitle: NS.xlink,
  13737. xlinkType: NS.xlink,
  13738. xmlBase: NS.xml,
  13739. xmlLang: NS.xml,
  13740. xmlSpace: NS.xml
  13741. },
  13742. DOMAttributeNames: {
  13743. clipPath: 'clip-path',
  13744. fillOpacity: 'fill-opacity',
  13745. fontFamily: 'font-family',
  13746. fontSize: 'font-size',
  13747. gradientTransform: 'gradientTransform',
  13748. gradientUnits: 'gradientUnits',
  13749. markerEnd: 'marker-end',
  13750. markerMid: 'marker-mid',
  13751. markerStart: 'marker-start',
  13752. patternContentUnits: 'patternContentUnits',
  13753. patternUnits: 'patternUnits',
  13754. preserveAspectRatio: 'preserveAspectRatio',
  13755. spreadMethod: 'spreadMethod',
  13756. stopColor: 'stop-color',
  13757. stopOpacity: 'stop-opacity',
  13758. strokeDasharray: 'stroke-dasharray',
  13759. strokeLinecap: 'stroke-linecap',
  13760. strokeOpacity: 'stroke-opacity',
  13761. strokeWidth: 'stroke-width',
  13762. textAnchor: 'text-anchor',
  13763. viewBox: 'viewBox',
  13764. xlinkActuate: 'xlink:actuate',
  13765. xlinkArcrole: 'xlink:arcrole',
  13766. xlinkHref: 'xlink:href',
  13767. xlinkRole: 'xlink:role',
  13768. xlinkShow: 'xlink:show',
  13769. xlinkTitle: 'xlink:title',
  13770. xlinkType: 'xlink:type',
  13771. xmlBase: 'xml:base',
  13772. xmlLang: 'xml:lang',
  13773. xmlSpace: 'xml:space'
  13774. }
  13775. };
  13776. module.exports = SVGDOMPropertyConfig;
  13777. },{"10":10}],99:[function(_dereq_,module,exports){
  13778. /**
  13779. * Copyright 2013-2015, Facebook, Inc.
  13780. * All rights reserved.
  13781. *
  13782. * This source code is licensed under the BSD-style license found in the
  13783. * LICENSE file in the root directory of this source tree. An additional grant
  13784. * of patent rights can be found in the PATENTS file in the same directory.
  13785. *
  13786. * @providesModule SelectEventPlugin
  13787. */
  13788. 'use strict';
  13789. var EventConstants = _dereq_(15);
  13790. var EventPropagators = _dereq_(19);
  13791. var ExecutionEnvironment = _dereq_(147);
  13792. var ReactInputSelection = _dereq_(66);
  13793. var SyntheticEvent = _dereq_(105);
  13794. var getActiveElement = _dereq_(156);
  13795. var isTextInputElement = _dereq_(134);
  13796. var keyOf = _dereq_(166);
  13797. var shallowEqual = _dereq_(171);
  13798. var topLevelTypes = EventConstants.topLevelTypes;
  13799. var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
  13800. var eventTypes = {
  13801. select: {
  13802. phasedRegistrationNames: {
  13803. bubbled: keyOf({ onSelect: null }),
  13804. captured: keyOf({ onSelectCapture: null })
  13805. },
  13806. dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
  13807. }
  13808. };
  13809. var activeElement = null;
  13810. var activeElementID = null;
  13811. var lastSelection = null;
  13812. var mouseDown = false;
  13813. // Track whether a listener exists for this plugin. If none exist, we do
  13814. // not extract events.
  13815. var hasListener = false;
  13816. var ON_SELECT_KEY = keyOf({ onSelect: null });
  13817. /**
  13818. * Get an object which is a unique representation of the current selection.
  13819. *
  13820. * The return value will not be consistent across nodes or browsers, but
  13821. * two identical selections on the same node will return identical objects.
  13822. *
  13823. * @param {DOMElement} node
  13824. * @return {object}
  13825. */
  13826. function getSelection(node) {
  13827. if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
  13828. return {
  13829. start: node.selectionStart,
  13830. end: node.selectionEnd
  13831. };
  13832. } else if (window.getSelection) {
  13833. var selection = window.getSelection();
  13834. return {
  13835. anchorNode: selection.anchorNode,
  13836. anchorOffset: selection.anchorOffset,
  13837. focusNode: selection.focusNode,
  13838. focusOffset: selection.focusOffset
  13839. };
  13840. } else if (document.selection) {
  13841. var range = document.selection.createRange();
  13842. return {
  13843. parentElement: range.parentElement(),
  13844. text: range.text,
  13845. top: range.boundingTop,
  13846. left: range.boundingLeft
  13847. };
  13848. }
  13849. }
  13850. /**
  13851. * Poll selection to see whether it's changed.
  13852. *
  13853. * @param {object} nativeEvent
  13854. * @return {?SyntheticEvent}
  13855. */
  13856. function constructSelectEvent(nativeEvent, nativeEventTarget) {
  13857. // Ensure we have the right element, and that the user is not dragging a
  13858. // selection (this matches native `select` event behavior). In HTML5, select
  13859. // fires only on input and textarea thus if there's no focused element we
  13860. // won't dispatch.
  13861. if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
  13862. return null;
  13863. }
  13864. // Only fire when selection has actually changed.
  13865. var currentSelection = getSelection(activeElement);
  13866. if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
  13867. lastSelection = currentSelection;
  13868. var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget);
  13869. syntheticEvent.type = 'select';
  13870. syntheticEvent.target = activeElement;
  13871. EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
  13872. return syntheticEvent;
  13873. }
  13874. return null;
  13875. }
  13876. /**
  13877. * This plugin creates an `onSelect` event that normalizes select events
  13878. * across form elements.
  13879. *
  13880. * Supported elements are:
  13881. * - input (see `isTextInputElement`)
  13882. * - textarea
  13883. * - contentEditable
  13884. *
  13885. * This differs from native browser implementations in the following ways:
  13886. * - Fires on contentEditable fields as well as inputs.
  13887. * - Fires for collapsed selection.
  13888. * - Fires after user input.
  13889. */
  13890. var SelectEventPlugin = {
  13891. eventTypes: eventTypes,
  13892. /**
  13893. * @param {string} topLevelType Record from `EventConstants`.
  13894. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  13895. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  13896. * @param {object} nativeEvent Native browser event.
  13897. * @return {*} An accumulation of synthetic events.
  13898. * @see {EventPluginHub.extractEvents}
  13899. */
  13900. extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
  13901. if (!hasListener) {
  13902. return null;
  13903. }
  13904. switch (topLevelType) {
  13905. // Track the input node that has focus.
  13906. case topLevelTypes.topFocus:
  13907. if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') {
  13908. activeElement = topLevelTarget;
  13909. activeElementID = topLevelTargetID;
  13910. lastSelection = null;
  13911. }
  13912. break;
  13913. case topLevelTypes.topBlur:
  13914. activeElement = null;
  13915. activeElementID = null;
  13916. lastSelection = null;
  13917. break;
  13918. // Don't fire the event while the user is dragging. This matches the
  13919. // semantics of the native select event.
  13920. case topLevelTypes.topMouseDown:
  13921. mouseDown = true;
  13922. break;
  13923. case topLevelTypes.topContextMenu:
  13924. case topLevelTypes.topMouseUp:
  13925. mouseDown = false;
  13926. return constructSelectEvent(nativeEvent, nativeEventTarget);
  13927. // Chrome and IE fire non-standard event when selection is changed (and
  13928. // sometimes when it hasn't). IE's event fires out of order with respect
  13929. // to key and input events on deletion, so we discard it.
  13930. //
  13931. // Firefox doesn't support selectionchange, so check selection status
  13932. // after each key entry. The selection changes after keydown and before
  13933. // keyup, but we check on keydown as well in the case of holding down a
  13934. // key, when multiple keydown events are fired but only one keyup is.
  13935. // This is also our approach for IE handling, for the reason above.
  13936. case topLevelTypes.topSelectionChange:
  13937. if (skipSelectionChangeEvent) {
  13938. break;
  13939. }
  13940. // falls through
  13941. case topLevelTypes.topKeyDown:
  13942. case topLevelTypes.topKeyUp:
  13943. return constructSelectEvent(nativeEvent, nativeEventTarget);
  13944. }
  13945. return null;
  13946. },
  13947. didPutListener: function (id, registrationName, listener) {
  13948. if (registrationName === ON_SELECT_KEY) {
  13949. hasListener = true;
  13950. }
  13951. }
  13952. };
  13953. module.exports = SelectEventPlugin;
  13954. },{"105":105,"134":134,"147":147,"15":15,"156":156,"166":166,"171":171,"19":19,"66":66}],100:[function(_dereq_,module,exports){
  13955. /**
  13956. * Copyright 2013-2015, Facebook, Inc.
  13957. * All rights reserved.
  13958. *
  13959. * This source code is licensed under the BSD-style license found in the
  13960. * LICENSE file in the root directory of this source tree. An additional grant
  13961. * of patent rights can be found in the PATENTS file in the same directory.
  13962. *
  13963. * @providesModule ServerReactRootIndex
  13964. * @typechecks
  13965. */
  13966. 'use strict';
  13967. /**
  13968. * Size of the reactRoot ID space. We generate random numbers for React root
  13969. * IDs and if there's a collision the events and DOM update system will
  13970. * get confused. In the future we need a way to generate GUIDs but for
  13971. * now this will work on a smaller scale.
  13972. */
  13973. var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
  13974. var ServerReactRootIndex = {
  13975. createReactRootIndex: function () {
  13976. return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
  13977. }
  13978. };
  13979. module.exports = ServerReactRootIndex;
  13980. },{}],101:[function(_dereq_,module,exports){
  13981. /**
  13982. * Copyright 2013-2015, Facebook, Inc.
  13983. * All rights reserved.
  13984. *
  13985. * This source code is licensed under the BSD-style license found in the
  13986. * LICENSE file in the root directory of this source tree. An additional grant
  13987. * of patent rights can be found in the PATENTS file in the same directory.
  13988. *
  13989. * @providesModule SimpleEventPlugin
  13990. */
  13991. 'use strict';
  13992. var EventConstants = _dereq_(15);
  13993. var EventListener = _dereq_(146);
  13994. var EventPropagators = _dereq_(19);
  13995. var ReactMount = _dereq_(72);
  13996. var SyntheticClipboardEvent = _dereq_(102);
  13997. var SyntheticEvent = _dereq_(105);
  13998. var SyntheticFocusEvent = _dereq_(106);
  13999. var SyntheticKeyboardEvent = _dereq_(108);
  14000. var SyntheticMouseEvent = _dereq_(109);
  14001. var SyntheticDragEvent = _dereq_(104);
  14002. var SyntheticTouchEvent = _dereq_(110);
  14003. var SyntheticUIEvent = _dereq_(111);
  14004. var SyntheticWheelEvent = _dereq_(112);
  14005. var emptyFunction = _dereq_(153);
  14006. var getEventCharCode = _dereq_(125);
  14007. var invariant = _dereq_(161);
  14008. var keyOf = _dereq_(166);
  14009. var topLevelTypes = EventConstants.topLevelTypes;
  14010. var eventTypes = {
  14011. abort: {
  14012. phasedRegistrationNames: {
  14013. bubbled: keyOf({ onAbort: true }),
  14014. captured: keyOf({ onAbortCapture: true })
  14015. }
  14016. },
  14017. blur: {
  14018. phasedRegistrationNames: {
  14019. bubbled: keyOf({ onBlur: true }),
  14020. captured: keyOf({ onBlurCapture: true })
  14021. }
  14022. },
  14023. canPlay: {
  14024. phasedRegistrationNames: {
  14025. bubbled: keyOf({ onCanPlay: true }),
  14026. captured: keyOf({ onCanPlayCapture: true })
  14027. }
  14028. },
  14029. canPlayThrough: {
  14030. phasedRegistrationNames: {
  14031. bubbled: keyOf({ onCanPlayThrough: true }),
  14032. captured: keyOf({ onCanPlayThroughCapture: true })
  14033. }
  14034. },
  14035. click: {
  14036. phasedRegistrationNames: {
  14037. bubbled: keyOf({ onClick: true }),
  14038. captured: keyOf({ onClickCapture: true })
  14039. }
  14040. },
  14041. contextMenu: {
  14042. phasedRegistrationNames: {
  14043. bubbled: keyOf({ onContextMenu: true }),
  14044. captured: keyOf({ onContextMenuCapture: true })
  14045. }
  14046. },
  14047. copy: {
  14048. phasedRegistrationNames: {
  14049. bubbled: keyOf({ onCopy: true }),
  14050. captured: keyOf({ onCopyCapture: true })
  14051. }
  14052. },
  14053. cut: {
  14054. phasedRegistrationNames: {
  14055. bubbled: keyOf({ onCut: true }),
  14056. captured: keyOf({ onCutCapture: true })
  14057. }
  14058. },
  14059. doubleClick: {
  14060. phasedRegistrationNames: {
  14061. bubbled: keyOf({ onDoubleClick: true }),
  14062. captured: keyOf({ onDoubleClickCapture: true })
  14063. }
  14064. },
  14065. drag: {
  14066. phasedRegistrationNames: {
  14067. bubbled: keyOf({ onDrag: true }),
  14068. captured: keyOf({ onDragCapture: true })
  14069. }
  14070. },
  14071. dragEnd: {
  14072. phasedRegistrationNames: {
  14073. bubbled: keyOf({ onDragEnd: true }),
  14074. captured: keyOf({ onDragEndCapture: true })
  14075. }
  14076. },
  14077. dragEnter: {
  14078. phasedRegistrationNames: {
  14079. bubbled: keyOf({ onDragEnter: true }),
  14080. captured: keyOf({ onDragEnterCapture: true })
  14081. }
  14082. },
  14083. dragExit: {
  14084. phasedRegistrationNames: {
  14085. bubbled: keyOf({ onDragExit: true }),
  14086. captured: keyOf({ onDragExitCapture: true })
  14087. }
  14088. },
  14089. dragLeave: {
  14090. phasedRegistrationNames: {
  14091. bubbled: keyOf({ onDragLeave: true }),
  14092. captured: keyOf({ onDragLeaveCapture: true })
  14093. }
  14094. },
  14095. dragOver: {
  14096. phasedRegistrationNames: {
  14097. bubbled: keyOf({ onDragOver: true }),
  14098. captured: keyOf({ onDragOverCapture: true })
  14099. }
  14100. },
  14101. dragStart: {
  14102. phasedRegistrationNames: {
  14103. bubbled: keyOf({ onDragStart: true }),
  14104. captured: keyOf({ onDragStartCapture: true })
  14105. }
  14106. },
  14107. drop: {
  14108. phasedRegistrationNames: {
  14109. bubbled: keyOf({ onDrop: true }),
  14110. captured: keyOf({ onDropCapture: true })
  14111. }
  14112. },
  14113. durationChange: {
  14114. phasedRegistrationNames: {
  14115. bubbled: keyOf({ onDurationChange: true }),
  14116. captured: keyOf({ onDurationChangeCapture: true })
  14117. }
  14118. },
  14119. emptied: {
  14120. phasedRegistrationNames: {
  14121. bubbled: keyOf({ onEmptied: true }),
  14122. captured: keyOf({ onEmptiedCapture: true })
  14123. }
  14124. },
  14125. encrypted: {
  14126. phasedRegistrationNames: {
  14127. bubbled: keyOf({ onEncrypted: true }),
  14128. captured: keyOf({ onEncryptedCapture: true })
  14129. }
  14130. },
  14131. ended: {
  14132. phasedRegistrationNames: {
  14133. bubbled: keyOf({ onEnded: true }),
  14134. captured: keyOf({ onEndedCapture: true })
  14135. }
  14136. },
  14137. error: {
  14138. phasedRegistrationNames: {
  14139. bubbled: keyOf({ onError: true }),
  14140. captured: keyOf({ onErrorCapture: true })
  14141. }
  14142. },
  14143. focus: {
  14144. phasedRegistrationNames: {
  14145. bubbled: keyOf({ onFocus: true }),
  14146. captured: keyOf({ onFocusCapture: true })
  14147. }
  14148. },
  14149. input: {
  14150. phasedRegistrationNames: {
  14151. bubbled: keyOf({ onInput: true }),
  14152. captured: keyOf({ onInputCapture: true })
  14153. }
  14154. },
  14155. keyDown: {
  14156. phasedRegistrationNames: {
  14157. bubbled: keyOf({ onKeyDown: true }),
  14158. captured: keyOf({ onKeyDownCapture: true })
  14159. }
  14160. },
  14161. keyPress: {
  14162. phasedRegistrationNames: {
  14163. bubbled: keyOf({ onKeyPress: true }),
  14164. captured: keyOf({ onKeyPressCapture: true })
  14165. }
  14166. },
  14167. keyUp: {
  14168. phasedRegistrationNames: {
  14169. bubbled: keyOf({ onKeyUp: true }),
  14170. captured: keyOf({ onKeyUpCapture: true })
  14171. }
  14172. },
  14173. load: {
  14174. phasedRegistrationNames: {
  14175. bubbled: keyOf({ onLoad: true }),
  14176. captured: keyOf({ onLoadCapture: true })
  14177. }
  14178. },
  14179. loadedData: {
  14180. phasedRegistrationNames: {
  14181. bubbled: keyOf({ onLoadedData: true }),
  14182. captured: keyOf({ onLoadedDataCapture: true })
  14183. }
  14184. },
  14185. loadedMetadata: {
  14186. phasedRegistrationNames: {
  14187. bubbled: keyOf({ onLoadedMetadata: true }),
  14188. captured: keyOf({ onLoadedMetadataCapture: true })
  14189. }
  14190. },
  14191. loadStart: {
  14192. phasedRegistrationNames: {
  14193. bubbled: keyOf({ onLoadStart: true }),
  14194. captured: keyOf({ onLoadStartCapture: true })
  14195. }
  14196. },
  14197. // Note: We do not allow listening to mouseOver events. Instead, use the
  14198. // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
  14199. mouseDown: {
  14200. phasedRegistrationNames: {
  14201. bubbled: keyOf({ onMouseDown: true }),
  14202. captured: keyOf({ onMouseDownCapture: true })
  14203. }
  14204. },
  14205. mouseMove: {
  14206. phasedRegistrationNames: {
  14207. bubbled: keyOf({ onMouseMove: true }),
  14208. captured: keyOf({ onMouseMoveCapture: true })
  14209. }
  14210. },
  14211. mouseOut: {
  14212. phasedRegistrationNames: {
  14213. bubbled: keyOf({ onMouseOut: true }),
  14214. captured: keyOf({ onMouseOutCapture: true })
  14215. }
  14216. },
  14217. mouseOver: {
  14218. phasedRegistrationNames: {
  14219. bubbled: keyOf({ onMouseOver: true }),
  14220. captured: keyOf({ onMouseOverCapture: true })
  14221. }
  14222. },
  14223. mouseUp: {
  14224. phasedRegistrationNames: {
  14225. bubbled: keyOf({ onMouseUp: true }),
  14226. captured: keyOf({ onMouseUpCapture: true })
  14227. }
  14228. },
  14229. paste: {
  14230. phasedRegistrationNames: {
  14231. bubbled: keyOf({ onPaste: true }),
  14232. captured: keyOf({ onPasteCapture: true })
  14233. }
  14234. },
  14235. pause: {
  14236. phasedRegistrationNames: {
  14237. bubbled: keyOf({ onPause: true }),
  14238. captured: keyOf({ onPauseCapture: true })
  14239. }
  14240. },
  14241. play: {
  14242. phasedRegistrationNames: {
  14243. bubbled: keyOf({ onPlay: true }),
  14244. captured: keyOf({ onPlayCapture: true })
  14245. }
  14246. },
  14247. playing: {
  14248. phasedRegistrationNames: {
  14249. bubbled: keyOf({ onPlaying: true }),
  14250. captured: keyOf({ onPlayingCapture: true })
  14251. }
  14252. },
  14253. progress: {
  14254. phasedRegistrationNames: {
  14255. bubbled: keyOf({ onProgress: true }),
  14256. captured: keyOf({ onProgressCapture: true })
  14257. }
  14258. },
  14259. rateChange: {
  14260. phasedRegistrationNames: {
  14261. bubbled: keyOf({ onRateChange: true }),
  14262. captured: keyOf({ onRateChangeCapture: true })
  14263. }
  14264. },
  14265. reset: {
  14266. phasedRegistrationNames: {
  14267. bubbled: keyOf({ onReset: true }),
  14268. captured: keyOf({ onResetCapture: true })
  14269. }
  14270. },
  14271. scroll: {
  14272. phasedRegistrationNames: {
  14273. bubbled: keyOf({ onScroll: true }),
  14274. captured: keyOf({ onScrollCapture: true })
  14275. }
  14276. },
  14277. seeked: {
  14278. phasedRegistrationNames: {
  14279. bubbled: keyOf({ onSeeked: true }),
  14280. captured: keyOf({ onSeekedCapture: true })
  14281. }
  14282. },
  14283. seeking: {
  14284. phasedRegistrationNames: {
  14285. bubbled: keyOf({ onSeeking: true }),
  14286. captured: keyOf({ onSeekingCapture: true })
  14287. }
  14288. },
  14289. stalled: {
  14290. phasedRegistrationNames: {
  14291. bubbled: keyOf({ onStalled: true }),
  14292. captured: keyOf({ onStalledCapture: true })
  14293. }
  14294. },
  14295. submit: {
  14296. phasedRegistrationNames: {
  14297. bubbled: keyOf({ onSubmit: true }),
  14298. captured: keyOf({ onSubmitCapture: true })
  14299. }
  14300. },
  14301. suspend: {
  14302. phasedRegistrationNames: {
  14303. bubbled: keyOf({ onSuspend: true }),
  14304. captured: keyOf({ onSuspendCapture: true })
  14305. }
  14306. },
  14307. timeUpdate: {
  14308. phasedRegistrationNames: {
  14309. bubbled: keyOf({ onTimeUpdate: true }),
  14310. captured: keyOf({ onTimeUpdateCapture: true })
  14311. }
  14312. },
  14313. touchCancel: {
  14314. phasedRegistrationNames: {
  14315. bubbled: keyOf({ onTouchCancel: true }),
  14316. captured: keyOf({ onTouchCancelCapture: true })
  14317. }
  14318. },
  14319. touchEnd: {
  14320. phasedRegistrationNames: {
  14321. bubbled: keyOf({ onTouchEnd: true }),
  14322. captured: keyOf({ onTouchEndCapture: true })
  14323. }
  14324. },
  14325. touchMove: {
  14326. phasedRegistrationNames: {
  14327. bubbled: keyOf({ onTouchMove: true }),
  14328. captured: keyOf({ onTouchMoveCapture: true })
  14329. }
  14330. },
  14331. touchStart: {
  14332. phasedRegistrationNames: {
  14333. bubbled: keyOf({ onTouchStart: true }),
  14334. captured: keyOf({ onTouchStartCapture: true })
  14335. }
  14336. },
  14337. volumeChange: {
  14338. phasedRegistrationNames: {
  14339. bubbled: keyOf({ onVolumeChange: true }),
  14340. captured: keyOf({ onVolumeChangeCapture: true })
  14341. }
  14342. },
  14343. waiting: {
  14344. phasedRegistrationNames: {
  14345. bubbled: keyOf({ onWaiting: true }),
  14346. captured: keyOf({ onWaitingCapture: true })
  14347. }
  14348. },
  14349. wheel: {
  14350. phasedRegistrationNames: {
  14351. bubbled: keyOf({ onWheel: true }),
  14352. captured: keyOf({ onWheelCapture: true })
  14353. }
  14354. }
  14355. };
  14356. var topLevelEventsToDispatchConfig = {
  14357. topAbort: eventTypes.abort,
  14358. topBlur: eventTypes.blur,
  14359. topCanPlay: eventTypes.canPlay,
  14360. topCanPlayThrough: eventTypes.canPlayThrough,
  14361. topClick: eventTypes.click,
  14362. topContextMenu: eventTypes.contextMenu,
  14363. topCopy: eventTypes.copy,
  14364. topCut: eventTypes.cut,
  14365. topDoubleClick: eventTypes.doubleClick,
  14366. topDrag: eventTypes.drag,
  14367. topDragEnd: eventTypes.dragEnd,
  14368. topDragEnter: eventTypes.dragEnter,
  14369. topDragExit: eventTypes.dragExit,
  14370. topDragLeave: eventTypes.dragLeave,
  14371. topDragOver: eventTypes.dragOver,
  14372. topDragStart: eventTypes.dragStart,
  14373. topDrop: eventTypes.drop,
  14374. topDurationChange: eventTypes.durationChange,
  14375. topEmptied: eventTypes.emptied,
  14376. topEncrypted: eventTypes.encrypted,
  14377. topEnded: eventTypes.ended,
  14378. topError: eventTypes.error,
  14379. topFocus: eventTypes.focus,
  14380. topInput: eventTypes.input,
  14381. topKeyDown: eventTypes.keyDown,
  14382. topKeyPress: eventTypes.keyPress,
  14383. topKeyUp: eventTypes.keyUp,
  14384. topLoad: eventTypes.load,
  14385. topLoadedData: eventTypes.loadedData,
  14386. topLoadedMetadata: eventTypes.loadedMetadata,
  14387. topLoadStart: eventTypes.loadStart,
  14388. topMouseDown: eventTypes.mouseDown,
  14389. topMouseMove: eventTypes.mouseMove,
  14390. topMouseOut: eventTypes.mouseOut,
  14391. topMouseOver: eventTypes.mouseOver,
  14392. topMouseUp: eventTypes.mouseUp,
  14393. topPaste: eventTypes.paste,
  14394. topPause: eventTypes.pause,
  14395. topPlay: eventTypes.play,
  14396. topPlaying: eventTypes.playing,
  14397. topProgress: eventTypes.progress,
  14398. topRateChange: eventTypes.rateChange,
  14399. topReset: eventTypes.reset,
  14400. topScroll: eventTypes.scroll,
  14401. topSeeked: eventTypes.seeked,
  14402. topSeeking: eventTypes.seeking,
  14403. topStalled: eventTypes.stalled,
  14404. topSubmit: eventTypes.submit,
  14405. topSuspend: eventTypes.suspend,
  14406. topTimeUpdate: eventTypes.timeUpdate,
  14407. topTouchCancel: eventTypes.touchCancel,
  14408. topTouchEnd: eventTypes.touchEnd,
  14409. topTouchMove: eventTypes.touchMove,
  14410. topTouchStart: eventTypes.touchStart,
  14411. topVolumeChange: eventTypes.volumeChange,
  14412. topWaiting: eventTypes.waiting,
  14413. topWheel: eventTypes.wheel
  14414. };
  14415. for (var type in topLevelEventsToDispatchConfig) {
  14416. topLevelEventsToDispatchConfig[type].dependencies = [type];
  14417. }
  14418. var ON_CLICK_KEY = keyOf({ onClick: null });
  14419. var onClickListeners = {};
  14420. var SimpleEventPlugin = {
  14421. eventTypes: eventTypes,
  14422. /**
  14423. * @param {string} topLevelType Record from `EventConstants`.
  14424. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  14425. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  14426. * @param {object} nativeEvent Native browser event.
  14427. * @return {*} An accumulation of synthetic events.
  14428. * @see {EventPluginHub.extractEvents}
  14429. */
  14430. extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
  14431. var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
  14432. if (!dispatchConfig) {
  14433. return null;
  14434. }
  14435. var EventConstructor;
  14436. switch (topLevelType) {
  14437. case topLevelTypes.topAbort:
  14438. case topLevelTypes.topCanPlay:
  14439. case topLevelTypes.topCanPlayThrough:
  14440. case topLevelTypes.topDurationChange:
  14441. case topLevelTypes.topEmptied:
  14442. case topLevelTypes.topEncrypted:
  14443. case topLevelTypes.topEnded:
  14444. case topLevelTypes.topError:
  14445. case topLevelTypes.topInput:
  14446. case topLevelTypes.topLoad:
  14447. case topLevelTypes.topLoadedData:
  14448. case topLevelTypes.topLoadedMetadata:
  14449. case topLevelTypes.topLoadStart:
  14450. case topLevelTypes.topPause:
  14451. case topLevelTypes.topPlay:
  14452. case topLevelTypes.topPlaying:
  14453. case topLevelTypes.topProgress:
  14454. case topLevelTypes.topRateChange:
  14455. case topLevelTypes.topReset:
  14456. case topLevelTypes.topSeeked:
  14457. case topLevelTypes.topSeeking:
  14458. case topLevelTypes.topStalled:
  14459. case topLevelTypes.topSubmit:
  14460. case topLevelTypes.topSuspend:
  14461. case topLevelTypes.topTimeUpdate:
  14462. case topLevelTypes.topVolumeChange:
  14463. case topLevelTypes.topWaiting:
  14464. // HTML Events
  14465. // @see http://www.w3.org/TR/html5/index.html#events-0
  14466. EventConstructor = SyntheticEvent;
  14467. break;
  14468. case topLevelTypes.topKeyPress:
  14469. // FireFox creates a keypress event for function keys too. This removes
  14470. // the unwanted keypress events. Enter is however both printable and
  14471. // non-printable. One would expect Tab to be as well (but it isn't).
  14472. if (getEventCharCode(nativeEvent) === 0) {
  14473. return null;
  14474. }
  14475. /* falls through */
  14476. case topLevelTypes.topKeyDown:
  14477. case topLevelTypes.topKeyUp:
  14478. EventConstructor = SyntheticKeyboardEvent;
  14479. break;
  14480. case topLevelTypes.topBlur:
  14481. case topLevelTypes.topFocus:
  14482. EventConstructor = SyntheticFocusEvent;
  14483. break;
  14484. case topLevelTypes.topClick:
  14485. // Firefox creates a click event on right mouse clicks. This removes the
  14486. // unwanted click events.
  14487. if (nativeEvent.button === 2) {
  14488. return null;
  14489. }
  14490. /* falls through */
  14491. case topLevelTypes.topContextMenu:
  14492. case topLevelTypes.topDoubleClick:
  14493. case topLevelTypes.topMouseDown:
  14494. case topLevelTypes.topMouseMove:
  14495. case topLevelTypes.topMouseOut:
  14496. case topLevelTypes.topMouseOver:
  14497. case topLevelTypes.topMouseUp:
  14498. EventConstructor = SyntheticMouseEvent;
  14499. break;
  14500. case topLevelTypes.topDrag:
  14501. case topLevelTypes.topDragEnd:
  14502. case topLevelTypes.topDragEnter:
  14503. case topLevelTypes.topDragExit:
  14504. case topLevelTypes.topDragLeave:
  14505. case topLevelTypes.topDragOver:
  14506. case topLevelTypes.topDragStart:
  14507. case topLevelTypes.topDrop:
  14508. EventConstructor = SyntheticDragEvent;
  14509. break;
  14510. case topLevelTypes.topTouchCancel:
  14511. case topLevelTypes.topTouchEnd:
  14512. case topLevelTypes.topTouchMove:
  14513. case topLevelTypes.topTouchStart:
  14514. EventConstructor = SyntheticTouchEvent;
  14515. break;
  14516. case topLevelTypes.topScroll:
  14517. EventConstructor = SyntheticUIEvent;
  14518. break;
  14519. case topLevelTypes.topWheel:
  14520. EventConstructor = SyntheticWheelEvent;
  14521. break;
  14522. case topLevelTypes.topCopy:
  14523. case topLevelTypes.topCut:
  14524. case topLevelTypes.topPaste:
  14525. EventConstructor = SyntheticClipboardEvent;
  14526. break;
  14527. }
  14528. !EventConstructor ? "production" !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
  14529. var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget);
  14530. EventPropagators.accumulateTwoPhaseDispatches(event);
  14531. return event;
  14532. },
  14533. didPutListener: function (id, registrationName, listener) {
  14534. // Mobile Safari does not fire properly bubble click events on
  14535. // non-interactive elements, which means delegated click listeners do not
  14536. // fire. The workaround for this bug involves attaching an empty click
  14537. // listener on the target node.
  14538. if (registrationName === ON_CLICK_KEY) {
  14539. var node = ReactMount.getNode(id);
  14540. if (!onClickListeners[id]) {
  14541. onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction);
  14542. }
  14543. }
  14544. },
  14545. willDeleteListener: function (id, registrationName) {
  14546. if (registrationName === ON_CLICK_KEY) {
  14547. onClickListeners[id].remove();
  14548. delete onClickListeners[id];
  14549. }
  14550. }
  14551. };
  14552. module.exports = SimpleEventPlugin;
  14553. },{"102":102,"104":104,"105":105,"106":106,"108":108,"109":109,"110":110,"111":111,"112":112,"125":125,"146":146,"15":15,"153":153,"161":161,"166":166,"19":19,"72":72}],102:[function(_dereq_,module,exports){
  14554. /**
  14555. * Copyright 2013-2015, Facebook, Inc.
  14556. * All rights reserved.
  14557. *
  14558. * This source code is licensed under the BSD-style license found in the
  14559. * LICENSE file in the root directory of this source tree. An additional grant
  14560. * of patent rights can be found in the PATENTS file in the same directory.
  14561. *
  14562. * @providesModule SyntheticClipboardEvent
  14563. * @typechecks static-only
  14564. */
  14565. 'use strict';
  14566. var SyntheticEvent = _dereq_(105);
  14567. /**
  14568. * @interface Event
  14569. * @see http://www.w3.org/TR/clipboard-apis/
  14570. */
  14571. var ClipboardEventInterface = {
  14572. clipboardData: function (event) {
  14573. return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
  14574. }
  14575. };
  14576. /**
  14577. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14578. * @param {string} dispatchMarker Marker identifying the event target.
  14579. * @param {object} nativeEvent Native browser event.
  14580. * @extends {SyntheticUIEvent}
  14581. */
  14582. function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  14583. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  14584. }
  14585. SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
  14586. module.exports = SyntheticClipboardEvent;
  14587. },{"105":105}],103:[function(_dereq_,module,exports){
  14588. /**
  14589. * Copyright 2013-2015, Facebook, Inc.
  14590. * All rights reserved.
  14591. *
  14592. * This source code is licensed under the BSD-style license found in the
  14593. * LICENSE file in the root directory of this source tree. An additional grant
  14594. * of patent rights can be found in the PATENTS file in the same directory.
  14595. *
  14596. * @providesModule SyntheticCompositionEvent
  14597. * @typechecks static-only
  14598. */
  14599. 'use strict';
  14600. var SyntheticEvent = _dereq_(105);
  14601. /**
  14602. * @interface Event
  14603. * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
  14604. */
  14605. var CompositionEventInterface = {
  14606. data: null
  14607. };
  14608. /**
  14609. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14610. * @param {string} dispatchMarker Marker identifying the event target.
  14611. * @param {object} nativeEvent Native browser event.
  14612. * @extends {SyntheticUIEvent}
  14613. */
  14614. function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  14615. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  14616. }
  14617. SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
  14618. module.exports = SyntheticCompositionEvent;
  14619. },{"105":105}],104:[function(_dereq_,module,exports){
  14620. /**
  14621. * Copyright 2013-2015, Facebook, Inc.
  14622. * All rights reserved.
  14623. *
  14624. * This source code is licensed under the BSD-style license found in the
  14625. * LICENSE file in the root directory of this source tree. An additional grant
  14626. * of patent rights can be found in the PATENTS file in the same directory.
  14627. *
  14628. * @providesModule SyntheticDragEvent
  14629. * @typechecks static-only
  14630. */
  14631. 'use strict';
  14632. var SyntheticMouseEvent = _dereq_(109);
  14633. /**
  14634. * @interface DragEvent
  14635. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14636. */
  14637. var DragEventInterface = {
  14638. dataTransfer: null
  14639. };
  14640. /**
  14641. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14642. * @param {string} dispatchMarker Marker identifying the event target.
  14643. * @param {object} nativeEvent Native browser event.
  14644. * @extends {SyntheticUIEvent}
  14645. */
  14646. function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  14647. SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  14648. }
  14649. SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
  14650. module.exports = SyntheticDragEvent;
  14651. },{"109":109}],105:[function(_dereq_,module,exports){
  14652. /**
  14653. * Copyright 2013-2015, Facebook, Inc.
  14654. * All rights reserved.
  14655. *
  14656. * This source code is licensed under the BSD-style license found in the
  14657. * LICENSE file in the root directory of this source tree. An additional grant
  14658. * of patent rights can be found in the PATENTS file in the same directory.
  14659. *
  14660. * @providesModule SyntheticEvent
  14661. * @typechecks static-only
  14662. */
  14663. 'use strict';
  14664. var PooledClass = _dereq_(25);
  14665. var assign = _dereq_(24);
  14666. var emptyFunction = _dereq_(153);
  14667. var warning = _dereq_(173);
  14668. /**
  14669. * @interface Event
  14670. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14671. */
  14672. var EventInterface = {
  14673. type: null,
  14674. // currentTarget is set when dispatching; no use in copying it here
  14675. currentTarget: emptyFunction.thatReturnsNull,
  14676. eventPhase: null,
  14677. bubbles: null,
  14678. cancelable: null,
  14679. timeStamp: function (event) {
  14680. return event.timeStamp || Date.now();
  14681. },
  14682. defaultPrevented: null,
  14683. isTrusted: null
  14684. };
  14685. /**
  14686. * Synthetic events are dispatched by event plugins, typically in response to a
  14687. * top-level event delegation handler.
  14688. *
  14689. * These systems should generally use pooling to reduce the frequency of garbage
  14690. * collection. The system should check `isPersistent` to determine whether the
  14691. * event should be released into the pool after being dispatched. Users that
  14692. * need a persisted event should invoke `persist`.
  14693. *
  14694. * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
  14695. * normalizing browser quirks. Subclasses do not necessarily have to implement a
  14696. * DOM interface; custom application-specific events can also subclass this.
  14697. *
  14698. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14699. * @param {string} dispatchMarker Marker identifying the event target.
  14700. * @param {object} nativeEvent Native browser event.
  14701. */
  14702. function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  14703. this.dispatchConfig = dispatchConfig;
  14704. this.dispatchMarker = dispatchMarker;
  14705. this.nativeEvent = nativeEvent;
  14706. this.target = nativeEventTarget;
  14707. this.currentTarget = nativeEventTarget;
  14708. var Interface = this.constructor.Interface;
  14709. for (var propName in Interface) {
  14710. if (!Interface.hasOwnProperty(propName)) {
  14711. continue;
  14712. }
  14713. var normalize = Interface[propName];
  14714. if (normalize) {
  14715. this[propName] = normalize(nativeEvent);
  14716. } else {
  14717. this[propName] = nativeEvent[propName];
  14718. }
  14719. }
  14720. var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
  14721. if (defaultPrevented) {
  14722. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  14723. } else {
  14724. this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
  14725. }
  14726. this.isPropagationStopped = emptyFunction.thatReturnsFalse;
  14727. }
  14728. assign(SyntheticEvent.prototype, {
  14729. preventDefault: function () {
  14730. this.defaultPrevented = true;
  14731. var event = this.nativeEvent;
  14732. if ("production" !== 'production') {
  14733. "production" !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `preventDefault` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
  14734. }
  14735. if (!event) {
  14736. return;
  14737. }
  14738. if (event.preventDefault) {
  14739. event.preventDefault();
  14740. } else {
  14741. event.returnValue = false;
  14742. }
  14743. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  14744. },
  14745. stopPropagation: function () {
  14746. var event = this.nativeEvent;
  14747. if ("production" !== 'production') {
  14748. "production" !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `stopPropagation` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
  14749. }
  14750. if (!event) {
  14751. return;
  14752. }
  14753. if (event.stopPropagation) {
  14754. event.stopPropagation();
  14755. } else {
  14756. event.cancelBubble = true;
  14757. }
  14758. this.isPropagationStopped = emptyFunction.thatReturnsTrue;
  14759. },
  14760. /**
  14761. * We release all dispatched `SyntheticEvent`s after each event loop, adding
  14762. * them back into the pool. This allows a way to hold onto a reference that
  14763. * won't be added back into the pool.
  14764. */
  14765. persist: function () {
  14766. this.isPersistent = emptyFunction.thatReturnsTrue;
  14767. },
  14768. /**
  14769. * Checks if this event should be released back into the pool.
  14770. *
  14771. * @return {boolean} True if this should not be released, false otherwise.
  14772. */
  14773. isPersistent: emptyFunction.thatReturnsFalse,
  14774. /**
  14775. * `PooledClass` looks for `destructor` on each instance it releases.
  14776. */
  14777. destructor: function () {
  14778. var Interface = this.constructor.Interface;
  14779. for (var propName in Interface) {
  14780. this[propName] = null;
  14781. }
  14782. this.dispatchConfig = null;
  14783. this.dispatchMarker = null;
  14784. this.nativeEvent = null;
  14785. }
  14786. });
  14787. SyntheticEvent.Interface = EventInterface;
  14788. /**
  14789. * Helper to reduce boilerplate when creating subclasses.
  14790. *
  14791. * @param {function} Class
  14792. * @param {?object} Interface
  14793. */
  14794. SyntheticEvent.augmentClass = function (Class, Interface) {
  14795. var Super = this;
  14796. var prototype = Object.create(Super.prototype);
  14797. assign(prototype, Class.prototype);
  14798. Class.prototype = prototype;
  14799. Class.prototype.constructor = Class;
  14800. Class.Interface = assign({}, Super.Interface, Interface);
  14801. Class.augmentClass = Super.augmentClass;
  14802. PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
  14803. };
  14804. PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
  14805. module.exports = SyntheticEvent;
  14806. },{"153":153,"173":173,"24":24,"25":25}],106:[function(_dereq_,module,exports){
  14807. /**
  14808. * Copyright 2013-2015, Facebook, Inc.
  14809. * All rights reserved.
  14810. *
  14811. * This source code is licensed under the BSD-style license found in the
  14812. * LICENSE file in the root directory of this source tree. An additional grant
  14813. * of patent rights can be found in the PATENTS file in the same directory.
  14814. *
  14815. * @providesModule SyntheticFocusEvent
  14816. * @typechecks static-only
  14817. */
  14818. 'use strict';
  14819. var SyntheticUIEvent = _dereq_(111);
  14820. /**
  14821. * @interface FocusEvent
  14822. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14823. */
  14824. var FocusEventInterface = {
  14825. relatedTarget: null
  14826. };
  14827. /**
  14828. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14829. * @param {string} dispatchMarker Marker identifying the event target.
  14830. * @param {object} nativeEvent Native browser event.
  14831. * @extends {SyntheticUIEvent}
  14832. */
  14833. function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  14834. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  14835. }
  14836. SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
  14837. module.exports = SyntheticFocusEvent;
  14838. },{"111":111}],107:[function(_dereq_,module,exports){
  14839. /**
  14840. * Copyright 2013-2015, Facebook, Inc.
  14841. * All rights reserved.
  14842. *
  14843. * This source code is licensed under the BSD-style license found in the
  14844. * LICENSE file in the root directory of this source tree. An additional grant
  14845. * of patent rights can be found in the PATENTS file in the same directory.
  14846. *
  14847. * @providesModule SyntheticInputEvent
  14848. * @typechecks static-only
  14849. */
  14850. 'use strict';
  14851. var SyntheticEvent = _dereq_(105);
  14852. /**
  14853. * @interface Event
  14854. * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
  14855. * /#events-inputevents
  14856. */
  14857. var InputEventInterface = {
  14858. data: null
  14859. };
  14860. /**
  14861. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14862. * @param {string} dispatchMarker Marker identifying the event target.
  14863. * @param {object} nativeEvent Native browser event.
  14864. * @extends {SyntheticUIEvent}
  14865. */
  14866. function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  14867. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  14868. }
  14869. SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
  14870. module.exports = SyntheticInputEvent;
  14871. },{"105":105}],108:[function(_dereq_,module,exports){
  14872. /**
  14873. * Copyright 2013-2015, Facebook, Inc.
  14874. * All rights reserved.
  14875. *
  14876. * This source code is licensed under the BSD-style license found in the
  14877. * LICENSE file in the root directory of this source tree. An additional grant
  14878. * of patent rights can be found in the PATENTS file in the same directory.
  14879. *
  14880. * @providesModule SyntheticKeyboardEvent
  14881. * @typechecks static-only
  14882. */
  14883. 'use strict';
  14884. var SyntheticUIEvent = _dereq_(111);
  14885. var getEventCharCode = _dereq_(125);
  14886. var getEventKey = _dereq_(126);
  14887. var getEventModifierState = _dereq_(127);
  14888. /**
  14889. * @interface KeyboardEvent
  14890. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14891. */
  14892. var KeyboardEventInterface = {
  14893. key: getEventKey,
  14894. location: null,
  14895. ctrlKey: null,
  14896. shiftKey: null,
  14897. altKey: null,
  14898. metaKey: null,
  14899. repeat: null,
  14900. locale: null,
  14901. getModifierState: getEventModifierState,
  14902. // Legacy Interface
  14903. charCode: function (event) {
  14904. // `charCode` is the result of a KeyPress event and represents the value of
  14905. // the actual printable character.
  14906. // KeyPress is deprecated, but its replacement is not yet final and not
  14907. // implemented in any major browser. Only KeyPress has charCode.
  14908. if (event.type === 'keypress') {
  14909. return getEventCharCode(event);
  14910. }
  14911. return 0;
  14912. },
  14913. keyCode: function (event) {
  14914. // `keyCode` is the result of a KeyDown/Up event and represents the value of
  14915. // physical keyboard key.
  14916. // The actual meaning of the value depends on the users' keyboard layout
  14917. // which cannot be detected. Assuming that it is a US keyboard layout
  14918. // provides a surprisingly accurate mapping for US and European users.
  14919. // Due to this, it is left to the user to implement at this time.
  14920. if (event.type === 'keydown' || event.type === 'keyup') {
  14921. return event.keyCode;
  14922. }
  14923. return 0;
  14924. },
  14925. which: function (event) {
  14926. // `which` is an alias for either `keyCode` or `charCode` depending on the
  14927. // type of the event.
  14928. if (event.type === 'keypress') {
  14929. return getEventCharCode(event);
  14930. }
  14931. if (event.type === 'keydown' || event.type === 'keyup') {
  14932. return event.keyCode;
  14933. }
  14934. return 0;
  14935. }
  14936. };
  14937. /**
  14938. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14939. * @param {string} dispatchMarker Marker identifying the event target.
  14940. * @param {object} nativeEvent Native browser event.
  14941. * @extends {SyntheticUIEvent}
  14942. */
  14943. function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  14944. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  14945. }
  14946. SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
  14947. module.exports = SyntheticKeyboardEvent;
  14948. },{"111":111,"125":125,"126":126,"127":127}],109:[function(_dereq_,module,exports){
  14949. /**
  14950. * Copyright 2013-2015, Facebook, Inc.
  14951. * All rights reserved.
  14952. *
  14953. * This source code is licensed under the BSD-style license found in the
  14954. * LICENSE file in the root directory of this source tree. An additional grant
  14955. * of patent rights can be found in the PATENTS file in the same directory.
  14956. *
  14957. * @providesModule SyntheticMouseEvent
  14958. * @typechecks static-only
  14959. */
  14960. 'use strict';
  14961. var SyntheticUIEvent = _dereq_(111);
  14962. var ViewportMetrics = _dereq_(114);
  14963. var getEventModifierState = _dereq_(127);
  14964. /**
  14965. * @interface MouseEvent
  14966. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14967. */
  14968. var MouseEventInterface = {
  14969. screenX: null,
  14970. screenY: null,
  14971. clientX: null,
  14972. clientY: null,
  14973. ctrlKey: null,
  14974. shiftKey: null,
  14975. altKey: null,
  14976. metaKey: null,
  14977. getModifierState: getEventModifierState,
  14978. button: function (event) {
  14979. // Webkit, Firefox, IE9+
  14980. // which: 1 2 3
  14981. // button: 0 1 2 (standard)
  14982. var button = event.button;
  14983. if ('which' in event) {
  14984. return button;
  14985. }
  14986. // IE<9
  14987. // which: undefined
  14988. // button: 0 0 0
  14989. // button: 1 4 2 (onmouseup)
  14990. return button === 2 ? 2 : button === 4 ? 1 : 0;
  14991. },
  14992. buttons: null,
  14993. relatedTarget: function (event) {
  14994. return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
  14995. },
  14996. // "Proprietary" Interface.
  14997. pageX: function (event) {
  14998. return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
  14999. },
  15000. pageY: function (event) {
  15001. return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
  15002. }
  15003. };
  15004. /**
  15005. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15006. * @param {string} dispatchMarker Marker identifying the event target.
  15007. * @param {object} nativeEvent Native browser event.
  15008. * @extends {SyntheticUIEvent}
  15009. */
  15010. function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  15011. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  15012. }
  15013. SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
  15014. module.exports = SyntheticMouseEvent;
  15015. },{"111":111,"114":114,"127":127}],110:[function(_dereq_,module,exports){
  15016. /**
  15017. * Copyright 2013-2015, Facebook, Inc.
  15018. * All rights reserved.
  15019. *
  15020. * This source code is licensed under the BSD-style license found in the
  15021. * LICENSE file in the root directory of this source tree. An additional grant
  15022. * of patent rights can be found in the PATENTS file in the same directory.
  15023. *
  15024. * @providesModule SyntheticTouchEvent
  15025. * @typechecks static-only
  15026. */
  15027. 'use strict';
  15028. var SyntheticUIEvent = _dereq_(111);
  15029. var getEventModifierState = _dereq_(127);
  15030. /**
  15031. * @interface TouchEvent
  15032. * @see http://www.w3.org/TR/touch-events/
  15033. */
  15034. var TouchEventInterface = {
  15035. touches: null,
  15036. targetTouches: null,
  15037. changedTouches: null,
  15038. altKey: null,
  15039. metaKey: null,
  15040. ctrlKey: null,
  15041. shiftKey: null,
  15042. getModifierState: getEventModifierState
  15043. };
  15044. /**
  15045. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15046. * @param {string} dispatchMarker Marker identifying the event target.
  15047. * @param {object} nativeEvent Native browser event.
  15048. * @extends {SyntheticUIEvent}
  15049. */
  15050. function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  15051. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  15052. }
  15053. SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
  15054. module.exports = SyntheticTouchEvent;
  15055. },{"111":111,"127":127}],111:[function(_dereq_,module,exports){
  15056. /**
  15057. * Copyright 2013-2015, Facebook, Inc.
  15058. * All rights reserved.
  15059. *
  15060. * This source code is licensed under the BSD-style license found in the
  15061. * LICENSE file in the root directory of this source tree. An additional grant
  15062. * of patent rights can be found in the PATENTS file in the same directory.
  15063. *
  15064. * @providesModule SyntheticUIEvent
  15065. * @typechecks static-only
  15066. */
  15067. 'use strict';
  15068. var SyntheticEvent = _dereq_(105);
  15069. var getEventTarget = _dereq_(128);
  15070. /**
  15071. * @interface UIEvent
  15072. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  15073. */
  15074. var UIEventInterface = {
  15075. view: function (event) {
  15076. if (event.view) {
  15077. return event.view;
  15078. }
  15079. var target = getEventTarget(event);
  15080. if (target != null && target.window === target) {
  15081. // target is a window object
  15082. return target;
  15083. }
  15084. var doc = target.ownerDocument;
  15085. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  15086. if (doc) {
  15087. return doc.defaultView || doc.parentWindow;
  15088. } else {
  15089. return window;
  15090. }
  15091. },
  15092. detail: function (event) {
  15093. return event.detail || 0;
  15094. }
  15095. };
  15096. /**
  15097. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15098. * @param {string} dispatchMarker Marker identifying the event target.
  15099. * @param {object} nativeEvent Native browser event.
  15100. * @extends {SyntheticEvent}
  15101. */
  15102. function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  15103. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  15104. }
  15105. SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
  15106. module.exports = SyntheticUIEvent;
  15107. },{"105":105,"128":128}],112:[function(_dereq_,module,exports){
  15108. /**
  15109. * Copyright 2013-2015, Facebook, Inc.
  15110. * All rights reserved.
  15111. *
  15112. * This source code is licensed under the BSD-style license found in the
  15113. * LICENSE file in the root directory of this source tree. An additional grant
  15114. * of patent rights can be found in the PATENTS file in the same directory.
  15115. *
  15116. * @providesModule SyntheticWheelEvent
  15117. * @typechecks static-only
  15118. */
  15119. 'use strict';
  15120. var SyntheticMouseEvent = _dereq_(109);
  15121. /**
  15122. * @interface WheelEvent
  15123. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  15124. */
  15125. var WheelEventInterface = {
  15126. deltaX: function (event) {
  15127. return 'deltaX' in event ? event.deltaX :
  15128. // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
  15129. 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
  15130. },
  15131. deltaY: function (event) {
  15132. return 'deltaY' in event ? event.deltaY :
  15133. // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
  15134. 'wheelDeltaY' in event ? -event.wheelDeltaY :
  15135. // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
  15136. 'wheelDelta' in event ? -event.wheelDelta : 0;
  15137. },
  15138. deltaZ: null,
  15139. // Browsers without "deltaMode" is reporting in raw wheel delta where one
  15140. // notch on the scroll is always +/- 120, roughly equivalent to pixels.
  15141. // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
  15142. // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
  15143. deltaMode: null
  15144. };
  15145. /**
  15146. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15147. * @param {string} dispatchMarker Marker identifying the event target.
  15148. * @param {object} nativeEvent Native browser event.
  15149. * @extends {SyntheticMouseEvent}
  15150. */
  15151. function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  15152. SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  15153. }
  15154. SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
  15155. module.exports = SyntheticWheelEvent;
  15156. },{"109":109}],113:[function(_dereq_,module,exports){
  15157. /**
  15158. * Copyright 2013-2015, Facebook, Inc.
  15159. * All rights reserved.
  15160. *
  15161. * This source code is licensed under the BSD-style license found in the
  15162. * LICENSE file in the root directory of this source tree. An additional grant
  15163. * of patent rights can be found in the PATENTS file in the same directory.
  15164. *
  15165. * @providesModule Transaction
  15166. */
  15167. 'use strict';
  15168. var invariant = _dereq_(161);
  15169. /**
  15170. * `Transaction` creates a black box that is able to wrap any method such that
  15171. * certain invariants are maintained before and after the method is invoked
  15172. * (Even if an exception is thrown while invoking the wrapped method). Whoever
  15173. * instantiates a transaction can provide enforcers of the invariants at
  15174. * creation time. The `Transaction` class itself will supply one additional
  15175. * automatic invariant for you - the invariant that any transaction instance
  15176. * should not be run while it is already being run. You would typically create a
  15177. * single instance of a `Transaction` for reuse multiple times, that potentially
  15178. * is used to wrap several different methods. Wrappers are extremely simple -
  15179. * they only require implementing two methods.
  15180. *
  15181. * <pre>
  15182. * wrappers (injected at creation time)
  15183. * + +
  15184. * | |
  15185. * +-----------------|--------|--------------+
  15186. * | v | |
  15187. * | +---------------+ | |
  15188. * | +--| wrapper1 |---|----+ |
  15189. * | | +---------------+ v | |
  15190. * | | +-------------+ | |
  15191. * | | +----| wrapper2 |--------+ |
  15192. * | | | +-------------+ | | |
  15193. * | | | | | |
  15194. * | v v v v | wrapper
  15195. * | +---+ +---+ +---------+ +---+ +---+ | invariants
  15196. * perform(anyMethod) | | | | | | | | | | | | maintained
  15197. * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
  15198. * | | | | | | | | | | | |
  15199. * | | | | | | | | | | | |
  15200. * | | | | | | | | | | | |
  15201. * | +---+ +---+ +---------+ +---+ +---+ |
  15202. * | initialize close |
  15203. * +-----------------------------------------+
  15204. * </pre>
  15205. *
  15206. * Use cases:
  15207. * - Preserving the input selection ranges before/after reconciliation.
  15208. * Restoring selection even in the event of an unexpected error.
  15209. * - Deactivating events while rearranging the DOM, preventing blurs/focuses,
  15210. * while guaranteeing that afterwards, the event system is reactivated.
  15211. * - Flushing a queue of collected DOM mutations to the main UI thread after a
  15212. * reconciliation takes place in a worker thread.
  15213. * - Invoking any collected `componentDidUpdate` callbacks after rendering new
  15214. * content.
  15215. * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
  15216. * to preserve the `scrollTop` (an automatic scroll aware DOM).
  15217. * - (Future use case): Layout calculations before and after DOM updates.
  15218. *
  15219. * Transactional plugin API:
  15220. * - A module that has an `initialize` method that returns any precomputation.
  15221. * - and a `close` method that accepts the precomputation. `close` is invoked
  15222. * when the wrapped process is completed, or has failed.
  15223. *
  15224. * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
  15225. * that implement `initialize` and `close`.
  15226. * @return {Transaction} Single transaction for reuse in thread.
  15227. *
  15228. * @class Transaction
  15229. */
  15230. var Mixin = {
  15231. /**
  15232. * Sets up this instance so that it is prepared for collecting metrics. Does
  15233. * so such that this setup method may be used on an instance that is already
  15234. * initialized, in a way that does not consume additional memory upon reuse.
  15235. * That can be useful if you decide to make your subclass of this mixin a
  15236. * "PooledClass".
  15237. */
  15238. reinitializeTransaction: function () {
  15239. this.transactionWrappers = this.getTransactionWrappers();
  15240. if (this.wrapperInitData) {
  15241. this.wrapperInitData.length = 0;
  15242. } else {
  15243. this.wrapperInitData = [];
  15244. }
  15245. this._isInTransaction = false;
  15246. },
  15247. _isInTransaction: false,
  15248. /**
  15249. * @abstract
  15250. * @return {Array<TransactionWrapper>} Array of transaction wrappers.
  15251. */
  15252. getTransactionWrappers: null,
  15253. isInTransaction: function () {
  15254. return !!this._isInTransaction;
  15255. },
  15256. /**
  15257. * Executes the function within a safety window. Use this for the top level
  15258. * methods that result in large amounts of computation/mutations that would
  15259. * need to be safety checked. The optional arguments helps prevent the need
  15260. * to bind in many cases.
  15261. *
  15262. * @param {function} method Member of scope to call.
  15263. * @param {Object} scope Scope to invoke from.
  15264. * @param {Object?=} a Argument to pass to the method.
  15265. * @param {Object?=} b Argument to pass to the method.
  15266. * @param {Object?=} c Argument to pass to the method.
  15267. * @param {Object?=} d Argument to pass to the method.
  15268. * @param {Object?=} e Argument to pass to the method.
  15269. * @param {Object?=} f Argument to pass to the method.
  15270. *
  15271. * @return {*} Return value from `method`.
  15272. */
  15273. perform: function (method, scope, a, b, c, d, e, f) {
  15274. !!this.isInTransaction() ? "production" !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : undefined;
  15275. var errorThrown;
  15276. var ret;
  15277. try {
  15278. this._isInTransaction = true;
  15279. // Catching errors makes debugging more difficult, so we start with
  15280. // errorThrown set to true before setting it to false after calling
  15281. // close -- if it's still set to true in the finally block, it means
  15282. // one of these calls threw.
  15283. errorThrown = true;
  15284. this.initializeAll(0);
  15285. ret = method.call(scope, a, b, c, d, e, f);
  15286. errorThrown = false;
  15287. } finally {
  15288. try {
  15289. if (errorThrown) {
  15290. // If `method` throws, prefer to show that stack trace over any thrown
  15291. // by invoking `closeAll`.
  15292. try {
  15293. this.closeAll(0);
  15294. } catch (err) {}
  15295. } else {
  15296. // Since `method` didn't throw, we don't want to silence the exception
  15297. // here.
  15298. this.closeAll(0);
  15299. }
  15300. } finally {
  15301. this._isInTransaction = false;
  15302. }
  15303. }
  15304. return ret;
  15305. },
  15306. initializeAll: function (startIndex) {
  15307. var transactionWrappers = this.transactionWrappers;
  15308. for (var i = startIndex; i < transactionWrappers.length; i++) {
  15309. var wrapper = transactionWrappers[i];
  15310. try {
  15311. // Catching errors makes debugging more difficult, so we start with the
  15312. // OBSERVED_ERROR state before overwriting it with the real return value
  15313. // of initialize -- if it's still set to OBSERVED_ERROR in the finally
  15314. // block, it means wrapper.initialize threw.
  15315. this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
  15316. this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
  15317. } finally {
  15318. if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
  15319. // The initializer for wrapper i threw an error; initialize the
  15320. // remaining wrappers but silence any exceptions from them to ensure
  15321. // that the first error is the one to bubble up.
  15322. try {
  15323. this.initializeAll(i + 1);
  15324. } catch (err) {}
  15325. }
  15326. }
  15327. }
  15328. },
  15329. /**
  15330. * Invokes each of `this.transactionWrappers.close[i]` functions, passing into
  15331. * them the respective return values of `this.transactionWrappers.init[i]`
  15332. * (`close`rs that correspond to initializers that failed will not be
  15333. * invoked).
  15334. */
  15335. closeAll: function (startIndex) {
  15336. !this.isInTransaction() ? "production" !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : undefined;
  15337. var transactionWrappers = this.transactionWrappers;
  15338. for (var i = startIndex; i < transactionWrappers.length; i++) {
  15339. var wrapper = transactionWrappers[i];
  15340. var initData = this.wrapperInitData[i];
  15341. var errorThrown;
  15342. try {
  15343. // Catching errors makes debugging more difficult, so we start with
  15344. // errorThrown set to true before setting it to false after calling
  15345. // close -- if it's still set to true in the finally block, it means
  15346. // wrapper.close threw.
  15347. errorThrown = true;
  15348. if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {
  15349. wrapper.close.call(this, initData);
  15350. }
  15351. errorThrown = false;
  15352. } finally {
  15353. if (errorThrown) {
  15354. // The closer for wrapper i threw an error; close the remaining
  15355. // wrappers but silence any exceptions from them to ensure that the
  15356. // first error is the one to bubble up.
  15357. try {
  15358. this.closeAll(i + 1);
  15359. } catch (e) {}
  15360. }
  15361. }
  15362. }
  15363. this.wrapperInitData.length = 0;
  15364. }
  15365. };
  15366. var Transaction = {
  15367. Mixin: Mixin,
  15368. /**
  15369. * Token to look for to determine if an error occurred.
  15370. */
  15371. OBSERVED_ERROR: {}
  15372. };
  15373. module.exports = Transaction;
  15374. },{"161":161}],114:[function(_dereq_,module,exports){
  15375. /**
  15376. * Copyright 2013-2015, Facebook, Inc.
  15377. * All rights reserved.
  15378. *
  15379. * This source code is licensed under the BSD-style license found in the
  15380. * LICENSE file in the root directory of this source tree. An additional grant
  15381. * of patent rights can be found in the PATENTS file in the same directory.
  15382. *
  15383. * @providesModule ViewportMetrics
  15384. */
  15385. 'use strict';
  15386. var ViewportMetrics = {
  15387. currentScrollLeft: 0,
  15388. currentScrollTop: 0,
  15389. refreshScrollValues: function (scrollPosition) {
  15390. ViewportMetrics.currentScrollLeft = scrollPosition.x;
  15391. ViewportMetrics.currentScrollTop = scrollPosition.y;
  15392. }
  15393. };
  15394. module.exports = ViewportMetrics;
  15395. },{}],115:[function(_dereq_,module,exports){
  15396. /**
  15397. * Copyright 2014-2015, Facebook, Inc.
  15398. * All rights reserved.
  15399. *
  15400. * This source code is licensed under the BSD-style license found in the
  15401. * LICENSE file in the root directory of this source tree. An additional grant
  15402. * of patent rights can be found in the PATENTS file in the same directory.
  15403. *
  15404. * @providesModule accumulateInto
  15405. */
  15406. 'use strict';
  15407. var invariant = _dereq_(161);
  15408. /**
  15409. *
  15410. * Accumulates items that must not be null or undefined into the first one. This
  15411. * is used to conserve memory by avoiding array allocations, and thus sacrifices
  15412. * API cleanness. Since `current` can be null before being passed in and not
  15413. * null after this function, make sure to assign it back to `current`:
  15414. *
  15415. * `a = accumulateInto(a, b);`
  15416. *
  15417. * This API should be sparingly used. Try `accumulate` for something cleaner.
  15418. *
  15419. * @return {*|array<*>} An accumulation of items.
  15420. */
  15421. function accumulateInto(current, next) {
  15422. !(next != null) ? "production" !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined;
  15423. if (current == null) {
  15424. return next;
  15425. }
  15426. // Both are not empty. Warning: Never call x.concat(y) when you are not
  15427. // certain that x is an Array (x could be a string with concat method).
  15428. var currentIsArray = Array.isArray(current);
  15429. var nextIsArray = Array.isArray(next);
  15430. if (currentIsArray && nextIsArray) {
  15431. current.push.apply(current, next);
  15432. return current;
  15433. }
  15434. if (currentIsArray) {
  15435. current.push(next);
  15436. return current;
  15437. }
  15438. if (nextIsArray) {
  15439. // A bit too dangerous to mutate `next`.
  15440. return [current].concat(next);
  15441. }
  15442. return [current, next];
  15443. }
  15444. module.exports = accumulateInto;
  15445. },{"161":161}],116:[function(_dereq_,module,exports){
  15446. /**
  15447. * Copyright 2013-2015, Facebook, Inc.
  15448. * All rights reserved.
  15449. *
  15450. * This source code is licensed under the BSD-style license found in the
  15451. * LICENSE file in the root directory of this source tree. An additional grant
  15452. * of patent rights can be found in the PATENTS file in the same directory.
  15453. *
  15454. * @providesModule adler32
  15455. */
  15456. 'use strict';
  15457. var MOD = 65521;
  15458. // adler32 is not cryptographically strong, and is only used to sanity check that
  15459. // markup generated on the server matches the markup generated on the client.
  15460. // This implementation (a modified version of the SheetJS version) has been optimized
  15461. // for our use case, at the expense of conforming to the adler32 specification
  15462. // for non-ascii inputs.
  15463. function adler32(data) {
  15464. var a = 1;
  15465. var b = 0;
  15466. var i = 0;
  15467. var l = data.length;
  15468. var m = l & ~0x3;
  15469. while (i < m) {
  15470. for (; i < Math.min(i + 4096, m); i += 4) {
  15471. b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
  15472. }
  15473. a %= MOD;
  15474. b %= MOD;
  15475. }
  15476. for (; i < l; i++) {
  15477. b += a += data.charCodeAt(i);
  15478. }
  15479. a %= MOD;
  15480. b %= MOD;
  15481. return a | b << 16;
  15482. }
  15483. module.exports = adler32;
  15484. },{}],117:[function(_dereq_,module,exports){
  15485. /**
  15486. * Copyright 2013-2015, Facebook, Inc.
  15487. * All rights reserved.
  15488. *
  15489. * This source code is licensed under the BSD-style license found in the
  15490. * LICENSE file in the root directory of this source tree. An additional grant
  15491. * of patent rights can be found in the PATENTS file in the same directory.
  15492. *
  15493. * @providesModule canDefineProperty
  15494. */
  15495. 'use strict';
  15496. var canDefineProperty = false;
  15497. if ("production" !== 'production') {
  15498. try {
  15499. Object.defineProperty({}, 'x', { get: function () {} });
  15500. canDefineProperty = true;
  15501. } catch (x) {
  15502. // IE will fail on defineProperty
  15503. }
  15504. }
  15505. module.exports = canDefineProperty;
  15506. },{}],118:[function(_dereq_,module,exports){
  15507. /**
  15508. * Copyright 2013-2015, Facebook, Inc.
  15509. * All rights reserved.
  15510. *
  15511. * This source code is licensed under the BSD-style license found in the
  15512. * LICENSE file in the root directory of this source tree. An additional grant
  15513. * of patent rights can be found in the PATENTS file in the same directory.
  15514. *
  15515. * @typechecks static-only
  15516. * @providesModule cloneWithProps
  15517. */
  15518. 'use strict';
  15519. var ReactElement = _dereq_(57);
  15520. var ReactPropTransferer = _dereq_(79);
  15521. var keyOf = _dereq_(166);
  15522. var warning = _dereq_(173);
  15523. var CHILDREN_PROP = keyOf({ children: null });
  15524. var didDeprecatedWarn = false;
  15525. /**
  15526. * Sometimes you want to change the props of a child passed to you. Usually
  15527. * this is to add a CSS class.
  15528. *
  15529. * @param {ReactElement} child child element you'd like to clone
  15530. * @param {object} props props you'd like to modify. className and style will be
  15531. * merged automatically.
  15532. * @return {ReactElement} a clone of child with props merged in.
  15533. * @deprecated
  15534. */
  15535. function cloneWithProps(child, props) {
  15536. if ("production" !== 'production') {
  15537. "production" !== 'production' ? warning(didDeprecatedWarn, 'cloneWithProps(...) is deprecated. ' + 'Please use React.cloneElement instead.') : undefined;
  15538. didDeprecatedWarn = true;
  15539. "production" !== 'production' ? warning(!child.ref, 'You are calling cloneWithProps() on a child with a ref. This is ' + 'dangerous because you\'re creating a new child which will not be ' + 'added as a ref to its parent.') : undefined;
  15540. }
  15541. var newProps = ReactPropTransferer.mergeProps(props, child.props);
  15542. // Use `child.props.children` if it is provided.
  15543. if (!newProps.hasOwnProperty(CHILDREN_PROP) && child.props.hasOwnProperty(CHILDREN_PROP)) {
  15544. newProps.children = child.props.children;
  15545. }
  15546. // The current API doesn't retain _owner, which is why this
  15547. // doesn't use ReactElement.cloneAndReplaceProps.
  15548. return ReactElement.createElement(child.type, newProps);
  15549. }
  15550. module.exports = cloneWithProps;
  15551. },{"166":166,"173":173,"57":57,"79":79}],119:[function(_dereq_,module,exports){
  15552. /**
  15553. * Copyright 2013-2015, Facebook, Inc.
  15554. * All rights reserved.
  15555. *
  15556. * This source code is licensed under the BSD-style license found in the
  15557. * LICENSE file in the root directory of this source tree. An additional grant
  15558. * of patent rights can be found in the PATENTS file in the same directory.
  15559. *
  15560. * @providesModule dangerousStyleValue
  15561. * @typechecks static-only
  15562. */
  15563. 'use strict';
  15564. var CSSProperty = _dereq_(4);
  15565. var isUnitlessNumber = CSSProperty.isUnitlessNumber;
  15566. /**
  15567. * Convert a value into the proper css writable value. The style name `name`
  15568. * should be logical (no hyphens), as specified
  15569. * in `CSSProperty.isUnitlessNumber`.
  15570. *
  15571. * @param {string} name CSS property name such as `topMargin`.
  15572. * @param {*} value CSS property value such as `10px`.
  15573. * @return {string} Normalized style value with dimensions applied.
  15574. */
  15575. function dangerousStyleValue(name, value) {
  15576. // Note that we've removed escapeTextForBrowser() calls here since the
  15577. // whole string will be escaped when the attribute is injected into
  15578. // the markup. If you provide unsafe user data here they can inject
  15579. // arbitrary CSS which may be problematic (I couldn't repro this):
  15580. // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
  15581. // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
  15582. // This is not an XSS hole but instead a potential CSS injection issue
  15583. // which has lead to a greater discussion about how we're going to
  15584. // trust URLs moving forward. See #2115901
  15585. var isEmpty = value == null || typeof value === 'boolean' || value === '';
  15586. if (isEmpty) {
  15587. return '';
  15588. }
  15589. var isNonNumeric = isNaN(value);
  15590. if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
  15591. return '' + value; // cast to string
  15592. }
  15593. if (typeof value === 'string') {
  15594. value = value.trim();
  15595. }
  15596. return value + 'px';
  15597. }
  15598. module.exports = dangerousStyleValue;
  15599. },{"4":4}],120:[function(_dereq_,module,exports){
  15600. /**
  15601. * Copyright 2013-2015, Facebook, Inc.
  15602. * All rights reserved.
  15603. *
  15604. * This source code is licensed under the BSD-style license found in the
  15605. * LICENSE file in the root directory of this source tree. An additional grant
  15606. * of patent rights can be found in the PATENTS file in the same directory.
  15607. *
  15608. * @providesModule deprecated
  15609. */
  15610. 'use strict';
  15611. var assign = _dereq_(24);
  15612. var warning = _dereq_(173);
  15613. /**
  15614. * This will log a single deprecation notice per function and forward the call
  15615. * on to the new API.
  15616. *
  15617. * @param {string} fnName The name of the function
  15618. * @param {string} newModule The module that fn will exist in
  15619. * @param {string} newPackage The module that fn will exist in
  15620. * @param {*} ctx The context this forwarded call should run in
  15621. * @param {function} fn The function to forward on to
  15622. * @return {function} The function that will warn once and then call fn
  15623. */
  15624. function deprecated(fnName, newModule, newPackage, ctx, fn) {
  15625. var warned = false;
  15626. if ("production" !== 'production') {
  15627. var newFn = function () {
  15628. "production" !== 'production' ? warning(warned,
  15629. // Require examples in this string must be split to prevent React's
  15630. // build tools from mistaking them for real requires.
  15631. // Otherwise the build tools will attempt to build a '%s' module.
  15632. 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined;
  15633. warned = true;
  15634. return fn.apply(ctx, arguments);
  15635. };
  15636. // We need to make sure all properties of the original fn are copied over.
  15637. // In particular, this is needed to support PropTypes
  15638. return assign(newFn, fn);
  15639. }
  15640. return fn;
  15641. }
  15642. module.exports = deprecated;
  15643. },{"173":173,"24":24}],121:[function(_dereq_,module,exports){
  15644. /**
  15645. * Copyright 2013-2015, Facebook, Inc.
  15646. * All rights reserved.
  15647. *
  15648. * This source code is licensed under the BSD-style license found in the
  15649. * LICENSE file in the root directory of this source tree. An additional grant
  15650. * of patent rights can be found in the PATENTS file in the same directory.
  15651. *
  15652. * @providesModule escapeTextContentForBrowser
  15653. */
  15654. 'use strict';
  15655. var ESCAPE_LOOKUP = {
  15656. '&': '&amp;',
  15657. '>': '&gt;',
  15658. '<': '&lt;',
  15659. '"': '&quot;',
  15660. '\'': '&#x27;'
  15661. };
  15662. var ESCAPE_REGEX = /[&><"']/g;
  15663. function escaper(match) {
  15664. return ESCAPE_LOOKUP[match];
  15665. }
  15666. /**
  15667. * Escapes text to prevent scripting attacks.
  15668. *
  15669. * @param {*} text Text value to escape.
  15670. * @return {string} An escaped string.
  15671. */
  15672. function escapeTextContentForBrowser(text) {
  15673. return ('' + text).replace(ESCAPE_REGEX, escaper);
  15674. }
  15675. module.exports = escapeTextContentForBrowser;
  15676. },{}],122:[function(_dereq_,module,exports){
  15677. /**
  15678. * Copyright 2013-2015, Facebook, Inc.
  15679. * All rights reserved.
  15680. *
  15681. * This source code is licensed under the BSD-style license found in the
  15682. * LICENSE file in the root directory of this source tree. An additional grant
  15683. * of patent rights can be found in the PATENTS file in the same directory.
  15684. *
  15685. * @providesModule findDOMNode
  15686. * @typechecks static-only
  15687. */
  15688. 'use strict';
  15689. var ReactCurrentOwner = _dereq_(39);
  15690. var ReactInstanceMap = _dereq_(68);
  15691. var ReactMount = _dereq_(72);
  15692. var invariant = _dereq_(161);
  15693. var warning = _dereq_(173);
  15694. /**
  15695. * Returns the DOM node rendered by this element.
  15696. *
  15697. * @param {ReactComponent|DOMElement} componentOrElement
  15698. * @return {?DOMElement} The root node of this element.
  15699. */
  15700. function findDOMNode(componentOrElement) {
  15701. if ("production" !== 'production') {
  15702. var owner = ReactCurrentOwner.current;
  15703. if (owner !== null) {
  15704. "production" !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
  15705. owner._warnedAboutRefsInRender = true;
  15706. }
  15707. }
  15708. if (componentOrElement == null) {
  15709. return null;
  15710. }
  15711. if (componentOrElement.nodeType === 1) {
  15712. return componentOrElement;
  15713. }
  15714. if (ReactInstanceMap.has(componentOrElement)) {
  15715. return ReactMount.getNodeFromInstance(componentOrElement);
  15716. }
  15717. !(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? "production" !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : undefined;
  15718. !false ? "production" !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;
  15719. }
  15720. module.exports = findDOMNode;
  15721. },{"161":161,"173":173,"39":39,"68":68,"72":72}],123:[function(_dereq_,module,exports){
  15722. /**
  15723. * Copyright 2013-2015, Facebook, Inc.
  15724. * All rights reserved.
  15725. *
  15726. * This source code is licensed under the BSD-style license found in the
  15727. * LICENSE file in the root directory of this source tree. An additional grant
  15728. * of patent rights can be found in the PATENTS file in the same directory.
  15729. *
  15730. * @providesModule flattenChildren
  15731. */
  15732. 'use strict';
  15733. var traverseAllChildren = _dereq_(142);
  15734. var warning = _dereq_(173);
  15735. /**
  15736. * @param {function} traverseContext Context passed through traversal.
  15737. * @param {?ReactComponent} child React child component.
  15738. * @param {!string} name String name of key path to child.
  15739. */
  15740. function flattenSingleChildIntoContext(traverseContext, child, name) {
  15741. // We found a component instance.
  15742. var result = traverseContext;
  15743. var keyUnique = result[name] === undefined;
  15744. if ("production" !== 'production') {
  15745. "production" !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
  15746. }
  15747. if (keyUnique && child != null) {
  15748. result[name] = child;
  15749. }
  15750. }
  15751. /**
  15752. * Flattens children that are typically specified as `props.children`. Any null
  15753. * children will not be included in the resulting object.
  15754. * @return {!object} flattened children keyed by name.
  15755. */
  15756. function flattenChildren(children) {
  15757. if (children == null) {
  15758. return children;
  15759. }
  15760. var result = {};
  15761. traverseAllChildren(children, flattenSingleChildIntoContext, result);
  15762. return result;
  15763. }
  15764. module.exports = flattenChildren;
  15765. },{"142":142,"173":173}],124:[function(_dereq_,module,exports){
  15766. /**
  15767. * Copyright 2013-2015, Facebook, Inc.
  15768. * All rights reserved.
  15769. *
  15770. * This source code is licensed under the BSD-style license found in the
  15771. * LICENSE file in the root directory of this source tree. An additional grant
  15772. * of patent rights can be found in the PATENTS file in the same directory.
  15773. *
  15774. * @providesModule forEachAccumulated
  15775. */
  15776. 'use strict';
  15777. /**
  15778. * @param {array} arr an "accumulation" of items which is either an Array or
  15779. * a single item. Useful when paired with the `accumulate` module. This is a
  15780. * simple utility that allows us to reason about a collection of items, but
  15781. * handling the case when there is exactly one item (and we do not need to
  15782. * allocate an array).
  15783. */
  15784. var forEachAccumulated = function (arr, cb, scope) {
  15785. if (Array.isArray(arr)) {
  15786. arr.forEach(cb, scope);
  15787. } else if (arr) {
  15788. cb.call(scope, arr);
  15789. }
  15790. };
  15791. module.exports = forEachAccumulated;
  15792. },{}],125:[function(_dereq_,module,exports){
  15793. /**
  15794. * Copyright 2013-2015, Facebook, Inc.
  15795. * All rights reserved.
  15796. *
  15797. * This source code is licensed under the BSD-style license found in the
  15798. * LICENSE file in the root directory of this source tree. An additional grant
  15799. * of patent rights can be found in the PATENTS file in the same directory.
  15800. *
  15801. * @providesModule getEventCharCode
  15802. * @typechecks static-only
  15803. */
  15804. 'use strict';
  15805. /**
  15806. * `charCode` represents the actual "character code" and is safe to use with
  15807. * `String.fromCharCode`. As such, only keys that correspond to printable
  15808. * characters produce a valid `charCode`, the only exception to this is Enter.
  15809. * The Tab-key is considered non-printable and does not have a `charCode`,
  15810. * presumably because it does not produce a tab-character in browsers.
  15811. *
  15812. * @param {object} nativeEvent Native browser event.
  15813. * @return {number} Normalized `charCode` property.
  15814. */
  15815. function getEventCharCode(nativeEvent) {
  15816. var charCode;
  15817. var keyCode = nativeEvent.keyCode;
  15818. if ('charCode' in nativeEvent) {
  15819. charCode = nativeEvent.charCode;
  15820. // FF does not set `charCode` for the Enter-key, check against `keyCode`.
  15821. if (charCode === 0 && keyCode === 13) {
  15822. charCode = 13;
  15823. }
  15824. } else {
  15825. // IE8 does not implement `charCode`, but `keyCode` has the correct value.
  15826. charCode = keyCode;
  15827. }
  15828. // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
  15829. // Must not discard the (non-)printable Enter-key.
  15830. if (charCode >= 32 || charCode === 13) {
  15831. return charCode;
  15832. }
  15833. return 0;
  15834. }
  15835. module.exports = getEventCharCode;
  15836. },{}],126:[function(_dereq_,module,exports){
  15837. /**
  15838. * Copyright 2013-2015, Facebook, Inc.
  15839. * All rights reserved.
  15840. *
  15841. * This source code is licensed under the BSD-style license found in the
  15842. * LICENSE file in the root directory of this source tree. An additional grant
  15843. * of patent rights can be found in the PATENTS file in the same directory.
  15844. *
  15845. * @providesModule getEventKey
  15846. * @typechecks static-only
  15847. */
  15848. 'use strict';
  15849. var getEventCharCode = _dereq_(125);
  15850. /**
  15851. * Normalization of deprecated HTML5 `key` values
  15852. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  15853. */
  15854. var normalizeKey = {
  15855. 'Esc': 'Escape',
  15856. 'Spacebar': ' ',
  15857. 'Left': 'ArrowLeft',
  15858. 'Up': 'ArrowUp',
  15859. 'Right': 'ArrowRight',
  15860. 'Down': 'ArrowDown',
  15861. 'Del': 'Delete',
  15862. 'Win': 'OS',
  15863. 'Menu': 'ContextMenu',
  15864. 'Apps': 'ContextMenu',
  15865. 'Scroll': 'ScrollLock',
  15866. 'MozPrintableKey': 'Unidentified'
  15867. };
  15868. /**
  15869. * Translation from legacy `keyCode` to HTML5 `key`
  15870. * Only special keys supported, all others depend on keyboard layout or browser
  15871. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  15872. */
  15873. var translateToKey = {
  15874. 8: 'Backspace',
  15875. 9: 'Tab',
  15876. 12: 'Clear',
  15877. 13: 'Enter',
  15878. 16: 'Shift',
  15879. 17: 'Control',
  15880. 18: 'Alt',
  15881. 19: 'Pause',
  15882. 20: 'CapsLock',
  15883. 27: 'Escape',
  15884. 32: ' ',
  15885. 33: 'PageUp',
  15886. 34: 'PageDown',
  15887. 35: 'End',
  15888. 36: 'Home',
  15889. 37: 'ArrowLeft',
  15890. 38: 'ArrowUp',
  15891. 39: 'ArrowRight',
  15892. 40: 'ArrowDown',
  15893. 45: 'Insert',
  15894. 46: 'Delete',
  15895. 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
  15896. 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
  15897. 144: 'NumLock',
  15898. 145: 'ScrollLock',
  15899. 224: 'Meta'
  15900. };
  15901. /**
  15902. * @param {object} nativeEvent Native browser event.
  15903. * @return {string} Normalized `key` property.
  15904. */
  15905. function getEventKey(nativeEvent) {
  15906. if (nativeEvent.key) {
  15907. // Normalize inconsistent values reported by browsers due to
  15908. // implementations of a working draft specification.
  15909. // FireFox implements `key` but returns `MozPrintableKey` for all
  15910. // printable characters (normalized to `Unidentified`), ignore it.
  15911. var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
  15912. if (key !== 'Unidentified') {
  15913. return key;
  15914. }
  15915. }
  15916. // Browser does not implement `key`, polyfill as much of it as we can.
  15917. if (nativeEvent.type === 'keypress') {
  15918. var charCode = getEventCharCode(nativeEvent);
  15919. // The enter-key is technically both printable and non-printable and can
  15920. // thus be captured by `keypress`, no other non-printable key should.
  15921. return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
  15922. }
  15923. if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
  15924. // While user keyboard layout determines the actual meaning of each
  15925. // `keyCode` value, almost all function keys have a universal value.
  15926. return translateToKey[nativeEvent.keyCode] || 'Unidentified';
  15927. }
  15928. return '';
  15929. }
  15930. module.exports = getEventKey;
  15931. },{"125":125}],127:[function(_dereq_,module,exports){
  15932. /**
  15933. * Copyright 2013-2015, Facebook, Inc.
  15934. * All rights reserved.
  15935. *
  15936. * This source code is licensed under the BSD-style license found in the
  15937. * LICENSE file in the root directory of this source tree. An additional grant
  15938. * of patent rights can be found in the PATENTS file in the same directory.
  15939. *
  15940. * @providesModule getEventModifierState
  15941. * @typechecks static-only
  15942. */
  15943. 'use strict';
  15944. /**
  15945. * Translation from modifier key to the associated property in the event.
  15946. * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
  15947. */
  15948. var modifierKeyToProp = {
  15949. 'Alt': 'altKey',
  15950. 'Control': 'ctrlKey',
  15951. 'Meta': 'metaKey',
  15952. 'Shift': 'shiftKey'
  15953. };
  15954. // IE8 does not implement getModifierState so we simply map it to the only
  15955. // modifier keys exposed by the event itself, does not support Lock-keys.
  15956. // Currently, all major browsers except Chrome seems to support Lock-keys.
  15957. function modifierStateGetter(keyArg) {
  15958. var syntheticEvent = this;
  15959. var nativeEvent = syntheticEvent.nativeEvent;
  15960. if (nativeEvent.getModifierState) {
  15961. return nativeEvent.getModifierState(keyArg);
  15962. }
  15963. var keyProp = modifierKeyToProp[keyArg];
  15964. return keyProp ? !!nativeEvent[keyProp] : false;
  15965. }
  15966. function getEventModifierState(nativeEvent) {
  15967. return modifierStateGetter;
  15968. }
  15969. module.exports = getEventModifierState;
  15970. },{}],128:[function(_dereq_,module,exports){
  15971. /**
  15972. * Copyright 2013-2015, Facebook, Inc.
  15973. * All rights reserved.
  15974. *
  15975. * This source code is licensed under the BSD-style license found in the
  15976. * LICENSE file in the root directory of this source tree. An additional grant
  15977. * of patent rights can be found in the PATENTS file in the same directory.
  15978. *
  15979. * @providesModule getEventTarget
  15980. * @typechecks static-only
  15981. */
  15982. 'use strict';
  15983. /**
  15984. * Gets the target node from a native browser event by accounting for
  15985. * inconsistencies in browser DOM APIs.
  15986. *
  15987. * @param {object} nativeEvent Native browser event.
  15988. * @return {DOMEventTarget} Target node.
  15989. */
  15990. function getEventTarget(nativeEvent) {
  15991. var target = nativeEvent.target || nativeEvent.srcElement || window;
  15992. // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
  15993. // @see http://www.quirksmode.org/js/events_properties.html
  15994. return target.nodeType === 3 ? target.parentNode : target;
  15995. }
  15996. module.exports = getEventTarget;
  15997. },{}],129:[function(_dereq_,module,exports){
  15998. /**
  15999. * Copyright 2013-2015, Facebook, Inc.
  16000. * All rights reserved.
  16001. *
  16002. * This source code is licensed under the BSD-style license found in the
  16003. * LICENSE file in the root directory of this source tree. An additional grant
  16004. * of patent rights can be found in the PATENTS file in the same directory.
  16005. *
  16006. * @providesModule getIteratorFn
  16007. * @typechecks static-only
  16008. */
  16009. 'use strict';
  16010. /* global Symbol */
  16011. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  16012. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  16013. /**
  16014. * Returns the iterator method function contained on the iterable object.
  16015. *
  16016. * Be sure to invoke the function with the iterable as context:
  16017. *
  16018. * var iteratorFn = getIteratorFn(myIterable);
  16019. * if (iteratorFn) {
  16020. * var iterator = iteratorFn.call(myIterable);
  16021. * ...
  16022. * }
  16023. *
  16024. * @param {?object} maybeIterable
  16025. * @return {?function}
  16026. */
  16027. function getIteratorFn(maybeIterable) {
  16028. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  16029. if (typeof iteratorFn === 'function') {
  16030. return iteratorFn;
  16031. }
  16032. }
  16033. module.exports = getIteratorFn;
  16034. },{}],130:[function(_dereq_,module,exports){
  16035. /**
  16036. * Copyright 2013-2015, Facebook, Inc.
  16037. * All rights reserved.
  16038. *
  16039. * This source code is licensed under the BSD-style license found in the
  16040. * LICENSE file in the root directory of this source tree. An additional grant
  16041. * of patent rights can be found in the PATENTS file in the same directory.
  16042. *
  16043. * @providesModule getNodeForCharacterOffset
  16044. */
  16045. 'use strict';
  16046. /**
  16047. * Given any node return the first leaf node without children.
  16048. *
  16049. * @param {DOMElement|DOMTextNode} node
  16050. * @return {DOMElement|DOMTextNode}
  16051. */
  16052. function getLeafNode(node) {
  16053. while (node && node.firstChild) {
  16054. node = node.firstChild;
  16055. }
  16056. return node;
  16057. }
  16058. /**
  16059. * Get the next sibling within a container. This will walk up the
  16060. * DOM if a node's siblings have been exhausted.
  16061. *
  16062. * @param {DOMElement|DOMTextNode} node
  16063. * @return {?DOMElement|DOMTextNode}
  16064. */
  16065. function getSiblingNode(node) {
  16066. while (node) {
  16067. if (node.nextSibling) {
  16068. return node.nextSibling;
  16069. }
  16070. node = node.parentNode;
  16071. }
  16072. }
  16073. /**
  16074. * Get object describing the nodes which contain characters at offset.
  16075. *
  16076. * @param {DOMElement|DOMTextNode} root
  16077. * @param {number} offset
  16078. * @return {?object}
  16079. */
  16080. function getNodeForCharacterOffset(root, offset) {
  16081. var node = getLeafNode(root);
  16082. var nodeStart = 0;
  16083. var nodeEnd = 0;
  16084. while (node) {
  16085. if (node.nodeType === 3) {
  16086. nodeEnd = nodeStart + node.textContent.length;
  16087. if (nodeStart <= offset && nodeEnd >= offset) {
  16088. return {
  16089. node: node,
  16090. offset: offset - nodeStart
  16091. };
  16092. }
  16093. nodeStart = nodeEnd;
  16094. }
  16095. node = getLeafNode(getSiblingNode(node));
  16096. }
  16097. }
  16098. module.exports = getNodeForCharacterOffset;
  16099. },{}],131:[function(_dereq_,module,exports){
  16100. /**
  16101. * Copyright 2013-2015, Facebook, Inc.
  16102. * All rights reserved.
  16103. *
  16104. * This source code is licensed under the BSD-style license found in the
  16105. * LICENSE file in the root directory of this source tree. An additional grant
  16106. * of patent rights can be found in the PATENTS file in the same directory.
  16107. *
  16108. * @providesModule getTextContentAccessor
  16109. */
  16110. 'use strict';
  16111. var ExecutionEnvironment = _dereq_(147);
  16112. var contentKey = null;
  16113. /**
  16114. * Gets the key used to access text content on a DOM node.
  16115. *
  16116. * @return {?string} Key used to access text content.
  16117. * @internal
  16118. */
  16119. function getTextContentAccessor() {
  16120. if (!contentKey && ExecutionEnvironment.canUseDOM) {
  16121. // Prefer textContent to innerText because many browsers support both but
  16122. // SVG <text> elements don't support innerText even when <div> does.
  16123. contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
  16124. }
  16125. return contentKey;
  16126. }
  16127. module.exports = getTextContentAccessor;
  16128. },{"147":147}],132:[function(_dereq_,module,exports){
  16129. /**
  16130. * Copyright 2013-2015, Facebook, Inc.
  16131. * All rights reserved.
  16132. *
  16133. * This source code is licensed under the BSD-style license found in the
  16134. * LICENSE file in the root directory of this source tree. An additional grant
  16135. * of patent rights can be found in the PATENTS file in the same directory.
  16136. *
  16137. * @providesModule instantiateReactComponent
  16138. * @typechecks static-only
  16139. */
  16140. 'use strict';
  16141. var ReactCompositeComponent = _dereq_(38);
  16142. var ReactEmptyComponent = _dereq_(59);
  16143. var ReactNativeComponent = _dereq_(75);
  16144. var assign = _dereq_(24);
  16145. var invariant = _dereq_(161);
  16146. var warning = _dereq_(173);
  16147. // To avoid a cyclic dependency, we create the final class in this module
  16148. var ReactCompositeComponentWrapper = function () {};
  16149. assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
  16150. _instantiateReactComponent: instantiateReactComponent
  16151. });
  16152. function getDeclarationErrorAddendum(owner) {
  16153. if (owner) {
  16154. var name = owner.getName();
  16155. if (name) {
  16156. return ' Check the render method of `' + name + '`.';
  16157. }
  16158. }
  16159. return '';
  16160. }
  16161. /**
  16162. * Check if the type reference is a known internal type. I.e. not a user
  16163. * provided composite type.
  16164. *
  16165. * @param {function} type
  16166. * @return {boolean} Returns true if this is a valid internal type.
  16167. */
  16168. function isInternalComponentType(type) {
  16169. return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
  16170. }
  16171. /**
  16172. * Given a ReactNode, create an instance that will actually be mounted.
  16173. *
  16174. * @param {ReactNode} node
  16175. * @return {object} A new instance of the element's constructor.
  16176. * @protected
  16177. */
  16178. function instantiateReactComponent(node) {
  16179. var instance;
  16180. if (node === null || node === false) {
  16181. instance = new ReactEmptyComponent(instantiateReactComponent);
  16182. } else if (typeof node === 'object') {
  16183. var element = node;
  16184. !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? "production" !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : undefined;
  16185. // Special case string values
  16186. if (typeof element.type === 'string') {
  16187. instance = ReactNativeComponent.createInternalComponent(element);
  16188. } else if (isInternalComponentType(element.type)) {
  16189. // This is temporarily available for custom components that are not string
  16190. // representations. I.e. ART. Once those are updated to use the string
  16191. // representation, we can drop this code path.
  16192. instance = new element.type(element);
  16193. } else {
  16194. instance = new ReactCompositeComponentWrapper();
  16195. }
  16196. } else if (typeof node === 'string' || typeof node === 'number') {
  16197. instance = ReactNativeComponent.createInstanceForText(node);
  16198. } else {
  16199. !false ? "production" !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : undefined;
  16200. }
  16201. if ("production" !== 'production') {
  16202. "production" !== 'production' ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : undefined;
  16203. }
  16204. // Sets up the instance. This can probably just move into the constructor now.
  16205. instance.construct(node);
  16206. // These two fields are used by the DOM and ART diffing algorithms
  16207. // respectively. Instead of using expandos on components, we should be
  16208. // storing the state needed by the diffing algorithms elsewhere.
  16209. instance._mountIndex = 0;
  16210. instance._mountImage = null;
  16211. if ("production" !== 'production') {
  16212. instance._isOwnerNecessary = false;
  16213. instance._warnedAboutRefsInRender = false;
  16214. }
  16215. // Internal instances should fully constructed at this point, so they should
  16216. // not get any new fields added to them at this point.
  16217. if ("production" !== 'production') {
  16218. if (Object.preventExtensions) {
  16219. Object.preventExtensions(instance);
  16220. }
  16221. }
  16222. return instance;
  16223. }
  16224. module.exports = instantiateReactComponent;
  16225. },{"161":161,"173":173,"24":24,"38":38,"59":59,"75":75}],133:[function(_dereq_,module,exports){
  16226. /**
  16227. * Copyright 2013-2015, Facebook, Inc.
  16228. * All rights reserved.
  16229. *
  16230. * This source code is licensed under the BSD-style license found in the
  16231. * LICENSE file in the root directory of this source tree. An additional grant
  16232. * of patent rights can be found in the PATENTS file in the same directory.
  16233. *
  16234. * @providesModule isEventSupported
  16235. */
  16236. 'use strict';
  16237. var ExecutionEnvironment = _dereq_(147);
  16238. var useHasFeature;
  16239. if (ExecutionEnvironment.canUseDOM) {
  16240. useHasFeature = document.implementation && document.implementation.hasFeature &&
  16241. // always returns true in newer browsers as per the standard.
  16242. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
  16243. document.implementation.hasFeature('', '') !== true;
  16244. }
  16245. /**
  16246. * Checks if an event is supported in the current execution environment.
  16247. *
  16248. * NOTE: This will not work correctly for non-generic events such as `change`,
  16249. * `reset`, `load`, `error`, and `select`.
  16250. *
  16251. * Borrows from Modernizr.
  16252. *
  16253. * @param {string} eventNameSuffix Event name, e.g. "click".
  16254. * @param {?boolean} capture Check if the capture phase is supported.
  16255. * @return {boolean} True if the event is supported.
  16256. * @internal
  16257. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  16258. */
  16259. function isEventSupported(eventNameSuffix, capture) {
  16260. if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
  16261. return false;
  16262. }
  16263. var eventName = 'on' + eventNameSuffix;
  16264. var isSupported = (eventName in document);
  16265. if (!isSupported) {
  16266. var element = document.createElementNS('http://www.w3.org/1999/xhtml', 'div');
  16267. element.setAttribute(eventName, 'return;');
  16268. isSupported = typeof element[eventName] === 'function';
  16269. }
  16270. if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
  16271. // This is the only way to test support for the `wheel` event in IE9+.
  16272. isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  16273. }
  16274. return isSupported;
  16275. }
  16276. module.exports = isEventSupported;
  16277. },{"147":147}],134:[function(_dereq_,module,exports){
  16278. /**
  16279. * Copyright 2013-2015, Facebook, Inc.
  16280. * All rights reserved.
  16281. *
  16282. * This source code is licensed under the BSD-style license found in the
  16283. * LICENSE file in the root directory of this source tree. An additional grant
  16284. * of patent rights can be found in the PATENTS file in the same directory.
  16285. *
  16286. * @providesModule isTextInputElement
  16287. */
  16288. 'use strict';
  16289. /**
  16290. * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
  16291. */
  16292. var supportedInputTypes = {
  16293. 'color': true,
  16294. 'date': true,
  16295. 'datetime': true,
  16296. 'datetime-local': true,
  16297. 'email': true,
  16298. 'month': true,
  16299. 'number': true,
  16300. 'password': true,
  16301. 'range': true,
  16302. 'search': true,
  16303. 'tel': true,
  16304. 'text': true,
  16305. 'time': true,
  16306. 'url': true,
  16307. 'week': true
  16308. };
  16309. function isTextInputElement(elem) {
  16310. var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
  16311. return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea');
  16312. }
  16313. module.exports = isTextInputElement;
  16314. },{}],135:[function(_dereq_,module,exports){
  16315. /**
  16316. * Copyright 2013-2015, Facebook, Inc.
  16317. * All rights reserved.
  16318. *
  16319. * This source code is licensed under the BSD-style license found in the
  16320. * LICENSE file in the root directory of this source tree. An additional grant
  16321. * of patent rights can be found in the PATENTS file in the same directory.
  16322. *
  16323. * @providesModule onlyChild
  16324. */
  16325. 'use strict';
  16326. var ReactElement = _dereq_(57);
  16327. var invariant = _dereq_(161);
  16328. /**
  16329. * Returns the first child in a collection of children and verifies that there
  16330. * is only one child in the collection. The current implementation of this
  16331. * function assumes that a single child gets passed without a wrapper, but the
  16332. * purpose of this helper function is to abstract away the particular structure
  16333. * of children.
  16334. *
  16335. * @param {?object} children Child collection structure.
  16336. * @return {ReactComponent} The first and only `ReactComponent` contained in the
  16337. * structure.
  16338. */
  16339. function onlyChild(children) {
  16340. !ReactElement.isValidElement(children) ? "production" !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : undefined;
  16341. return children;
  16342. }
  16343. module.exports = onlyChild;
  16344. },{"161":161,"57":57}],136:[function(_dereq_,module,exports){
  16345. /**
  16346. * Copyright 2013-2015, Facebook, Inc.
  16347. * All rights reserved.
  16348. *
  16349. * This source code is licensed under the BSD-style license found in the
  16350. * LICENSE file in the root directory of this source tree. An additional grant
  16351. * of patent rights can be found in the PATENTS file in the same directory.
  16352. *
  16353. * @providesModule quoteAttributeValueForBrowser
  16354. */
  16355. 'use strict';
  16356. var escapeTextContentForBrowser = _dereq_(121);
  16357. /**
  16358. * Escapes attribute value to prevent scripting attacks.
  16359. *
  16360. * @param {*} value Value to escape.
  16361. * @return {string} An escaped string.
  16362. */
  16363. function quoteAttributeValueForBrowser(value) {
  16364. return '"' + escapeTextContentForBrowser(value) + '"';
  16365. }
  16366. module.exports = quoteAttributeValueForBrowser;
  16367. },{"121":121}],137:[function(_dereq_,module,exports){
  16368. /**
  16369. * Copyright 2013-2015, Facebook, Inc.
  16370. * All rights reserved.
  16371. *
  16372. * This source code is licensed under the BSD-style license found in the
  16373. * LICENSE file in the root directory of this source tree. An additional grant
  16374. * of patent rights can be found in the PATENTS file in the same directory.
  16375. *
  16376. * @providesModule renderSubtreeIntoContainer
  16377. */
  16378. 'use strict';
  16379. var ReactMount = _dereq_(72);
  16380. module.exports = ReactMount.renderSubtreeIntoContainer;
  16381. },{"72":72}],138:[function(_dereq_,module,exports){
  16382. /**
  16383. * Copyright 2013-2015, Facebook, Inc.
  16384. * All rights reserved.
  16385. *
  16386. * This source code is licensed under the BSD-style license found in the
  16387. * LICENSE file in the root directory of this source tree. An additional grant
  16388. * of patent rights can be found in the PATENTS file in the same directory.
  16389. *
  16390. * @providesModule setInnerHTML
  16391. */
  16392. /* globals MSApp */
  16393. 'use strict';
  16394. var ExecutionEnvironment = _dereq_(147);
  16395. var WHITESPACE_TEST = /^[ \r\n\t\f]/;
  16396. var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
  16397. /**
  16398. * Set the innerHTML property of a node, ensuring that whitespace is preserved
  16399. * even in IE8.
  16400. *
  16401. * @param {DOMElement} node
  16402. * @param {string} html
  16403. * @internal
  16404. */
  16405. var setInnerHTML = function (node, html) {
  16406. node.innerHTML = html;
  16407. };
  16408. // Win8 apps: Allow all html to be inserted
  16409. if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
  16410. setInnerHTML = function (node, html) {
  16411. MSApp.execUnsafeLocalFunction(function () {
  16412. node.innerHTML = html;
  16413. });
  16414. };
  16415. }
  16416. if (ExecutionEnvironment.canUseDOM) {
  16417. // IE8: When updating a just created node with innerHTML only leading
  16418. // whitespace is removed. When updating an existing node with innerHTML
  16419. // whitespace in root TextNodes is also collapsed.
  16420. // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
  16421. // Feature detection; only IE8 is known to behave improperly like this.
  16422. var testElement = document.createElementNS('http://www.w3.org/1999/xhtml', 'div');
  16423. testElement.innerHTML = ' ';
  16424. if (testElement.innerHTML === '') {
  16425. setInnerHTML = function (node, html) {
  16426. // Magic theory: IE8 supposedly differentiates between added and updated
  16427. // nodes when processing innerHTML, innerHTML on updated nodes suffers
  16428. // from worse whitespace behavior. Re-adding a node like this triggers
  16429. // the initial and more favorable whitespace behavior.
  16430. // TODO: What to do on a detached node?
  16431. if (node.parentNode) {
  16432. node.parentNode.replaceChild(node, node);
  16433. }
  16434. // We also implement a workaround for non-visible tags disappearing into
  16435. // thin air on IE8, this only happens if there is no visible text
  16436. // in-front of the non-visible tags. Piggyback on the whitespace fix
  16437. // and simply check if any non-visible tags appear in the source.
  16438. if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
  16439. // Recover leading whitespace by temporarily prepending any character.
  16440. // \uFEFF has the potential advantage of being zero-width/invisible.
  16441. // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
  16442. // in hopes that this is preserved even if "\uFEFF" is transformed to
  16443. // the actual Unicode character (by Babel, for example).
  16444. // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
  16445. node.innerHTML = String.fromCharCode(0xFEFF) + html;
  16446. // deleteData leaves an empty `TextNode` which offsets the index of all
  16447. // children. Definitely want to avoid this.
  16448. var textNode = node.firstChild;
  16449. if (textNode.data.length === 1) {
  16450. node.removeChild(textNode);
  16451. } else {
  16452. textNode.deleteData(0, 1);
  16453. }
  16454. } else {
  16455. node.innerHTML = html;
  16456. }
  16457. };
  16458. }
  16459. }
  16460. module.exports = setInnerHTML;
  16461. },{"147":147}],139:[function(_dereq_,module,exports){
  16462. /**
  16463. * Copyright 2013-2015, Facebook, Inc.
  16464. * All rights reserved.
  16465. *
  16466. * This source code is licensed under the BSD-style license found in the
  16467. * LICENSE file in the root directory of this source tree. An additional grant
  16468. * of patent rights can be found in the PATENTS file in the same directory.
  16469. *
  16470. * @providesModule setTextContent
  16471. */
  16472. 'use strict';
  16473. var ExecutionEnvironment = _dereq_(147);
  16474. var escapeTextContentForBrowser = _dereq_(121);
  16475. var setInnerHTML = _dereq_(138);
  16476. /**
  16477. * Set the textContent property of a node, ensuring that whitespace is preserved
  16478. * even in IE8. innerText is a poor substitute for textContent and, among many
  16479. * issues, inserts <br> instead of the literal newline chars. innerHTML behaves
  16480. * as it should.
  16481. *
  16482. * @param {DOMElement} node
  16483. * @param {string} text
  16484. * @internal
  16485. */
  16486. var setTextContent = function (node, text) {
  16487. node.textContent = text;
  16488. };
  16489. if (ExecutionEnvironment.canUseDOM) {
  16490. if (!('textContent' in document.documentElement)) {
  16491. setTextContent = function (node, text) {
  16492. setInnerHTML(node, escapeTextContentForBrowser(text));
  16493. };
  16494. }
  16495. }
  16496. module.exports = setTextContent;
  16497. },{"121":121,"138":138,"147":147}],140:[function(_dereq_,module,exports){
  16498. /**
  16499. * Copyright 2013-2015, Facebook, Inc.
  16500. * All rights reserved.
  16501. *
  16502. * This source code is licensed under the BSD-style license found in the
  16503. * LICENSE file in the root directory of this source tree. An additional grant
  16504. * of patent rights can be found in the PATENTS file in the same directory.
  16505. *
  16506. * @providesModule shallowCompare
  16507. */
  16508. 'use strict';
  16509. var shallowEqual = _dereq_(171);
  16510. /**
  16511. * Does a shallow comparison for props and state.
  16512. * See ReactComponentWithPureRenderMixin
  16513. */
  16514. function shallowCompare(instance, nextProps, nextState) {
  16515. return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState);
  16516. }
  16517. module.exports = shallowCompare;
  16518. },{"171":171}],141:[function(_dereq_,module,exports){
  16519. /**
  16520. * Copyright 2013-2015, Facebook, Inc.
  16521. * All rights reserved.
  16522. *
  16523. * This source code is licensed under the BSD-style license found in the
  16524. * LICENSE file in the root directory of this source tree. An additional grant
  16525. * of patent rights can be found in the PATENTS file in the same directory.
  16526. *
  16527. * @providesModule shouldUpdateReactComponent
  16528. * @typechecks static-only
  16529. */
  16530. 'use strict';
  16531. /**
  16532. * Given a `prevElement` and `nextElement`, determines if the existing
  16533. * instance should be updated as opposed to being destroyed or replaced by a new
  16534. * instance. Both arguments are elements. This ensures that this logic can
  16535. * operate on stateless trees without any backing instance.
  16536. *
  16537. * @param {?object} prevElement
  16538. * @param {?object} nextElement
  16539. * @return {boolean} True if the existing instance should be updated.
  16540. * @protected
  16541. */
  16542. function shouldUpdateReactComponent(prevElement, nextElement) {
  16543. var prevEmpty = prevElement === null || prevElement === false;
  16544. var nextEmpty = nextElement === null || nextElement === false;
  16545. if (prevEmpty || nextEmpty) {
  16546. return prevEmpty === nextEmpty;
  16547. }
  16548. var prevType = typeof prevElement;
  16549. var nextType = typeof nextElement;
  16550. if (prevType === 'string' || prevType === 'number') {
  16551. return nextType === 'string' || nextType === 'number';
  16552. } else {
  16553. return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
  16554. }
  16555. return false;
  16556. }
  16557. module.exports = shouldUpdateReactComponent;
  16558. },{}],142:[function(_dereq_,module,exports){
  16559. /**
  16560. * Copyright 2013-2015, Facebook, Inc.
  16561. * All rights reserved.
  16562. *
  16563. * This source code is licensed under the BSD-style license found in the
  16564. * LICENSE file in the root directory of this source tree. An additional grant
  16565. * of patent rights can be found in the PATENTS file in the same directory.
  16566. *
  16567. * @providesModule traverseAllChildren
  16568. */
  16569. 'use strict';
  16570. var ReactCurrentOwner = _dereq_(39);
  16571. var ReactElement = _dereq_(57);
  16572. var ReactInstanceHandles = _dereq_(67);
  16573. var getIteratorFn = _dereq_(129);
  16574. var invariant = _dereq_(161);
  16575. var warning = _dereq_(173);
  16576. var SEPARATOR = ReactInstanceHandles.SEPARATOR;
  16577. var SUBSEPARATOR = ':';
  16578. /**
  16579. * TODO: Test that a single child and an array with one item have the same key
  16580. * pattern.
  16581. */
  16582. var userProvidedKeyEscaperLookup = {
  16583. '=': '=0',
  16584. '.': '=1',
  16585. ':': '=2'
  16586. };
  16587. var userProvidedKeyEscapeRegex = /[=.:]/g;
  16588. var didWarnAboutMaps = false;
  16589. function userProvidedKeyEscaper(match) {
  16590. return userProvidedKeyEscaperLookup[match];
  16591. }
  16592. /**
  16593. * Generate a key string that identifies a component within a set.
  16594. *
  16595. * @param {*} component A component that could contain a manual key.
  16596. * @param {number} index Index that is used if a manual key is not provided.
  16597. * @return {string}
  16598. */
  16599. function getComponentKey(component, index) {
  16600. if (component && component.key != null) {
  16601. // Explicit key
  16602. return wrapUserProvidedKey(component.key);
  16603. }
  16604. // Implicit key determined by the index in the set
  16605. return index.toString(36);
  16606. }
  16607. /**
  16608. * Escape a component key so that it is safe to use in a reactid.
  16609. *
  16610. * @param {*} text Component key to be escaped.
  16611. * @return {string} An escaped string.
  16612. */
  16613. function escapeUserProvidedKey(text) {
  16614. return ('' + text).replace(userProvidedKeyEscapeRegex, userProvidedKeyEscaper);
  16615. }
  16616. /**
  16617. * Wrap a `key` value explicitly provided by the user to distinguish it from
  16618. * implicitly-generated keys generated by a component's index in its parent.
  16619. *
  16620. * @param {string} key Value of a user-provided `key` attribute
  16621. * @return {string}
  16622. */
  16623. function wrapUserProvidedKey(key) {
  16624. return '$' + escapeUserProvidedKey(key);
  16625. }
  16626. /**
  16627. * @param {?*} children Children tree container.
  16628. * @param {!string} nameSoFar Name of the key path so far.
  16629. * @param {!function} callback Callback to invoke with each child found.
  16630. * @param {?*} traverseContext Used to pass information throughout the traversal
  16631. * process.
  16632. * @return {!number} The number of children in this subtree.
  16633. */
  16634. function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
  16635. var type = typeof children;
  16636. if (type === 'undefined' || type === 'boolean') {
  16637. // All of the above are perceived as null.
  16638. children = null;
  16639. }
  16640. if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) {
  16641. callback(traverseContext, children,
  16642. // If it's the only child, treat the name as if it was wrapped in an array
  16643. // so that it's consistent if the number of children grows.
  16644. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
  16645. return 1;
  16646. }
  16647. var child;
  16648. var nextName;
  16649. var subtreeCount = 0; // Count of children found in the current subtree.
  16650. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
  16651. if (Array.isArray(children)) {
  16652. for (var i = 0; i < children.length; i++) {
  16653. child = children[i];
  16654. nextName = nextNamePrefix + getComponentKey(child, i);
  16655. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  16656. }
  16657. } else {
  16658. var iteratorFn = getIteratorFn(children);
  16659. if (iteratorFn) {
  16660. var iterator = iteratorFn.call(children);
  16661. var step;
  16662. if (iteratorFn !== children.entries) {
  16663. var ii = 0;
  16664. while (!(step = iterator.next()).done) {
  16665. child = step.value;
  16666. nextName = nextNamePrefix + getComponentKey(child, ii++);
  16667. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  16668. }
  16669. } else {
  16670. if ("production" !== 'production') {
  16671. "production" !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : undefined;
  16672. didWarnAboutMaps = true;
  16673. }
  16674. // Iterator will provide entry [k,v] tuples rather than values.
  16675. while (!(step = iterator.next()).done) {
  16676. var entry = step.value;
  16677. if (entry) {
  16678. child = entry[1];
  16679. nextName = nextNamePrefix + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
  16680. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  16681. }
  16682. }
  16683. }
  16684. } else if (type === 'object') {
  16685. var addendum = '';
  16686. if ("production" !== 'production') {
  16687. addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
  16688. if (children._isReactElement) {
  16689. addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
  16690. }
  16691. if (ReactCurrentOwner.current) {
  16692. var name = ReactCurrentOwner.current.getName();
  16693. if (name) {
  16694. addendum += ' Check the render method of `' + name + '`.';
  16695. }
  16696. }
  16697. }
  16698. var childrenString = String(children);
  16699. !false ? "production" !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) : undefined;
  16700. }
  16701. }
  16702. return subtreeCount;
  16703. }
  16704. /**
  16705. * Traverses children that are typically specified as `props.children`, but
  16706. * might also be specified through attributes:
  16707. *
  16708. * - `traverseAllChildren(this.props.children, ...)`
  16709. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  16710. *
  16711. * The `traverseContext` is an optional argument that is passed through the
  16712. * entire traversal. It can be used to store accumulations or anything else that
  16713. * the callback might find relevant.
  16714. *
  16715. * @param {?*} children Children tree object.
  16716. * @param {!function} callback To invoke upon traversing each child.
  16717. * @param {?*} traverseContext Context for traversal.
  16718. * @return {!number} The number of children in this subtree.
  16719. */
  16720. function traverseAllChildren(children, callback, traverseContext) {
  16721. if (children == null) {
  16722. return 0;
  16723. }
  16724. return traverseAllChildrenImpl(children, '', callback, traverseContext);
  16725. }
  16726. module.exports = traverseAllChildren;
  16727. },{"129":129,"161":161,"173":173,"39":39,"57":57,"67":67}],143:[function(_dereq_,module,exports){
  16728. /**
  16729. * Copyright 2013-2015, Facebook, Inc.
  16730. * All rights reserved.
  16731. *
  16732. * This source code is licensed under the BSD-style license found in the
  16733. * LICENSE file in the root directory of this source tree. An additional grant
  16734. * of patent rights can be found in the PATENTS file in the same directory.
  16735. *
  16736. * @providesModule update
  16737. */
  16738. /* global hasOwnProperty:true */
  16739. 'use strict';
  16740. var assign = _dereq_(24);
  16741. var keyOf = _dereq_(166);
  16742. var invariant = _dereq_(161);
  16743. var hasOwnProperty = ({}).hasOwnProperty;
  16744. function shallowCopy(x) {
  16745. if (Array.isArray(x)) {
  16746. return x.concat();
  16747. } else if (x && typeof x === 'object') {
  16748. return assign(new x.constructor(), x);
  16749. } else {
  16750. return x;
  16751. }
  16752. }
  16753. var COMMAND_PUSH = keyOf({ $push: null });
  16754. var COMMAND_UNSHIFT = keyOf({ $unshift: null });
  16755. var COMMAND_SPLICE = keyOf({ $splice: null });
  16756. var COMMAND_SET = keyOf({ $set: null });
  16757. var COMMAND_MERGE = keyOf({ $merge: null });
  16758. var COMMAND_APPLY = keyOf({ $apply: null });
  16759. var ALL_COMMANDS_LIST = [COMMAND_PUSH, COMMAND_UNSHIFT, COMMAND_SPLICE, COMMAND_SET, COMMAND_MERGE, COMMAND_APPLY];
  16760. var ALL_COMMANDS_SET = {};
  16761. ALL_COMMANDS_LIST.forEach(function (command) {
  16762. ALL_COMMANDS_SET[command] = true;
  16763. });
  16764. function invariantArrayCase(value, spec, command) {
  16765. !Array.isArray(value) ? "production" !== 'production' ? invariant(false, 'update(): expected target of %s to be an array; got %s.', command, value) : invariant(false) : undefined;
  16766. var specValue = spec[command];
  16767. !Array.isArray(specValue) ? "production" !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array; got %s. ' + 'Did you forget to wrap your parameter in an array?', command, specValue) : invariant(false) : undefined;
  16768. }
  16769. function update(value, spec) {
  16770. !(typeof spec === 'object') ? "production" !== 'production' ? invariant(false, 'update(): You provided a key path to update() that did not contain one ' + 'of %s. Did you forget to include {%s: ...}?', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : invariant(false) : undefined;
  16771. if (hasOwnProperty.call(spec, COMMAND_SET)) {
  16772. !(Object.keys(spec).length === 1) ? "production" !== 'production' ? invariant(false, 'Cannot have more than one key in an object with %s', COMMAND_SET) : invariant(false) : undefined;
  16773. return spec[COMMAND_SET];
  16774. }
  16775. var nextValue = shallowCopy(value);
  16776. if (hasOwnProperty.call(spec, COMMAND_MERGE)) {
  16777. var mergeObj = spec[COMMAND_MERGE];
  16778. !(mergeObj && typeof mergeObj === 'object') ? "production" !== 'production' ? invariant(false, 'update(): %s expects a spec of type \'object\'; got %s', COMMAND_MERGE, mergeObj) : invariant(false) : undefined;
  16779. !(nextValue && typeof nextValue === 'object') ? "production" !== 'production' ? invariant(false, 'update(): %s expects a target of type \'object\'; got %s', COMMAND_MERGE, nextValue) : invariant(false) : undefined;
  16780. assign(nextValue, spec[COMMAND_MERGE]);
  16781. }
  16782. if (hasOwnProperty.call(spec, COMMAND_PUSH)) {
  16783. invariantArrayCase(value, spec, COMMAND_PUSH);
  16784. spec[COMMAND_PUSH].forEach(function (item) {
  16785. nextValue.push(item);
  16786. });
  16787. }
  16788. if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) {
  16789. invariantArrayCase(value, spec, COMMAND_UNSHIFT);
  16790. spec[COMMAND_UNSHIFT].forEach(function (item) {
  16791. nextValue.unshift(item);
  16792. });
  16793. }
  16794. if (hasOwnProperty.call(spec, COMMAND_SPLICE)) {
  16795. !Array.isArray(value) ? "production" !== 'production' ? invariant(false, 'Expected %s target to be an array; got %s', COMMAND_SPLICE, value) : invariant(false) : undefined;
  16796. !Array.isArray(spec[COMMAND_SPLICE]) ? "production" !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : undefined;
  16797. spec[COMMAND_SPLICE].forEach(function (args) {
  16798. !Array.isArray(args) ? "production" !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : undefined;
  16799. nextValue.splice.apply(nextValue, args);
  16800. });
  16801. }
  16802. if (hasOwnProperty.call(spec, COMMAND_APPLY)) {
  16803. !(typeof spec[COMMAND_APPLY] === 'function') ? "production" !== 'production' ? invariant(false, 'update(): expected spec of %s to be a function; got %s.', COMMAND_APPLY, spec[COMMAND_APPLY]) : invariant(false) : undefined;
  16804. nextValue = spec[COMMAND_APPLY](nextValue);
  16805. }
  16806. for (var k in spec) {
  16807. if (!(ALL_COMMANDS_SET.hasOwnProperty(k) && ALL_COMMANDS_SET[k])) {
  16808. nextValue[k] = update(value[k], spec[k]);
  16809. }
  16810. }
  16811. return nextValue;
  16812. }
  16813. module.exports = update;
  16814. },{"161":161,"166":166,"24":24}],144:[function(_dereq_,module,exports){
  16815. /**
  16816. * Copyright 2015, Facebook, Inc.
  16817. * All rights reserved.
  16818. *
  16819. * This source code is licensed under the BSD-style license found in the
  16820. * LICENSE file in the root directory of this source tree. An additional grant
  16821. * of patent rights can be found in the PATENTS file in the same directory.
  16822. *
  16823. * @providesModule validateDOMNesting
  16824. */
  16825. 'use strict';
  16826. var assign = _dereq_(24);
  16827. var emptyFunction = _dereq_(153);
  16828. var warning = _dereq_(173);
  16829. var validateDOMNesting = emptyFunction;
  16830. if ("production" !== 'production') {
  16831. // This validation code was written based on the HTML5 parsing spec:
  16832. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
  16833. //
  16834. // Note: this does not catch all invalid nesting, nor does it try to (as it's
  16835. // not clear what practical benefit doing so provides); instead, we warn only
  16836. // for cases where the parser will give a parse tree differing from what React
  16837. // intended. For example, <b><div></div></b> is invalid but we don't warn
  16838. // because it still parses correctly; we do warn for other cases like nested
  16839. // <p> tags where the beginning of the second element implicitly closes the
  16840. // first, causing a confusing mess.
  16841. // https://html.spec.whatwg.org/multipage/syntax.html#special
  16842. var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
  16843. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
  16844. var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
  16845. // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
  16846. // TODO: Distinguish by namespace here -- for <title>, including it here
  16847. // errs on the side of fewer warnings
  16848. 'foreignObject', 'desc', 'title'];
  16849. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
  16850. var buttonScopeTags = inScopeTags.concat(['button']);
  16851. // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
  16852. var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
  16853. var emptyAncestorInfo = {
  16854. parentTag: null,
  16855. formTag: null,
  16856. aTagInScope: null,
  16857. buttonTagInScope: null,
  16858. nobrTagInScope: null,
  16859. pTagInButtonScope: null,
  16860. listItemTagAutoclosing: null,
  16861. dlItemTagAutoclosing: null
  16862. };
  16863. var updatedAncestorInfo = function (oldInfo, tag, instance) {
  16864. var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo);
  16865. var info = { tag: tag, instance: instance };
  16866. if (inScopeTags.indexOf(tag) !== -1) {
  16867. ancestorInfo.aTagInScope = null;
  16868. ancestorInfo.buttonTagInScope = null;
  16869. ancestorInfo.nobrTagInScope = null;
  16870. }
  16871. if (buttonScopeTags.indexOf(tag) !== -1) {
  16872. ancestorInfo.pTagInButtonScope = null;
  16873. }
  16874. // See rules for 'li', 'dd', 'dt' start tags in
  16875. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
  16876. if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
  16877. ancestorInfo.listItemTagAutoclosing = null;
  16878. ancestorInfo.dlItemTagAutoclosing = null;
  16879. }
  16880. ancestorInfo.parentTag = info;
  16881. if (tag === 'form') {
  16882. ancestorInfo.formTag = info;
  16883. }
  16884. if (tag === 'a') {
  16885. ancestorInfo.aTagInScope = info;
  16886. }
  16887. if (tag === 'button') {
  16888. ancestorInfo.buttonTagInScope = info;
  16889. }
  16890. if (tag === 'nobr') {
  16891. ancestorInfo.nobrTagInScope = info;
  16892. }
  16893. if (tag === 'p') {
  16894. ancestorInfo.pTagInButtonScope = info;
  16895. }
  16896. if (tag === 'li') {
  16897. ancestorInfo.listItemTagAutoclosing = info;
  16898. }
  16899. if (tag === 'dd' || tag === 'dt') {
  16900. ancestorInfo.dlItemTagAutoclosing = info;
  16901. }
  16902. return ancestorInfo;
  16903. };
  16904. /**
  16905. * Returns whether
  16906. */
  16907. var isTagValidWithParent = function (tag, parentTag) {
  16908. // First, let's check if we're in an unusual parsing mode...
  16909. switch (parentTag) {
  16910. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
  16911. case 'select':
  16912. return tag === 'option' || tag === 'optgroup' || tag === '#text';
  16913. case 'optgroup':
  16914. return tag === 'option' || tag === '#text';
  16915. // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
  16916. // but
  16917. case 'option':
  16918. return tag === '#text';
  16919. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
  16920. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
  16921. // No special behavior since these rules fall back to "in body" mode for
  16922. // all except special table nodes which cause bad parsing behavior anyway.
  16923. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
  16924. case 'tr':
  16925. return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
  16926. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
  16927. case 'tbody':
  16928. case 'thead':
  16929. case 'tfoot':
  16930. return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
  16931. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
  16932. case 'colgroup':
  16933. return tag === 'col' || tag === 'template';
  16934. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
  16935. case 'table':
  16936. return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
  16937. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
  16938. case 'head':
  16939. return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
  16940. // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
  16941. case 'html':
  16942. return tag === 'head' || tag === 'body';
  16943. }
  16944. // Probably in the "in body" parsing mode, so we outlaw only tag combos
  16945. // where the parsing rules cause implicit opens or closes to be added.
  16946. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
  16947. switch (tag) {
  16948. case 'h1':
  16949. case 'h2':
  16950. case 'h3':
  16951. case 'h4':
  16952. case 'h5':
  16953. case 'h6':
  16954. return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
  16955. case 'rp':
  16956. case 'rt':
  16957. return impliedEndTags.indexOf(parentTag) === -1;
  16958. case 'caption':
  16959. case 'col':
  16960. case 'colgroup':
  16961. case 'frame':
  16962. case 'head':
  16963. case 'tbody':
  16964. case 'td':
  16965. case 'tfoot':
  16966. case 'th':
  16967. case 'thead':
  16968. case 'tr':
  16969. // These tags are only valid with a few parents that have special child
  16970. // parsing rules -- if we're down here, then none of those matched and
  16971. // so we allow it only if we don't know what the parent is, as all other
  16972. // cases are invalid.
  16973. return parentTag == null;
  16974. }
  16975. return true;
  16976. };
  16977. /**
  16978. * Returns whether
  16979. */
  16980. var findInvalidAncestorForTag = function (tag, ancestorInfo) {
  16981. switch (tag) {
  16982. case 'address':
  16983. case 'article':
  16984. case 'aside':
  16985. case 'blockquote':
  16986. case 'center':
  16987. case 'details':
  16988. case 'dialog':
  16989. case 'dir':
  16990. case 'div':
  16991. case 'dl':
  16992. case 'fieldset':
  16993. case 'figcaption':
  16994. case 'figure':
  16995. case 'footer':
  16996. case 'header':
  16997. case 'hgroup':
  16998. case 'main':
  16999. case 'menu':
  17000. case 'nav':
  17001. case 'ol':
  17002. case 'p':
  17003. case 'section':
  17004. case 'summary':
  17005. case 'ul':
  17006. case 'pre':
  17007. case 'listing':
  17008. case 'table':
  17009. case 'hr':
  17010. case 'xmp':
  17011. case 'h1':
  17012. case 'h2':
  17013. case 'h3':
  17014. case 'h4':
  17015. case 'h5':
  17016. case 'h6':
  17017. return ancestorInfo.pTagInButtonScope;
  17018. case 'form':
  17019. return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
  17020. case 'li':
  17021. return ancestorInfo.listItemTagAutoclosing;
  17022. case 'dd':
  17023. case 'dt':
  17024. return ancestorInfo.dlItemTagAutoclosing;
  17025. case 'button':
  17026. return ancestorInfo.buttonTagInScope;
  17027. case 'a':
  17028. // Spec says something about storing a list of markers, but it sounds
  17029. // equivalent to this check.
  17030. return ancestorInfo.aTagInScope;
  17031. case 'nobr':
  17032. return ancestorInfo.nobrTagInScope;
  17033. }
  17034. return null;
  17035. };
  17036. /**
  17037. * Given a ReactCompositeComponent instance, return a list of its recursive
  17038. * owners, starting at the root and ending with the instance itself.
  17039. */
  17040. var findOwnerStack = function (instance) {
  17041. if (!instance) {
  17042. return [];
  17043. }
  17044. var stack = [];
  17045. /*eslint-disable space-after-keywords */
  17046. do {
  17047. /*eslint-enable space-after-keywords */
  17048. stack.push(instance);
  17049. } while (instance = instance._currentElement._owner);
  17050. stack.reverse();
  17051. return stack;
  17052. };
  17053. var didWarn = {};
  17054. validateDOMNesting = function (childTag, childInstance, ancestorInfo) {
  17055. ancestorInfo = ancestorInfo || emptyAncestorInfo;
  17056. var parentInfo = ancestorInfo.parentTag;
  17057. var parentTag = parentInfo && parentInfo.tag;
  17058. var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
  17059. var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
  17060. var problematic = invalidParent || invalidAncestor;
  17061. if (problematic) {
  17062. var ancestorTag = problematic.tag;
  17063. var ancestorInstance = problematic.instance;
  17064. var childOwner = childInstance && childInstance._currentElement._owner;
  17065. var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
  17066. var childOwners = findOwnerStack(childOwner);
  17067. var ancestorOwners = findOwnerStack(ancestorOwner);
  17068. var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
  17069. var i;
  17070. var deepestCommon = -1;
  17071. for (i = 0; i < minStackLen; i++) {
  17072. if (childOwners[i] === ancestorOwners[i]) {
  17073. deepestCommon = i;
  17074. } else {
  17075. break;
  17076. }
  17077. }
  17078. var UNKNOWN = '(unknown)';
  17079. var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
  17080. return inst.getName() || UNKNOWN;
  17081. });
  17082. var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
  17083. return inst.getName() || UNKNOWN;
  17084. });
  17085. var ownerInfo = [].concat(
  17086. // If the parent and child instances have a common owner ancestor, start
  17087. // with that -- otherwise we just start with the parent's owners.
  17088. deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
  17089. // If we're warning about an invalid (non-parent) ancestry, add '...'
  17090. invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
  17091. var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
  17092. if (didWarn[warnKey]) {
  17093. return;
  17094. }
  17095. didWarn[warnKey] = true;
  17096. if (invalidParent) {
  17097. var info = '';
  17098. if (ancestorTag === 'table' && childTag === 'tr') {
  17099. info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
  17100. }
  17101. "production" !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a child of <%s>. ' + 'See %s.%s', childTag, ancestorTag, ownerInfo, info) : undefined;
  17102. } else {
  17103. "production" !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a descendant of ' + '<%s>. See %s.', childTag, ancestorTag, ownerInfo) : undefined;
  17104. }
  17105. }
  17106. };
  17107. validateDOMNesting.ancestorInfoContextKey = '__validateDOMNesting_ancestorInfo$' + Math.random().toString(36).slice(2);
  17108. validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
  17109. // For testing
  17110. validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
  17111. ancestorInfo = ancestorInfo || emptyAncestorInfo;
  17112. var parentInfo = ancestorInfo.parentTag;
  17113. var parentTag = parentInfo && parentInfo.tag;
  17114. return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
  17115. };
  17116. }
  17117. module.exports = validateDOMNesting;
  17118. },{"153":153,"173":173,"24":24}],145:[function(_dereq_,module,exports){
  17119. /**
  17120. * Copyright 2013-2015, Facebook, Inc.
  17121. * All rights reserved.
  17122. *
  17123. * This source code is licensed under the BSD-style license found in the
  17124. * LICENSE file in the root directory of this source tree. An additional grant
  17125. * of patent rights can be found in the PATENTS file in the same directory.
  17126. *
  17127. * @providesModule CSSCore
  17128. * @typechecks
  17129. */
  17130. 'use strict';
  17131. var invariant = _dereq_(161);
  17132. /**
  17133. * The CSSCore module specifies the API (and implements most of the methods)
  17134. * that should be used when dealing with the display of elements (via their
  17135. * CSS classes and visibility on screen. It is an API focused on mutating the
  17136. * display and not reading it as no logical state should be encoded in the
  17137. * display of elements.
  17138. */
  17139. var CSSCore = {
  17140. /**
  17141. * Adds the class passed in to the element if it doesn't already have it.
  17142. *
  17143. * @param {DOMElement} element the element to set the class on
  17144. * @param {string} className the CSS className
  17145. * @return {DOMElement} the element passed in
  17146. */
  17147. addClass: function (element, className) {
  17148. !!/\s/.test(className) ? "production" !== 'production' ? invariant(false, 'CSSCore.addClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : undefined;
  17149. if (className) {
  17150. if (element.classList) {
  17151. element.classList.add(className);
  17152. } else if (!CSSCore.hasClass(element, className)) {
  17153. element.className = element.className + ' ' + className;
  17154. }
  17155. }
  17156. return element;
  17157. },
  17158. /**
  17159. * Removes the class passed in from the element
  17160. *
  17161. * @param {DOMElement} element the element to set the class on
  17162. * @param {string} className the CSS className
  17163. * @return {DOMElement} the element passed in
  17164. */
  17165. removeClass: function (element, className) {
  17166. !!/\s/.test(className) ? "production" !== 'production' ? invariant(false, 'CSSCore.removeClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : undefined;
  17167. if (className) {
  17168. if (element.classList) {
  17169. element.classList.remove(className);
  17170. } else if (CSSCore.hasClass(element, className)) {
  17171. element.className = element.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ') // multiple spaces to one
  17172. .replace(/^\s*|\s*$/g, ''); // trim the ends
  17173. }
  17174. }
  17175. return element;
  17176. },
  17177. /**
  17178. * Helper to add or remove a class from an element based on a condition.
  17179. *
  17180. * @param {DOMElement} element the element to set the class on
  17181. * @param {string} className the CSS className
  17182. * @param {*} bool condition to whether to add or remove the class
  17183. * @return {DOMElement} the element passed in
  17184. */
  17185. conditionClass: function (element, className, bool) {
  17186. return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);
  17187. },
  17188. /**
  17189. * Tests whether the element has the class specified.
  17190. *
  17191. * @param {DOMNode|DOMWindow} element the element to set the class on
  17192. * @param {string} className the CSS className
  17193. * @return {boolean} true if the element has the class, false if not
  17194. */
  17195. hasClass: function (element, className) {
  17196. !!/\s/.test(className) ? "production" !== 'production' ? invariant(false, 'CSS.hasClass takes only a single class name.') : invariant(false) : undefined;
  17197. if (element.classList) {
  17198. return !!className && element.classList.contains(className);
  17199. }
  17200. return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
  17201. }
  17202. };
  17203. module.exports = CSSCore;
  17204. },{"161":161}],146:[function(_dereq_,module,exports){
  17205. /**
  17206. * Copyright 2013-2015, Facebook, Inc.
  17207. *
  17208. * Licensed under the Apache License, Version 2.0 (the "License");
  17209. * you may not use this file except in compliance with the License.
  17210. * You may obtain a copy of the License at
  17211. *
  17212. * http://www.apache.org/licenses/LICENSE-2.0
  17213. *
  17214. * Unless required by applicable law or agreed to in writing, software
  17215. * distributed under the License is distributed on an "AS IS" BASIS,
  17216. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17217. * See the License for the specific language governing permissions and
  17218. * limitations under the License.
  17219. *
  17220. * @providesModule EventListener
  17221. * @typechecks
  17222. */
  17223. 'use strict';
  17224. var emptyFunction = _dereq_(153);
  17225. /**
  17226. * Upstream version of event listener. Does not take into account specific
  17227. * nature of platform.
  17228. */
  17229. var EventListener = {
  17230. /**
  17231. * Listen to DOM events during the bubble phase.
  17232. *
  17233. * @param {DOMEventTarget} target DOM element to register listener on.
  17234. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  17235. * @param {function} callback Callback function.
  17236. * @return {object} Object with a `remove` method.
  17237. */
  17238. listen: function (target, eventType, callback) {
  17239. if (target.addEventListener) {
  17240. target.addEventListener(eventType, callback, false);
  17241. return {
  17242. remove: function () {
  17243. target.removeEventListener(eventType, callback, false);
  17244. }
  17245. };
  17246. } else if (target.attachEvent) {
  17247. target.attachEvent('on' + eventType, callback);
  17248. return {
  17249. remove: function () {
  17250. target.detachEvent('on' + eventType, callback);
  17251. }
  17252. };
  17253. }
  17254. },
  17255. /**
  17256. * Listen to DOM events during the capture phase.
  17257. *
  17258. * @param {DOMEventTarget} target DOM element to register listener on.
  17259. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  17260. * @param {function} callback Callback function.
  17261. * @return {object} Object with a `remove` method.
  17262. */
  17263. capture: function (target, eventType, callback) {
  17264. if (target.addEventListener) {
  17265. target.addEventListener(eventType, callback, true);
  17266. return {
  17267. remove: function () {
  17268. target.removeEventListener(eventType, callback, true);
  17269. }
  17270. };
  17271. } else {
  17272. if ("production" !== 'production') {
  17273. console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');
  17274. }
  17275. return {
  17276. remove: emptyFunction
  17277. };
  17278. }
  17279. },
  17280. registerDefault: function () {}
  17281. };
  17282. module.exports = EventListener;
  17283. },{"153":153}],147:[function(_dereq_,module,exports){
  17284. /**
  17285. * Copyright 2013-2015, Facebook, Inc.
  17286. * All rights reserved.
  17287. *
  17288. * This source code is licensed under the BSD-style license found in the
  17289. * LICENSE file in the root directory of this source tree. An additional grant
  17290. * of patent rights can be found in the PATENTS file in the same directory.
  17291. *
  17292. * @providesModule ExecutionEnvironment
  17293. */
  17294. 'use strict';
  17295. var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
  17296. /**
  17297. * Simple, lightweight module assisting with the detection and context of
  17298. * Worker. Helps avoid circular dependencies and allows code to reason about
  17299. * whether or not they are in a Worker, even if they never include the main
  17300. * `ReactWorker` dependency.
  17301. */
  17302. var ExecutionEnvironment = {
  17303. canUseDOM: canUseDOM,
  17304. canUseWorkers: typeof Worker !== 'undefined',
  17305. canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
  17306. canUseViewport: canUseDOM && !!window.screen,
  17307. isInWorker: !canUseDOM // For now, this is true - might change in the future.
  17308. };
  17309. module.exports = ExecutionEnvironment;
  17310. },{}],148:[function(_dereq_,module,exports){
  17311. /**
  17312. * Copyright 2013-2015, Facebook, Inc.
  17313. * All rights reserved.
  17314. *
  17315. * This source code is licensed under the BSD-style license found in the
  17316. * LICENSE file in the root directory of this source tree. An additional grant
  17317. * of patent rights can be found in the PATENTS file in the same directory.
  17318. *
  17319. * @providesModule camelize
  17320. * @typechecks
  17321. */
  17322. "use strict";
  17323. var _hyphenPattern = /-(.)/g;
  17324. /**
  17325. * Camelcases a hyphenated string, for example:
  17326. *
  17327. * > camelize('background-color')
  17328. * < "backgroundColor"
  17329. *
  17330. * @param {string} string
  17331. * @return {string}
  17332. */
  17333. function camelize(string) {
  17334. return string.replace(_hyphenPattern, function (_, character) {
  17335. return character.toUpperCase();
  17336. });
  17337. }
  17338. module.exports = camelize;
  17339. },{}],149:[function(_dereq_,module,exports){
  17340. /**
  17341. * Copyright 2013-2015, Facebook, Inc.
  17342. * All rights reserved.
  17343. *
  17344. * This source code is licensed under the BSD-style license found in the
  17345. * LICENSE file in the root directory of this source tree. An additional grant
  17346. * of patent rights can be found in the PATENTS file in the same directory.
  17347. *
  17348. * @providesModule camelizeStyleName
  17349. * @typechecks
  17350. */
  17351. 'use strict';
  17352. var camelize = _dereq_(148);
  17353. var msPattern = /^-ms-/;
  17354. /**
  17355. * Camelcases a hyphenated CSS property name, for example:
  17356. *
  17357. * > camelizeStyleName('background-color')
  17358. * < "backgroundColor"
  17359. * > camelizeStyleName('-moz-transition')
  17360. * < "MozTransition"
  17361. * > camelizeStyleName('-ms-transition')
  17362. * < "msTransition"
  17363. *
  17364. * As Andi Smith suggests
  17365. * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
  17366. * is converted to lowercase `ms`.
  17367. *
  17368. * @param {string} string
  17369. * @return {string}
  17370. */
  17371. function camelizeStyleName(string) {
  17372. return camelize(string.replace(msPattern, 'ms-'));
  17373. }
  17374. module.exports = camelizeStyleName;
  17375. },{"148":148}],150:[function(_dereq_,module,exports){
  17376. /**
  17377. * Copyright 2013-2015, Facebook, Inc.
  17378. * All rights reserved.
  17379. *
  17380. * This source code is licensed under the BSD-style license found in the
  17381. * LICENSE file in the root directory of this source tree. An additional grant
  17382. * of patent rights can be found in the PATENTS file in the same directory.
  17383. *
  17384. * @providesModule containsNode
  17385. * @typechecks
  17386. */
  17387. 'use strict';
  17388. var isTextNode = _dereq_(163);
  17389. /*eslint-disable no-bitwise */
  17390. /**
  17391. * Checks if a given DOM node contains or is another DOM node.
  17392. *
  17393. * @param {?DOMNode} outerNode Outer DOM node.
  17394. * @param {?DOMNode} innerNode Inner DOM node.
  17395. * @return {boolean} True if `outerNode` contains or is `innerNode`.
  17396. */
  17397. function containsNode(_x, _x2) {
  17398. var _again = true;
  17399. _function: while (_again) {
  17400. var outerNode = _x,
  17401. innerNode = _x2;
  17402. _again = false;
  17403. if (!outerNode || !innerNode) {
  17404. return false;
  17405. } else if (outerNode === innerNode) {
  17406. return true;
  17407. } else if (isTextNode(outerNode)) {
  17408. return false;
  17409. } else if (isTextNode(innerNode)) {
  17410. _x = outerNode;
  17411. _x2 = innerNode.parentNode;
  17412. _again = true;
  17413. continue _function;
  17414. } else if (outerNode.contains) {
  17415. return outerNode.contains(innerNode);
  17416. } else if (outerNode.compareDocumentPosition) {
  17417. return !!(outerNode.compareDocumentPosition(innerNode) & 16);
  17418. } else {
  17419. return false;
  17420. }
  17421. }
  17422. }
  17423. module.exports = containsNode;
  17424. },{"163":163}],151:[function(_dereq_,module,exports){
  17425. /**
  17426. * Copyright 2013-2015, Facebook, Inc.
  17427. * All rights reserved.
  17428. *
  17429. * This source code is licensed under the BSD-style license found in the
  17430. * LICENSE file in the root directory of this source tree. An additional grant
  17431. * of patent rights can be found in the PATENTS file in the same directory.
  17432. *
  17433. * @providesModule createArrayFromMixed
  17434. * @typechecks
  17435. */
  17436. 'use strict';
  17437. var toArray = _dereq_(172);
  17438. /**
  17439. * Perform a heuristic test to determine if an object is "array-like".
  17440. *
  17441. * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
  17442. * Joshu replied: "Mu."
  17443. *
  17444. * This function determines if its argument has "array nature": it returns
  17445. * true if the argument is an actual array, an `arguments' object, or an
  17446. * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
  17447. *
  17448. * It will return false for other array-like objects like Filelist.
  17449. *
  17450. * @param {*} obj
  17451. * @return {boolean}
  17452. */
  17453. function hasArrayNature(obj) {
  17454. return(
  17455. // not null/false
  17456. !!obj && (
  17457. // arrays are objects, NodeLists are functions in Safari
  17458. typeof obj == 'object' || typeof obj == 'function') &&
  17459. // quacks like an array
  17460. 'length' in obj &&
  17461. // not window
  17462. !('setInterval' in obj) &&
  17463. // no DOM node should be considered an array-like
  17464. // a 'select' element has 'length' and 'item' properties on IE8
  17465. typeof obj.nodeType != 'number' && (
  17466. // a real array
  17467. Array.isArray(obj) ||
  17468. // arguments
  17469. 'callee' in obj ||
  17470. // HTMLCollection/NodeList
  17471. 'item' in obj)
  17472. );
  17473. }
  17474. /**
  17475. * Ensure that the argument is an array by wrapping it in an array if it is not.
  17476. * Creates a copy of the argument if it is already an array.
  17477. *
  17478. * This is mostly useful idiomatically:
  17479. *
  17480. * var createArrayFromMixed = require('createArrayFromMixed');
  17481. *
  17482. * function takesOneOrMoreThings(things) {
  17483. * things = createArrayFromMixed(things);
  17484. * ...
  17485. * }
  17486. *
  17487. * This allows you to treat `things' as an array, but accept scalars in the API.
  17488. *
  17489. * If you need to convert an array-like object, like `arguments`, into an array
  17490. * use toArray instead.
  17491. *
  17492. * @param {*} obj
  17493. * @return {array}
  17494. */
  17495. function createArrayFromMixed(obj) {
  17496. if (!hasArrayNature(obj)) {
  17497. return [obj];
  17498. } else if (Array.isArray(obj)) {
  17499. return obj.slice();
  17500. } else {
  17501. return toArray(obj);
  17502. }
  17503. }
  17504. module.exports = createArrayFromMixed;
  17505. },{"172":172}],152:[function(_dereq_,module,exports){
  17506. /**
  17507. * Copyright 2013-2015, Facebook, Inc.
  17508. * All rights reserved.
  17509. *
  17510. * This source code is licensed under the BSD-style license found in the
  17511. * LICENSE file in the root directory of this source tree. An additional grant
  17512. * of patent rights can be found in the PATENTS file in the same directory.
  17513. *
  17514. * @providesModule createNodesFromMarkup
  17515. * @typechecks
  17516. */
  17517. /*eslint-disable fb-www/unsafe-html*/
  17518. 'use strict';
  17519. var ExecutionEnvironment = _dereq_(147);
  17520. var createArrayFromMixed = _dereq_(151);
  17521. var getMarkupWrap = _dereq_(157);
  17522. var invariant = _dereq_(161);
  17523. /**
  17524. * Dummy container used to render all markup.
  17525. */
  17526. var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElementNS('http://www.w3.org/1999/xhtml', 'div') : null;
  17527. /**
  17528. * Pattern used by `getNodeName`.
  17529. */
  17530. var nodeNamePattern = /^\s*<(\w+)/;
  17531. /**
  17532. * Extracts the `nodeName` of the first element in a string of markup.
  17533. *
  17534. * @param {string} markup String of markup.
  17535. * @return {?string} Node name of the supplied markup.
  17536. */
  17537. function getNodeName(markup) {
  17538. var nodeNameMatch = markup.match(nodeNamePattern);
  17539. return nodeNameMatch && nodeNameMatch[1].toLowerCase();
  17540. }
  17541. /**
  17542. * Creates an array containing the nodes rendered from the supplied markup. The
  17543. * optionally supplied `handleScript` function will be invoked once for each
  17544. * <script> element that is rendered. If no `handleScript` function is supplied,
  17545. * an exception is thrown if any <script> elements are rendered.
  17546. *
  17547. * @param {string} markup A string of valid HTML markup.
  17548. * @param {?function} handleScript Invoked once for each rendered <script>.
  17549. * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
  17550. */
  17551. function createNodesFromMarkup(markup, handleScript) {
  17552. var node = dummyNode;
  17553. !!!dummyNode ? "production" !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : undefined;
  17554. var nodeName = getNodeName(markup);
  17555. var wrap = nodeName && getMarkupWrap(nodeName);
  17556. if (wrap) {
  17557. node.innerHTML = wrap[1] + markup + wrap[2];
  17558. var wrapDepth = wrap[0];
  17559. while (wrapDepth--) {
  17560. node = node.lastChild;
  17561. }
  17562. } else {
  17563. node.innerHTML = markup;
  17564. }
  17565. var scripts = node.getElementsByTagName('script');
  17566. if (scripts.length) {
  17567. !handleScript ? "production" !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : undefined;
  17568. createArrayFromMixed(scripts).forEach(handleScript);
  17569. }
  17570. var nodes = createArrayFromMixed(node.childNodes);
  17571. while (node.lastChild) {
  17572. node.removeChild(node.lastChild);
  17573. }
  17574. return nodes;
  17575. }
  17576. module.exports = createNodesFromMarkup;
  17577. },{"147":147,"151":151,"157":157,"161":161}],153:[function(_dereq_,module,exports){
  17578. /**
  17579. * Copyright 2013-2015, Facebook, Inc.
  17580. * All rights reserved.
  17581. *
  17582. * This source code is licensed under the BSD-style license found in the
  17583. * LICENSE file in the root directory of this source tree. An additional grant
  17584. * of patent rights can be found in the PATENTS file in the same directory.
  17585. *
  17586. * @providesModule emptyFunction
  17587. */
  17588. "use strict";
  17589. function makeEmptyFunction(arg) {
  17590. return function () {
  17591. return arg;
  17592. };
  17593. }
  17594. /**
  17595. * This function accepts and discards inputs; it has no side effects. This is
  17596. * primarily useful idiomatically for overridable function endpoints which
  17597. * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
  17598. */
  17599. function emptyFunction() {}
  17600. emptyFunction.thatReturns = makeEmptyFunction;
  17601. emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
  17602. emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
  17603. emptyFunction.thatReturnsNull = makeEmptyFunction(null);
  17604. emptyFunction.thatReturnsThis = function () {
  17605. return this;
  17606. };
  17607. emptyFunction.thatReturnsArgument = function (arg) {
  17608. return arg;
  17609. };
  17610. module.exports = emptyFunction;
  17611. },{}],154:[function(_dereq_,module,exports){
  17612. /**
  17613. * Copyright 2013-2015, Facebook, Inc.
  17614. * All rights reserved.
  17615. *
  17616. * This source code is licensed under the BSD-style license found in the
  17617. * LICENSE file in the root directory of this source tree. An additional grant
  17618. * of patent rights can be found in the PATENTS file in the same directory.
  17619. *
  17620. * @providesModule emptyObject
  17621. */
  17622. 'use strict';
  17623. var emptyObject = {};
  17624. if ("production" !== 'production') {
  17625. Object.freeze(emptyObject);
  17626. }
  17627. module.exports = emptyObject;
  17628. },{}],155:[function(_dereq_,module,exports){
  17629. /**
  17630. * Copyright 2013-2015, Facebook, Inc.
  17631. * All rights reserved.
  17632. *
  17633. * This source code is licensed under the BSD-style license found in the
  17634. * LICENSE file in the root directory of this source tree. An additional grant
  17635. * of patent rights can be found in the PATENTS file in the same directory.
  17636. *
  17637. * @providesModule focusNode
  17638. */
  17639. 'use strict';
  17640. /**
  17641. * @param {DOMElement} node input/textarea to focus
  17642. */
  17643. function focusNode(node) {
  17644. // IE8 can throw "Can't move focus to the control because it is invisible,
  17645. // not enabled, or of a type that does not accept the focus." for all kinds of
  17646. // reasons that are too expensive and fragile to test.
  17647. try {
  17648. node.focus();
  17649. } catch (e) {}
  17650. }
  17651. module.exports = focusNode;
  17652. },{}],156:[function(_dereq_,module,exports){
  17653. /**
  17654. * Copyright 2013-2015, Facebook, Inc.
  17655. * All rights reserved.
  17656. *
  17657. * This source code is licensed under the BSD-style license found in the
  17658. * LICENSE file in the root directory of this source tree. An additional grant
  17659. * of patent rights can be found in the PATENTS file in the same directory.
  17660. *
  17661. * @providesModule getActiveElement
  17662. * @typechecks
  17663. */
  17664. /* eslint-disable fb-www/typeof-undefined */
  17665. /**
  17666. * Same as document.activeElement but wraps in a try-catch block. In IE it is
  17667. * not safe to call document.activeElement if there is nothing focused.
  17668. *
  17669. * The activeElement will be null only if the document or document body is not
  17670. * yet defined.
  17671. */
  17672. 'use strict';
  17673. function getActiveElement() /*?DOMElement*/{
  17674. if (typeof document === 'undefined') {
  17675. return null;
  17676. }
  17677. try {
  17678. return document.activeElement || document.body;
  17679. } catch (e) {
  17680. return document.body;
  17681. }
  17682. }
  17683. module.exports = getActiveElement;
  17684. },{}],157:[function(_dereq_,module,exports){
  17685. /**
  17686. * Copyright 2013-2015, Facebook, Inc.
  17687. * All rights reserved.
  17688. *
  17689. * This source code is licensed under the BSD-style license found in the
  17690. * LICENSE file in the root directory of this source tree. An additional grant
  17691. * of patent rights can be found in the PATENTS file in the same directory.
  17692. *
  17693. * @providesModule getMarkupWrap
  17694. */
  17695. /*eslint-disable fb-www/unsafe-html */
  17696. 'use strict';
  17697. var ExecutionEnvironment = _dereq_(147);
  17698. var invariant = _dereq_(161);
  17699. /**
  17700. * Dummy container used to detect which wraps are necessary.
  17701. */
  17702. var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElementNS('http://www.w3.org/1999/xhtml', 'div') : null;
  17703. /**
  17704. * Some browsers cannot use `innerHTML` to render certain elements standalone,
  17705. * so we wrap them, render the wrapped nodes, then extract the desired node.
  17706. *
  17707. * In IE8, certain elements cannot render alone, so wrap all elements ('*').
  17708. */
  17709. var shouldWrap = {};
  17710. var selectWrap = [1, '<select multiple="true">', '</select>'];
  17711. var tableWrap = [1, '<table>', '</table>'];
  17712. var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
  17713. var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
  17714. var markupWrap = {
  17715. '*': [1, '?<div>', '</div>'],
  17716. 'area': [1, '<map>', '</map>'],
  17717. 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
  17718. 'legend': [1, '<fieldset>', '</fieldset>'],
  17719. 'param': [1, '<object>', '</object>'],
  17720. 'tr': [2, '<table><tbody>', '</tbody></table>'],
  17721. 'optgroup': selectWrap,
  17722. 'option': selectWrap,
  17723. 'caption': tableWrap,
  17724. 'colgroup': tableWrap,
  17725. 'tbody': tableWrap,
  17726. 'tfoot': tableWrap,
  17727. 'thead': tableWrap,
  17728. 'td': trWrap,
  17729. 'th': trWrap
  17730. };
  17731. // Initialize the SVG elements since we know they'll always need to be wrapped
  17732. // consistently. If they are created inside a <div> they will be initialized in
  17733. // the wrong namespace (and will not display).
  17734. var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
  17735. svgElements.forEach(function (nodeName) {
  17736. markupWrap[nodeName] = svgWrap;
  17737. shouldWrap[nodeName] = true;
  17738. });
  17739. /**
  17740. * Gets the markup wrap configuration for the supplied `nodeName`.
  17741. *
  17742. * NOTE: This lazily detects which wraps are necessary for the current browser.
  17743. *
  17744. * @param {string} nodeName Lowercase `nodeName`.
  17745. * @return {?array} Markup wrap configuration, if applicable.
  17746. */
  17747. function getMarkupWrap(nodeName) {
  17748. !!!dummyNode ? "production" !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : undefined;
  17749. if (!markupWrap.hasOwnProperty(nodeName)) {
  17750. nodeName = '*';
  17751. }
  17752. if (!shouldWrap.hasOwnProperty(nodeName)) {
  17753. if (nodeName === '*') {
  17754. dummyNode.innerHTML = '<link />';
  17755. } else {
  17756. dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
  17757. }
  17758. shouldWrap[nodeName] = !dummyNode.firstChild;
  17759. }
  17760. return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
  17761. }
  17762. module.exports = getMarkupWrap;
  17763. },{"147":147,"161":161}],158:[function(_dereq_,module,exports){
  17764. /**
  17765. * Copyright 2013-2015, Facebook, Inc.
  17766. * All rights reserved.
  17767. *
  17768. * This source code is licensed under the BSD-style license found in the
  17769. * LICENSE file in the root directory of this source tree. An additional grant
  17770. * of patent rights can be found in the PATENTS file in the same directory.
  17771. *
  17772. * @providesModule getUnboundedScrollPosition
  17773. * @typechecks
  17774. */
  17775. 'use strict';
  17776. /**
  17777. * Gets the scroll position of the supplied element or window.
  17778. *
  17779. * The return values are unbounded, unlike `getScrollPosition`. This means they
  17780. * may be negative or exceed the element boundaries (which is possible using
  17781. * inertial scrolling).
  17782. *
  17783. * @param {DOMWindow|DOMElement} scrollable
  17784. * @return {object} Map with `x` and `y` keys.
  17785. */
  17786. function getUnboundedScrollPosition(scrollable) {
  17787. if (scrollable === window) {
  17788. return {
  17789. x: window.pageXOffset || document.documentElement.scrollLeft,
  17790. y: window.pageYOffset || document.documentElement.scrollTop
  17791. };
  17792. }
  17793. return {
  17794. x: scrollable.scrollLeft,
  17795. y: scrollable.scrollTop
  17796. };
  17797. }
  17798. module.exports = getUnboundedScrollPosition;
  17799. },{}],159:[function(_dereq_,module,exports){
  17800. /**
  17801. * Copyright 2013-2015, Facebook, Inc.
  17802. * All rights reserved.
  17803. *
  17804. * This source code is licensed under the BSD-style license found in the
  17805. * LICENSE file in the root directory of this source tree. An additional grant
  17806. * of patent rights can be found in the PATENTS file in the same directory.
  17807. *
  17808. * @providesModule hyphenate
  17809. * @typechecks
  17810. */
  17811. 'use strict';
  17812. var _uppercasePattern = /([A-Z])/g;
  17813. /**
  17814. * Hyphenates a camelcased string, for example:
  17815. *
  17816. * > hyphenate('backgroundColor')
  17817. * < "background-color"
  17818. *
  17819. * For CSS style names, use `hyphenateStyleName` instead which works properly
  17820. * with all vendor prefixes, including `ms`.
  17821. *
  17822. * @param {string} string
  17823. * @return {string}
  17824. */
  17825. function hyphenate(string) {
  17826. return string.replace(_uppercasePattern, '-$1').toLowerCase();
  17827. }
  17828. module.exports = hyphenate;
  17829. },{}],160:[function(_dereq_,module,exports){
  17830. /**
  17831. * Copyright 2013-2015, Facebook, Inc.
  17832. * All rights reserved.
  17833. *
  17834. * This source code is licensed under the BSD-style license found in the
  17835. * LICENSE file in the root directory of this source tree. An additional grant
  17836. * of patent rights can be found in the PATENTS file in the same directory.
  17837. *
  17838. * @providesModule hyphenateStyleName
  17839. * @typechecks
  17840. */
  17841. 'use strict';
  17842. var hyphenate = _dereq_(159);
  17843. var msPattern = /^ms-/;
  17844. /**
  17845. * Hyphenates a camelcased CSS property name, for example:
  17846. *
  17847. * > hyphenateStyleName('backgroundColor')
  17848. * < "background-color"
  17849. * > hyphenateStyleName('MozTransition')
  17850. * < "-moz-transition"
  17851. * > hyphenateStyleName('msTransition')
  17852. * < "-ms-transition"
  17853. *
  17854. * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
  17855. * is converted to `-ms-`.
  17856. *
  17857. * @param {string} string
  17858. * @return {string}
  17859. */
  17860. function hyphenateStyleName(string) {
  17861. return hyphenate(string).replace(msPattern, '-ms-');
  17862. }
  17863. module.exports = hyphenateStyleName;
  17864. },{"159":159}],161:[function(_dereq_,module,exports){
  17865. /**
  17866. * Copyright 2013-2015, Facebook, Inc.
  17867. * All rights reserved.
  17868. *
  17869. * This source code is licensed under the BSD-style license found in the
  17870. * LICENSE file in the root directory of this source tree. An additional grant
  17871. * of patent rights can be found in the PATENTS file in the same directory.
  17872. *
  17873. * @providesModule invariant
  17874. */
  17875. 'use strict';
  17876. /**
  17877. * Use invariant() to assert state which your program assumes to be true.
  17878. *
  17879. * Provide sprintf-style format (only %s is supported) and arguments
  17880. * to provide information about what broke and what you were
  17881. * expecting.
  17882. *
  17883. * The invariant message will be stripped in production, but the invariant
  17884. * will remain to ensure logic does not differ in production.
  17885. */
  17886. function invariant(condition, format, a, b, c, d, e, f) {
  17887. if ("production" !== 'production') {
  17888. if (format === undefined) {
  17889. throw new Error('invariant requires an error message argument');
  17890. }
  17891. }
  17892. if (!condition) {
  17893. var error;
  17894. if (format === undefined) {
  17895. error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
  17896. } else {
  17897. var args = [a, b, c, d, e, f];
  17898. var argIndex = 0;
  17899. error = new Error(format.replace(/%s/g, function () {
  17900. return args[argIndex++];
  17901. }));
  17902. error.name = 'Invariant Violation';
  17903. }
  17904. error.framesToPop = 1; // we don't care about invariant's own frame
  17905. throw error;
  17906. }
  17907. }
  17908. module.exports = invariant;
  17909. },{}],162:[function(_dereq_,module,exports){
  17910. /**
  17911. * Copyright 2013-2015, Facebook, Inc.
  17912. * All rights reserved.
  17913. *
  17914. * This source code is licensed under the BSD-style license found in the
  17915. * LICENSE file in the root directory of this source tree. An additional grant
  17916. * of patent rights can be found in the PATENTS file in the same directory.
  17917. *
  17918. * @providesModule isNode
  17919. * @typechecks
  17920. */
  17921. /**
  17922. * @param {*} object The object to check.
  17923. * @return {boolean} Whether or not the object is a DOM node.
  17924. */
  17925. 'use strict';
  17926. function isNode(object) {
  17927. return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
  17928. }
  17929. module.exports = isNode;
  17930. },{}],163:[function(_dereq_,module,exports){
  17931. /**
  17932. * Copyright 2013-2015, Facebook, Inc.
  17933. * All rights reserved.
  17934. *
  17935. * This source code is licensed under the BSD-style license found in the
  17936. * LICENSE file in the root directory of this source tree. An additional grant
  17937. * of patent rights can be found in the PATENTS file in the same directory.
  17938. *
  17939. * @providesModule isTextNode
  17940. * @typechecks
  17941. */
  17942. 'use strict';
  17943. var isNode = _dereq_(162);
  17944. /**
  17945. * @param {*} object The object to check.
  17946. * @return {boolean} Whether or not the object is a DOM text node.
  17947. */
  17948. function isTextNode(object) {
  17949. return isNode(object) && object.nodeType == 3;
  17950. }
  17951. module.exports = isTextNode;
  17952. },{"162":162}],164:[function(_dereq_,module,exports){
  17953. /**
  17954. * Copyright 2013-2015, Facebook, Inc.
  17955. * All rights reserved.
  17956. *
  17957. * This source code is licensed under the BSD-style license found in the
  17958. * LICENSE file in the root directory of this source tree. An additional grant
  17959. * of patent rights can be found in the PATENTS file in the same directory.
  17960. *
  17961. * @providesModule joinClasses
  17962. * @typechecks static-only
  17963. */
  17964. 'use strict';
  17965. /**
  17966. * Combines multiple className strings into one.
  17967. * http://jsperf.com/joinclasses-args-vs-array
  17968. *
  17969. * @param {...?string} className
  17970. * @return {string}
  17971. */
  17972. function joinClasses(className /*, ... */) {
  17973. if (!className) {
  17974. className = '';
  17975. }
  17976. var nextClass;
  17977. var argLength = arguments.length;
  17978. if (argLength > 1) {
  17979. for (var ii = 1; ii < argLength; ii++) {
  17980. nextClass = arguments[ii];
  17981. if (nextClass) {
  17982. className = (className ? className + ' ' : '') + nextClass;
  17983. }
  17984. }
  17985. }
  17986. return className;
  17987. }
  17988. module.exports = joinClasses;
  17989. },{}],165:[function(_dereq_,module,exports){
  17990. /**
  17991. * Copyright 2013-2015, Facebook, Inc.
  17992. * All rights reserved.
  17993. *
  17994. * This source code is licensed under the BSD-style license found in the
  17995. * LICENSE file in the root directory of this source tree. An additional grant
  17996. * of patent rights can be found in the PATENTS file in the same directory.
  17997. *
  17998. * @providesModule keyMirror
  17999. * @typechecks static-only
  18000. */
  18001. 'use strict';
  18002. var invariant = _dereq_(161);
  18003. /**
  18004. * Constructs an enumeration with keys equal to their value.
  18005. *
  18006. * For example:
  18007. *
  18008. * var COLORS = keyMirror({blue: null, red: null});
  18009. * var myColor = COLORS.blue;
  18010. * var isColorValid = !!COLORS[myColor];
  18011. *
  18012. * The last line could not be performed if the values of the generated enum were
  18013. * not equal to their keys.
  18014. *
  18015. * Input: {key1: val1, key2: val2}
  18016. * Output: {key1: key1, key2: key2}
  18017. *
  18018. * @param {object} obj
  18019. * @return {object}
  18020. */
  18021. var keyMirror = function (obj) {
  18022. var ret = {};
  18023. var key;
  18024. !(obj instanceof Object && !Array.isArray(obj)) ? "production" !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : undefined;
  18025. for (key in obj) {
  18026. if (!obj.hasOwnProperty(key)) {
  18027. continue;
  18028. }
  18029. ret[key] = key;
  18030. }
  18031. return ret;
  18032. };
  18033. module.exports = keyMirror;
  18034. },{"161":161}],166:[function(_dereq_,module,exports){
  18035. /**
  18036. * Copyright 2013-2015, Facebook, Inc.
  18037. * All rights reserved.
  18038. *
  18039. * This source code is licensed under the BSD-style license found in the
  18040. * LICENSE file in the root directory of this source tree. An additional grant
  18041. * of patent rights can be found in the PATENTS file in the same directory.
  18042. *
  18043. * @providesModule keyOf
  18044. */
  18045. /**
  18046. * Allows extraction of a minified key. Let's the build system minify keys
  18047. * without losing the ability to dynamically use key strings as values
  18048. * themselves. Pass in an object with a single key/val pair and it will return
  18049. * you the string key of that single record. Suppose you want to grab the
  18050. * value for a key 'className' inside of an object. Key/val minification may
  18051. * have aliased that key to be 'xa12'. keyOf({className: null}) will return
  18052. * 'xa12' in that case. Resolve keys you want to use once at startup time, then
  18053. * reuse those resolutions.
  18054. */
  18055. "use strict";
  18056. var keyOf = function (oneKeyObj) {
  18057. var key;
  18058. for (key in oneKeyObj) {
  18059. if (!oneKeyObj.hasOwnProperty(key)) {
  18060. continue;
  18061. }
  18062. return key;
  18063. }
  18064. return null;
  18065. };
  18066. module.exports = keyOf;
  18067. },{}],167:[function(_dereq_,module,exports){
  18068. /**
  18069. * Copyright 2013-2015, Facebook, Inc.
  18070. * All rights reserved.
  18071. *
  18072. * This source code is licensed under the BSD-style license found in the
  18073. * LICENSE file in the root directory of this source tree. An additional grant
  18074. * of patent rights can be found in the PATENTS file in the same directory.
  18075. *
  18076. * @providesModule mapObject
  18077. */
  18078. 'use strict';
  18079. var hasOwnProperty = Object.prototype.hasOwnProperty;
  18080. /**
  18081. * Executes the provided `callback` once for each enumerable own property in the
  18082. * object and constructs a new object from the results. The `callback` is
  18083. * invoked with three arguments:
  18084. *
  18085. * - the property value
  18086. * - the property name
  18087. * - the object being traversed
  18088. *
  18089. * Properties that are added after the call to `mapObject` will not be visited
  18090. * by `callback`. If the values of existing properties are changed, the value
  18091. * passed to `callback` will be the value at the time `mapObject` visits them.
  18092. * Properties that are deleted before being visited are not visited.
  18093. *
  18094. * @grep function objectMap()
  18095. * @grep function objMap()
  18096. *
  18097. * @param {?object} object
  18098. * @param {function} callback
  18099. * @param {*} context
  18100. * @return {?object}
  18101. */
  18102. function mapObject(object, callback, context) {
  18103. if (!object) {
  18104. return null;
  18105. }
  18106. var result = {};
  18107. for (var name in object) {
  18108. if (hasOwnProperty.call(object, name)) {
  18109. result[name] = callback.call(context, object[name], name, object);
  18110. }
  18111. }
  18112. return result;
  18113. }
  18114. module.exports = mapObject;
  18115. },{}],168:[function(_dereq_,module,exports){
  18116. /**
  18117. * Copyright 2013-2015, Facebook, Inc.
  18118. * All rights reserved.
  18119. *
  18120. * This source code is licensed under the BSD-style license found in the
  18121. * LICENSE file in the root directory of this source tree. An additional grant
  18122. * of patent rights can be found in the PATENTS file in the same directory.
  18123. *
  18124. * @providesModule memoizeStringOnly
  18125. * @typechecks static-only
  18126. */
  18127. 'use strict';
  18128. /**
  18129. * Memoizes the return value of a function that accepts one string argument.
  18130. *
  18131. * @param {function} callback
  18132. * @return {function}
  18133. */
  18134. function memoizeStringOnly(callback) {
  18135. var cache = {};
  18136. return function (string) {
  18137. if (!cache.hasOwnProperty(string)) {
  18138. cache[string] = callback.call(this, string);
  18139. }
  18140. return cache[string];
  18141. };
  18142. }
  18143. module.exports = memoizeStringOnly;
  18144. },{}],169:[function(_dereq_,module,exports){
  18145. /**
  18146. * Copyright 2013-2015, Facebook, Inc.
  18147. * All rights reserved.
  18148. *
  18149. * This source code is licensed under the BSD-style license found in the
  18150. * LICENSE file in the root directory of this source tree. An additional grant
  18151. * of patent rights can be found in the PATENTS file in the same directory.
  18152. *
  18153. * @providesModule performance
  18154. * @typechecks
  18155. */
  18156. 'use strict';
  18157. var ExecutionEnvironment = _dereq_(147);
  18158. var performance;
  18159. if (ExecutionEnvironment.canUseDOM) {
  18160. performance = window.performance || window.msPerformance || window.webkitPerformance;
  18161. }
  18162. module.exports = performance || {};
  18163. },{"147":147}],170:[function(_dereq_,module,exports){
  18164. /**
  18165. * Copyright 2013-2015, Facebook, Inc.
  18166. * All rights reserved.
  18167. *
  18168. * This source code is licensed under the BSD-style license found in the
  18169. * LICENSE file in the root directory of this source tree. An additional grant
  18170. * of patent rights can be found in the PATENTS file in the same directory.
  18171. *
  18172. * @providesModule performanceNow
  18173. * @typechecks
  18174. */
  18175. 'use strict';
  18176. var performance = _dereq_(169);
  18177. var performanceNow;
  18178. /**
  18179. * Detect if we can use `window.performance.now()` and gracefully fallback to
  18180. * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
  18181. * because of Facebook's testing infrastructure.
  18182. */
  18183. if (performance.now) {
  18184. performanceNow = function () {
  18185. return performance.now();
  18186. };
  18187. } else {
  18188. performanceNow = function () {
  18189. return Date.now();
  18190. };
  18191. }
  18192. module.exports = performanceNow;
  18193. },{"169":169}],171:[function(_dereq_,module,exports){
  18194. /**
  18195. * Copyright 2013-2015, Facebook, Inc.
  18196. * All rights reserved.
  18197. *
  18198. * This source code is licensed under the BSD-style license found in the
  18199. * LICENSE file in the root directory of this source tree. An additional grant
  18200. * of patent rights can be found in the PATENTS file in the same directory.
  18201. *
  18202. * @providesModule shallowEqual
  18203. * @typechecks
  18204. *
  18205. */
  18206. 'use strict';
  18207. var hasOwnProperty = Object.prototype.hasOwnProperty;
  18208. /**
  18209. * Performs equality by iterating through keys on an object and returning false
  18210. * when any key has values which are not strictly equal between the arguments.
  18211. * Returns true when the values of all keys are strictly equal.
  18212. */
  18213. function shallowEqual(objA, objB) {
  18214. if (objA === objB) {
  18215. return true;
  18216. }
  18217. if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
  18218. return false;
  18219. }
  18220. var keysA = Object.keys(objA);
  18221. var keysB = Object.keys(objB);
  18222. if (keysA.length !== keysB.length) {
  18223. return false;
  18224. }
  18225. // Test for A's keys different from B.
  18226. var bHasOwnProperty = hasOwnProperty.bind(objB);
  18227. for (var i = 0; i < keysA.length; i++) {
  18228. if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
  18229. return false;
  18230. }
  18231. }
  18232. return true;
  18233. }
  18234. module.exports = shallowEqual;
  18235. },{}],172:[function(_dereq_,module,exports){
  18236. /**
  18237. * Copyright 2013-2015, Facebook, Inc.
  18238. * All rights reserved.
  18239. *
  18240. * This source code is licensed under the BSD-style license found in the
  18241. * LICENSE file in the root directory of this source tree. An additional grant
  18242. * of patent rights can be found in the PATENTS file in the same directory.
  18243. *
  18244. * @providesModule toArray
  18245. * @typechecks
  18246. */
  18247. 'use strict';
  18248. var invariant = _dereq_(161);
  18249. /**
  18250. * Convert array-like objects to arrays.
  18251. *
  18252. * This API assumes the caller knows the contents of the data type. For less
  18253. * well defined inputs use createArrayFromMixed.
  18254. *
  18255. * @param {object|function|filelist} obj
  18256. * @return {array}
  18257. */
  18258. function toArray(obj) {
  18259. var length = obj.length;
  18260. // Some browse builtin objects can report typeof 'function' (e.g. NodeList in
  18261. // old versions of Safari).
  18262. !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? "production" !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : undefined;
  18263. !(typeof length === 'number') ? "production" !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : undefined;
  18264. !(length === 0 || length - 1 in obj) ? "production" !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : undefined;
  18265. // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
  18266. // without method will throw during the slice call and skip straight to the
  18267. // fallback.
  18268. if (obj.hasOwnProperty) {
  18269. try {
  18270. return Array.prototype.slice.call(obj);
  18271. } catch (e) {
  18272. // IE < 9 does not support Array#slice on collections objects
  18273. }
  18274. }
  18275. // Fall back to copying key by key. This assumes all keys have a value,
  18276. // so will not preserve sparsely populated inputs.
  18277. var ret = Array(length);
  18278. for (var ii = 0; ii < length; ii++) {
  18279. ret[ii] = obj[ii];
  18280. }
  18281. return ret;
  18282. }
  18283. module.exports = toArray;
  18284. },{"161":161}],173:[function(_dereq_,module,exports){
  18285. /**
  18286. * Copyright 2014-2015, Facebook, Inc.
  18287. * All rights reserved.
  18288. *
  18289. * This source code is licensed under the BSD-style license found in the
  18290. * LICENSE file in the root directory of this source tree. An additional grant
  18291. * of patent rights can be found in the PATENTS file in the same directory.
  18292. *
  18293. * @providesModule warning
  18294. */
  18295. 'use strict';
  18296. var emptyFunction = _dereq_(153);
  18297. /**
  18298. * Similar to invariant but only logs a warning if the condition is not met.
  18299. * This can be used to log issues in development environments in critical
  18300. * paths. Removing the logging code for production environments will keep the
  18301. * same logic and follow the same code paths.
  18302. */
  18303. var warning = emptyFunction;
  18304. if ("production" !== 'production') {
  18305. warning = function (condition, format) {
  18306. for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
  18307. args[_key - 2] = arguments[_key];
  18308. }
  18309. if (format === undefined) {
  18310. throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
  18311. }
  18312. if (format.indexOf('Failed Composite propType: ') === 0) {
  18313. return; // Ignore CompositeComponent proptype check.
  18314. }
  18315. if (!condition) {
  18316. var argIndex = 0;
  18317. var message = 'Warning: ' + format.replace(/%s/g, function () {
  18318. return args[argIndex++];
  18319. });
  18320. if (typeof console !== 'undefined') {
  18321. console.error(message);
  18322. }
  18323. try {
  18324. // --- Welcome to debugging React ---
  18325. // This error was thrown as a convenience so that you can use this stack
  18326. // to find the callsite that caused this warning to fire.
  18327. throw new Error(message);
  18328. } catch (x) {}
  18329. }
  18330. };
  18331. }
  18332. module.exports = warning;
  18333. },{"153":153}]},{},[1])(1)
  18334. });