react-dom.js 638 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116
  1. /**
  2. * ReactDOM v15.6.1
  3. */
  4. import React from './react';
  5. ;(function(f) {
  6. // CommonJS
  7. // if (typeof exports === "object" && typeof module !== "undefined") {
  8. // module.exports = f(require('react'));
  9. // // module.exports = f(react);
  10. // // RequireJS
  11. // } else if (typeof define === "function" && define.amd) {
  12. // define(['react'], f);
  13. // // <script>
  14. // } else {
  15. var g;
  16. if (typeof window !== "undefined") {
  17. g = window;
  18. } else if (typeof global !== "undefined") {
  19. g = global;
  20. } else if (typeof self !== "undefined") {
  21. g = self;
  22. } else {
  23. // works providing we're not in "use strict";
  24. // needed for Java 8 Nashorn
  25. // see https://github.com/facebook/react/issues/3037
  26. g = this;
  27. }
  28. // g.ReactDOM = f(g.React);
  29. g.ReactDOM = f(React);
  30. // }
  31. })(function(React) {
  32. return (function(f){return 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){
  33. /**
  34. * Copyright 2013-present, Facebook, Inc.
  35. * All rights reserved.
  36. *
  37. * This source code is licensed under the BSD-style license found in the
  38. * LICENSE file in the root directory of this source tree. An additional grant
  39. * of patent rights can be found in the PATENTS file in the same directory.
  40. *
  41. */
  42. 'use strict';
  43. var ARIADOMPropertyConfig = {
  44. Properties: {
  45. // Global States and Properties
  46. 'aria-current': 0, // state
  47. 'aria-details': 0,
  48. 'aria-disabled': 0, // state
  49. 'aria-hidden': 0, // state
  50. 'aria-invalid': 0, // state
  51. 'aria-keyshortcuts': 0,
  52. 'aria-label': 0,
  53. 'aria-roledescription': 0,
  54. // Widget Attributes
  55. 'aria-autocomplete': 0,
  56. 'aria-checked': 0,
  57. 'aria-expanded': 0,
  58. 'aria-haspopup': 0,
  59. 'aria-level': 0,
  60. 'aria-modal': 0,
  61. 'aria-multiline': 0,
  62. 'aria-multiselectable': 0,
  63. 'aria-orientation': 0,
  64. 'aria-placeholder': 0,
  65. 'aria-pressed': 0,
  66. 'aria-readonly': 0,
  67. 'aria-required': 0,
  68. 'aria-selected': 0,
  69. 'aria-sort': 0,
  70. 'aria-valuemax': 0,
  71. 'aria-valuemin': 0,
  72. 'aria-valuenow': 0,
  73. 'aria-valuetext': 0,
  74. // Live Region Attributes
  75. 'aria-atomic': 0,
  76. 'aria-busy': 0,
  77. 'aria-live': 0,
  78. 'aria-relevant': 0,
  79. // Drag-and-Drop Attributes
  80. 'aria-dropeffect': 0,
  81. 'aria-grabbed': 0,
  82. // Relationship Attributes
  83. 'aria-activedescendant': 0,
  84. 'aria-colcount': 0,
  85. 'aria-colindex': 0,
  86. 'aria-colspan': 0,
  87. 'aria-controls': 0,
  88. 'aria-describedby': 0,
  89. 'aria-errormessage': 0,
  90. 'aria-flowto': 0,
  91. 'aria-labelledby': 0,
  92. 'aria-owns': 0,
  93. 'aria-posinset': 0,
  94. 'aria-rowcount': 0,
  95. 'aria-rowindex': 0,
  96. 'aria-rowspan': 0,
  97. 'aria-setsize': 0
  98. },
  99. DOMAttributeNames: {},
  100. DOMPropertyNames: {}
  101. };
  102. module.exports = ARIADOMPropertyConfig;
  103. },{}],2:[function(_dereq_,module,exports){
  104. /**
  105. * Copyright 2013-present, Facebook, Inc.
  106. * All rights reserved.
  107. *
  108. * This source code is licensed under the BSD-style license found in the
  109. * LICENSE file in the root directory of this source tree. An additional grant
  110. * of patent rights can be found in the PATENTS file in the same directory.
  111. *
  112. */
  113. 'use strict';
  114. var ReactDOMComponentTree = _dereq_(34);
  115. var focusNode = _dereq_(146);
  116. var AutoFocusUtils = {
  117. focusDOMComponent: function () {
  118. focusNode(ReactDOMComponentTree.getNodeFromInstance(this));
  119. }
  120. };
  121. module.exports = AutoFocusUtils;
  122. },{"146":146,"34":34}],3:[function(_dereq_,module,exports){
  123. /**
  124. * Copyright 2013-present Facebook, Inc.
  125. * All rights reserved.
  126. *
  127. * This source code is licensed under the BSD-style license found in the
  128. * LICENSE file in the root directory of this source tree. An additional grant
  129. * of patent rights can be found in the PATENTS file in the same directory.
  130. *
  131. */
  132. 'use strict';
  133. var EventPropagators = _dereq_(20);
  134. var ExecutionEnvironment = _dereq_(138);
  135. var FallbackCompositionState = _dereq_(21);
  136. var SyntheticCompositionEvent = _dereq_(89);
  137. var SyntheticInputEvent = _dereq_(93);
  138. var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
  139. var START_KEYCODE = 229;
  140. var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
  141. var documentMode = null;
  142. if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
  143. documentMode = document.documentMode;
  144. }
  145. // Webkit offers a very useful `textInput` event that can be used to
  146. // directly represent `beforeInput`. The IE `textinput` event is not as
  147. // useful, so we don't use it.
  148. var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
  149. // In IE9+, we have access to composition events, but the data supplied
  150. // by the native compositionend event may be incorrect. Japanese ideographic
  151. // spaces, for instance (\u3000) are not recorded correctly.
  152. var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
  153. /**
  154. * Opera <= 12 includes TextEvent in window, but does not fire
  155. * text input events. Rely on keypress instead.
  156. */
  157. function isPresto() {
  158. var opera = window.opera;
  159. return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
  160. }
  161. var SPACEBAR_CODE = 32;
  162. var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
  163. // Events and their corresponding property names.
  164. var eventTypes = {
  165. beforeInput: {
  166. phasedRegistrationNames: {
  167. bubbled: 'onBeforeInput',
  168. captured: 'onBeforeInputCapture'
  169. },
  170. dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste']
  171. },
  172. compositionEnd: {
  173. phasedRegistrationNames: {
  174. bubbled: 'onCompositionEnd',
  175. captured: 'onCompositionEndCapture'
  176. },
  177. dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  178. },
  179. compositionStart: {
  180. phasedRegistrationNames: {
  181. bubbled: 'onCompositionStart',
  182. captured: 'onCompositionStartCapture'
  183. },
  184. dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  185. },
  186. compositionUpdate: {
  187. phasedRegistrationNames: {
  188. bubbled: 'onCompositionUpdate',
  189. captured: 'onCompositionUpdateCapture'
  190. },
  191. dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  192. }
  193. };
  194. // Track whether we've ever handled a keypress on the space key.
  195. var hasSpaceKeypress = false;
  196. /**
  197. * Return whether a native keypress event is assumed to be a command.
  198. * This is required because Firefox fires `keypress` events for key commands
  199. * (cut, copy, select-all, etc.) even though no character is inserted.
  200. */
  201. function isKeypressCommand(nativeEvent) {
  202. return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
  203. // ctrlKey && altKey is equivalent to AltGr, and is not a command.
  204. !(nativeEvent.ctrlKey && nativeEvent.altKey);
  205. }
  206. /**
  207. * Translate native top level events into event types.
  208. *
  209. * @param {string} topLevelType
  210. * @return {object}
  211. */
  212. function getCompositionEventType(topLevelType) {
  213. switch (topLevelType) {
  214. case 'topCompositionStart':
  215. return eventTypes.compositionStart;
  216. case 'topCompositionEnd':
  217. return eventTypes.compositionEnd;
  218. case 'topCompositionUpdate':
  219. return eventTypes.compositionUpdate;
  220. }
  221. }
  222. /**
  223. * Does our fallback best-guess model think this event signifies that
  224. * composition has begun?
  225. *
  226. * @param {string} topLevelType
  227. * @param {object} nativeEvent
  228. * @return {boolean}
  229. */
  230. function isFallbackCompositionStart(topLevelType, nativeEvent) {
  231. return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE;
  232. }
  233. /**
  234. * Does our fallback mode think that this event is the end of composition?
  235. *
  236. * @param {string} topLevelType
  237. * @param {object} nativeEvent
  238. * @return {boolean}
  239. */
  240. function isFallbackCompositionEnd(topLevelType, nativeEvent) {
  241. switch (topLevelType) {
  242. case 'topKeyUp':
  243. // Command keys insert or clear IME input.
  244. return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
  245. case 'topKeyDown':
  246. // Expect IME keyCode on each keydown. If we get any other
  247. // code we must have exited earlier.
  248. return nativeEvent.keyCode !== START_KEYCODE;
  249. case 'topKeyPress':
  250. case 'topMouseDown':
  251. case 'topBlur':
  252. // Events are not possible without cancelling IME.
  253. return true;
  254. default:
  255. return false;
  256. }
  257. }
  258. /**
  259. * Google Input Tools provides composition data via a CustomEvent,
  260. * with the `data` property populated in the `detail` object. If this
  261. * is available on the event object, use it. If not, this is a plain
  262. * composition event and we have nothing special to extract.
  263. *
  264. * @param {object} nativeEvent
  265. * @return {?string}
  266. */
  267. function getDataFromCustomEvent(nativeEvent) {
  268. var detail = nativeEvent.detail;
  269. if (typeof detail === 'object' && 'data' in detail) {
  270. return detail.data;
  271. }
  272. return null;
  273. }
  274. // Track the current IME composition fallback object, if any.
  275. var currentComposition = null;
  276. /**
  277. * @return {?object} A SyntheticCompositionEvent.
  278. */
  279. function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  280. var eventType;
  281. var fallbackData;
  282. if (canUseCompositionEvent) {
  283. eventType = getCompositionEventType(topLevelType);
  284. } else if (!currentComposition) {
  285. if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
  286. eventType = eventTypes.compositionStart;
  287. }
  288. } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  289. eventType = eventTypes.compositionEnd;
  290. }
  291. if (!eventType) {
  292. return null;
  293. }
  294. if (useFallbackCompositionData) {
  295. // The current composition is stored statically and must not be
  296. // overwritten while composition continues.
  297. if (!currentComposition && eventType === eventTypes.compositionStart) {
  298. currentComposition = FallbackCompositionState.getPooled(nativeEventTarget);
  299. } else if (eventType === eventTypes.compositionEnd) {
  300. if (currentComposition) {
  301. fallbackData = currentComposition.getData();
  302. }
  303. }
  304. }
  305. var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
  306. if (fallbackData) {
  307. // Inject data generated from fallback path into the synthetic event.
  308. // This matches the property of native CompositionEventInterface.
  309. event.data = fallbackData;
  310. } else {
  311. var customData = getDataFromCustomEvent(nativeEvent);
  312. if (customData !== null) {
  313. event.data = customData;
  314. }
  315. }
  316. EventPropagators.accumulateTwoPhaseDispatches(event);
  317. return event;
  318. }
  319. /**
  320. * @param {string} topLevelType Record from `EventConstants`.
  321. * @param {object} nativeEvent Native browser event.
  322. * @return {?string} The string corresponding to this `beforeInput` event.
  323. */
  324. function getNativeBeforeInputChars(topLevelType, nativeEvent) {
  325. switch (topLevelType) {
  326. case 'topCompositionEnd':
  327. return getDataFromCustomEvent(nativeEvent);
  328. case 'topKeyPress':
  329. /**
  330. * If native `textInput` events are available, our goal is to make
  331. * use of them. However, there is a special case: the spacebar key.
  332. * In Webkit, preventing default on a spacebar `textInput` event
  333. * cancels character insertion, but it *also* causes the browser
  334. * to fall back to its default spacebar behavior of scrolling the
  335. * page.
  336. *
  337. * Tracking at:
  338. * https://code.google.com/p/chromium/issues/detail?id=355103
  339. *
  340. * To avoid this issue, use the keypress event as if no `textInput`
  341. * event is available.
  342. */
  343. var which = nativeEvent.which;
  344. if (which !== SPACEBAR_CODE) {
  345. return null;
  346. }
  347. hasSpaceKeypress = true;
  348. return SPACEBAR_CHAR;
  349. case 'topTextInput':
  350. // Record the characters to be added to the DOM.
  351. var chars = nativeEvent.data;
  352. // If it's a spacebar character, assume that we have already handled
  353. // it at the keypress level and bail immediately. Android Chrome
  354. // doesn't give us keycodes, so we need to blacklist it.
  355. if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
  356. return null;
  357. }
  358. return chars;
  359. default:
  360. // For other native event types, do nothing.
  361. return null;
  362. }
  363. }
  364. /**
  365. * For browsers that do not provide the `textInput` event, extract the
  366. * appropriate string to use for SyntheticInputEvent.
  367. *
  368. * @param {string} topLevelType Record from `EventConstants`.
  369. * @param {object} nativeEvent Native browser event.
  370. * @return {?string} The fallback string for this `beforeInput` event.
  371. */
  372. function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
  373. // If we are currently composing (IME) and using a fallback to do so,
  374. // try to extract the composed characters from the fallback object.
  375. // If composition event is available, we extract a string only at
  376. // compositionevent, otherwise extract it at fallback events.
  377. if (currentComposition) {
  378. if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  379. var chars = currentComposition.getData();
  380. FallbackCompositionState.release(currentComposition);
  381. currentComposition = null;
  382. return chars;
  383. }
  384. return null;
  385. }
  386. switch (topLevelType) {
  387. case 'topPaste':
  388. // If a paste event occurs after a keypress, throw out the input
  389. // chars. Paste events should not lead to BeforeInput events.
  390. return null;
  391. case 'topKeyPress':
  392. /**
  393. * As of v27, Firefox may fire keypress events even when no character
  394. * will be inserted. A few possibilities:
  395. *
  396. * - `which` is `0`. Arrow keys, Esc key, etc.
  397. *
  398. * - `which` is the pressed key code, but no char is available.
  399. * Ex: 'AltGr + d` in Polish. There is no modified character for
  400. * this key combination and no character is inserted into the
  401. * document, but FF fires the keypress for char code `100` anyway.
  402. * No `input` event will occur.
  403. *
  404. * - `which` is the pressed key code, but a command combination is
  405. * being used. Ex: `Cmd+C`. No character is inserted, and no
  406. * `input` event will occur.
  407. */
  408. if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
  409. return String.fromCharCode(nativeEvent.which);
  410. }
  411. return null;
  412. case 'topCompositionEnd':
  413. return useFallbackCompositionData ? null : nativeEvent.data;
  414. default:
  415. return null;
  416. }
  417. }
  418. /**
  419. * Extract a SyntheticInputEvent for `beforeInput`, based on either native
  420. * `textInput` or fallback behavior.
  421. *
  422. * @return {?object} A SyntheticInputEvent.
  423. */
  424. function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  425. var chars;
  426. if (canUseTextInputEvent) {
  427. chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
  428. } else {
  429. chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
  430. }
  431. // If no characters are being inserted, no BeforeInput event should
  432. // be fired.
  433. if (!chars) {
  434. return null;
  435. }
  436. var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
  437. event.data = chars;
  438. EventPropagators.accumulateTwoPhaseDispatches(event);
  439. return event;
  440. }
  441. /**
  442. * Create an `onBeforeInput` event to match
  443. * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
  444. *
  445. * This event plugin is based on the native `textInput` event
  446. * available in Chrome, Safari, Opera, and IE. This event fires after
  447. * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
  448. *
  449. * `beforeInput` is spec'd but not implemented in any browsers, and
  450. * the `input` event does not provide any useful information about what has
  451. * actually been added, contrary to the spec. Thus, `textInput` is the best
  452. * available event to identify the characters that have actually been inserted
  453. * into the target node.
  454. *
  455. * This plugin is also responsible for emitting `composition` events, thus
  456. * allowing us to share composition fallback code for both `beforeInput` and
  457. * `composition` event types.
  458. */
  459. var BeforeInputEventPlugin = {
  460. eventTypes: eventTypes,
  461. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  462. return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)];
  463. }
  464. };
  465. module.exports = BeforeInputEventPlugin;
  466. },{"138":138,"20":20,"21":21,"89":89,"93":93}],4:[function(_dereq_,module,exports){
  467. /**
  468. * Copyright 2013-present, Facebook, Inc.
  469. * All rights reserved.
  470. *
  471. * This source code is licensed under the BSD-style license found in the
  472. * LICENSE file in the root directory of this source tree. An additional grant
  473. * of patent rights can be found in the PATENTS file in the same directory.
  474. *
  475. */
  476. 'use strict';
  477. /**
  478. * CSS properties which accept numbers but are not in units of "px".
  479. */
  480. var isUnitlessNumber = {
  481. animationIterationCount: true,
  482. borderImageOutset: true,
  483. borderImageSlice: true,
  484. borderImageWidth: true,
  485. boxFlex: true,
  486. boxFlexGroup: true,
  487. boxOrdinalGroup: true,
  488. columnCount: true,
  489. flex: true,
  490. flexGrow: true,
  491. flexPositive: true,
  492. flexShrink: true,
  493. flexNegative: true,
  494. flexOrder: true,
  495. gridRow: true,
  496. gridRowEnd: true,
  497. gridRowSpan: true,
  498. gridRowStart: true,
  499. gridColumn: true,
  500. gridColumnEnd: true,
  501. gridColumnSpan: true,
  502. gridColumnStart: true,
  503. fontWeight: true,
  504. lineClamp: true,
  505. lineHeight: true,
  506. opacity: true,
  507. order: true,
  508. orphans: true,
  509. tabSize: true,
  510. widows: true,
  511. zIndex: true,
  512. zoom: true,
  513. // SVG-related properties
  514. fillOpacity: true,
  515. floodOpacity: true,
  516. stopOpacity: true,
  517. strokeDasharray: true,
  518. strokeDashoffset: true,
  519. strokeMiterlimit: true,
  520. strokeOpacity: true,
  521. strokeWidth: true
  522. };
  523. /**
  524. * @param {string} prefix vendor-specific prefix, eg: Webkit
  525. * @param {string} key style name, eg: transitionDuration
  526. * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
  527. * WebkitTransitionDuration
  528. */
  529. function prefixKey(prefix, key) {
  530. return prefix + key.charAt(0).toUpperCase() + key.substring(1);
  531. }
  532. /**
  533. * Support style names that may come passed in prefixed by adding permutations
  534. * of vendor prefixes.
  535. */
  536. var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
  537. // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
  538. // infinite loop, because it iterates over the newly added props too.
  539. Object.keys(isUnitlessNumber).forEach(function (prop) {
  540. prefixes.forEach(function (prefix) {
  541. isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
  542. });
  543. });
  544. /**
  545. * Most style properties can be unset by doing .style[prop] = '' but IE8
  546. * doesn't like doing that with shorthand properties so for the properties that
  547. * IE8 breaks on, which are listed here, we instead unset each of the
  548. * individual properties. See http://bugs.jquery.com/ticket/12385.
  549. * The 4-value 'clock' properties like margin, padding, border-width seem to
  550. * behave without any problems. Curiously, list-style works too without any
  551. * special prodding.
  552. */
  553. var shorthandPropertyExpansions = {
  554. background: {
  555. backgroundAttachment: true,
  556. backgroundColor: true,
  557. backgroundImage: true,
  558. backgroundPositionX: true,
  559. backgroundPositionY: true,
  560. backgroundRepeat: true
  561. },
  562. backgroundPosition: {
  563. backgroundPositionX: true,
  564. backgroundPositionY: true
  565. },
  566. border: {
  567. borderWidth: true,
  568. borderStyle: true,
  569. borderColor: true
  570. },
  571. borderBottom: {
  572. borderBottomWidth: true,
  573. borderBottomStyle: true,
  574. borderBottomColor: true
  575. },
  576. borderLeft: {
  577. borderLeftWidth: true,
  578. borderLeftStyle: true,
  579. borderLeftColor: true
  580. },
  581. borderRight: {
  582. borderRightWidth: true,
  583. borderRightStyle: true,
  584. borderRightColor: true
  585. },
  586. borderTop: {
  587. borderTopWidth: true,
  588. borderTopStyle: true,
  589. borderTopColor: true
  590. },
  591. font: {
  592. fontStyle: true,
  593. fontVariant: true,
  594. fontWeight: true,
  595. fontSize: true,
  596. lineHeight: true,
  597. fontFamily: true
  598. },
  599. outline: {
  600. outlineWidth: true,
  601. outlineStyle: true,
  602. outlineColor: true
  603. }
  604. };
  605. var CSSProperty = {
  606. isUnitlessNumber: isUnitlessNumber,
  607. shorthandPropertyExpansions: shorthandPropertyExpansions
  608. };
  609. module.exports = CSSProperty;
  610. },{}],5:[function(_dereq_,module,exports){
  611. /**
  612. * Copyright 2013-present, Facebook, Inc.
  613. * All rights reserved.
  614. *
  615. * This source code is licensed under the BSD-style license found in the
  616. * LICENSE file in the root directory of this source tree. An additional grant
  617. * of patent rights can be found in the PATENTS file in the same directory.
  618. *
  619. */
  620. 'use strict';
  621. var CSSProperty = _dereq_(4);
  622. var ExecutionEnvironment = _dereq_(138);
  623. var ReactInstrumentation = _dereq_(64);
  624. var camelizeStyleName = _dereq_(140);
  625. var dangerousStyleValue = _dereq_(106);
  626. var hyphenateStyleName = _dereq_(151);
  627. var memoizeStringOnly = _dereq_(155);
  628. var warning = _dereq_(159);
  629. var processStyleName = memoizeStringOnly(function (styleName) {
  630. return hyphenateStyleName(styleName);
  631. });
  632. var hasShorthandPropertyBug = false;
  633. var styleFloatAccessor = 'cssFloat';
  634. if (ExecutionEnvironment.canUseDOM) {
  635. var tempStyle = document.createElement('div').style;
  636. try {
  637. // IE8 throws "Invalid argument." if resetting shorthand style properties.
  638. tempStyle.font = '';
  639. } catch (e) {
  640. hasShorthandPropertyBug = true;
  641. }
  642. // IE8 only supports accessing cssFloat (standard) as styleFloat
  643. if (document.documentElement.style.cssFloat === undefined) {
  644. styleFloatAccessor = 'styleFloat';
  645. }
  646. }
  647. if ("development" !== 'production') {
  648. // 'msTransform' is correct, but the other prefixes should be capitalized
  649. var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
  650. // style values shouldn't contain a semicolon
  651. var badStyleValueWithSemicolonPattern = /;\s*$/;
  652. var warnedStyleNames = {};
  653. var warnedStyleValues = {};
  654. var warnedForNaNValue = false;
  655. var warnHyphenatedStyleName = function (name, owner) {
  656. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  657. return;
  658. }
  659. warnedStyleNames[name] = true;
  660. "development" !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0;
  661. };
  662. var warnBadVendoredStyleName = function (name, owner) {
  663. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  664. return;
  665. }
  666. warnedStyleNames[name] = true;
  667. "development" !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), checkRenderMessage(owner)) : void 0;
  668. };
  669. var warnStyleValueWithSemicolon = function (name, value, owner) {
  670. if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
  671. return;
  672. }
  673. warnedStyleValues[value] = true;
  674. "development" !== 'production' ? warning(false, "Style property values shouldn't contain a semicolon.%s " + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, '')) : void 0;
  675. };
  676. var warnStyleValueIsNaN = function (name, value, owner) {
  677. if (warnedForNaNValue) {
  678. return;
  679. }
  680. warnedForNaNValue = true;
  681. "development" !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0;
  682. };
  683. var checkRenderMessage = function (owner) {
  684. if (owner) {
  685. var name = owner.getName();
  686. if (name) {
  687. return ' Check the render method of `' + name + '`.';
  688. }
  689. }
  690. return '';
  691. };
  692. /**
  693. * @param {string} name
  694. * @param {*} value
  695. * @param {ReactDOMComponent} component
  696. */
  697. var warnValidStyle = function (name, value, component) {
  698. var owner;
  699. if (component) {
  700. owner = component._currentElement._owner;
  701. }
  702. if (name.indexOf('-') > -1) {
  703. warnHyphenatedStyleName(name, owner);
  704. } else if (badVendoredStyleNamePattern.test(name)) {
  705. warnBadVendoredStyleName(name, owner);
  706. } else if (badStyleValueWithSemicolonPattern.test(value)) {
  707. warnStyleValueWithSemicolon(name, value, owner);
  708. }
  709. if (typeof value === 'number' && isNaN(value)) {
  710. warnStyleValueIsNaN(name, value, owner);
  711. }
  712. };
  713. }
  714. /**
  715. * Operations for dealing with CSS properties.
  716. */
  717. var CSSPropertyOperations = {
  718. /**
  719. * Serializes a mapping of style properties for use as inline styles:
  720. *
  721. * > createMarkupForStyles({width: '200px', height: 0})
  722. * "width:200px;height:0;"
  723. *
  724. * Undefined values are ignored so that declarative programming is easier.
  725. * The result should be HTML-escaped before insertion into the DOM.
  726. *
  727. * @param {object} styles
  728. * @param {ReactDOMComponent} component
  729. * @return {?string}
  730. */
  731. createMarkupForStyles: function (styles, component) {
  732. var serialized = '';
  733. for (var styleName in styles) {
  734. if (!styles.hasOwnProperty(styleName)) {
  735. continue;
  736. }
  737. var isCustomProperty = styleName.indexOf('--') === 0;
  738. var styleValue = styles[styleName];
  739. if ("development" !== 'production') {
  740. if (!isCustomProperty) {
  741. warnValidStyle(styleName, styleValue, component);
  742. }
  743. }
  744. if (styleValue != null) {
  745. serialized += processStyleName(styleName) + ':';
  746. serialized += dangerousStyleValue(styleName, styleValue, component, isCustomProperty) + ';';
  747. }
  748. }
  749. return serialized || null;
  750. },
  751. /**
  752. * Sets the value for multiple styles on a node. If a value is specified as
  753. * '' (empty string), the corresponding style property will be unset.
  754. *
  755. * @param {DOMElement} node
  756. * @param {object} styles
  757. * @param {ReactDOMComponent} component
  758. */
  759. setValueForStyles: function (node, styles, component) {
  760. if ("development" !== 'production') {
  761. ReactInstrumentation.debugTool.onHostOperation({
  762. instanceID: component._debugID,
  763. type: 'update styles',
  764. payload: styles
  765. });
  766. }
  767. var style = node.style;
  768. for (var styleName in styles) {
  769. if (!styles.hasOwnProperty(styleName)) {
  770. continue;
  771. }
  772. var isCustomProperty = styleName.indexOf('--') === 0;
  773. if ("development" !== 'production') {
  774. if (!isCustomProperty) {
  775. warnValidStyle(styleName, styles[styleName], component);
  776. }
  777. }
  778. var styleValue = dangerousStyleValue(styleName, styles[styleName], component, isCustomProperty);
  779. if (styleName === 'float' || styleName === 'cssFloat') {
  780. styleName = styleFloatAccessor;
  781. }
  782. if (isCustomProperty) {
  783. style.setProperty(styleName, styleValue);
  784. } else if (styleValue) {
  785. style[styleName] = styleValue;
  786. } else {
  787. var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
  788. if (expansion) {
  789. // Shorthand property that IE8 won't like unsetting, so unset each
  790. // component to placate it
  791. for (var individualStyleName in expansion) {
  792. style[individualStyleName] = '';
  793. }
  794. } else {
  795. style[styleName] = '';
  796. }
  797. }
  798. }
  799. }
  800. };
  801. module.exports = CSSPropertyOperations;
  802. },{"106":106,"138":138,"140":140,"151":151,"155":155,"159":159,"4":4,"64":64}],6:[function(_dereq_,module,exports){
  803. /**
  804. * Copyright 2013-present, Facebook, Inc.
  805. * All rights reserved.
  806. *
  807. * This source code is licensed under the BSD-style license found in the
  808. * LICENSE file in the root directory of this source tree. An additional grant
  809. * of patent rights can be found in the PATENTS file in the same directory.
  810. *
  811. *
  812. */
  813. 'use strict';
  814. var _prodInvariant = _dereq_(126);
  815. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  816. var PooledClass = _dereq_(25);
  817. var invariant = _dereq_(152);
  818. /**
  819. * A specialized pseudo-event module to help keep track of components waiting to
  820. * be notified when their DOM representations are available for use.
  821. *
  822. * This implements `PooledClass`, so you should never need to instantiate this.
  823. * Instead, use `CallbackQueue.getPooled()`.
  824. *
  825. * @class ReactMountReady
  826. * @implements PooledClass
  827. * @internal
  828. */
  829. var CallbackQueue = function () {
  830. function CallbackQueue(arg) {
  831. _classCallCheck(this, CallbackQueue);
  832. this._callbacks = null;
  833. this._contexts = null;
  834. this._arg = arg;
  835. }
  836. /**
  837. * Enqueues a callback to be invoked when `notifyAll` is invoked.
  838. *
  839. * @param {function} callback Invoked when `notifyAll` is invoked.
  840. * @param {?object} context Context to call `callback` with.
  841. * @internal
  842. */
  843. CallbackQueue.prototype.enqueue = function enqueue(callback, context) {
  844. this._callbacks = this._callbacks || [];
  845. this._callbacks.push(callback);
  846. this._contexts = this._contexts || [];
  847. this._contexts.push(context);
  848. };
  849. /**
  850. * Invokes all enqueued callbacks and clears the queue. This is invoked after
  851. * the DOM representation of a component has been created or updated.
  852. *
  853. * @internal
  854. */
  855. CallbackQueue.prototype.notifyAll = function notifyAll() {
  856. var callbacks = this._callbacks;
  857. var contexts = this._contexts;
  858. var arg = this._arg;
  859. if (callbacks && contexts) {
  860. !(callbacks.length === contexts.length) ? "development" !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : _prodInvariant('24') : void 0;
  861. this._callbacks = null;
  862. this._contexts = null;
  863. for (var i = 0; i < callbacks.length; i++) {
  864. callbacks[i].call(contexts[i], arg);
  865. }
  866. callbacks.length = 0;
  867. contexts.length = 0;
  868. }
  869. };
  870. CallbackQueue.prototype.checkpoint = function checkpoint() {
  871. return this._callbacks ? this._callbacks.length : 0;
  872. };
  873. CallbackQueue.prototype.rollback = function rollback(len) {
  874. if (this._callbacks && this._contexts) {
  875. this._callbacks.length = len;
  876. this._contexts.length = len;
  877. }
  878. };
  879. /**
  880. * Resets the internal queue.
  881. *
  882. * @internal
  883. */
  884. CallbackQueue.prototype.reset = function reset() {
  885. this._callbacks = null;
  886. this._contexts = null;
  887. };
  888. /**
  889. * `PooledClass` looks for this.
  890. */
  891. CallbackQueue.prototype.destructor = function destructor() {
  892. this.reset();
  893. };
  894. return CallbackQueue;
  895. }();
  896. module.exports = PooledClass.addPoolingTo(CallbackQueue);
  897. },{"126":126,"152":152,"25":25}],7:[function(_dereq_,module,exports){
  898. /**
  899. * Copyright 2013-present, Facebook, Inc.
  900. * All rights reserved.
  901. *
  902. * This source code is licensed under the BSD-style license found in the
  903. * LICENSE file in the root directory of this source tree. An additional grant
  904. * of patent rights can be found in the PATENTS file in the same directory.
  905. *
  906. */
  907. 'use strict';
  908. var EventPluginHub = _dereq_(17);
  909. var EventPropagators = _dereq_(20);
  910. var ExecutionEnvironment = _dereq_(138);
  911. var ReactDOMComponentTree = _dereq_(34);
  912. var ReactUpdates = _dereq_(82);
  913. var SyntheticEvent = _dereq_(91);
  914. var inputValueTracking = _dereq_(120);
  915. var getEventTarget = _dereq_(114);
  916. var isEventSupported = _dereq_(122);
  917. var isTextInputElement = _dereq_(123);
  918. var eventTypes = {
  919. change: {
  920. phasedRegistrationNames: {
  921. bubbled: 'onChange',
  922. captured: 'onChangeCapture'
  923. },
  924. dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange']
  925. }
  926. };
  927. function createAndAccumulateChangeEvent(inst, nativeEvent, target) {
  928. var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, target);
  929. event.type = 'change';
  930. EventPropagators.accumulateTwoPhaseDispatches(event);
  931. return event;
  932. }
  933. /**
  934. * For IE shims
  935. */
  936. var activeElement = null;
  937. var activeElementInst = null;
  938. /**
  939. * SECTION: handle `change` event
  940. */
  941. function shouldUseChangeEvent(elem) {
  942. var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
  943. return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
  944. }
  945. var doesChangeEventBubble = false;
  946. if (ExecutionEnvironment.canUseDOM) {
  947. // See `handleChange` comment below
  948. doesChangeEventBubble = isEventSupported('change') && (!document.documentMode || document.documentMode > 8);
  949. }
  950. function manualDispatchChangeEvent(nativeEvent) {
  951. var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent));
  952. // If change and propertychange bubbled, we'd just bind to it like all the
  953. // other events and have it go through ReactBrowserEventEmitter. Since it
  954. // doesn't, we manually listen for the events and so we have to enqueue and
  955. // process the abstract event manually.
  956. //
  957. // Batching is necessary here in order to ensure that all event handlers run
  958. // before the next rerender (including event handlers attached to ancestor
  959. // elements instead of directly on the input). Without this, controlled
  960. // components don't work properly in conjunction with event bubbling because
  961. // the component is rerendered and the value reverted before all the event
  962. // handlers can run. See https://github.com/facebook/react/issues/708.
  963. ReactUpdates.batchedUpdates(runEventInBatch, event);
  964. }
  965. function runEventInBatch(event) {
  966. EventPluginHub.enqueueEvents(event);
  967. EventPluginHub.processEventQueue(false);
  968. }
  969. function startWatchingForChangeEventIE8(target, targetInst) {
  970. activeElement = target;
  971. activeElementInst = targetInst;
  972. activeElement.attachEvent('onchange', manualDispatchChangeEvent);
  973. }
  974. function stopWatchingForChangeEventIE8() {
  975. if (!activeElement) {
  976. return;
  977. }
  978. activeElement.detachEvent('onchange', manualDispatchChangeEvent);
  979. activeElement = null;
  980. activeElementInst = null;
  981. }
  982. function getInstIfValueChanged(targetInst, nativeEvent) {
  983. var updated = inputValueTracking.updateValueIfChanged(targetInst);
  984. var simulated = nativeEvent.simulated === true && ChangeEventPlugin._allowSimulatedPassThrough;
  985. if (updated || simulated) {
  986. return targetInst;
  987. }
  988. }
  989. function getTargetInstForChangeEvent(topLevelType, targetInst) {
  990. if (topLevelType === 'topChange') {
  991. return targetInst;
  992. }
  993. }
  994. function handleEventsForChangeEventIE8(topLevelType, target, targetInst) {
  995. if (topLevelType === 'topFocus') {
  996. // stopWatching() should be a noop here but we call it just in case we
  997. // missed a blur event somehow.
  998. stopWatchingForChangeEventIE8();
  999. startWatchingForChangeEventIE8(target, targetInst);
  1000. } else if (topLevelType === 'topBlur') {
  1001. stopWatchingForChangeEventIE8();
  1002. }
  1003. }
  1004. /**
  1005. * SECTION: handle `input` event
  1006. */
  1007. var isInputEventSupported = false;
  1008. if (ExecutionEnvironment.canUseDOM) {
  1009. // IE9 claims to support the input event but fails to trigger it when
  1010. // deleting text, so we ignore its input events.
  1011. isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9);
  1012. }
  1013. /**
  1014. * (For IE <=9) Starts tracking propertychange events on the passed-in element
  1015. * and override the value property so that we can distinguish user events from
  1016. * value changes in JS.
  1017. */
  1018. function startWatchingForValueChange(target, targetInst) {
  1019. activeElement = target;
  1020. activeElementInst = targetInst;
  1021. activeElement.attachEvent('onpropertychange', handlePropertyChange);
  1022. }
  1023. /**
  1024. * (For IE <=9) Removes the event listeners from the currently-tracked element,
  1025. * if any exists.
  1026. */
  1027. function stopWatchingForValueChange() {
  1028. if (!activeElement) {
  1029. return;
  1030. }
  1031. activeElement.detachEvent('onpropertychange', handlePropertyChange);
  1032. activeElement = null;
  1033. activeElementInst = null;
  1034. }
  1035. /**
  1036. * (For IE <=9) Handles a propertychange event, sending a `change` event if
  1037. * the value of the active element has changed.
  1038. */
  1039. function handlePropertyChange(nativeEvent) {
  1040. if (nativeEvent.propertyName !== 'value') {
  1041. return;
  1042. }
  1043. if (getInstIfValueChanged(activeElementInst, nativeEvent)) {
  1044. manualDispatchChangeEvent(nativeEvent);
  1045. }
  1046. }
  1047. function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) {
  1048. if (topLevelType === 'topFocus') {
  1049. // In IE8, we can capture almost all .value changes by adding a
  1050. // propertychange handler and looking for events with propertyName
  1051. // equal to 'value'
  1052. // In IE9, propertychange fires for most input events but is buggy and
  1053. // doesn't fire when text is deleted, but conveniently, selectionchange
  1054. // appears to fire in all of the remaining cases so we catch those and
  1055. // forward the event if the value has changed
  1056. // In either case, we don't want to call the event handler if the value
  1057. // is changed from JS so we redefine a setter for `.value` that updates
  1058. // our activeElementValue variable, allowing us to ignore those changes
  1059. //
  1060. // stopWatching() should be a noop here but we call it just in case we
  1061. // missed a blur event somehow.
  1062. stopWatchingForValueChange();
  1063. startWatchingForValueChange(target, targetInst);
  1064. } else if (topLevelType === 'topBlur') {
  1065. stopWatchingForValueChange();
  1066. }
  1067. }
  1068. // For IE8 and IE9.
  1069. function getTargetInstForInputEventPolyfill(topLevelType, targetInst, nativeEvent) {
  1070. if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') {
  1071. // On the selectionchange event, the target is just document which isn't
  1072. // helpful for us so just check activeElement instead.
  1073. //
  1074. // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
  1075. // propertychange on the first input event after setting `value` from a
  1076. // script and fires only keydown, keypress, keyup. Catching keyup usually
  1077. // gets it and catching keydown lets us fire an event for the first
  1078. // keystroke if user does a key repeat (it'll be a little delayed: right
  1079. // before the second keystroke). Other input methods (e.g., paste) seem to
  1080. // fire selectionchange normally.
  1081. return getInstIfValueChanged(activeElementInst, nativeEvent);
  1082. }
  1083. }
  1084. /**
  1085. * SECTION: handle `click` event
  1086. */
  1087. function shouldUseClickEvent(elem) {
  1088. // Use the `click` event to detect changes to checkbox and radio inputs.
  1089. // This approach works across all browsers, whereas `change` does not fire
  1090. // until `blur` in IE8.
  1091. var nodeName = elem.nodeName;
  1092. return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
  1093. }
  1094. function getTargetInstForClickEvent(topLevelType, targetInst, nativeEvent) {
  1095. if (topLevelType === 'topClick') {
  1096. return getInstIfValueChanged(targetInst, nativeEvent);
  1097. }
  1098. }
  1099. function getTargetInstForInputOrChangeEvent(topLevelType, targetInst, nativeEvent) {
  1100. if (topLevelType === 'topInput' || topLevelType === 'topChange') {
  1101. return getInstIfValueChanged(targetInst, nativeEvent);
  1102. }
  1103. }
  1104. function handleControlledInputBlur(inst, node) {
  1105. // TODO: In IE, inst is occasionally null. Why?
  1106. if (inst == null) {
  1107. return;
  1108. }
  1109. // Fiber and ReactDOM keep wrapper state in separate places
  1110. var state = inst._wrapperState || node._wrapperState;
  1111. if (!state || !state.controlled || node.type !== 'number') {
  1112. return;
  1113. }
  1114. // If controlled, assign the value attribute to the current value on blur
  1115. var value = '' + node.value;
  1116. if (node.getAttribute('value') !== value) {
  1117. node.setAttribute('value', value);
  1118. }
  1119. }
  1120. /**
  1121. * This plugin creates an `onChange` event that normalizes change events
  1122. * across form elements. This event fires at a time when it's possible to
  1123. * change the element's value without seeing a flicker.
  1124. *
  1125. * Supported elements are:
  1126. * - input (see `isTextInputElement`)
  1127. * - textarea
  1128. * - select
  1129. */
  1130. var ChangeEventPlugin = {
  1131. eventTypes: eventTypes,
  1132. _allowSimulatedPassThrough: true,
  1133. _isInputEventSupported: isInputEventSupported,
  1134. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  1135. var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
  1136. var getTargetInstFunc, handleEventFunc;
  1137. if (shouldUseChangeEvent(targetNode)) {
  1138. if (doesChangeEventBubble) {
  1139. getTargetInstFunc = getTargetInstForChangeEvent;
  1140. } else {
  1141. handleEventFunc = handleEventsForChangeEventIE8;
  1142. }
  1143. } else if (isTextInputElement(targetNode)) {
  1144. if (isInputEventSupported) {
  1145. getTargetInstFunc = getTargetInstForInputOrChangeEvent;
  1146. } else {
  1147. getTargetInstFunc = getTargetInstForInputEventPolyfill;
  1148. handleEventFunc = handleEventsForInputEventPolyfill;
  1149. }
  1150. } else if (shouldUseClickEvent(targetNode)) {
  1151. getTargetInstFunc = getTargetInstForClickEvent;
  1152. }
  1153. if (getTargetInstFunc) {
  1154. var inst = getTargetInstFunc(topLevelType, targetInst, nativeEvent);
  1155. if (inst) {
  1156. var event = createAndAccumulateChangeEvent(inst, nativeEvent, nativeEventTarget);
  1157. return event;
  1158. }
  1159. }
  1160. if (handleEventFunc) {
  1161. handleEventFunc(topLevelType, targetNode, targetInst);
  1162. }
  1163. // When blurring, set the value attribute for number inputs
  1164. if (topLevelType === 'topBlur') {
  1165. handleControlledInputBlur(targetInst, targetNode);
  1166. }
  1167. }
  1168. };
  1169. module.exports = ChangeEventPlugin;
  1170. },{"114":114,"120":120,"122":122,"123":123,"138":138,"17":17,"20":20,"34":34,"82":82,"91":91}],8:[function(_dereq_,module,exports){
  1171. /**
  1172. * Copyright 2013-present, Facebook, Inc.
  1173. * All rights reserved.
  1174. *
  1175. * This source code is licensed under the BSD-style license found in the
  1176. * LICENSE file in the root directory of this source tree. An additional grant
  1177. * of patent rights can be found in the PATENTS file in the same directory.
  1178. *
  1179. */
  1180. 'use strict';
  1181. var DOMLazyTree = _dereq_(9);
  1182. var Danger = _dereq_(13);
  1183. var ReactDOMComponentTree = _dereq_(34);
  1184. var ReactInstrumentation = _dereq_(64);
  1185. var createMicrosoftUnsafeLocalFunction = _dereq_(105);
  1186. var setInnerHTML = _dereq_(128);
  1187. var setTextContent = _dereq_(129);
  1188. function getNodeAfter(parentNode, node) {
  1189. // Special case for text components, which return [open, close] comments
  1190. // from getHostNode.
  1191. if (Array.isArray(node)) {
  1192. node = node[1];
  1193. }
  1194. return node ? node.nextSibling : parentNode.firstChild;
  1195. }
  1196. /**
  1197. * Inserts `childNode` as a child of `parentNode` at the `index`.
  1198. *
  1199. * @param {DOMElement} parentNode Parent node in which to insert.
  1200. * @param {DOMElement} childNode Child node to insert.
  1201. * @param {number} index Index at which to insert the child.
  1202. * @internal
  1203. */
  1204. var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) {
  1205. // We rely exclusively on `insertBefore(node, null)` instead of also using
  1206. // `appendChild(node)`. (Using `undefined` is not allowed by all browsers so
  1207. // we are careful to use `null`.)
  1208. parentNode.insertBefore(childNode, referenceNode);
  1209. });
  1210. function insertLazyTreeChildAt(parentNode, childTree, referenceNode) {
  1211. DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode);
  1212. }
  1213. function moveChild(parentNode, childNode, referenceNode) {
  1214. if (Array.isArray(childNode)) {
  1215. moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode);
  1216. } else {
  1217. insertChildAt(parentNode, childNode, referenceNode);
  1218. }
  1219. }
  1220. function removeChild(parentNode, childNode) {
  1221. if (Array.isArray(childNode)) {
  1222. var closingComment = childNode[1];
  1223. childNode = childNode[0];
  1224. removeDelimitedText(parentNode, childNode, closingComment);
  1225. parentNode.removeChild(closingComment);
  1226. }
  1227. parentNode.removeChild(childNode);
  1228. }
  1229. function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) {
  1230. var node = openingComment;
  1231. while (true) {
  1232. var nextNode = node.nextSibling;
  1233. insertChildAt(parentNode, node, referenceNode);
  1234. if (node === closingComment) {
  1235. break;
  1236. }
  1237. node = nextNode;
  1238. }
  1239. }
  1240. function removeDelimitedText(parentNode, startNode, closingComment) {
  1241. while (true) {
  1242. var node = startNode.nextSibling;
  1243. if (node === closingComment) {
  1244. // The closing comment is removed by ReactMultiChild.
  1245. break;
  1246. } else {
  1247. parentNode.removeChild(node);
  1248. }
  1249. }
  1250. }
  1251. function replaceDelimitedText(openingComment, closingComment, stringText) {
  1252. var parentNode = openingComment.parentNode;
  1253. var nodeAfterComment = openingComment.nextSibling;
  1254. if (nodeAfterComment === closingComment) {
  1255. // There are no text nodes between the opening and closing comments; insert
  1256. // a new one if stringText isn't empty.
  1257. if (stringText) {
  1258. insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment);
  1259. }
  1260. } else {
  1261. if (stringText) {
  1262. // Set the text content of the first node after the opening comment, and
  1263. // remove all following nodes up until the closing comment.
  1264. setTextContent(nodeAfterComment, stringText);
  1265. removeDelimitedText(parentNode, nodeAfterComment, closingComment);
  1266. } else {
  1267. removeDelimitedText(parentNode, openingComment, closingComment);
  1268. }
  1269. }
  1270. if ("development" !== 'production') {
  1271. ReactInstrumentation.debugTool.onHostOperation({
  1272. instanceID: ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID,
  1273. type: 'replace text',
  1274. payload: stringText
  1275. });
  1276. }
  1277. }
  1278. var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup;
  1279. if ("development" !== 'production') {
  1280. dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) {
  1281. Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup);
  1282. if (prevInstance._debugID !== 0) {
  1283. ReactInstrumentation.debugTool.onHostOperation({
  1284. instanceID: prevInstance._debugID,
  1285. type: 'replace with',
  1286. payload: markup.toString()
  1287. });
  1288. } else {
  1289. var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node);
  1290. if (nextInstance._debugID !== 0) {
  1291. ReactInstrumentation.debugTool.onHostOperation({
  1292. instanceID: nextInstance._debugID,
  1293. type: 'mount',
  1294. payload: markup.toString()
  1295. });
  1296. }
  1297. }
  1298. };
  1299. }
  1300. /**
  1301. * Operations for updating with DOM children.
  1302. */
  1303. var DOMChildrenOperations = {
  1304. dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup,
  1305. replaceDelimitedText: replaceDelimitedText,
  1306. /**
  1307. * Updates a component's children by processing a series of updates. The
  1308. * update configurations are each expected to have a `parentNode` property.
  1309. *
  1310. * @param {array<object>} updates List of update configurations.
  1311. * @internal
  1312. */
  1313. processUpdates: function (parentNode, updates) {
  1314. if ("development" !== 'production') {
  1315. var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID;
  1316. }
  1317. for (var k = 0; k < updates.length; k++) {
  1318. var update = updates[k];
  1319. switch (update.type) {
  1320. case 'INSERT_MARKUP':
  1321. insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode));
  1322. if ("development" !== 'production') {
  1323. ReactInstrumentation.debugTool.onHostOperation({
  1324. instanceID: parentNodeDebugID,
  1325. type: 'insert child',
  1326. payload: {
  1327. toIndex: update.toIndex,
  1328. content: update.content.toString()
  1329. }
  1330. });
  1331. }
  1332. break;
  1333. case 'MOVE_EXISTING':
  1334. moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode));
  1335. if ("development" !== 'production') {
  1336. ReactInstrumentation.debugTool.onHostOperation({
  1337. instanceID: parentNodeDebugID,
  1338. type: 'move child',
  1339. payload: { fromIndex: update.fromIndex, toIndex: update.toIndex }
  1340. });
  1341. }
  1342. break;
  1343. case 'SET_MARKUP':
  1344. setInnerHTML(parentNode, update.content);
  1345. if ("development" !== 'production') {
  1346. ReactInstrumentation.debugTool.onHostOperation({
  1347. instanceID: parentNodeDebugID,
  1348. type: 'replace children',
  1349. payload: update.content.toString()
  1350. });
  1351. }
  1352. break;
  1353. case 'TEXT_CONTENT':
  1354. setTextContent(parentNode, update.content);
  1355. if ("development" !== 'production') {
  1356. ReactInstrumentation.debugTool.onHostOperation({
  1357. instanceID: parentNodeDebugID,
  1358. type: 'replace text',
  1359. payload: update.content.toString()
  1360. });
  1361. }
  1362. break;
  1363. case 'REMOVE_NODE':
  1364. removeChild(parentNode, update.fromNode);
  1365. if ("development" !== 'production') {
  1366. ReactInstrumentation.debugTool.onHostOperation({
  1367. instanceID: parentNodeDebugID,
  1368. type: 'remove child',
  1369. payload: { fromIndex: update.fromIndex }
  1370. });
  1371. }
  1372. break;
  1373. }
  1374. }
  1375. }
  1376. };
  1377. module.exports = DOMChildrenOperations;
  1378. },{"105":105,"128":128,"129":129,"13":13,"34":34,"64":64,"9":9}],9:[function(_dereq_,module,exports){
  1379. /**
  1380. * Copyright 2015-present, Facebook, Inc.
  1381. * All rights reserved.
  1382. *
  1383. * This source code is licensed under the BSD-style license found in the
  1384. * LICENSE file in the root directory of this source tree. An additional grant
  1385. * of patent rights can be found in the PATENTS file in the same directory.
  1386. *
  1387. */
  1388. 'use strict';
  1389. var DOMNamespaces = _dereq_(10);
  1390. var setInnerHTML = _dereq_(128);
  1391. var createMicrosoftUnsafeLocalFunction = _dereq_(105);
  1392. var setTextContent = _dereq_(129);
  1393. var ELEMENT_NODE_TYPE = 1;
  1394. var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
  1395. /**
  1396. * In IE (8-11) and Edge, appending nodes with no children is dramatically
  1397. * faster than appending a full subtree, so we essentially queue up the
  1398. * .appendChild calls here and apply them so each node is added to its parent
  1399. * before any children are added.
  1400. *
  1401. * In other browsers, doing so is slower or neutral compared to the other order
  1402. * (in Firefox, twice as slow) so we only do this inversion in IE.
  1403. *
  1404. * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode.
  1405. */
  1406. var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent);
  1407. function insertTreeChildren(tree) {
  1408. if (!enableLazy) {
  1409. return;
  1410. }
  1411. var node = tree.node;
  1412. var children = tree.children;
  1413. if (children.length) {
  1414. for (var i = 0; i < children.length; i++) {
  1415. insertTreeBefore(node, children[i], null);
  1416. }
  1417. } else if (tree.html != null) {
  1418. setInnerHTML(node, tree.html);
  1419. } else if (tree.text != null) {
  1420. setTextContent(node, tree.text);
  1421. }
  1422. }
  1423. var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) {
  1424. // DocumentFragments aren't actually part of the DOM after insertion so
  1425. // appending children won't update the DOM. We need to ensure the fragment
  1426. // is properly populated first, breaking out of our lazy approach for just
  1427. // this level. Also, some <object> plugins (like Flash Player) will read
  1428. // <param> nodes immediately upon insertion into the DOM, so <object>
  1429. // must also be populated prior to insertion into the DOM.
  1430. if (tree.node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE || tree.node.nodeType === ELEMENT_NODE_TYPE && tree.node.nodeName.toLowerCase() === 'object' && (tree.node.namespaceURI == null || tree.node.namespaceURI === DOMNamespaces.html)) {
  1431. insertTreeChildren(tree);
  1432. parentNode.insertBefore(tree.node, referenceNode);
  1433. } else {
  1434. parentNode.insertBefore(tree.node, referenceNode);
  1435. insertTreeChildren(tree);
  1436. }
  1437. });
  1438. function replaceChildWithTree(oldNode, newTree) {
  1439. oldNode.parentNode.replaceChild(newTree.node, oldNode);
  1440. insertTreeChildren(newTree);
  1441. }
  1442. function queueChild(parentTree, childTree) {
  1443. if (enableLazy) {
  1444. parentTree.children.push(childTree);
  1445. } else {
  1446. parentTree.node.appendChild(childTree.node);
  1447. }
  1448. }
  1449. function queueHTML(tree, html) {
  1450. if (enableLazy) {
  1451. tree.html = html;
  1452. } else {
  1453. setInnerHTML(tree.node, html);
  1454. }
  1455. }
  1456. function queueText(tree, text) {
  1457. if (enableLazy) {
  1458. tree.text = text;
  1459. } else {
  1460. setTextContent(tree.node, text);
  1461. }
  1462. }
  1463. function toString() {
  1464. return this.node.nodeName;
  1465. }
  1466. function DOMLazyTree(node) {
  1467. return {
  1468. node: node,
  1469. children: [],
  1470. html: null,
  1471. text: null,
  1472. toString: toString
  1473. };
  1474. }
  1475. DOMLazyTree.insertTreeBefore = insertTreeBefore;
  1476. DOMLazyTree.replaceChildWithTree = replaceChildWithTree;
  1477. DOMLazyTree.queueChild = queueChild;
  1478. DOMLazyTree.queueHTML = queueHTML;
  1479. DOMLazyTree.queueText = queueText;
  1480. module.exports = DOMLazyTree;
  1481. },{"10":10,"105":105,"128":128,"129":129}],10:[function(_dereq_,module,exports){
  1482. /**
  1483. * Copyright 2013-present, Facebook, Inc.
  1484. * All rights reserved.
  1485. *
  1486. * This source code is licensed under the BSD-style license found in the
  1487. * LICENSE file in the root directory of this source tree. An additional grant
  1488. * of patent rights can be found in the PATENTS file in the same directory.
  1489. *
  1490. */
  1491. 'use strict';
  1492. var DOMNamespaces = {
  1493. html: 'http://www.w3.org/1999/xhtml',
  1494. mathml: 'http://www.w3.org/1998/Math/MathML',
  1495. svg: 'http://www.w3.org/2000/svg'
  1496. };
  1497. module.exports = DOMNamespaces;
  1498. },{}],11:[function(_dereq_,module,exports){
  1499. /**
  1500. * Copyright 2013-present, Facebook, Inc.
  1501. * All rights reserved.
  1502. *
  1503. * This source code is licensed under the BSD-style license found in the
  1504. * LICENSE file in the root directory of this source tree. An additional grant
  1505. * of patent rights can be found in the PATENTS file in the same directory.
  1506. *
  1507. */
  1508. 'use strict';
  1509. var _prodInvariant = _dereq_(126);
  1510. var invariant = _dereq_(152);
  1511. function checkMask(value, bitmask) {
  1512. return (value & bitmask) === bitmask;
  1513. }
  1514. var DOMPropertyInjection = {
  1515. /**
  1516. * Mapping from normalized, camelcased property names to a configuration that
  1517. * specifies how the associated DOM property should be accessed or rendered.
  1518. */
  1519. MUST_USE_PROPERTY: 0x1,
  1520. HAS_BOOLEAN_VALUE: 0x4,
  1521. HAS_NUMERIC_VALUE: 0x8,
  1522. HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,
  1523. HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,
  1524. /**
  1525. * Inject some specialized knowledge about the DOM. This takes a config object
  1526. * with the following properties:
  1527. *
  1528. * isCustomAttribute: function that given an attribute name will return true
  1529. * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
  1530. * attributes where it's impossible to enumerate all of the possible
  1531. * attribute names,
  1532. *
  1533. * Properties: object mapping DOM property name to one of the
  1534. * DOMPropertyInjection constants or null. If your attribute isn't in here,
  1535. * it won't get written to the DOM.
  1536. *
  1537. * DOMAttributeNames: object mapping React attribute name to the DOM
  1538. * attribute name. Attribute names not specified use the **lowercase**
  1539. * normalized name.
  1540. *
  1541. * DOMAttributeNamespaces: object mapping React attribute name to the DOM
  1542. * attribute namespace URL. (Attribute names not specified use no namespace.)
  1543. *
  1544. * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
  1545. * Property names not specified use the normalized name.
  1546. *
  1547. * DOMMutationMethods: Properties that require special mutation methods. If
  1548. * `value` is undefined, the mutation method should unset the property.
  1549. *
  1550. * @param {object} domPropertyConfig the config as described above.
  1551. */
  1552. injectDOMPropertyConfig: function (domPropertyConfig) {
  1553. var Injection = DOMPropertyInjection;
  1554. var Properties = domPropertyConfig.Properties || {};
  1555. var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
  1556. var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
  1557. var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
  1558. var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
  1559. if (domPropertyConfig.isCustomAttribute) {
  1560. DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
  1561. }
  1562. for (var propName in Properties) {
  1563. !!DOMProperty.properties.hasOwnProperty(propName) ? "development" !== '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) : _prodInvariant('48', propName) : void 0;
  1564. var lowerCased = propName.toLowerCase();
  1565. var propConfig = Properties[propName];
  1566. var propertyInfo = {
  1567. attributeName: lowerCased,
  1568. attributeNamespace: null,
  1569. propertyName: propName,
  1570. mutationMethod: null,
  1571. mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
  1572. hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
  1573. hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
  1574. hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
  1575. hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
  1576. };
  1577. !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : _prodInvariant('50', propName) : void 0;
  1578. if ("development" !== 'production') {
  1579. DOMProperty.getPossibleStandardName[lowerCased] = propName;
  1580. }
  1581. if (DOMAttributeNames.hasOwnProperty(propName)) {
  1582. var attributeName = DOMAttributeNames[propName];
  1583. propertyInfo.attributeName = attributeName;
  1584. if ("development" !== 'production') {
  1585. DOMProperty.getPossibleStandardName[attributeName] = propName;
  1586. }
  1587. }
  1588. if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
  1589. propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
  1590. }
  1591. if (DOMPropertyNames.hasOwnProperty(propName)) {
  1592. propertyInfo.propertyName = DOMPropertyNames[propName];
  1593. }
  1594. if (DOMMutationMethods.hasOwnProperty(propName)) {
  1595. propertyInfo.mutationMethod = DOMMutationMethods[propName];
  1596. }
  1597. DOMProperty.properties[propName] = propertyInfo;
  1598. }
  1599. }
  1600. };
  1601. /* eslint-disable max-len */
  1602. var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
  1603. /* eslint-enable max-len */
  1604. /**
  1605. * DOMProperty exports lookup objects that can be used like functions:
  1606. *
  1607. * > DOMProperty.isValid['id']
  1608. * true
  1609. * > DOMProperty.isValid['foobar']
  1610. * undefined
  1611. *
  1612. * Although this may be confusing, it performs better in general.
  1613. *
  1614. * @see http://jsperf.com/key-exists
  1615. * @see http://jsperf.com/key-missing
  1616. */
  1617. var DOMProperty = {
  1618. ID_ATTRIBUTE_NAME: 'data-reactid',
  1619. ROOT_ATTRIBUTE_NAME: 'data-reactroot',
  1620. ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,
  1621. ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040',
  1622. /**
  1623. * Map from property "standard name" to an object with info about how to set
  1624. * the property in the DOM. Each object contains:
  1625. *
  1626. * attributeName:
  1627. * Used when rendering markup or with `*Attribute()`.
  1628. * attributeNamespace
  1629. * propertyName:
  1630. * Used on DOM node instances. (This includes properties that mutate due to
  1631. * external factors.)
  1632. * mutationMethod:
  1633. * If non-null, used instead of the property or `setAttribute()` after
  1634. * initial render.
  1635. * mustUseProperty:
  1636. * Whether the property must be accessed and mutated as an object property.
  1637. * hasBooleanValue:
  1638. * Whether the property should be removed when set to a falsey value.
  1639. * hasNumericValue:
  1640. * Whether the property must be numeric or parse as a numeric and should be
  1641. * removed when set to a falsey value.
  1642. * hasPositiveNumericValue:
  1643. * Whether the property must be positive numeric or parse as a positive
  1644. * numeric and should be removed when set to a falsey value.
  1645. * hasOverloadedBooleanValue:
  1646. * Whether the property can be used as a flag as well as with a value.
  1647. * Removed when strictly equal to false; present without a value when
  1648. * strictly equal to true; present with a value otherwise.
  1649. */
  1650. properties: {},
  1651. /**
  1652. * Mapping from lowercase property names to the properly cased version, used
  1653. * to warn in the case of missing properties. Available only in __DEV__.
  1654. *
  1655. * autofocus is predefined, because adding it to the property whitelist
  1656. * causes unintended side effects.
  1657. *
  1658. * @type {Object}
  1659. */
  1660. getPossibleStandardName: "development" !== 'production' ? { autofocus: 'autoFocus' } : null,
  1661. /**
  1662. * All of the isCustomAttribute() functions that have been injected.
  1663. */
  1664. _isCustomAttributeFunctions: [],
  1665. /**
  1666. * Checks whether a property name is a custom attribute.
  1667. * @method
  1668. */
  1669. isCustomAttribute: function (attributeName) {
  1670. for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
  1671. var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
  1672. if (isCustomAttributeFn(attributeName)) {
  1673. return true;
  1674. }
  1675. }
  1676. return false;
  1677. },
  1678. injection: DOMPropertyInjection
  1679. };
  1680. module.exports = DOMProperty;
  1681. },{"126":126,"152":152}],12:[function(_dereq_,module,exports){
  1682. /**
  1683. * Copyright 2013-present, Facebook, Inc.
  1684. * All rights reserved.
  1685. *
  1686. * This source code is licensed under the BSD-style license found in the
  1687. * LICENSE file in the root directory of this source tree. An additional grant
  1688. * of patent rights can be found in the PATENTS file in the same directory.
  1689. *
  1690. */
  1691. 'use strict';
  1692. var DOMProperty = _dereq_(11);
  1693. var ReactDOMComponentTree = _dereq_(34);
  1694. var ReactInstrumentation = _dereq_(64);
  1695. var quoteAttributeValueForBrowser = _dereq_(125);
  1696. var warning = _dereq_(159);
  1697. var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$');
  1698. var illegalAttributeNameCache = {};
  1699. var validatedAttributeNameCache = {};
  1700. function isAttributeNameSafe(attributeName) {
  1701. if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
  1702. return true;
  1703. }
  1704. if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
  1705. return false;
  1706. }
  1707. if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
  1708. validatedAttributeNameCache[attributeName] = true;
  1709. return true;
  1710. }
  1711. illegalAttributeNameCache[attributeName] = true;
  1712. "development" !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0;
  1713. return false;
  1714. }
  1715. function shouldIgnoreValue(propertyInfo, value) {
  1716. return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
  1717. }
  1718. /**
  1719. * Operations for dealing with DOM properties.
  1720. */
  1721. var DOMPropertyOperations = {
  1722. /**
  1723. * Creates markup for the ID property.
  1724. *
  1725. * @param {string} id Unescaped ID.
  1726. * @return {string} Markup string.
  1727. */
  1728. createMarkupForID: function (id) {
  1729. return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
  1730. },
  1731. setAttributeForID: function (node, id) {
  1732. node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
  1733. },
  1734. createMarkupForRoot: function () {
  1735. return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""';
  1736. },
  1737. setAttributeForRoot: function (node) {
  1738. node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, '');
  1739. },
  1740. /**
  1741. * Creates markup for a property.
  1742. *
  1743. * @param {string} name
  1744. * @param {*} value
  1745. * @return {?string} Markup string, or null if the property was invalid.
  1746. */
  1747. createMarkupForProperty: function (name, value) {
  1748. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  1749. if (propertyInfo) {
  1750. if (shouldIgnoreValue(propertyInfo, value)) {
  1751. return '';
  1752. }
  1753. var attributeName = propertyInfo.attributeName;
  1754. if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
  1755. return attributeName + '=""';
  1756. }
  1757. return attributeName + '=' + quoteAttributeValueForBrowser(value);
  1758. } else if (DOMProperty.isCustomAttribute(name)) {
  1759. if (value == null) {
  1760. return '';
  1761. }
  1762. return name + '=' + quoteAttributeValueForBrowser(value);
  1763. }
  1764. return null;
  1765. },
  1766. /**
  1767. * Creates markup for a custom property.
  1768. *
  1769. * @param {string} name
  1770. * @param {*} value
  1771. * @return {string} Markup string, or empty string if the property was invalid.
  1772. */
  1773. createMarkupForCustomAttribute: function (name, value) {
  1774. if (!isAttributeNameSafe(name) || value == null) {
  1775. return '';
  1776. }
  1777. return name + '=' + quoteAttributeValueForBrowser(value);
  1778. },
  1779. /**
  1780. * Sets the value for a property on a node.
  1781. *
  1782. * @param {DOMElement} node
  1783. * @param {string} name
  1784. * @param {*} value
  1785. */
  1786. setValueForProperty: function (node, name, value) {
  1787. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  1788. if (propertyInfo) {
  1789. var mutationMethod = propertyInfo.mutationMethod;
  1790. if (mutationMethod) {
  1791. mutationMethod(node, value);
  1792. } else if (shouldIgnoreValue(propertyInfo, value)) {
  1793. this.deleteValueForProperty(node, name);
  1794. return;
  1795. } else if (propertyInfo.mustUseProperty) {
  1796. // Contrary to `setAttribute`, object properties are properly
  1797. // `toString`ed by IE8/9.
  1798. node[propertyInfo.propertyName] = value;
  1799. } else {
  1800. var attributeName = propertyInfo.attributeName;
  1801. var namespace = propertyInfo.attributeNamespace;
  1802. // `setAttribute` with objects becomes only `[object]` in IE8/9,
  1803. // ('' + value) makes it output the correct toString()-value.
  1804. if (namespace) {
  1805. node.setAttributeNS(namespace, attributeName, '' + value);
  1806. } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
  1807. node.setAttribute(attributeName, '');
  1808. } else {
  1809. node.setAttribute(attributeName, '' + value);
  1810. }
  1811. }
  1812. } else if (DOMProperty.isCustomAttribute(name)) {
  1813. DOMPropertyOperations.setValueForAttribute(node, name, value);
  1814. return;
  1815. }
  1816. if ("development" !== 'production') {
  1817. var payload = {};
  1818. payload[name] = value;
  1819. ReactInstrumentation.debugTool.onHostOperation({
  1820. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  1821. type: 'update attribute',
  1822. payload: payload
  1823. });
  1824. }
  1825. },
  1826. setValueForAttribute: function (node, name, value) {
  1827. if (!isAttributeNameSafe(name)) {
  1828. return;
  1829. }
  1830. if (value == null) {
  1831. node.removeAttribute(name);
  1832. } else {
  1833. node.setAttribute(name, '' + value);
  1834. }
  1835. if ("development" !== 'production') {
  1836. var payload = {};
  1837. payload[name] = value;
  1838. ReactInstrumentation.debugTool.onHostOperation({
  1839. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  1840. type: 'update attribute',
  1841. payload: payload
  1842. });
  1843. }
  1844. },
  1845. /**
  1846. * Deletes an attributes from a node.
  1847. *
  1848. * @param {DOMElement} node
  1849. * @param {string} name
  1850. */
  1851. deleteValueForAttribute: function (node, name) {
  1852. node.removeAttribute(name);
  1853. if ("development" !== 'production') {
  1854. ReactInstrumentation.debugTool.onHostOperation({
  1855. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  1856. type: 'remove attribute',
  1857. payload: name
  1858. });
  1859. }
  1860. },
  1861. /**
  1862. * Deletes the value for a property on a node.
  1863. *
  1864. * @param {DOMElement} node
  1865. * @param {string} name
  1866. */
  1867. deleteValueForProperty: function (node, name) {
  1868. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  1869. if (propertyInfo) {
  1870. var mutationMethod = propertyInfo.mutationMethod;
  1871. if (mutationMethod) {
  1872. mutationMethod(node, undefined);
  1873. } else if (propertyInfo.mustUseProperty) {
  1874. var propName = propertyInfo.propertyName;
  1875. if (propertyInfo.hasBooleanValue) {
  1876. node[propName] = false;
  1877. } else {
  1878. node[propName] = '';
  1879. }
  1880. } else {
  1881. node.removeAttribute(propertyInfo.attributeName);
  1882. }
  1883. } else if (DOMProperty.isCustomAttribute(name)) {
  1884. node.removeAttribute(name);
  1885. }
  1886. if ("development" !== 'production') {
  1887. ReactInstrumentation.debugTool.onHostOperation({
  1888. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  1889. type: 'remove attribute',
  1890. payload: name
  1891. });
  1892. }
  1893. }
  1894. };
  1895. module.exports = DOMPropertyOperations;
  1896. },{"11":11,"125":125,"159":159,"34":34,"64":64}],13:[function(_dereq_,module,exports){
  1897. /**
  1898. * Copyright 2013-present, Facebook, Inc.
  1899. * All rights reserved.
  1900. *
  1901. * This source code is licensed under the BSD-style license found in the
  1902. * LICENSE file in the root directory of this source tree. An additional grant
  1903. * of patent rights can be found in the PATENTS file in the same directory.
  1904. *
  1905. */
  1906. 'use strict';
  1907. var _prodInvariant = _dereq_(126);
  1908. var DOMLazyTree = _dereq_(9);
  1909. var ExecutionEnvironment = _dereq_(138);
  1910. var createNodesFromMarkup = _dereq_(143);
  1911. var emptyFunction = _dereq_(144);
  1912. var invariant = _dereq_(152);
  1913. var Danger = {
  1914. /**
  1915. * Replaces a node with a string of markup at its current position within its
  1916. * parent. The markup must render into a single root node.
  1917. *
  1918. * @param {DOMElement} oldChild Child node to replace.
  1919. * @param {string} markup Markup to render in place of the child node.
  1920. * @internal
  1921. */
  1922. dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
  1923. !ExecutionEnvironment.canUseDOM ? "development" !== '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.') : _prodInvariant('56') : void 0;
  1924. !markup ? "development" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : _prodInvariant('57') : void 0;
  1925. !(oldChild.nodeName !== 'HTML') ? "development" !== '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().') : _prodInvariant('58') : void 0;
  1926. if (typeof markup === 'string') {
  1927. var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
  1928. oldChild.parentNode.replaceChild(newChild, oldChild);
  1929. } else {
  1930. DOMLazyTree.replaceChildWithTree(oldChild, markup);
  1931. }
  1932. }
  1933. };
  1934. module.exports = Danger;
  1935. },{"126":126,"138":138,"143":143,"144":144,"152":152,"9":9}],14:[function(_dereq_,module,exports){
  1936. /**
  1937. * Copyright 2013-present, Facebook, Inc.
  1938. * All rights reserved.
  1939. *
  1940. * This source code is licensed under the BSD-style license found in the
  1941. * LICENSE file in the root directory of this source tree. An additional grant
  1942. * of patent rights can be found in the PATENTS file in the same directory.
  1943. *
  1944. */
  1945. 'use strict';
  1946. /**
  1947. * Module that is injectable into `EventPluginHub`, that specifies a
  1948. * deterministic ordering of `EventPlugin`s. A convenient way to reason about
  1949. * plugins, without having to package every one of them. This is better than
  1950. * having plugins be ordered in the same order that they are injected because
  1951. * that ordering would be influenced by the packaging order.
  1952. * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
  1953. * preventing default on events is convenient in `SimpleEventPlugin` handlers.
  1954. */
  1955. var DefaultEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
  1956. module.exports = DefaultEventPluginOrder;
  1957. },{}],15:[function(_dereq_,module,exports){
  1958. /**
  1959. * Copyright 2013-present, Facebook, Inc.
  1960. * All rights reserved.
  1961. *
  1962. * This source code is licensed under the BSD-style license found in the
  1963. * LICENSE file in the root directory of this source tree. An additional grant
  1964. * of patent rights can be found in the PATENTS file in the same directory.
  1965. *
  1966. */
  1967. 'use strict';
  1968. var EventPropagators = _dereq_(20);
  1969. var ReactDOMComponentTree = _dereq_(34);
  1970. var SyntheticMouseEvent = _dereq_(95);
  1971. var eventTypes = {
  1972. mouseEnter: {
  1973. registrationName: 'onMouseEnter',
  1974. dependencies: ['topMouseOut', 'topMouseOver']
  1975. },
  1976. mouseLeave: {
  1977. registrationName: 'onMouseLeave',
  1978. dependencies: ['topMouseOut', 'topMouseOver']
  1979. }
  1980. };
  1981. var EnterLeaveEventPlugin = {
  1982. eventTypes: eventTypes,
  1983. /**
  1984. * For almost every interaction we care about, there will be both a top-level
  1985. * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
  1986. * we do not extract duplicate events. However, moving the mouse into the
  1987. * browser from outside will not fire a `mouseout` event. In this case, we use
  1988. * the `mouseover` top-level event.
  1989. */
  1990. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  1991. if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
  1992. return null;
  1993. }
  1994. if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') {
  1995. // Must not be a mouse in or mouse out - ignoring.
  1996. return null;
  1997. }
  1998. var win;
  1999. if (nativeEventTarget.window === nativeEventTarget) {
  2000. // `nativeEventTarget` is probably a window object.
  2001. win = nativeEventTarget;
  2002. } else {
  2003. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  2004. var doc = nativeEventTarget.ownerDocument;
  2005. if (doc) {
  2006. win = doc.defaultView || doc.parentWindow;
  2007. } else {
  2008. win = window;
  2009. }
  2010. }
  2011. var from;
  2012. var to;
  2013. if (topLevelType === 'topMouseOut') {
  2014. from = targetInst;
  2015. var related = nativeEvent.relatedTarget || nativeEvent.toElement;
  2016. to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null;
  2017. } else {
  2018. // Moving to a node from outside the window.
  2019. from = null;
  2020. to = targetInst;
  2021. }
  2022. if (from === to) {
  2023. // Nothing pertains to our managed components.
  2024. return null;
  2025. }
  2026. var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from);
  2027. var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to);
  2028. var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget);
  2029. leave.type = 'mouseleave';
  2030. leave.target = fromNode;
  2031. leave.relatedTarget = toNode;
  2032. var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget);
  2033. enter.type = 'mouseenter';
  2034. enter.target = toNode;
  2035. enter.relatedTarget = fromNode;
  2036. EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to);
  2037. return [leave, enter];
  2038. }
  2039. };
  2040. module.exports = EnterLeaveEventPlugin;
  2041. },{"20":20,"34":34,"95":95}],16:[function(_dereq_,module,exports){
  2042. /**
  2043. * Copyright 2013-present, Facebook, Inc.
  2044. * All rights reserved.
  2045. *
  2046. * This source code is licensed under the BSD-style license found in the
  2047. * LICENSE file in the root directory of this source tree. An additional grant
  2048. * of patent rights can be found in the PATENTS file in the same directory.
  2049. *
  2050. */
  2051. 'use strict';
  2052. /**
  2053. * Types of raw signals from the browser caught at the top level.
  2054. */
  2055. var topLevelTypes = {
  2056. topAbort: null,
  2057. topAnimationEnd: null,
  2058. topAnimationIteration: null,
  2059. topAnimationStart: null,
  2060. topBlur: null,
  2061. topCanPlay: null,
  2062. topCanPlayThrough: null,
  2063. topChange: null,
  2064. topClick: null,
  2065. topCompositionEnd: null,
  2066. topCompositionStart: null,
  2067. topCompositionUpdate: null,
  2068. topContextMenu: null,
  2069. topCopy: null,
  2070. topCut: null,
  2071. topDoubleClick: null,
  2072. topDrag: null,
  2073. topDragEnd: null,
  2074. topDragEnter: null,
  2075. topDragExit: null,
  2076. topDragLeave: null,
  2077. topDragOver: null,
  2078. topDragStart: null,
  2079. topDrop: null,
  2080. topDurationChange: null,
  2081. topEmptied: null,
  2082. topEncrypted: null,
  2083. topEnded: null,
  2084. topError: null,
  2085. topFocus: null,
  2086. topInput: null,
  2087. topInvalid: null,
  2088. topKeyDown: null,
  2089. topKeyPress: null,
  2090. topKeyUp: null,
  2091. topLoad: null,
  2092. topLoadedData: null,
  2093. topLoadedMetadata: null,
  2094. topLoadStart: null,
  2095. topMouseDown: null,
  2096. topMouseMove: null,
  2097. topMouseOut: null,
  2098. topMouseOver: null,
  2099. topMouseUp: null,
  2100. topPaste: null,
  2101. topPause: null,
  2102. topPlay: null,
  2103. topPlaying: null,
  2104. topProgress: null,
  2105. topRateChange: null,
  2106. topReset: null,
  2107. topScroll: null,
  2108. topSeeked: null,
  2109. topSeeking: null,
  2110. topSelectionChange: null,
  2111. topStalled: null,
  2112. topSubmit: null,
  2113. topSuspend: null,
  2114. topTextInput: null,
  2115. topTimeUpdate: null,
  2116. topTouchCancel: null,
  2117. topTouchEnd: null,
  2118. topTouchMove: null,
  2119. topTouchStart: null,
  2120. topTransitionEnd: null,
  2121. topVolumeChange: null,
  2122. topWaiting: null,
  2123. topWheel: null
  2124. };
  2125. var EventConstants = {
  2126. topLevelTypes: topLevelTypes
  2127. };
  2128. module.exports = EventConstants;
  2129. },{}],17:[function(_dereq_,module,exports){
  2130. /**
  2131. * Copyright 2013-present, Facebook, Inc.
  2132. * All rights reserved.
  2133. *
  2134. * This source code is licensed under the BSD-style license found in the
  2135. * LICENSE file in the root directory of this source tree. An additional grant
  2136. * of patent rights can be found in the PATENTS file in the same directory.
  2137. *
  2138. */
  2139. 'use strict';
  2140. var _prodInvariant = _dereq_(126);
  2141. var EventPluginRegistry = _dereq_(18);
  2142. var EventPluginUtils = _dereq_(19);
  2143. var ReactErrorUtils = _dereq_(55);
  2144. var accumulateInto = _dereq_(102);
  2145. var forEachAccumulated = _dereq_(110);
  2146. var invariant = _dereq_(152);
  2147. /**
  2148. * Internal store for event listeners
  2149. */
  2150. var listenerBank = {};
  2151. /**
  2152. * Internal queue of events that have accumulated their dispatches and are
  2153. * waiting to have their dispatches executed.
  2154. */
  2155. var eventQueue = null;
  2156. /**
  2157. * Dispatches an event and releases it back into the pool, unless persistent.
  2158. *
  2159. * @param {?object} event Synthetic event to be dispatched.
  2160. * @param {boolean} simulated If the event is simulated (changes exn behavior)
  2161. * @private
  2162. */
  2163. var executeDispatchesAndRelease = function (event, simulated) {
  2164. if (event) {
  2165. EventPluginUtils.executeDispatchesInOrder(event, simulated);
  2166. if (!event.isPersistent()) {
  2167. event.constructor.release(event);
  2168. }
  2169. }
  2170. };
  2171. var executeDispatchesAndReleaseSimulated = function (e) {
  2172. return executeDispatchesAndRelease(e, true);
  2173. };
  2174. var executeDispatchesAndReleaseTopLevel = function (e) {
  2175. return executeDispatchesAndRelease(e, false);
  2176. };
  2177. var getDictionaryKey = function (inst) {
  2178. // Prevents V8 performance issue:
  2179. // https://github.com/facebook/react/pull/7232
  2180. return '.' + inst._rootNodeID;
  2181. };
  2182. function isInteractive(tag) {
  2183. return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
  2184. }
  2185. function shouldPreventMouseEvent(name, type, props) {
  2186. switch (name) {
  2187. case 'onClick':
  2188. case 'onClickCapture':
  2189. case 'onDoubleClick':
  2190. case 'onDoubleClickCapture':
  2191. case 'onMouseDown':
  2192. case 'onMouseDownCapture':
  2193. case 'onMouseMove':
  2194. case 'onMouseMoveCapture':
  2195. case 'onMouseUp':
  2196. case 'onMouseUpCapture':
  2197. return !!(props.disabled && isInteractive(type));
  2198. default:
  2199. return false;
  2200. }
  2201. }
  2202. /**
  2203. * This is a unified interface for event plugins to be installed and configured.
  2204. *
  2205. * Event plugins can implement the following properties:
  2206. *
  2207. * `extractEvents` {function(string, DOMEventTarget, string, object): *}
  2208. * Required. When a top-level event is fired, this method is expected to
  2209. * extract synthetic events that will in turn be queued and dispatched.
  2210. *
  2211. * `eventTypes` {object}
  2212. * Optional, plugins that fire events must publish a mapping of registration
  2213. * names that are used to register listeners. Values of this mapping must
  2214. * be objects that contain `registrationName` or `phasedRegistrationNames`.
  2215. *
  2216. * `executeDispatch` {function(object, function, string)}
  2217. * Optional, allows plugins to override how an event gets dispatched. By
  2218. * default, the listener is simply invoked.
  2219. *
  2220. * Each plugin that is injected into `EventsPluginHub` is immediately operable.
  2221. *
  2222. * @public
  2223. */
  2224. var EventPluginHub = {
  2225. /**
  2226. * Methods for injecting dependencies.
  2227. */
  2228. injection: {
  2229. /**
  2230. * @param {array} InjectedEventPluginOrder
  2231. * @public
  2232. */
  2233. injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
  2234. /**
  2235. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2236. */
  2237. injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
  2238. },
  2239. /**
  2240. * Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent.
  2241. *
  2242. * @param {object} inst The instance, which is the source of events.
  2243. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2244. * @param {function} listener The callback to store.
  2245. */
  2246. putListener: function (inst, registrationName, listener) {
  2247. !(typeof listener === 'function') ? "development" !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : _prodInvariant('94', registrationName, typeof listener) : void 0;
  2248. var key = getDictionaryKey(inst);
  2249. var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
  2250. bankForRegistrationName[key] = listener;
  2251. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2252. if (PluginModule && PluginModule.didPutListener) {
  2253. PluginModule.didPutListener(inst, registrationName, listener);
  2254. }
  2255. },
  2256. /**
  2257. * @param {object} inst The instance, which is the source of events.
  2258. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2259. * @return {?function} The stored callback.
  2260. */
  2261. getListener: function (inst, registrationName) {
  2262. // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
  2263. // live here; needs to be moved to a better place soon
  2264. var bankForRegistrationName = listenerBank[registrationName];
  2265. if (shouldPreventMouseEvent(registrationName, inst._currentElement.type, inst._currentElement.props)) {
  2266. return null;
  2267. }
  2268. var key = getDictionaryKey(inst);
  2269. return bankForRegistrationName && bankForRegistrationName[key];
  2270. },
  2271. /**
  2272. * Deletes a listener from the registration bank.
  2273. *
  2274. * @param {object} inst The instance, which is the source of events.
  2275. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2276. */
  2277. deleteListener: function (inst, registrationName) {
  2278. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2279. if (PluginModule && PluginModule.willDeleteListener) {
  2280. PluginModule.willDeleteListener(inst, registrationName);
  2281. }
  2282. var bankForRegistrationName = listenerBank[registrationName];
  2283. // TODO: This should never be null -- when is it?
  2284. if (bankForRegistrationName) {
  2285. var key = getDictionaryKey(inst);
  2286. delete bankForRegistrationName[key];
  2287. }
  2288. },
  2289. /**
  2290. * Deletes all listeners for the DOM element with the supplied ID.
  2291. *
  2292. * @param {object} inst The instance, which is the source of events.
  2293. */
  2294. deleteAllListeners: function (inst) {
  2295. var key = getDictionaryKey(inst);
  2296. for (var registrationName in listenerBank) {
  2297. if (!listenerBank.hasOwnProperty(registrationName)) {
  2298. continue;
  2299. }
  2300. if (!listenerBank[registrationName][key]) {
  2301. continue;
  2302. }
  2303. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2304. if (PluginModule && PluginModule.willDeleteListener) {
  2305. PluginModule.willDeleteListener(inst, registrationName);
  2306. }
  2307. delete listenerBank[registrationName][key];
  2308. }
  2309. },
  2310. /**
  2311. * Allows registered plugins an opportunity to extract events from top-level
  2312. * native browser events.
  2313. *
  2314. * @return {*} An accumulation of synthetic events.
  2315. * @internal
  2316. */
  2317. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  2318. var events;
  2319. var plugins = EventPluginRegistry.plugins;
  2320. for (var i = 0; i < plugins.length; i++) {
  2321. // Not every plugin in the ordering may be loaded at runtime.
  2322. var possiblePlugin = plugins[i];
  2323. if (possiblePlugin) {
  2324. var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
  2325. if (extractedEvents) {
  2326. events = accumulateInto(events, extractedEvents);
  2327. }
  2328. }
  2329. }
  2330. return events;
  2331. },
  2332. /**
  2333. * Enqueues a synthetic event that should be dispatched when
  2334. * `processEventQueue` is invoked.
  2335. *
  2336. * @param {*} events An accumulation of synthetic events.
  2337. * @internal
  2338. */
  2339. enqueueEvents: function (events) {
  2340. if (events) {
  2341. eventQueue = accumulateInto(eventQueue, events);
  2342. }
  2343. },
  2344. /**
  2345. * Dispatches all synthetic events on the event queue.
  2346. *
  2347. * @internal
  2348. */
  2349. processEventQueue: function (simulated) {
  2350. // Set `eventQueue` to null before processing it so that we can tell if more
  2351. // events get enqueued while processing.
  2352. var processingEventQueue = eventQueue;
  2353. eventQueue = null;
  2354. if (simulated) {
  2355. forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
  2356. } else {
  2357. forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
  2358. }
  2359. !!eventQueue ? "development" !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : _prodInvariant('95') : void 0;
  2360. // This would be a good time to rethrow if any of the event handlers threw.
  2361. ReactErrorUtils.rethrowCaughtError();
  2362. },
  2363. /**
  2364. * These are needed for tests only. Do not use!
  2365. */
  2366. __purge: function () {
  2367. listenerBank = {};
  2368. },
  2369. __getListenerBank: function () {
  2370. return listenerBank;
  2371. }
  2372. };
  2373. module.exports = EventPluginHub;
  2374. },{"102":102,"110":110,"126":126,"152":152,"18":18,"19":19,"55":55}],18:[function(_dereq_,module,exports){
  2375. /**
  2376. * Copyright 2013-present, Facebook, Inc.
  2377. * All rights reserved.
  2378. *
  2379. * This source code is licensed under the BSD-style license found in the
  2380. * LICENSE file in the root directory of this source tree. An additional grant
  2381. * of patent rights can be found in the PATENTS file in the same directory.
  2382. *
  2383. *
  2384. */
  2385. 'use strict';
  2386. var _prodInvariant = _dereq_(126);
  2387. var invariant = _dereq_(152);
  2388. /**
  2389. * Injectable ordering of event plugins.
  2390. */
  2391. var eventPluginOrder = null;
  2392. /**
  2393. * Injectable mapping from names to event plugin modules.
  2394. */
  2395. var namesToPlugins = {};
  2396. /**
  2397. * Recomputes the plugin list using the injected plugins and plugin ordering.
  2398. *
  2399. * @private
  2400. */
  2401. function recomputePluginOrdering() {
  2402. if (!eventPluginOrder) {
  2403. // Wait until an `eventPluginOrder` is injected.
  2404. return;
  2405. }
  2406. for (var pluginName in namesToPlugins) {
  2407. var pluginModule = namesToPlugins[pluginName];
  2408. var pluginIndex = eventPluginOrder.indexOf(pluginName);
  2409. !(pluginIndex > -1) ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : _prodInvariant('96', pluginName) : void 0;
  2410. if (EventPluginRegistry.plugins[pluginIndex]) {
  2411. continue;
  2412. }
  2413. !pluginModule.extractEvents ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : _prodInvariant('97', pluginName) : void 0;
  2414. EventPluginRegistry.plugins[pluginIndex] = pluginModule;
  2415. var publishedEvents = pluginModule.eventTypes;
  2416. for (var eventName in publishedEvents) {
  2417. !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : _prodInvariant('98', eventName, pluginName) : void 0;
  2418. }
  2419. }
  2420. }
  2421. /**
  2422. * Publishes an event so that it can be dispatched by the supplied plugin.
  2423. *
  2424. * @param {object} dispatchConfig Dispatch configuration for the event.
  2425. * @param {object} PluginModule Plugin publishing the event.
  2426. * @return {boolean} True if the event was successfully published.
  2427. * @private
  2428. */
  2429. function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
  2430. !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? "development" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : _prodInvariant('99', eventName) : void 0;
  2431. EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
  2432. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  2433. if (phasedRegistrationNames) {
  2434. for (var phaseName in phasedRegistrationNames) {
  2435. if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
  2436. var phasedRegistrationName = phasedRegistrationNames[phaseName];
  2437. publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
  2438. }
  2439. }
  2440. return true;
  2441. } else if (dispatchConfig.registrationName) {
  2442. publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
  2443. return true;
  2444. }
  2445. return false;
  2446. }
  2447. /**
  2448. * Publishes a registration name that is used to identify dispatched events and
  2449. * can be used with `EventPluginHub.putListener` to register listeners.
  2450. *
  2451. * @param {string} registrationName Registration name to add.
  2452. * @param {object} PluginModule Plugin publishing the event.
  2453. * @private
  2454. */
  2455. function publishRegistrationName(registrationName, pluginModule, eventName) {
  2456. !!EventPluginRegistry.registrationNameModules[registrationName] ? "development" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : _prodInvariant('100', registrationName) : void 0;
  2457. EventPluginRegistry.registrationNameModules[registrationName] = pluginModule;
  2458. EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
  2459. if ("development" !== 'production') {
  2460. var lowerCasedName = registrationName.toLowerCase();
  2461. EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName;
  2462. if (registrationName === 'onDoubleClick') {
  2463. EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName;
  2464. }
  2465. }
  2466. }
  2467. /**
  2468. * Registers plugins so that they can extract and dispatch events.
  2469. *
  2470. * @see {EventPluginHub}
  2471. */
  2472. var EventPluginRegistry = {
  2473. /**
  2474. * Ordered list of injected plugins.
  2475. */
  2476. plugins: [],
  2477. /**
  2478. * Mapping from event name to dispatch config
  2479. */
  2480. eventNameDispatchConfigs: {},
  2481. /**
  2482. * Mapping from registration name to plugin module
  2483. */
  2484. registrationNameModules: {},
  2485. /**
  2486. * Mapping from registration name to event name
  2487. */
  2488. registrationNameDependencies: {},
  2489. /**
  2490. * Mapping from lowercase registration names to the properly cased version,
  2491. * used to warn in the case of missing event handlers. Available
  2492. * only in __DEV__.
  2493. * @type {Object}
  2494. */
  2495. possibleRegistrationNames: "development" !== 'production' ? {} : null,
  2496. // Trust the developer to only use possibleRegistrationNames in __DEV__
  2497. /**
  2498. * Injects an ordering of plugins (by plugin name). This allows the ordering
  2499. * to be decoupled from injection of the actual plugins so that ordering is
  2500. * always deterministic regardless of packaging, on-the-fly injection, etc.
  2501. *
  2502. * @param {array} InjectedEventPluginOrder
  2503. * @internal
  2504. * @see {EventPluginHub.injection.injectEventPluginOrder}
  2505. */
  2506. injectEventPluginOrder: function (injectedEventPluginOrder) {
  2507. !!eventPluginOrder ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : _prodInvariant('101') : void 0;
  2508. // Clone the ordering so it cannot be dynamically mutated.
  2509. eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
  2510. recomputePluginOrdering();
  2511. },
  2512. /**
  2513. * Injects plugins to be used by `EventPluginHub`. The plugin names must be
  2514. * in the ordering injected by `injectEventPluginOrder`.
  2515. *
  2516. * Plugins can be injected as part of page initialization or on-the-fly.
  2517. *
  2518. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2519. * @internal
  2520. * @see {EventPluginHub.injection.injectEventPluginsByName}
  2521. */
  2522. injectEventPluginsByName: function (injectedNamesToPlugins) {
  2523. var isOrderingDirty = false;
  2524. for (var pluginName in injectedNamesToPlugins) {
  2525. if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
  2526. continue;
  2527. }
  2528. var pluginModule = injectedNamesToPlugins[pluginName];
  2529. if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
  2530. !!namesToPlugins[pluginName] ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : _prodInvariant('102', pluginName) : void 0;
  2531. namesToPlugins[pluginName] = pluginModule;
  2532. isOrderingDirty = true;
  2533. }
  2534. }
  2535. if (isOrderingDirty) {
  2536. recomputePluginOrdering();
  2537. }
  2538. },
  2539. /**
  2540. * Looks up the plugin for the supplied event.
  2541. *
  2542. * @param {object} event A synthetic event.
  2543. * @return {?object} The plugin that created the supplied event.
  2544. * @internal
  2545. */
  2546. getPluginModuleForEvent: function (event) {
  2547. var dispatchConfig = event.dispatchConfig;
  2548. if (dispatchConfig.registrationName) {
  2549. return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
  2550. }
  2551. if (dispatchConfig.phasedRegistrationNames !== undefined) {
  2552. // pulling phasedRegistrationNames out of dispatchConfig helps Flow see
  2553. // that it is not undefined.
  2554. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  2555. for (var phase in phasedRegistrationNames) {
  2556. if (!phasedRegistrationNames.hasOwnProperty(phase)) {
  2557. continue;
  2558. }
  2559. var pluginModule = EventPluginRegistry.registrationNameModules[phasedRegistrationNames[phase]];
  2560. if (pluginModule) {
  2561. return pluginModule;
  2562. }
  2563. }
  2564. }
  2565. return null;
  2566. },
  2567. /**
  2568. * Exposed for unit testing.
  2569. * @private
  2570. */
  2571. _resetEventPlugins: function () {
  2572. eventPluginOrder = null;
  2573. for (var pluginName in namesToPlugins) {
  2574. if (namesToPlugins.hasOwnProperty(pluginName)) {
  2575. delete namesToPlugins[pluginName];
  2576. }
  2577. }
  2578. EventPluginRegistry.plugins.length = 0;
  2579. var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
  2580. for (var eventName in eventNameDispatchConfigs) {
  2581. if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
  2582. delete eventNameDispatchConfigs[eventName];
  2583. }
  2584. }
  2585. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  2586. for (var registrationName in registrationNameModules) {
  2587. if (registrationNameModules.hasOwnProperty(registrationName)) {
  2588. delete registrationNameModules[registrationName];
  2589. }
  2590. }
  2591. if ("development" !== 'production') {
  2592. var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames;
  2593. for (var lowerCasedName in possibleRegistrationNames) {
  2594. if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) {
  2595. delete possibleRegistrationNames[lowerCasedName];
  2596. }
  2597. }
  2598. }
  2599. }
  2600. };
  2601. module.exports = EventPluginRegistry;
  2602. },{"126":126,"152":152}],19:[function(_dereq_,module,exports){
  2603. /**
  2604. * Copyright 2013-present, Facebook, Inc.
  2605. * All rights reserved.
  2606. *
  2607. * This source code is licensed under the BSD-style license found in the
  2608. * LICENSE file in the root directory of this source tree. An additional grant
  2609. * of patent rights can be found in the PATENTS file in the same directory.
  2610. *
  2611. */
  2612. 'use strict';
  2613. var _prodInvariant = _dereq_(126);
  2614. var ReactErrorUtils = _dereq_(55);
  2615. var invariant = _dereq_(152);
  2616. var warning = _dereq_(159);
  2617. /**
  2618. * Injected dependencies:
  2619. */
  2620. /**
  2621. * - `ComponentTree`: [required] Module that can convert between React instances
  2622. * and actual node references.
  2623. */
  2624. var ComponentTree;
  2625. var TreeTraversal;
  2626. var injection = {
  2627. injectComponentTree: function (Injected) {
  2628. ComponentTree = Injected;
  2629. if ("development" !== 'production') {
  2630. "development" !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
  2631. }
  2632. },
  2633. injectTreeTraversal: function (Injected) {
  2634. TreeTraversal = Injected;
  2635. if ("development" !== 'production') {
  2636. "development" !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0;
  2637. }
  2638. }
  2639. };
  2640. function isEndish(topLevelType) {
  2641. return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel';
  2642. }
  2643. function isMoveish(topLevelType) {
  2644. return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove';
  2645. }
  2646. function isStartish(topLevelType) {
  2647. return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart';
  2648. }
  2649. var validateEventDispatches;
  2650. if ("development" !== 'production') {
  2651. validateEventDispatches = function (event) {
  2652. var dispatchListeners = event._dispatchListeners;
  2653. var dispatchInstances = event._dispatchInstances;
  2654. var listenersIsArr = Array.isArray(dispatchListeners);
  2655. var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
  2656. var instancesIsArr = Array.isArray(dispatchInstances);
  2657. var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
  2658. "development" !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0;
  2659. };
  2660. }
  2661. /**
  2662. * Dispatch the event to the listener.
  2663. * @param {SyntheticEvent} event SyntheticEvent to handle
  2664. * @param {boolean} simulated If the event is simulated (changes exn behavior)
  2665. * @param {function} listener Application-level callback
  2666. * @param {*} inst Internal component instance
  2667. */
  2668. function executeDispatch(event, simulated, listener, inst) {
  2669. var type = event.type || 'unknown-event';
  2670. event.currentTarget = EventPluginUtils.getNodeFromInstance(inst);
  2671. if (simulated) {
  2672. ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event);
  2673. } else {
  2674. ReactErrorUtils.invokeGuardedCallback(type, listener, event);
  2675. }
  2676. event.currentTarget = null;
  2677. }
  2678. /**
  2679. * Standard/simple iteration through an event's collected dispatches.
  2680. */
  2681. function executeDispatchesInOrder(event, simulated) {
  2682. var dispatchListeners = event._dispatchListeners;
  2683. var dispatchInstances = event._dispatchInstances;
  2684. if ("development" !== 'production') {
  2685. validateEventDispatches(event);
  2686. }
  2687. if (Array.isArray(dispatchListeners)) {
  2688. for (var i = 0; i < dispatchListeners.length; i++) {
  2689. if (event.isPropagationStopped()) {
  2690. break;
  2691. }
  2692. // Listeners and Instances are two parallel arrays that are always in sync.
  2693. executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]);
  2694. }
  2695. } else if (dispatchListeners) {
  2696. executeDispatch(event, simulated, dispatchListeners, dispatchInstances);
  2697. }
  2698. event._dispatchListeners = null;
  2699. event._dispatchInstances = null;
  2700. }
  2701. /**
  2702. * Standard/simple iteration through an event's collected dispatches, but stops
  2703. * at the first dispatch execution returning true, and returns that id.
  2704. *
  2705. * @return {?string} id of the first dispatch execution who's listener returns
  2706. * true, or null if no listener returned true.
  2707. */
  2708. function executeDispatchesInOrderStopAtTrueImpl(event) {
  2709. var dispatchListeners = event._dispatchListeners;
  2710. var dispatchInstances = event._dispatchInstances;
  2711. if ("development" !== 'production') {
  2712. validateEventDispatches(event);
  2713. }
  2714. if (Array.isArray(dispatchListeners)) {
  2715. for (var i = 0; i < dispatchListeners.length; i++) {
  2716. if (event.isPropagationStopped()) {
  2717. break;
  2718. }
  2719. // Listeners and Instances are two parallel arrays that are always in sync.
  2720. if (dispatchListeners[i](event, dispatchInstances[i])) {
  2721. return dispatchInstances[i];
  2722. }
  2723. }
  2724. } else if (dispatchListeners) {
  2725. if (dispatchListeners(event, dispatchInstances)) {
  2726. return dispatchInstances;
  2727. }
  2728. }
  2729. return null;
  2730. }
  2731. /**
  2732. * @see executeDispatchesInOrderStopAtTrueImpl
  2733. */
  2734. function executeDispatchesInOrderStopAtTrue(event) {
  2735. var ret = executeDispatchesInOrderStopAtTrueImpl(event);
  2736. event._dispatchInstances = null;
  2737. event._dispatchListeners = null;
  2738. return ret;
  2739. }
  2740. /**
  2741. * Execution of a "direct" dispatch - there must be at most one dispatch
  2742. * accumulated on the event or it is considered an error. It doesn't really make
  2743. * sense for an event with multiple dispatches (bubbled) to keep track of the
  2744. * return values at each dispatch execution, but it does tend to make sense when
  2745. * dealing with "direct" dispatches.
  2746. *
  2747. * @return {*} The return value of executing the single dispatch.
  2748. */
  2749. function executeDirectDispatch(event) {
  2750. if ("development" !== 'production') {
  2751. validateEventDispatches(event);
  2752. }
  2753. var dispatchListener = event._dispatchListeners;
  2754. var dispatchInstance = event._dispatchInstances;
  2755. !!Array.isArray(dispatchListener) ? "development" !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0;
  2756. event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null;
  2757. var res = dispatchListener ? dispatchListener(event) : null;
  2758. event.currentTarget = null;
  2759. event._dispatchListeners = null;
  2760. event._dispatchInstances = null;
  2761. return res;
  2762. }
  2763. /**
  2764. * @param {SyntheticEvent} event
  2765. * @return {boolean} True iff number of dispatches accumulated is greater than 0.
  2766. */
  2767. function hasDispatches(event) {
  2768. return !!event._dispatchListeners;
  2769. }
  2770. /**
  2771. * General utilities that are useful in creating custom Event Plugins.
  2772. */
  2773. var EventPluginUtils = {
  2774. isEndish: isEndish,
  2775. isMoveish: isMoveish,
  2776. isStartish: isStartish,
  2777. executeDirectDispatch: executeDirectDispatch,
  2778. executeDispatchesInOrder: executeDispatchesInOrder,
  2779. executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
  2780. hasDispatches: hasDispatches,
  2781. getInstanceFromNode: function (node) {
  2782. return ComponentTree.getInstanceFromNode(node);
  2783. },
  2784. getNodeFromInstance: function (node) {
  2785. return ComponentTree.getNodeFromInstance(node);
  2786. },
  2787. isAncestor: function (a, b) {
  2788. return TreeTraversal.isAncestor(a, b);
  2789. },
  2790. getLowestCommonAncestor: function (a, b) {
  2791. return TreeTraversal.getLowestCommonAncestor(a, b);
  2792. },
  2793. getParentInstance: function (inst) {
  2794. return TreeTraversal.getParentInstance(inst);
  2795. },
  2796. traverseTwoPhase: function (target, fn, arg) {
  2797. return TreeTraversal.traverseTwoPhase(target, fn, arg);
  2798. },
  2799. traverseEnterLeave: function (from, to, fn, argFrom, argTo) {
  2800. return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo);
  2801. },
  2802. injection: injection
  2803. };
  2804. module.exports = EventPluginUtils;
  2805. },{"126":126,"152":152,"159":159,"55":55}],20:[function(_dereq_,module,exports){
  2806. /**
  2807. * Copyright 2013-present, Facebook, Inc.
  2808. * All rights reserved.
  2809. *
  2810. * This source code is licensed under the BSD-style license found in the
  2811. * LICENSE file in the root directory of this source tree. An additional grant
  2812. * of patent rights can be found in the PATENTS file in the same directory.
  2813. *
  2814. */
  2815. 'use strict';
  2816. var EventPluginHub = _dereq_(17);
  2817. var EventPluginUtils = _dereq_(19);
  2818. var accumulateInto = _dereq_(102);
  2819. var forEachAccumulated = _dereq_(110);
  2820. var warning = _dereq_(159);
  2821. var getListener = EventPluginHub.getListener;
  2822. /**
  2823. * Some event types have a notion of different registration names for different
  2824. * "phases" of propagation. This finds listeners by a given phase.
  2825. */
  2826. function listenerAtPhase(inst, event, propagationPhase) {
  2827. var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
  2828. return getListener(inst, registrationName);
  2829. }
  2830. /**
  2831. * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
  2832. * here, allows us to not have to bind or create functions for each event.
  2833. * Mutating the event's members allows us to not have to create a wrapping
  2834. * "dispatch" object that pairs the event with the listener.
  2835. */
  2836. function accumulateDirectionalDispatches(inst, phase, event) {
  2837. if ("development" !== 'production') {
  2838. "development" !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0;
  2839. }
  2840. var listener = listenerAtPhase(inst, event, phase);
  2841. if (listener) {
  2842. event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
  2843. event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
  2844. }
  2845. }
  2846. /**
  2847. * Collect dispatches (must be entirely collected before dispatching - see unit
  2848. * tests). Lazily allocate the array to conserve memory. We must loop through
  2849. * each event and perform the traversal for each one. We cannot perform a
  2850. * single traversal for the entire collection of events because each event may
  2851. * have a different target.
  2852. */
  2853. function accumulateTwoPhaseDispatchesSingle(event) {
  2854. if (event && event.dispatchConfig.phasedRegistrationNames) {
  2855. EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
  2856. }
  2857. }
  2858. /**
  2859. * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
  2860. */
  2861. function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
  2862. if (event && event.dispatchConfig.phasedRegistrationNames) {
  2863. var targetInst = event._targetInst;
  2864. var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null;
  2865. EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event);
  2866. }
  2867. }
  2868. /**
  2869. * Accumulates without regard to direction, does not look for phased
  2870. * registration names. Same as `accumulateDirectDispatchesSingle` but without
  2871. * requiring that the `dispatchMarker` be the same as the dispatched ID.
  2872. */
  2873. function accumulateDispatches(inst, ignoredDirection, event) {
  2874. if (event && event.dispatchConfig.registrationName) {
  2875. var registrationName = event.dispatchConfig.registrationName;
  2876. var listener = getListener(inst, registrationName);
  2877. if (listener) {
  2878. event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
  2879. event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
  2880. }
  2881. }
  2882. }
  2883. /**
  2884. * Accumulates dispatches on an `SyntheticEvent`, but only for the
  2885. * `dispatchMarker`.
  2886. * @param {SyntheticEvent} event
  2887. */
  2888. function accumulateDirectDispatchesSingle(event) {
  2889. if (event && event.dispatchConfig.registrationName) {
  2890. accumulateDispatches(event._targetInst, null, event);
  2891. }
  2892. }
  2893. function accumulateTwoPhaseDispatches(events) {
  2894. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
  2895. }
  2896. function accumulateTwoPhaseDispatchesSkipTarget(events) {
  2897. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
  2898. }
  2899. function accumulateEnterLeaveDispatches(leave, enter, from, to) {
  2900. EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
  2901. }
  2902. function accumulateDirectDispatches(events) {
  2903. forEachAccumulated(events, accumulateDirectDispatchesSingle);
  2904. }
  2905. /**
  2906. * A small set of propagation patterns, each of which will accept a small amount
  2907. * of information, and generate a set of "dispatch ready event objects" - which
  2908. * are sets of events that have already been annotated with a set of dispatched
  2909. * listener functions/ids. The API is designed this way to discourage these
  2910. * propagation strategies from actually executing the dispatches, since we
  2911. * always want to collect the entire set of dispatches before executing event a
  2912. * single one.
  2913. *
  2914. * @constructor EventPropagators
  2915. */
  2916. var EventPropagators = {
  2917. accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
  2918. accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
  2919. accumulateDirectDispatches: accumulateDirectDispatches,
  2920. accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
  2921. };
  2922. module.exports = EventPropagators;
  2923. },{"102":102,"110":110,"159":159,"17":17,"19":19}],21:[function(_dereq_,module,exports){
  2924. /**
  2925. * Copyright 2013-present, Facebook, Inc.
  2926. * All rights reserved.
  2927. *
  2928. * This source code is licensed under the BSD-style license found in the
  2929. * LICENSE file in the root directory of this source tree. An additional grant
  2930. * of patent rights can be found in the PATENTS file in the same directory.
  2931. *
  2932. */
  2933. 'use strict';
  2934. var _assign = _dereq_(160);
  2935. var PooledClass = _dereq_(25);
  2936. var getTextContentAccessor = _dereq_(118);
  2937. /**
  2938. * This helper class stores information about text content of a target node,
  2939. * allowing comparison of content before and after a given event.
  2940. *
  2941. * Identify the node where selection currently begins, then observe
  2942. * both its text content and its current position in the DOM. Since the
  2943. * browser may natively replace the target node during composition, we can
  2944. * use its position to find its replacement.
  2945. *
  2946. * @param {DOMEventTarget} root
  2947. */
  2948. function FallbackCompositionState(root) {
  2949. this._root = root;
  2950. this._startText = this.getText();
  2951. this._fallbackText = null;
  2952. }
  2953. _assign(FallbackCompositionState.prototype, {
  2954. destructor: function () {
  2955. this._root = null;
  2956. this._startText = null;
  2957. this._fallbackText = null;
  2958. },
  2959. /**
  2960. * Get current text of input.
  2961. *
  2962. * @return {string}
  2963. */
  2964. getText: function () {
  2965. if ('value' in this._root) {
  2966. return this._root.value;
  2967. }
  2968. return this._root[getTextContentAccessor()];
  2969. },
  2970. /**
  2971. * Determine the differing substring between the initially stored
  2972. * text content and the current content.
  2973. *
  2974. * @return {string}
  2975. */
  2976. getData: function () {
  2977. if (this._fallbackText) {
  2978. return this._fallbackText;
  2979. }
  2980. var start;
  2981. var startValue = this._startText;
  2982. var startLength = startValue.length;
  2983. var end;
  2984. var endValue = this.getText();
  2985. var endLength = endValue.length;
  2986. for (start = 0; start < startLength; start++) {
  2987. if (startValue[start] !== endValue[start]) {
  2988. break;
  2989. }
  2990. }
  2991. var minEnd = startLength - start;
  2992. for (end = 1; end <= minEnd; end++) {
  2993. if (startValue[startLength - end] !== endValue[endLength - end]) {
  2994. break;
  2995. }
  2996. }
  2997. var sliceTail = end > 1 ? 1 - end : undefined;
  2998. this._fallbackText = endValue.slice(start, sliceTail);
  2999. return this._fallbackText;
  3000. }
  3001. });
  3002. PooledClass.addPoolingTo(FallbackCompositionState);
  3003. module.exports = FallbackCompositionState;
  3004. },{"118":118,"160":160,"25":25}],22:[function(_dereq_,module,exports){
  3005. /**
  3006. * Copyright 2013-present, Facebook, Inc.
  3007. * All rights reserved.
  3008. *
  3009. * This source code is licensed under the BSD-style license found in the
  3010. * LICENSE file in the root directory of this source tree. An additional grant
  3011. * of patent rights can be found in the PATENTS file in the same directory.
  3012. *
  3013. */
  3014. 'use strict';
  3015. var DOMProperty = _dereq_(11);
  3016. var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
  3017. var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
  3018. var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
  3019. var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
  3020. var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
  3021. var HTMLDOMPropertyConfig = {
  3022. isCustomAttribute: RegExp.prototype.test.bind(new RegExp('^(data|aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$')),
  3023. Properties: {
  3024. /**
  3025. * Standard Properties
  3026. */
  3027. accept: 0,
  3028. acceptCharset: 0,
  3029. accessKey: 0,
  3030. action: 0,
  3031. allowFullScreen: HAS_BOOLEAN_VALUE,
  3032. allowTransparency: 0,
  3033. alt: 0,
  3034. // specifies target context for links with `preload` type
  3035. as: 0,
  3036. async: HAS_BOOLEAN_VALUE,
  3037. autoComplete: 0,
  3038. // autoFocus is polyfilled/normalized by AutoFocusUtils
  3039. // autoFocus: HAS_BOOLEAN_VALUE,
  3040. autoPlay: HAS_BOOLEAN_VALUE,
  3041. capture: HAS_BOOLEAN_VALUE,
  3042. cellPadding: 0,
  3043. cellSpacing: 0,
  3044. charSet: 0,
  3045. challenge: 0,
  3046. checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3047. cite: 0,
  3048. classID: 0,
  3049. className: 0,
  3050. cols: HAS_POSITIVE_NUMERIC_VALUE,
  3051. colSpan: 0,
  3052. content: 0,
  3053. contentEditable: 0,
  3054. contextMenu: 0,
  3055. controls: HAS_BOOLEAN_VALUE,
  3056. coords: 0,
  3057. crossOrigin: 0,
  3058. data: 0, // For `<object />` acts as `src`.
  3059. dateTime: 0,
  3060. 'default': HAS_BOOLEAN_VALUE,
  3061. defer: HAS_BOOLEAN_VALUE,
  3062. dir: 0,
  3063. disabled: HAS_BOOLEAN_VALUE,
  3064. download: HAS_OVERLOADED_BOOLEAN_VALUE,
  3065. draggable: 0,
  3066. encType: 0,
  3067. form: 0,
  3068. formAction: 0,
  3069. formEncType: 0,
  3070. formMethod: 0,
  3071. formNoValidate: HAS_BOOLEAN_VALUE,
  3072. formTarget: 0,
  3073. frameBorder: 0,
  3074. headers: 0,
  3075. height: 0,
  3076. hidden: HAS_BOOLEAN_VALUE,
  3077. high: 0,
  3078. href: 0,
  3079. hrefLang: 0,
  3080. htmlFor: 0,
  3081. httpEquiv: 0,
  3082. icon: 0,
  3083. id: 0,
  3084. inputMode: 0,
  3085. integrity: 0,
  3086. is: 0,
  3087. keyParams: 0,
  3088. keyType: 0,
  3089. kind: 0,
  3090. label: 0,
  3091. lang: 0,
  3092. list: 0,
  3093. loop: HAS_BOOLEAN_VALUE,
  3094. low: 0,
  3095. manifest: 0,
  3096. marginHeight: 0,
  3097. marginWidth: 0,
  3098. max: 0,
  3099. maxLength: 0,
  3100. media: 0,
  3101. mediaGroup: 0,
  3102. method: 0,
  3103. min: 0,
  3104. minLength: 0,
  3105. // Caution; `option.selected` is not updated if `select.multiple` is
  3106. // disabled with `removeAttribute`.
  3107. multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3108. muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3109. name: 0,
  3110. nonce: 0,
  3111. noValidate: HAS_BOOLEAN_VALUE,
  3112. open: HAS_BOOLEAN_VALUE,
  3113. optimum: 0,
  3114. pattern: 0,
  3115. placeholder: 0,
  3116. playsInline: HAS_BOOLEAN_VALUE,
  3117. poster: 0,
  3118. preload: 0,
  3119. profile: 0,
  3120. radioGroup: 0,
  3121. readOnly: HAS_BOOLEAN_VALUE,
  3122. referrerPolicy: 0,
  3123. rel: 0,
  3124. required: HAS_BOOLEAN_VALUE,
  3125. reversed: HAS_BOOLEAN_VALUE,
  3126. role: 0,
  3127. rows: HAS_POSITIVE_NUMERIC_VALUE,
  3128. rowSpan: HAS_NUMERIC_VALUE,
  3129. sandbox: 0,
  3130. scope: 0,
  3131. scoped: HAS_BOOLEAN_VALUE,
  3132. scrolling: 0,
  3133. seamless: HAS_BOOLEAN_VALUE,
  3134. selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3135. shape: 0,
  3136. size: HAS_POSITIVE_NUMERIC_VALUE,
  3137. sizes: 0,
  3138. span: HAS_POSITIVE_NUMERIC_VALUE,
  3139. spellCheck: 0,
  3140. src: 0,
  3141. srcDoc: 0,
  3142. srcLang: 0,
  3143. srcSet: 0,
  3144. start: HAS_NUMERIC_VALUE,
  3145. step: 0,
  3146. style: 0,
  3147. summary: 0,
  3148. tabIndex: 0,
  3149. target: 0,
  3150. title: 0,
  3151. // Setting .type throws on non-<input> tags
  3152. type: 0,
  3153. useMap: 0,
  3154. value: 0,
  3155. width: 0,
  3156. wmode: 0,
  3157. wrap: 0,
  3158. /**
  3159. * RDFa Properties
  3160. */
  3161. about: 0,
  3162. datatype: 0,
  3163. inlist: 0,
  3164. prefix: 0,
  3165. // property is also supported for OpenGraph in meta tags.
  3166. property: 0,
  3167. resource: 0,
  3168. 'typeof': 0,
  3169. vocab: 0,
  3170. /**
  3171. * Non-standard Properties
  3172. */
  3173. // autoCapitalize and autoCorrect are supported in Mobile Safari for
  3174. // keyboard hints.
  3175. autoCapitalize: 0,
  3176. autoCorrect: 0,
  3177. // autoSave allows WebKit/Blink to persist values of input fields on page reloads
  3178. autoSave: 0,
  3179. // color is for Safari mask-icon link
  3180. color: 0,
  3181. // itemProp, itemScope, itemType are for
  3182. // Microdata support. See http://schema.org/docs/gs.html
  3183. itemProp: 0,
  3184. itemScope: HAS_BOOLEAN_VALUE,
  3185. itemType: 0,
  3186. // itemID and itemRef are for Microdata support as well but
  3187. // only specified in the WHATWG spec document. See
  3188. // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
  3189. itemID: 0,
  3190. itemRef: 0,
  3191. // results show looking glass icon and recent searches on input
  3192. // search fields in WebKit/Blink
  3193. results: 0,
  3194. // IE-only attribute that specifies security restrictions on an iframe
  3195. // as an alternative to the sandbox attribute on IE<10
  3196. security: 0,
  3197. // IE-only attribute that controls focus behavior
  3198. unselectable: 0
  3199. },
  3200. DOMAttributeNames: {
  3201. acceptCharset: 'accept-charset',
  3202. className: 'class',
  3203. htmlFor: 'for',
  3204. httpEquiv: 'http-equiv'
  3205. },
  3206. DOMPropertyNames: {},
  3207. DOMMutationMethods: {
  3208. value: function (node, value) {
  3209. if (value == null) {
  3210. return node.removeAttribute('value');
  3211. }
  3212. // Number inputs get special treatment due to some edge cases in
  3213. // Chrome. Let everything else assign the value attribute as normal.
  3214. // https://github.com/facebook/react/issues/7253#issuecomment-236074326
  3215. if (node.type !== 'number' || node.hasAttribute('value') === false) {
  3216. node.setAttribute('value', '' + value);
  3217. } else if (node.validity && !node.validity.badInput && node.ownerDocument.activeElement !== node) {
  3218. // Don't assign an attribute if validation reports bad
  3219. // input. Chrome will clear the value. Additionally, don't
  3220. // operate on inputs that have focus, otherwise Chrome might
  3221. // strip off trailing decimal places and cause the user's
  3222. // cursor position to jump to the beginning of the input.
  3223. //
  3224. // In ReactDOMInput, we have an onBlur event that will trigger
  3225. // this function again when focus is lost.
  3226. node.setAttribute('value', '' + value);
  3227. }
  3228. }
  3229. }
  3230. };
  3231. module.exports = HTMLDOMPropertyConfig;
  3232. },{"11":11}],23:[function(_dereq_,module,exports){
  3233. /**
  3234. * Copyright 2013-present, Facebook, Inc.
  3235. * All rights reserved.
  3236. *
  3237. * This source code is licensed under the BSD-style license found in the
  3238. * LICENSE file in the root directory of this source tree. An additional grant
  3239. * of patent rights can be found in the PATENTS file in the same directory.
  3240. *
  3241. *
  3242. */
  3243. 'use strict';
  3244. /**
  3245. * Escape and wrap key so it is safe to use as a reactid
  3246. *
  3247. * @param {string} key to be escaped.
  3248. * @return {string} the escaped key.
  3249. */
  3250. function escape(key) {
  3251. var escapeRegex = /[=:]/g;
  3252. var escaperLookup = {
  3253. '=': '=0',
  3254. ':': '=2'
  3255. };
  3256. var escapedString = ('' + key).replace(escapeRegex, function (match) {
  3257. return escaperLookup[match];
  3258. });
  3259. return '$' + escapedString;
  3260. }
  3261. /**
  3262. * Unescape and unwrap key for human-readable display
  3263. *
  3264. * @param {string} key to unescape.
  3265. * @return {string} the unescaped key.
  3266. */
  3267. function unescape(key) {
  3268. var unescapeRegex = /(=0|=2)/g;
  3269. var unescaperLookup = {
  3270. '=0': '=',
  3271. '=2': ':'
  3272. };
  3273. var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
  3274. return ('' + keySubstring).replace(unescapeRegex, function (match) {
  3275. return unescaperLookup[match];
  3276. });
  3277. }
  3278. var KeyEscapeUtils = {
  3279. escape: escape,
  3280. unescape: unescape
  3281. };
  3282. module.exports = KeyEscapeUtils;
  3283. },{}],24:[function(_dereq_,module,exports){
  3284. /**
  3285. * Copyright 2013-present, Facebook, Inc.
  3286. * All rights reserved.
  3287. *
  3288. * This source code is licensed under the BSD-style license found in the
  3289. * LICENSE file in the root directory of this source tree. An additional grant
  3290. * of patent rights can be found in the PATENTS file in the same directory.
  3291. *
  3292. */
  3293. 'use strict';
  3294. var _prodInvariant = _dereq_(126);
  3295. var ReactPropTypesSecret = _dereq_(73);
  3296. var propTypesFactory = _dereq_(162);
  3297. var React = _dereq_(135);
  3298. var PropTypes = propTypesFactory(React.isValidElement);
  3299. var invariant = _dereq_(152);
  3300. var warning = _dereq_(159);
  3301. var hasReadOnlyValue = {
  3302. button: true,
  3303. checkbox: true,
  3304. image: true,
  3305. hidden: true,
  3306. radio: true,
  3307. reset: true,
  3308. submit: true
  3309. };
  3310. function _assertSingleLink(inputProps) {
  3311. !(inputProps.checkedLink == null || inputProps.valueLink == null) ? "development" !== '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.') : _prodInvariant('87') : void 0;
  3312. }
  3313. function _assertValueLink(inputProps) {
  3314. _assertSingleLink(inputProps);
  3315. !(inputProps.value == null && inputProps.onChange == null) ? "development" !== '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.') : _prodInvariant('88') : void 0;
  3316. }
  3317. function _assertCheckedLink(inputProps) {
  3318. _assertSingleLink(inputProps);
  3319. !(inputProps.checked == null && inputProps.onChange == null) ? "development" !== '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') : _prodInvariant('89') : void 0;
  3320. }
  3321. var propTypes = {
  3322. value: function (props, propName, componentName) {
  3323. if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
  3324. return null;
  3325. }
  3326. 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`.');
  3327. },
  3328. checked: function (props, propName, componentName) {
  3329. if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
  3330. return null;
  3331. }
  3332. 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`.');
  3333. },
  3334. onChange: PropTypes.func
  3335. };
  3336. var loggedTypeFailures = {};
  3337. function getDeclarationErrorAddendum(owner) {
  3338. if (owner) {
  3339. var name = owner.getName();
  3340. if (name) {
  3341. return ' Check the render method of `' + name + '`.';
  3342. }
  3343. }
  3344. return '';
  3345. }
  3346. /**
  3347. * Provide a linked `value` attribute for controlled forms. You should not use
  3348. * this outside of the ReactDOM controlled form components.
  3349. */
  3350. var LinkedValueUtils = {
  3351. checkPropTypes: function (tagName, props, owner) {
  3352. for (var propName in propTypes) {
  3353. if (propTypes.hasOwnProperty(propName)) {
  3354. var error = propTypes[propName](props, propName, tagName, 'prop', null, ReactPropTypesSecret);
  3355. }
  3356. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  3357. // Only monitor this failure once because there tends to be a lot of the
  3358. // same error.
  3359. loggedTypeFailures[error.message] = true;
  3360. var addendum = getDeclarationErrorAddendum(owner);
  3361. "development" !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0;
  3362. }
  3363. }
  3364. },
  3365. /**
  3366. * @param {object} inputProps Props for form component
  3367. * @return {*} current value of the input either from value prop or link.
  3368. */
  3369. getValue: function (inputProps) {
  3370. if (inputProps.valueLink) {
  3371. _assertValueLink(inputProps);
  3372. return inputProps.valueLink.value;
  3373. }
  3374. return inputProps.value;
  3375. },
  3376. /**
  3377. * @param {object} inputProps Props for form component
  3378. * @return {*} current checked status of the input either from checked prop
  3379. * or link.
  3380. */
  3381. getChecked: function (inputProps) {
  3382. if (inputProps.checkedLink) {
  3383. _assertCheckedLink(inputProps);
  3384. return inputProps.checkedLink.value;
  3385. }
  3386. return inputProps.checked;
  3387. },
  3388. /**
  3389. * @param {object} inputProps Props for form component
  3390. * @param {SyntheticEvent} event change event to handle
  3391. */
  3392. executeOnChange: function (inputProps, event) {
  3393. if (inputProps.valueLink) {
  3394. _assertValueLink(inputProps);
  3395. return inputProps.valueLink.requestChange(event.target.value);
  3396. } else if (inputProps.checkedLink) {
  3397. _assertCheckedLink(inputProps);
  3398. return inputProps.checkedLink.requestChange(event.target.checked);
  3399. } else if (inputProps.onChange) {
  3400. return inputProps.onChange.call(undefined, event);
  3401. }
  3402. }
  3403. };
  3404. module.exports = LinkedValueUtils;
  3405. },{"126":126,"135":135,"152":152,"159":159,"162":162,"73":73}],25:[function(_dereq_,module,exports){
  3406. /**
  3407. * Copyright 2013-present, Facebook, Inc.
  3408. * All rights reserved.
  3409. *
  3410. * This source code is licensed under the BSD-style license found in the
  3411. * LICENSE file in the root directory of this source tree. An additional grant
  3412. * of patent rights can be found in the PATENTS file in the same directory.
  3413. *
  3414. *
  3415. */
  3416. 'use strict';
  3417. var _prodInvariant = _dereq_(126);
  3418. var invariant = _dereq_(152);
  3419. /**
  3420. * Static poolers. Several custom versions for each potential number of
  3421. * arguments. A completely generic pooler is easy to implement, but would
  3422. * require accessing the `arguments` object. In each of these, `this` refers to
  3423. * the Class itself, not an instance. If any others are needed, simply add them
  3424. * here, or in their own files.
  3425. */
  3426. var oneArgumentPooler = function (copyFieldsFrom) {
  3427. var Klass = this;
  3428. if (Klass.instancePool.length) {
  3429. var instance = Klass.instancePool.pop();
  3430. Klass.call(instance, copyFieldsFrom);
  3431. return instance;
  3432. } else {
  3433. return new Klass(copyFieldsFrom);
  3434. }
  3435. };
  3436. var twoArgumentPooler = function (a1, a2) {
  3437. var Klass = this;
  3438. if (Klass.instancePool.length) {
  3439. var instance = Klass.instancePool.pop();
  3440. Klass.call(instance, a1, a2);
  3441. return instance;
  3442. } else {
  3443. return new Klass(a1, a2);
  3444. }
  3445. };
  3446. var threeArgumentPooler = function (a1, a2, a3) {
  3447. var Klass = this;
  3448. if (Klass.instancePool.length) {
  3449. var instance = Klass.instancePool.pop();
  3450. Klass.call(instance, a1, a2, a3);
  3451. return instance;
  3452. } else {
  3453. return new Klass(a1, a2, a3);
  3454. }
  3455. };
  3456. var fourArgumentPooler = function (a1, a2, a3, a4) {
  3457. var Klass = this;
  3458. if (Klass.instancePool.length) {
  3459. var instance = Klass.instancePool.pop();
  3460. Klass.call(instance, a1, a2, a3, a4);
  3461. return instance;
  3462. } else {
  3463. return new Klass(a1, a2, a3, a4);
  3464. }
  3465. };
  3466. var standardReleaser = function (instance) {
  3467. var Klass = this;
  3468. !(instance instanceof Klass) ? "development" !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
  3469. instance.destructor();
  3470. if (Klass.instancePool.length < Klass.poolSize) {
  3471. Klass.instancePool.push(instance);
  3472. }
  3473. };
  3474. var DEFAULT_POOL_SIZE = 10;
  3475. var DEFAULT_POOLER = oneArgumentPooler;
  3476. /**
  3477. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  3478. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  3479. * you give this may have a `poolSize` property, and will look for a
  3480. * prototypical `destructor` on instances.
  3481. *
  3482. * @param {Function} CopyConstructor Constructor that can be used to reset.
  3483. * @param {Function} pooler Customizable pooler.
  3484. */
  3485. var addPoolingTo = function (CopyConstructor, pooler) {
  3486. // Casting as any so that flow ignores the actual implementation and trusts
  3487. // it to match the type we declared
  3488. var NewKlass = CopyConstructor;
  3489. NewKlass.instancePool = [];
  3490. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  3491. if (!NewKlass.poolSize) {
  3492. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  3493. }
  3494. NewKlass.release = standardReleaser;
  3495. return NewKlass;
  3496. };
  3497. var PooledClass = {
  3498. addPoolingTo: addPoolingTo,
  3499. oneArgumentPooler: oneArgumentPooler,
  3500. twoArgumentPooler: twoArgumentPooler,
  3501. threeArgumentPooler: threeArgumentPooler,
  3502. fourArgumentPooler: fourArgumentPooler
  3503. };
  3504. module.exports = PooledClass;
  3505. },{"126":126,"152":152}],26:[function(_dereq_,module,exports){
  3506. /**
  3507. * Copyright 2013-present, Facebook, Inc.
  3508. * All rights reserved.
  3509. *
  3510. * This source code is licensed under the BSD-style license found in the
  3511. * LICENSE file in the root directory of this source tree. An additional grant
  3512. * of patent rights can be found in the PATENTS file in the same directory.
  3513. *
  3514. */
  3515. 'use strict';
  3516. var _assign = _dereq_(160);
  3517. var EventPluginRegistry = _dereq_(18);
  3518. var ReactEventEmitterMixin = _dereq_(56);
  3519. var ViewportMetrics = _dereq_(101);
  3520. var getVendorPrefixedEventName = _dereq_(119);
  3521. var isEventSupported = _dereq_(122);
  3522. /**
  3523. * Summary of `ReactBrowserEventEmitter` event handling:
  3524. *
  3525. * - Top-level delegation is used to trap most native browser events. This
  3526. * may only occur in the main thread and is the responsibility of
  3527. * ReactEventListener, which is injected and can therefore support pluggable
  3528. * event sources. This is the only work that occurs in the main thread.
  3529. *
  3530. * - We normalize and de-duplicate events to account for browser quirks. This
  3531. * may be done in the worker thread.
  3532. *
  3533. * - Forward these native events (with the associated top-level type used to
  3534. * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
  3535. * to extract any synthetic events.
  3536. *
  3537. * - The `EventPluginHub` will then process each event by annotating them with
  3538. * "dispatches", a sequence of listeners and IDs that care about that event.
  3539. *
  3540. * - The `EventPluginHub` then dispatches the events.
  3541. *
  3542. * Overview of React and the event system:
  3543. *
  3544. * +------------+ .
  3545. * | DOM | .
  3546. * +------------+ .
  3547. * | .
  3548. * v .
  3549. * +------------+ .
  3550. * | ReactEvent | .
  3551. * | Listener | .
  3552. * +------------+ . +-----------+
  3553. * | . +--------+|SimpleEvent|
  3554. * | . | |Plugin |
  3555. * +-----|------+ . v +-----------+
  3556. * | | | . +--------------+ +------------+
  3557. * | +-----------.--->|EventPluginHub| | Event |
  3558. * | | . | | +-----------+ | Propagators|
  3559. * | ReactEvent | . | | |TapEvent | |------------|
  3560. * | Emitter | . | |<---+|Plugin | |other plugin|
  3561. * | | . | | +-----------+ | utilities |
  3562. * | +-----------.--->| | +------------+
  3563. * | | | . +--------------+
  3564. * +-----|------+ . ^ +-----------+
  3565. * | . | |Enter/Leave|
  3566. * + . +-------+|Plugin |
  3567. * +-------------+ . +-----------+
  3568. * | application | .
  3569. * |-------------| .
  3570. * | | .
  3571. * | | .
  3572. * +-------------+ .
  3573. * .
  3574. * React Core . General Purpose Event Plugin System
  3575. */
  3576. var hasEventPageXY;
  3577. var alreadyListeningTo = {};
  3578. var isMonitoringScrollValue = false;
  3579. var reactTopListenersCounter = 0;
  3580. // For events like 'submit' which don't consistently bubble (which we trap at a
  3581. // lower node than `document`), binding at `document` would cause duplicate
  3582. // events so we don't include them here
  3583. var topEventMapping = {
  3584. topAbort: 'abort',
  3585. topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend',
  3586. topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration',
  3587. topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart',
  3588. topBlur: 'blur',
  3589. topCanPlay: 'canplay',
  3590. topCanPlayThrough: 'canplaythrough',
  3591. topChange: 'change',
  3592. topClick: 'click',
  3593. topCompositionEnd: 'compositionend',
  3594. topCompositionStart: 'compositionstart',
  3595. topCompositionUpdate: 'compositionupdate',
  3596. topContextMenu: 'contextmenu',
  3597. topCopy: 'copy',
  3598. topCut: 'cut',
  3599. topDoubleClick: 'dblclick',
  3600. topDrag: 'drag',
  3601. topDragEnd: 'dragend',
  3602. topDragEnter: 'dragenter',
  3603. topDragExit: 'dragexit',
  3604. topDragLeave: 'dragleave',
  3605. topDragOver: 'dragover',
  3606. topDragStart: 'dragstart',
  3607. topDrop: 'drop',
  3608. topDurationChange: 'durationchange',
  3609. topEmptied: 'emptied',
  3610. topEncrypted: 'encrypted',
  3611. topEnded: 'ended',
  3612. topError: 'error',
  3613. topFocus: 'focus',
  3614. topInput: 'input',
  3615. topKeyDown: 'keydown',
  3616. topKeyPress: 'keypress',
  3617. topKeyUp: 'keyup',
  3618. topLoadedData: 'loadeddata',
  3619. topLoadedMetadata: 'loadedmetadata',
  3620. topLoadStart: 'loadstart',
  3621. topMouseDown: 'mousedown',
  3622. topMouseMove: 'mousemove',
  3623. topMouseOut: 'mouseout',
  3624. topMouseOver: 'mouseover',
  3625. topMouseUp: 'mouseup',
  3626. topPaste: 'paste',
  3627. topPause: 'pause',
  3628. topPlay: 'play',
  3629. topPlaying: 'playing',
  3630. topProgress: 'progress',
  3631. topRateChange: 'ratechange',
  3632. topScroll: 'scroll',
  3633. topSeeked: 'seeked',
  3634. topSeeking: 'seeking',
  3635. topSelectionChange: 'selectionchange',
  3636. topStalled: 'stalled',
  3637. topSuspend: 'suspend',
  3638. topTextInput: 'textInput',
  3639. topTimeUpdate: 'timeupdate',
  3640. topTouchCancel: 'touchcancel',
  3641. topTouchEnd: 'touchend',
  3642. topTouchMove: 'touchmove',
  3643. topTouchStart: 'touchstart',
  3644. topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend',
  3645. topVolumeChange: 'volumechange',
  3646. topWaiting: 'waiting',
  3647. topWheel: 'wheel'
  3648. };
  3649. /**
  3650. * To ensure no conflicts with other potential React instances on the page
  3651. */
  3652. var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
  3653. function getListeningForDocument(mountAt) {
  3654. // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
  3655. // directly.
  3656. if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
  3657. mountAt[topListenersIDKey] = reactTopListenersCounter++;
  3658. alreadyListeningTo[mountAt[topListenersIDKey]] = {};
  3659. }
  3660. return alreadyListeningTo[mountAt[topListenersIDKey]];
  3661. }
  3662. /**
  3663. * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
  3664. * example:
  3665. *
  3666. * EventPluginHub.putListener('myID', 'onClick', myFunction);
  3667. *
  3668. * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
  3669. *
  3670. * @internal
  3671. */
  3672. var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, {
  3673. /**
  3674. * Injectable event backend
  3675. */
  3676. ReactEventListener: null,
  3677. injection: {
  3678. /**
  3679. * @param {object} ReactEventListener
  3680. */
  3681. injectReactEventListener: function (ReactEventListener) {
  3682. ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
  3683. ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
  3684. }
  3685. },
  3686. /**
  3687. * Sets whether or not any created callbacks should be enabled.
  3688. *
  3689. * @param {boolean} enabled True if callbacks should be enabled.
  3690. */
  3691. setEnabled: function (enabled) {
  3692. if (ReactBrowserEventEmitter.ReactEventListener) {
  3693. ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
  3694. }
  3695. },
  3696. /**
  3697. * @return {boolean} True if callbacks are enabled.
  3698. */
  3699. isEnabled: function () {
  3700. return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
  3701. },
  3702. /**
  3703. * We listen for bubbled touch events on the document object.
  3704. *
  3705. * Firefox v8.01 (and possibly others) exhibited strange behavior when
  3706. * mounting `onmousemove` events at some node that was not the document
  3707. * element. The symptoms were that if your mouse is not moving over something
  3708. * contained within that mount point (for example on the background) the
  3709. * top-level listeners for `onmousemove` won't be called. However, if you
  3710. * register the `mousemove` on the document object, then it will of course
  3711. * catch all `mousemove`s. This along with iOS quirks, justifies restricting
  3712. * top-level listeners to the document object only, at least for these
  3713. * movement types of events and possibly all events.
  3714. *
  3715. * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  3716. *
  3717. * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
  3718. * they bubble to document.
  3719. *
  3720. * @param {string} registrationName Name of listener (e.g. `onClick`).
  3721. * @param {object} contentDocumentHandle Document which owns the container
  3722. */
  3723. listenTo: function (registrationName, contentDocumentHandle) {
  3724. var mountAt = contentDocumentHandle;
  3725. var isListening = getListeningForDocument(mountAt);
  3726. var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
  3727. for (var i = 0; i < dependencies.length; i++) {
  3728. var dependency = dependencies[i];
  3729. if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
  3730. if (dependency === 'topWheel') {
  3731. if (isEventSupported('wheel')) {
  3732. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'wheel', mountAt);
  3733. } else if (isEventSupported('mousewheel')) {
  3734. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'mousewheel', mountAt);
  3735. } else {
  3736. // Firefox needs to capture a different mouse scroll event.
  3737. // @see http://www.quirksmode.org/dom/events/tests/scroll.html
  3738. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'DOMMouseScroll', mountAt);
  3739. }
  3740. } else if (dependency === 'topScroll') {
  3741. if (isEventSupported('scroll', true)) {
  3742. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topScroll', 'scroll', mountAt);
  3743. } else {
  3744. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topScroll', 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
  3745. }
  3746. } else if (dependency === 'topFocus' || dependency === 'topBlur') {
  3747. if (isEventSupported('focus', true)) {
  3748. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topFocus', 'focus', mountAt);
  3749. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topBlur', 'blur', mountAt);
  3750. } else if (isEventSupported('focusin')) {
  3751. // IE has `focusin` and `focusout` events which bubble.
  3752. // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
  3753. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topFocus', 'focusin', mountAt);
  3754. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topBlur', 'focusout', mountAt);
  3755. }
  3756. // to make sure blur and focus event listeners are only attached once
  3757. isListening.topBlur = true;
  3758. isListening.topFocus = true;
  3759. } else if (topEventMapping.hasOwnProperty(dependency)) {
  3760. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
  3761. }
  3762. isListening[dependency] = true;
  3763. }
  3764. }
  3765. },
  3766. trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
  3767. return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
  3768. },
  3769. trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
  3770. return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
  3771. },
  3772. /**
  3773. * Protect against document.createEvent() returning null
  3774. * Some popup blocker extensions appear to do this:
  3775. * https://github.com/facebook/react/issues/6887
  3776. */
  3777. supportsEventPageXY: function () {
  3778. if (!document.createEvent) {
  3779. return false;
  3780. }
  3781. var ev = document.createEvent('MouseEvent');
  3782. return ev != null && 'pageX' in ev;
  3783. },
  3784. /**
  3785. * Listens to window scroll and resize events. We cache scroll values so that
  3786. * application code can access them without triggering reflows.
  3787. *
  3788. * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when
  3789. * pageX/pageY isn't supported (legacy browsers).
  3790. *
  3791. * NOTE: Scroll events do not bubble.
  3792. *
  3793. * @see http://www.quirksmode.org/dom/events/scroll.html
  3794. */
  3795. ensureScrollValueMonitoring: function () {
  3796. if (hasEventPageXY === undefined) {
  3797. hasEventPageXY = ReactBrowserEventEmitter.supportsEventPageXY();
  3798. }
  3799. if (!hasEventPageXY && !isMonitoringScrollValue) {
  3800. var refresh = ViewportMetrics.refreshScrollValues;
  3801. ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
  3802. isMonitoringScrollValue = true;
  3803. }
  3804. }
  3805. });
  3806. module.exports = ReactBrowserEventEmitter;
  3807. },{"101":101,"119":119,"122":122,"160":160,"18":18,"56":56}],27:[function(_dereq_,module,exports){
  3808. (function (process){
  3809. /**
  3810. * Copyright 2014-present, Facebook, Inc.
  3811. * All rights reserved.
  3812. *
  3813. * This source code is licensed under the BSD-style license found in the
  3814. * LICENSE file in the root directory of this source tree. An additional grant
  3815. * of patent rights can be found in the PATENTS file in the same directory.
  3816. *
  3817. */
  3818. 'use strict';
  3819. var ReactReconciler = _dereq_(75);
  3820. var instantiateReactComponent = _dereq_(121);
  3821. var KeyEscapeUtils = _dereq_(23);
  3822. var shouldUpdateReactComponent = _dereq_(130);
  3823. var traverseAllChildren = _dereq_(131);
  3824. var warning = _dereq_(159);
  3825. var ReactComponentTreeHook;
  3826. if (typeof process !== 'undefined' && process.env && "development" === 'test') {
  3827. // Temporary hack.
  3828. // Inline requires don't work well with Jest:
  3829. // https://github.com/facebook/react/issues/7240
  3830. // Remove the inline requires when we don't need them anymore:
  3831. // https://github.com/facebook/react/pull/7178
  3832. ReactComponentTreeHook = _dereq_(133);
  3833. }
  3834. function instantiateChild(childInstances, child, name, selfDebugID) {
  3835. // We found a component instance.
  3836. var keyUnique = childInstances[name] === undefined;
  3837. if ("development" !== 'production') {
  3838. if (!ReactComponentTreeHook) {
  3839. ReactComponentTreeHook = _dereq_(133);
  3840. }
  3841. if (!keyUnique) {
  3842. "development" !== 'production' ? warning(false, '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.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0;
  3843. }
  3844. }
  3845. if (child != null && keyUnique) {
  3846. childInstances[name] = instantiateReactComponent(child, true);
  3847. }
  3848. }
  3849. /**
  3850. * ReactChildReconciler provides helpers for initializing or updating a set of
  3851. * children. Its output is suitable for passing it onto ReactMultiChild which
  3852. * does diffed reordering and insertion.
  3853. */
  3854. var ReactChildReconciler = {
  3855. /**
  3856. * Generates a "mount image" for each of the supplied children. In the case
  3857. * of `ReactDOMComponent`, a mount image is a string of markup.
  3858. *
  3859. * @param {?object} nestedChildNodes Nested child maps.
  3860. * @return {?object} A set of child instances.
  3861. * @internal
  3862. */
  3863. instantiateChildren: function (nestedChildNodes, transaction, context, selfDebugID) // 0 in production and for roots
  3864. {
  3865. if (nestedChildNodes == null) {
  3866. return null;
  3867. }
  3868. var childInstances = {};
  3869. if ("development" !== 'production') {
  3870. traverseAllChildren(nestedChildNodes, function (childInsts, child, name) {
  3871. return instantiateChild(childInsts, child, name, selfDebugID);
  3872. }, childInstances);
  3873. } else {
  3874. traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
  3875. }
  3876. return childInstances;
  3877. },
  3878. /**
  3879. * Updates the rendered children and returns a new set of children.
  3880. *
  3881. * @param {?object} prevChildren Previously initialized set of children.
  3882. * @param {?object} nextChildren Flat child element maps.
  3883. * @param {ReactReconcileTransaction} transaction
  3884. * @param {object} context
  3885. * @return {?object} A new set of child instances.
  3886. * @internal
  3887. */
  3888. updateChildren: function (prevChildren, nextChildren, mountImages, removedNodes, transaction, hostParent, hostContainerInfo, context, selfDebugID) // 0 in production and for roots
  3889. {
  3890. // We currently don't have a way to track moves here but if we use iterators
  3891. // instead of for..in we can zip the iterators and check if an item has
  3892. // moved.
  3893. // TODO: If nothing has changed, return the prevChildren object so that we
  3894. // can quickly bailout if nothing has changed.
  3895. if (!nextChildren && !prevChildren) {
  3896. return;
  3897. }
  3898. var name;
  3899. var prevChild;
  3900. for (name in nextChildren) {
  3901. if (!nextChildren.hasOwnProperty(name)) {
  3902. continue;
  3903. }
  3904. prevChild = prevChildren && prevChildren[name];
  3905. var prevElement = prevChild && prevChild._currentElement;
  3906. var nextElement = nextChildren[name];
  3907. if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
  3908. ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
  3909. nextChildren[name] = prevChild;
  3910. } else {
  3911. if (prevChild) {
  3912. removedNodes[name] = ReactReconciler.getHostNode(prevChild);
  3913. ReactReconciler.unmountComponent(prevChild, false);
  3914. }
  3915. // The child must be instantiated before it's mounted.
  3916. var nextChildInstance = instantiateReactComponent(nextElement, true);
  3917. nextChildren[name] = nextChildInstance;
  3918. // Creating mount image now ensures refs are resolved in right order
  3919. // (see https://github.com/facebook/react/pull/7101 for explanation).
  3920. var nextChildMountImage = ReactReconciler.mountComponent(nextChildInstance, transaction, hostParent, hostContainerInfo, context, selfDebugID);
  3921. mountImages.push(nextChildMountImage);
  3922. }
  3923. }
  3924. // Unmount children that are no longer present.
  3925. for (name in prevChildren) {
  3926. if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
  3927. prevChild = prevChildren[name];
  3928. removedNodes[name] = ReactReconciler.getHostNode(prevChild);
  3929. ReactReconciler.unmountComponent(prevChild, false);
  3930. }
  3931. }
  3932. },
  3933. /**
  3934. * Unmounts all rendered children. This should be used to clean up children
  3935. * when this component is unmounted.
  3936. *
  3937. * @param {?object} renderedChildren Previously initialized set of children.
  3938. * @internal
  3939. */
  3940. unmountChildren: function (renderedChildren, safely) {
  3941. for (var name in renderedChildren) {
  3942. if (renderedChildren.hasOwnProperty(name)) {
  3943. var renderedChild = renderedChildren[name];
  3944. ReactReconciler.unmountComponent(renderedChild, safely);
  3945. }
  3946. }
  3947. }
  3948. };
  3949. module.exports = ReactChildReconciler;
  3950. }).call(this,undefined)
  3951. },{"121":121,"130":130,"131":131,"133":133,"159":159,"23":23,"75":75}],28:[function(_dereq_,module,exports){
  3952. /**
  3953. * Copyright 2013-present, Facebook, Inc.
  3954. * All rights reserved.
  3955. *
  3956. * This source code is licensed under the BSD-style license found in the
  3957. * LICENSE file in the root directory of this source tree. An additional grant
  3958. * of patent rights can be found in the PATENTS file in the same directory.
  3959. *
  3960. */
  3961. 'use strict';
  3962. var DOMChildrenOperations = _dereq_(8);
  3963. var ReactDOMIDOperations = _dereq_(38);
  3964. /**
  3965. * Abstracts away all functionality of the reconciler that requires knowledge of
  3966. * the browser context. TODO: These callers should be refactored to avoid the
  3967. * need for this injection.
  3968. */
  3969. var ReactComponentBrowserEnvironment = {
  3970. processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
  3971. replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup
  3972. };
  3973. module.exports = ReactComponentBrowserEnvironment;
  3974. },{"38":38,"8":8}],29:[function(_dereq_,module,exports){
  3975. /**
  3976. * Copyright 2014-present, Facebook, Inc.
  3977. * All rights reserved.
  3978. *
  3979. * This source code is licensed under the BSD-style license found in the
  3980. * LICENSE file in the root directory of this source tree. An additional grant
  3981. * of patent rights can be found in the PATENTS file in the same directory.
  3982. *
  3983. *
  3984. */
  3985. 'use strict';
  3986. var _prodInvariant = _dereq_(126);
  3987. var invariant = _dereq_(152);
  3988. var injected = false;
  3989. var ReactComponentEnvironment = {
  3990. /**
  3991. * Optionally injectable hook for swapping out mount images in the middle of
  3992. * the tree.
  3993. */
  3994. replaceNodeWithMarkup: null,
  3995. /**
  3996. * Optionally injectable hook for processing a queue of child updates. Will
  3997. * later move into MultiChildComponents.
  3998. */
  3999. processChildrenUpdates: null,
  4000. injection: {
  4001. injectEnvironment: function (environment) {
  4002. !!injected ? "development" !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : _prodInvariant('104') : void 0;
  4003. ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup;
  4004. ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
  4005. injected = true;
  4006. }
  4007. }
  4008. };
  4009. module.exports = ReactComponentEnvironment;
  4010. },{"126":126,"152":152}],30:[function(_dereq_,module,exports){
  4011. /**
  4012. * Copyright 2013-present, Facebook, Inc.
  4013. * All rights reserved.
  4014. *
  4015. * This source code is licensed under the BSD-style license found in the
  4016. * LICENSE file in the root directory of this source tree. An additional grant
  4017. * of patent rights can be found in the PATENTS file in the same directory.
  4018. *
  4019. */
  4020. 'use strict';
  4021. var _prodInvariant = _dereq_(126),
  4022. _assign = _dereq_(160);
  4023. var React = _dereq_(135);
  4024. var ReactComponentEnvironment = _dereq_(29);
  4025. var ReactCurrentOwner = _dereq_(134);
  4026. var ReactErrorUtils = _dereq_(55);
  4027. var ReactInstanceMap = _dereq_(63);
  4028. var ReactInstrumentation = _dereq_(64);
  4029. var ReactNodeTypes = _dereq_(69);
  4030. var ReactReconciler = _dereq_(75);
  4031. if ("development" !== 'production') {
  4032. var checkReactTypeSpec = _dereq_(104);
  4033. }
  4034. var emptyObject = _dereq_(145);
  4035. var invariant = _dereq_(152);
  4036. var shallowEqual = _dereq_(158);
  4037. var shouldUpdateReactComponent = _dereq_(130);
  4038. var warning = _dereq_(159);
  4039. var CompositeTypes = {
  4040. ImpureClass: 0,
  4041. PureClass: 1,
  4042. StatelessFunctional: 2
  4043. };
  4044. function StatelessComponent(Component) {}
  4045. StatelessComponent.prototype.render = function () {
  4046. var Component = ReactInstanceMap.get(this)._currentElement.type;
  4047. var element = Component(this.props, this.context, this.updater);
  4048. warnIfInvalidElement(Component, element);
  4049. return element;
  4050. };
  4051. function warnIfInvalidElement(Component, element) {
  4052. if ("development" !== 'production') {
  4053. "development" !== 'production' ? warning(element === null || element === false || React.isValidElement(element), '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : void 0;
  4054. "development" !== 'production' ? warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component') : void 0;
  4055. }
  4056. }
  4057. function shouldConstruct(Component) {
  4058. return !!(Component.prototype && Component.prototype.isReactComponent);
  4059. }
  4060. function isPureComponent(Component) {
  4061. return !!(Component.prototype && Component.prototype.isPureReactComponent);
  4062. }
  4063. // Separated into a function to contain deoptimizations caused by try/finally.
  4064. function measureLifeCyclePerf(fn, debugID, timerType) {
  4065. if (debugID === 0) {
  4066. // Top-level wrappers (see ReactMount) and empty components (see
  4067. // ReactDOMEmptyComponent) are invisible to hooks and devtools.
  4068. // Both are implementation details that should go away in the future.
  4069. return fn();
  4070. }
  4071. ReactInstrumentation.debugTool.onBeginLifeCycleTimer(debugID, timerType);
  4072. try {
  4073. return fn();
  4074. } finally {
  4075. ReactInstrumentation.debugTool.onEndLifeCycleTimer(debugID, timerType);
  4076. }
  4077. }
  4078. /**
  4079. * ------------------ The Life-Cycle of a Composite Component ------------------
  4080. *
  4081. * - constructor: Initialization of state. The instance is now retained.
  4082. * - componentWillMount
  4083. * - render
  4084. * - [children's constructors]
  4085. * - [children's componentWillMount and render]
  4086. * - [children's componentDidMount]
  4087. * - componentDidMount
  4088. *
  4089. * Update Phases:
  4090. * - componentWillReceiveProps (only called if parent updated)
  4091. * - shouldComponentUpdate
  4092. * - componentWillUpdate
  4093. * - render
  4094. * - [children's constructors or receive props phases]
  4095. * - componentDidUpdate
  4096. *
  4097. * - componentWillUnmount
  4098. * - [children's componentWillUnmount]
  4099. * - [children destroyed]
  4100. * - (destroyed): The instance is now blank, released by React and ready for GC.
  4101. *
  4102. * -----------------------------------------------------------------------------
  4103. */
  4104. /**
  4105. * An incrementing ID assigned to each component when it is mounted. This is
  4106. * used to enforce the order in which `ReactUpdates` updates dirty components.
  4107. *
  4108. * @private
  4109. */
  4110. var nextMountID = 1;
  4111. /**
  4112. * @lends {ReactCompositeComponent.prototype}
  4113. */
  4114. var ReactCompositeComponent = {
  4115. /**
  4116. * Base constructor for all composite component.
  4117. *
  4118. * @param {ReactElement} element
  4119. * @final
  4120. * @internal
  4121. */
  4122. construct: function (element) {
  4123. this._currentElement = element;
  4124. this._rootNodeID = 0;
  4125. this._compositeType = null;
  4126. this._instance = null;
  4127. this._hostParent = null;
  4128. this._hostContainerInfo = null;
  4129. // See ReactUpdateQueue
  4130. this._updateBatchNumber = null;
  4131. this._pendingElement = null;
  4132. this._pendingStateQueue = null;
  4133. this._pendingReplaceState = false;
  4134. this._pendingForceUpdate = false;
  4135. this._renderedNodeType = null;
  4136. this._renderedComponent = null;
  4137. this._context = null;
  4138. this._mountOrder = 0;
  4139. this._topLevelWrapper = null;
  4140. // See ReactUpdates and ReactUpdateQueue.
  4141. this._pendingCallbacks = null;
  4142. // ComponentWillUnmount shall only be called once
  4143. this._calledComponentWillUnmount = false;
  4144. if ("development" !== 'production') {
  4145. this._warnedAboutRefsInRender = false;
  4146. }
  4147. },
  4148. /**
  4149. * Initializes the component, renders markup, and registers event listeners.
  4150. *
  4151. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  4152. * @param {?object} hostParent
  4153. * @param {?object} hostContainerInfo
  4154. * @param {?object} context
  4155. * @return {?string} Rendered markup to be inserted into the DOM.
  4156. * @final
  4157. * @internal
  4158. */
  4159. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  4160. var _this = this;
  4161. this._context = context;
  4162. this._mountOrder = nextMountID++;
  4163. this._hostParent = hostParent;
  4164. this._hostContainerInfo = hostContainerInfo;
  4165. var publicProps = this._currentElement.props;
  4166. var publicContext = this._processContext(context);
  4167. var Component = this._currentElement.type;
  4168. var updateQueue = transaction.getUpdateQueue();
  4169. // Initialize the public class
  4170. var doConstruct = shouldConstruct(Component);
  4171. var inst = this._constructComponent(doConstruct, publicProps, publicContext, updateQueue);
  4172. var renderedElement;
  4173. // Support functional components
  4174. if (!doConstruct && (inst == null || inst.render == null)) {
  4175. renderedElement = inst;
  4176. warnIfInvalidElement(Component, renderedElement);
  4177. !(inst === null || inst === false || React.isValidElement(inst)) ? "development" !== 'production' ? invariant(false, '%s(...): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : _prodInvariant('105', Component.displayName || Component.name || 'Component') : void 0;
  4178. inst = new StatelessComponent(Component);
  4179. this._compositeType = CompositeTypes.StatelessFunctional;
  4180. } else {
  4181. if (isPureComponent(Component)) {
  4182. this._compositeType = CompositeTypes.PureClass;
  4183. } else {
  4184. this._compositeType = CompositeTypes.ImpureClass;
  4185. }
  4186. }
  4187. if ("development" !== 'production') {
  4188. // This will throw later in _renderValidatedComponent, but add an early
  4189. // warning now to help debugging
  4190. if (inst.render == null) {
  4191. "development" !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', Component.displayName || Component.name || 'Component') : void 0;
  4192. }
  4193. var propsMutated = inst.props !== publicProps;
  4194. var componentName = Component.displayName || Component.name || 'Component';
  4195. "development" !== 'production' ? warning(inst.props === undefined || !propsMutated, '%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", componentName, componentName) : void 0;
  4196. }
  4197. // These should be set up in the constructor, but as a convenience for
  4198. // simpler class abstractions, we set them up after the fact.
  4199. inst.props = publicProps;
  4200. inst.context = publicContext;
  4201. inst.refs = emptyObject;
  4202. inst.updater = updateQueue;
  4203. this._instance = inst;
  4204. // Store a reference from the instance back to the internal representation
  4205. ReactInstanceMap.set(inst, this);
  4206. if ("development" !== 'production') {
  4207. // Since plain JS classes are defined without any special initialization
  4208. // logic, we can not catch common errors early. Therefore, we have to
  4209. // catch them here, at initialization time, instead.
  4210. "development" !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved || inst.state, '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') : void 0;
  4211. "development" !== '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') : void 0;
  4212. "development" !== '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') : void 0;
  4213. "development" !== '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') : void 0;
  4214. "development" !== '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') : void 0;
  4215. "development" !== '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') : void 0;
  4216. "development" !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : void 0;
  4217. }
  4218. var initialState = inst.state;
  4219. if (initialState === undefined) {
  4220. inst.state = initialState = null;
  4221. }
  4222. !(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : _prodInvariant('106', this.getName() || 'ReactCompositeComponent') : void 0;
  4223. this._pendingStateQueue = null;
  4224. this._pendingReplaceState = false;
  4225. this._pendingForceUpdate = false;
  4226. var markup;
  4227. if (inst.unstable_handleError) {
  4228. markup = this.performInitialMountWithErrorHandling(renderedElement, hostParent, hostContainerInfo, transaction, context);
  4229. } else {
  4230. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  4231. }
  4232. if (inst.componentDidMount) {
  4233. if ("development" !== 'production') {
  4234. transaction.getReactMountReady().enqueue(function () {
  4235. measureLifeCyclePerf(function () {
  4236. return inst.componentDidMount();
  4237. }, _this._debugID, 'componentDidMount');
  4238. });
  4239. } else {
  4240. transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
  4241. }
  4242. }
  4243. return markup;
  4244. },
  4245. _constructComponent: function (doConstruct, publicProps, publicContext, updateQueue) {
  4246. if ("development" !== 'production') {
  4247. ReactCurrentOwner.current = this;
  4248. try {
  4249. return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
  4250. } finally {
  4251. ReactCurrentOwner.current = null;
  4252. }
  4253. } else {
  4254. return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
  4255. }
  4256. },
  4257. _constructComponentWithoutOwner: function (doConstruct, publicProps, publicContext, updateQueue) {
  4258. var Component = this._currentElement.type;
  4259. if (doConstruct) {
  4260. if ("development" !== 'production') {
  4261. return measureLifeCyclePerf(function () {
  4262. return new Component(publicProps, publicContext, updateQueue);
  4263. }, this._debugID, 'ctor');
  4264. } else {
  4265. return new Component(publicProps, publicContext, updateQueue);
  4266. }
  4267. }
  4268. // This can still be an instance in case of factory components
  4269. // but we'll count this as time spent rendering as the more common case.
  4270. if ("development" !== 'production') {
  4271. return measureLifeCyclePerf(function () {
  4272. return Component(publicProps, publicContext, updateQueue);
  4273. }, this._debugID, 'render');
  4274. } else {
  4275. return Component(publicProps, publicContext, updateQueue);
  4276. }
  4277. },
  4278. performInitialMountWithErrorHandling: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
  4279. var markup;
  4280. var checkpoint = transaction.checkpoint();
  4281. try {
  4282. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  4283. } catch (e) {
  4284. // Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint
  4285. transaction.rollback(checkpoint);
  4286. this._instance.unstable_handleError(e);
  4287. if (this._pendingStateQueue) {
  4288. this._instance.state = this._processPendingState(this._instance.props, this._instance.context);
  4289. }
  4290. checkpoint = transaction.checkpoint();
  4291. this._renderedComponent.unmountComponent(true);
  4292. transaction.rollback(checkpoint);
  4293. // Try again - we've informed the component about the error, so they can render an error message this time.
  4294. // If this throws again, the error will bubble up (and can be caught by a higher error boundary).
  4295. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  4296. }
  4297. return markup;
  4298. },
  4299. performInitialMount: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
  4300. var inst = this._instance;
  4301. var debugID = 0;
  4302. if ("development" !== 'production') {
  4303. debugID = this._debugID;
  4304. }
  4305. if (inst.componentWillMount) {
  4306. if ("development" !== 'production') {
  4307. measureLifeCyclePerf(function () {
  4308. return inst.componentWillMount();
  4309. }, debugID, 'componentWillMount');
  4310. } else {
  4311. inst.componentWillMount();
  4312. }
  4313. // When mounting, calls to `setState` by `componentWillMount` will set
  4314. // `this._pendingStateQueue` without triggering a re-render.
  4315. if (this._pendingStateQueue) {
  4316. inst.state = this._processPendingState(inst.props, inst.context);
  4317. }
  4318. }
  4319. // If not a stateless component, we now render
  4320. if (renderedElement === undefined) {
  4321. renderedElement = this._renderValidatedComponent();
  4322. }
  4323. var nodeType = ReactNodeTypes.getType(renderedElement);
  4324. this._renderedNodeType = nodeType;
  4325. var child = this._instantiateReactComponent(renderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
  4326. );
  4327. this._renderedComponent = child;
  4328. var markup = ReactReconciler.mountComponent(child, transaction, hostParent, hostContainerInfo, this._processChildContext(context), debugID);
  4329. if ("development" !== 'production') {
  4330. if (debugID !== 0) {
  4331. var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
  4332. ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
  4333. }
  4334. }
  4335. return markup;
  4336. },
  4337. getHostNode: function () {
  4338. return ReactReconciler.getHostNode(this._renderedComponent);
  4339. },
  4340. /**
  4341. * Releases any resources allocated by `mountComponent`.
  4342. *
  4343. * @final
  4344. * @internal
  4345. */
  4346. unmountComponent: function (safely) {
  4347. if (!this._renderedComponent) {
  4348. return;
  4349. }
  4350. var inst = this._instance;
  4351. if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) {
  4352. inst._calledComponentWillUnmount = true;
  4353. if (safely) {
  4354. var name = this.getName() + '.componentWillUnmount()';
  4355. ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst));
  4356. } else {
  4357. if ("development" !== 'production') {
  4358. measureLifeCyclePerf(function () {
  4359. return inst.componentWillUnmount();
  4360. }, this._debugID, 'componentWillUnmount');
  4361. } else {
  4362. inst.componentWillUnmount();
  4363. }
  4364. }
  4365. }
  4366. if (this._renderedComponent) {
  4367. ReactReconciler.unmountComponent(this._renderedComponent, safely);
  4368. this._renderedNodeType = null;
  4369. this._renderedComponent = null;
  4370. this._instance = null;
  4371. }
  4372. // Reset pending fields
  4373. // Even if this component is scheduled for another update in ReactUpdates,
  4374. // it would still be ignored because these fields are reset.
  4375. this._pendingStateQueue = null;
  4376. this._pendingReplaceState = false;
  4377. this._pendingForceUpdate = false;
  4378. this._pendingCallbacks = null;
  4379. this._pendingElement = null;
  4380. // These fields do not really need to be reset since this object is no
  4381. // longer accessible.
  4382. this._context = null;
  4383. this._rootNodeID = 0;
  4384. this._topLevelWrapper = null;
  4385. // Delete the reference from the instance to this internal representation
  4386. // which allow the internals to be properly cleaned up even if the user
  4387. // leaks a reference to the public instance.
  4388. ReactInstanceMap.remove(inst);
  4389. // Some existing components rely on inst.props even after they've been
  4390. // destroyed (in event handlers).
  4391. // TODO: inst.props = null;
  4392. // TODO: inst.state = null;
  4393. // TODO: inst.context = null;
  4394. },
  4395. /**
  4396. * Filters the context object to only contain keys specified in
  4397. * `contextTypes`
  4398. *
  4399. * @param {object} context
  4400. * @return {?object}
  4401. * @private
  4402. */
  4403. _maskContext: function (context) {
  4404. var Component = this._currentElement.type;
  4405. var contextTypes = Component.contextTypes;
  4406. if (!contextTypes) {
  4407. return emptyObject;
  4408. }
  4409. var maskedContext = {};
  4410. for (var contextName in contextTypes) {
  4411. maskedContext[contextName] = context[contextName];
  4412. }
  4413. return maskedContext;
  4414. },
  4415. /**
  4416. * Filters the context object to only contain keys specified in
  4417. * `contextTypes`, and asserts that they are valid.
  4418. *
  4419. * @param {object} context
  4420. * @return {?object}
  4421. * @private
  4422. */
  4423. _processContext: function (context) {
  4424. var maskedContext = this._maskContext(context);
  4425. if ("development" !== 'production') {
  4426. var Component = this._currentElement.type;
  4427. if (Component.contextTypes) {
  4428. this._checkContextTypes(Component.contextTypes, maskedContext, 'context');
  4429. }
  4430. }
  4431. return maskedContext;
  4432. },
  4433. /**
  4434. * @param {object} currentContext
  4435. * @return {object}
  4436. * @private
  4437. */
  4438. _processChildContext: function (currentContext) {
  4439. var Component = this._currentElement.type;
  4440. var inst = this._instance;
  4441. var childContext;
  4442. if (inst.getChildContext) {
  4443. if ("development" !== 'production') {
  4444. ReactInstrumentation.debugTool.onBeginProcessingChildContext();
  4445. try {
  4446. childContext = inst.getChildContext();
  4447. } finally {
  4448. ReactInstrumentation.debugTool.onEndProcessingChildContext();
  4449. }
  4450. } else {
  4451. childContext = inst.getChildContext();
  4452. }
  4453. }
  4454. if (childContext) {
  4455. !(typeof Component.childContextTypes === 'object') ? "development" !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().', this.getName() || 'ReactCompositeComponent') : _prodInvariant('107', this.getName() || 'ReactCompositeComponent') : void 0;
  4456. if ("development" !== 'production') {
  4457. this._checkContextTypes(Component.childContextTypes, childContext, 'child context');
  4458. }
  4459. for (var name in childContext) {
  4460. !(name in Component.childContextTypes) ? "development" !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : _prodInvariant('108', this.getName() || 'ReactCompositeComponent', name) : void 0;
  4461. }
  4462. return _assign({}, currentContext, childContext);
  4463. }
  4464. return currentContext;
  4465. },
  4466. /**
  4467. * Assert that the context types are valid
  4468. *
  4469. * @param {object} typeSpecs Map of context field to a ReactPropType
  4470. * @param {object} values Runtime values that need to be type-checked
  4471. * @param {string} location e.g. "prop", "context", "child context"
  4472. * @private
  4473. */
  4474. _checkContextTypes: function (typeSpecs, values, location) {
  4475. if ("development" !== 'production') {
  4476. checkReactTypeSpec(typeSpecs, values, location, this.getName(), null, this._debugID);
  4477. }
  4478. },
  4479. receiveComponent: function (nextElement, transaction, nextContext) {
  4480. var prevElement = this._currentElement;
  4481. var prevContext = this._context;
  4482. this._pendingElement = null;
  4483. this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
  4484. },
  4485. /**
  4486. * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
  4487. * is set, update the component.
  4488. *
  4489. * @param {ReactReconcileTransaction} transaction
  4490. * @internal
  4491. */
  4492. performUpdateIfNecessary: function (transaction) {
  4493. if (this._pendingElement != null) {
  4494. ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context);
  4495. } else if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
  4496. this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
  4497. } else {
  4498. this._updateBatchNumber = null;
  4499. }
  4500. },
  4501. /**
  4502. * Perform an update to a mounted component. The componentWillReceiveProps and
  4503. * shouldComponentUpdate methods are called, then (assuming the update isn't
  4504. * skipped) the remaining update lifecycle methods are called and the DOM
  4505. * representation is updated.
  4506. *
  4507. * By default, this implements React's rendering and reconciliation algorithm.
  4508. * Sophisticated clients may wish to override this.
  4509. *
  4510. * @param {ReactReconcileTransaction} transaction
  4511. * @param {ReactElement} prevParentElement
  4512. * @param {ReactElement} nextParentElement
  4513. * @internal
  4514. * @overridable
  4515. */
  4516. updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
  4517. var inst = this._instance;
  4518. !(inst != null) ? "development" !== 'production' ? invariant(false, 'Attempted to update component `%s` that has already been unmounted (or failed to mount).', this.getName() || 'ReactCompositeComponent') : _prodInvariant('136', this.getName() || 'ReactCompositeComponent') : void 0;
  4519. var willReceive = false;
  4520. var nextContext;
  4521. // Determine if the context has changed or not
  4522. if (this._context === nextUnmaskedContext) {
  4523. nextContext = inst.context;
  4524. } else {
  4525. nextContext = this._processContext(nextUnmaskedContext);
  4526. willReceive = true;
  4527. }
  4528. var prevProps = prevParentElement.props;
  4529. var nextProps = nextParentElement.props;
  4530. // Not a simple state update but a props update
  4531. if (prevParentElement !== nextParentElement) {
  4532. willReceive = true;
  4533. }
  4534. // An update here will schedule an update but immediately set
  4535. // _pendingStateQueue which will ensure that any state updates gets
  4536. // immediately reconciled instead of waiting for the next batch.
  4537. if (willReceive && inst.componentWillReceiveProps) {
  4538. if ("development" !== 'production') {
  4539. measureLifeCyclePerf(function () {
  4540. return inst.componentWillReceiveProps(nextProps, nextContext);
  4541. }, this._debugID, 'componentWillReceiveProps');
  4542. } else {
  4543. inst.componentWillReceiveProps(nextProps, nextContext);
  4544. }
  4545. }
  4546. var nextState = this._processPendingState(nextProps, nextContext);
  4547. var shouldUpdate = true;
  4548. if (!this._pendingForceUpdate) {
  4549. if (inst.shouldComponentUpdate) {
  4550. if ("development" !== 'production') {
  4551. shouldUpdate = measureLifeCyclePerf(function () {
  4552. return inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  4553. }, this._debugID, 'shouldComponentUpdate');
  4554. } else {
  4555. shouldUpdate = inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  4556. }
  4557. } else {
  4558. if (this._compositeType === CompositeTypes.PureClass) {
  4559. shouldUpdate = !shallowEqual(prevProps, nextProps) || !shallowEqual(inst.state, nextState);
  4560. }
  4561. }
  4562. }
  4563. if ("development" !== 'production') {
  4564. "development" !== 'production' ? warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : void 0;
  4565. }
  4566. this._updateBatchNumber = null;
  4567. if (shouldUpdate) {
  4568. this._pendingForceUpdate = false;
  4569. // Will set `this.props`, `this.state` and `this.context`.
  4570. this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
  4571. } else {
  4572. // If it's determined that a component should not update, we still want
  4573. // to set props and state but we shortcut the rest of the update.
  4574. this._currentElement = nextParentElement;
  4575. this._context = nextUnmaskedContext;
  4576. inst.props = nextProps;
  4577. inst.state = nextState;
  4578. inst.context = nextContext;
  4579. }
  4580. },
  4581. _processPendingState: function (props, context) {
  4582. var inst = this._instance;
  4583. var queue = this._pendingStateQueue;
  4584. var replace = this._pendingReplaceState;
  4585. this._pendingReplaceState = false;
  4586. this._pendingStateQueue = null;
  4587. if (!queue) {
  4588. return inst.state;
  4589. }
  4590. if (replace && queue.length === 1) {
  4591. return queue[0];
  4592. }
  4593. var nextState = _assign({}, replace ? queue[0] : inst.state);
  4594. for (var i = replace ? 1 : 0; i < queue.length; i++) {
  4595. var partial = queue[i];
  4596. _assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
  4597. }
  4598. return nextState;
  4599. },
  4600. /**
  4601. * Merges new props and state, notifies delegate methods of update and
  4602. * performs update.
  4603. *
  4604. * @param {ReactElement} nextElement Next element
  4605. * @param {object} nextProps Next public object to set as properties.
  4606. * @param {?object} nextState Next object to set as state.
  4607. * @param {?object} nextContext Next public object to set as context.
  4608. * @param {ReactReconcileTransaction} transaction
  4609. * @param {?object} unmaskedContext
  4610. * @private
  4611. */
  4612. _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
  4613. var _this2 = this;
  4614. var inst = this._instance;
  4615. var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
  4616. var prevProps;
  4617. var prevState;
  4618. var prevContext;
  4619. if (hasComponentDidUpdate) {
  4620. prevProps = inst.props;
  4621. prevState = inst.state;
  4622. prevContext = inst.context;
  4623. }
  4624. if (inst.componentWillUpdate) {
  4625. if ("development" !== 'production') {
  4626. measureLifeCyclePerf(function () {
  4627. return inst.componentWillUpdate(nextProps, nextState, nextContext);
  4628. }, this._debugID, 'componentWillUpdate');
  4629. } else {
  4630. inst.componentWillUpdate(nextProps, nextState, nextContext);
  4631. }
  4632. }
  4633. this._currentElement = nextElement;
  4634. this._context = unmaskedContext;
  4635. inst.props = nextProps;
  4636. inst.state = nextState;
  4637. inst.context = nextContext;
  4638. this._updateRenderedComponent(transaction, unmaskedContext);
  4639. if (hasComponentDidUpdate) {
  4640. if ("development" !== 'production') {
  4641. transaction.getReactMountReady().enqueue(function () {
  4642. measureLifeCyclePerf(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), _this2._debugID, 'componentDidUpdate');
  4643. });
  4644. } else {
  4645. transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
  4646. }
  4647. }
  4648. },
  4649. /**
  4650. * Call the component's `render` method and update the DOM accordingly.
  4651. *
  4652. * @param {ReactReconcileTransaction} transaction
  4653. * @internal
  4654. */
  4655. _updateRenderedComponent: function (transaction, context) {
  4656. var prevComponentInstance = this._renderedComponent;
  4657. var prevRenderedElement = prevComponentInstance._currentElement;
  4658. var nextRenderedElement = this._renderValidatedComponent();
  4659. var debugID = 0;
  4660. if ("development" !== 'production') {
  4661. debugID = this._debugID;
  4662. }
  4663. if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
  4664. ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
  4665. } else {
  4666. var oldHostNode = ReactReconciler.getHostNode(prevComponentInstance);
  4667. ReactReconciler.unmountComponent(prevComponentInstance, false);
  4668. var nodeType = ReactNodeTypes.getType(nextRenderedElement);
  4669. this._renderedNodeType = nodeType;
  4670. var child = this._instantiateReactComponent(nextRenderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
  4671. );
  4672. this._renderedComponent = child;
  4673. var nextMarkup = ReactReconciler.mountComponent(child, transaction, this._hostParent, this._hostContainerInfo, this._processChildContext(context), debugID);
  4674. if ("development" !== 'production') {
  4675. if (debugID !== 0) {
  4676. var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
  4677. ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
  4678. }
  4679. }
  4680. this._replaceNodeWithMarkup(oldHostNode, nextMarkup, prevComponentInstance);
  4681. }
  4682. },
  4683. /**
  4684. * Overridden in shallow rendering.
  4685. *
  4686. * @protected
  4687. */
  4688. _replaceNodeWithMarkup: function (oldHostNode, nextMarkup, prevInstance) {
  4689. ReactComponentEnvironment.replaceNodeWithMarkup(oldHostNode, nextMarkup, prevInstance);
  4690. },
  4691. /**
  4692. * @protected
  4693. */
  4694. _renderValidatedComponentWithoutOwnerOrContext: function () {
  4695. var inst = this._instance;
  4696. var renderedElement;
  4697. if ("development" !== 'production') {
  4698. renderedElement = measureLifeCyclePerf(function () {
  4699. return inst.render();
  4700. }, this._debugID, 'render');
  4701. } else {
  4702. renderedElement = inst.render();
  4703. }
  4704. if ("development" !== 'production') {
  4705. // We allow auto-mocks to proceed as if they're returning null.
  4706. if (renderedElement === undefined && inst.render._isMockFunction) {
  4707. // This is probably bad practice. Consider warning here and
  4708. // deprecating this convenience.
  4709. renderedElement = null;
  4710. }
  4711. }
  4712. return renderedElement;
  4713. },
  4714. /**
  4715. * @private
  4716. */
  4717. _renderValidatedComponent: function () {
  4718. var renderedElement;
  4719. if ("development" !== 'production' || this._compositeType !== CompositeTypes.StatelessFunctional) {
  4720. ReactCurrentOwner.current = this;
  4721. try {
  4722. renderedElement = this._renderValidatedComponentWithoutOwnerOrContext();
  4723. } finally {
  4724. ReactCurrentOwner.current = null;
  4725. }
  4726. } else {
  4727. renderedElement = this._renderValidatedComponentWithoutOwnerOrContext();
  4728. }
  4729. !(
  4730. // TODO: An `isValidNode` function would probably be more appropriate
  4731. renderedElement === null || renderedElement === false || React.isValidElement(renderedElement)) ? "development" !== 'production' ? invariant(false, '%s.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : _prodInvariant('109', this.getName() || 'ReactCompositeComponent') : void 0;
  4732. return renderedElement;
  4733. },
  4734. /**
  4735. * Lazily allocates the refs object and stores `component` as `ref`.
  4736. *
  4737. * @param {string} ref Reference name.
  4738. * @param {component} component Component to store as `ref`.
  4739. * @final
  4740. * @private
  4741. */
  4742. attachRef: function (ref, component) {
  4743. var inst = this.getPublicInstance();
  4744. !(inst != null) ? "development" !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : _prodInvariant('110') : void 0;
  4745. var publicComponentInstance = component.getPublicInstance();
  4746. if ("development" !== 'production') {
  4747. var componentName = component && component.getName ? component.getName() : 'a component';
  4748. "development" !== 'production' ? warning(publicComponentInstance != null || component._compositeType !== CompositeTypes.StatelessFunctional, '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()) : void 0;
  4749. }
  4750. var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
  4751. refs[ref] = publicComponentInstance;
  4752. },
  4753. /**
  4754. * Detaches a reference name.
  4755. *
  4756. * @param {string} ref Name to dereference.
  4757. * @final
  4758. * @private
  4759. */
  4760. detachRef: function (ref) {
  4761. var refs = this.getPublicInstance().refs;
  4762. delete refs[ref];
  4763. },
  4764. /**
  4765. * Get a text description of the component that can be used to identify it
  4766. * in error messages.
  4767. * @return {string} The name or null.
  4768. * @internal
  4769. */
  4770. getName: function () {
  4771. var type = this._currentElement.type;
  4772. var constructor = this._instance && this._instance.constructor;
  4773. return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
  4774. },
  4775. /**
  4776. * Get the publicly accessible representation of this component - i.e. what
  4777. * is exposed by refs and returned by render. Can be null for stateless
  4778. * components.
  4779. *
  4780. * @return {ReactComponent} the public component instance.
  4781. * @internal
  4782. */
  4783. getPublicInstance: function () {
  4784. var inst = this._instance;
  4785. if (this._compositeType === CompositeTypes.StatelessFunctional) {
  4786. return null;
  4787. }
  4788. return inst;
  4789. },
  4790. // Stub
  4791. _instantiateReactComponent: null
  4792. };
  4793. module.exports = ReactCompositeComponent;
  4794. },{"104":104,"126":126,"130":130,"134":134,"135":135,"145":145,"152":152,"158":158,"159":159,"160":160,"29":29,"55":55,"63":63,"64":64,"69":69,"75":75}],31:[function(_dereq_,module,exports){
  4795. /**
  4796. * Copyright 2013-present, Facebook, Inc.
  4797. * All rights reserved.
  4798. *
  4799. * This source code is licensed under the BSD-style license found in the
  4800. * LICENSE file in the root directory of this source tree. An additional grant
  4801. * of patent rights can be found in the PATENTS file in the same directory.
  4802. *
  4803. */
  4804. /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
  4805. 'use strict';
  4806. var ReactDOMComponentTree = _dereq_(34);
  4807. var ReactDefaultInjection = _dereq_(52);
  4808. var ReactMount = _dereq_(67);
  4809. var ReactReconciler = _dereq_(75);
  4810. var ReactUpdates = _dereq_(82);
  4811. var ReactVersion = _dereq_(83);
  4812. var findDOMNode = _dereq_(108);
  4813. var getHostComponentFromComposite = _dereq_(115);
  4814. var renderSubtreeIntoContainer = _dereq_(127);
  4815. var warning = _dereq_(159);
  4816. ReactDefaultInjection.inject();
  4817. var ReactDOM = {
  4818. findDOMNode: findDOMNode,
  4819. render: ReactMount.render,
  4820. unmountComponentAtNode: ReactMount.unmountComponentAtNode,
  4821. version: ReactVersion,
  4822. /* eslint-disable camelcase */
  4823. unstable_batchedUpdates: ReactUpdates.batchedUpdates,
  4824. unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
  4825. /* eslint-enable camelcase */
  4826. };
  4827. // Inject the runtime into a devtools global hook regardless of browser.
  4828. // Allows for debugging when the hook is injected on the page.
  4829. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
  4830. __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
  4831. ComponentTree: {
  4832. getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode,
  4833. getNodeFromInstance: function (inst) {
  4834. // inst is an internal instance (but could be a composite)
  4835. if (inst._renderedComponent) {
  4836. inst = getHostComponentFromComposite(inst);
  4837. }
  4838. if (inst) {
  4839. return ReactDOMComponentTree.getNodeFromInstance(inst);
  4840. } else {
  4841. return null;
  4842. }
  4843. }
  4844. },
  4845. Mount: ReactMount,
  4846. Reconciler: ReactReconciler
  4847. });
  4848. }
  4849. if ("development" !== 'production') {
  4850. var ExecutionEnvironment = _dereq_(138);
  4851. if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
  4852. // First check if devtools is not installed
  4853. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
  4854. // If we're in Chrome or Firefox, provide a download link if not installed.
  4855. if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
  4856. // Firefox does not have the issue with devtools loaded over file://
  4857. var showFileUrlMessage = window.location.protocol.indexOf('http') === -1 && navigator.userAgent.indexOf('Firefox') === -1;
  4858. console.debug('Download the React DevTools ' + (showFileUrlMessage ? 'and use an HTTP server (instead of a file: URL) ' : '') + 'for a better development experience: ' + 'https://fb.me/react-devtools');
  4859. }
  4860. }
  4861. var testFunc = function testFn() {};
  4862. "development" !== 'production' ? warning((testFunc.name || testFunc.toString()).indexOf('testFn') !== -1, "It looks like you're using a minified copy of the development build " + 'of React. When deploying React apps to production, make sure to use ' + 'the production build which skips development warnings and is faster. ' + 'See https://fb.me/react-minification for more details.') : void 0;
  4863. // If we're in IE8, check to see if we are in compatibility mode and provide
  4864. // information on preventing compatibility mode
  4865. var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
  4866. "development" !== '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" />') : void 0;
  4867. var expectedFeatures = [
  4868. // shims
  4869. Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.trim];
  4870. for (var i = 0; i < expectedFeatures.length; i++) {
  4871. if (!expectedFeatures[i]) {
  4872. "development" !== 'production' ? warning(false, 'One or more ES5 shims expected by React are not available: ' + 'https://fb.me/react-warning-polyfills') : void 0;
  4873. break;
  4874. }
  4875. }
  4876. }
  4877. }
  4878. if ("development" !== 'production') {
  4879. var ReactInstrumentation = _dereq_(64);
  4880. var ReactDOMUnknownPropertyHook = _dereq_(49);
  4881. var ReactDOMNullInputValuePropHook = _dereq_(41);
  4882. var ReactDOMInvalidARIAHook = _dereq_(40);
  4883. ReactInstrumentation.debugTool.addHook(ReactDOMUnknownPropertyHook);
  4884. ReactInstrumentation.debugTool.addHook(ReactDOMNullInputValuePropHook);
  4885. ReactInstrumentation.debugTool.addHook(ReactDOMInvalidARIAHook);
  4886. }
  4887. module.exports = ReactDOM;
  4888. },{"108":108,"115":115,"127":127,"138":138,"159":159,"34":34,"40":40,"41":41,"49":49,"52":52,"64":64,"67":67,"75":75,"82":82,"83":83}],32:[function(_dereq_,module,exports){
  4889. /**
  4890. * Copyright 2013-present, Facebook, Inc.
  4891. * All rights reserved.
  4892. *
  4893. * This source code is licensed under the BSD-style license found in the
  4894. * LICENSE file in the root directory of this source tree. An additional grant
  4895. * of patent rights can be found in the PATENTS file in the same directory.
  4896. *
  4897. */
  4898. /* global hasOwnProperty:true */
  4899. 'use strict';
  4900. var _prodInvariant = _dereq_(126),
  4901. _assign = _dereq_(160);
  4902. var AutoFocusUtils = _dereq_(2);
  4903. var CSSPropertyOperations = _dereq_(5);
  4904. var DOMLazyTree = _dereq_(9);
  4905. var DOMNamespaces = _dereq_(10);
  4906. var DOMProperty = _dereq_(11);
  4907. var DOMPropertyOperations = _dereq_(12);
  4908. var EventPluginHub = _dereq_(17);
  4909. var EventPluginRegistry = _dereq_(18);
  4910. var ReactBrowserEventEmitter = _dereq_(26);
  4911. var ReactDOMComponentFlags = _dereq_(33);
  4912. var ReactDOMComponentTree = _dereq_(34);
  4913. var ReactDOMInput = _dereq_(39);
  4914. var ReactDOMOption = _dereq_(42);
  4915. var ReactDOMSelect = _dereq_(43);
  4916. var ReactDOMTextarea = _dereq_(46);
  4917. var ReactInstrumentation = _dereq_(64);
  4918. var ReactMultiChild = _dereq_(68);
  4919. var ReactServerRenderingTransaction = _dereq_(77);
  4920. var emptyFunction = _dereq_(144);
  4921. var escapeTextContentForBrowser = _dereq_(107);
  4922. var invariant = _dereq_(152);
  4923. var isEventSupported = _dereq_(122);
  4924. var shallowEqual = _dereq_(158);
  4925. var inputValueTracking = _dereq_(120);
  4926. var validateDOMNesting = _dereq_(132);
  4927. var warning = _dereq_(159);
  4928. var Flags = ReactDOMComponentFlags;
  4929. var deleteListener = EventPluginHub.deleteListener;
  4930. var getNode = ReactDOMComponentTree.getNodeFromInstance;
  4931. var listenTo = ReactBrowserEventEmitter.listenTo;
  4932. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  4933. // For quickly matching children type, to test if can be treated as content.
  4934. var CONTENT_TYPES = { string: true, number: true };
  4935. var STYLE = 'style';
  4936. var HTML = '__html';
  4937. var RESERVED_PROPS = {
  4938. children: null,
  4939. dangerouslySetInnerHTML: null,
  4940. suppressContentEditableWarning: null
  4941. };
  4942. // Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE).
  4943. var DOC_FRAGMENT_TYPE = 11;
  4944. function getDeclarationErrorAddendum(internalInstance) {
  4945. if (internalInstance) {
  4946. var owner = internalInstance._currentElement._owner || null;
  4947. if (owner) {
  4948. var name = owner.getName();
  4949. if (name) {
  4950. return ' This DOM node was rendered by `' + name + '`.';
  4951. }
  4952. }
  4953. }
  4954. return '';
  4955. }
  4956. function friendlyStringify(obj) {
  4957. if (typeof obj === 'object') {
  4958. if (Array.isArray(obj)) {
  4959. return '[' + obj.map(friendlyStringify).join(', ') + ']';
  4960. } else {
  4961. var pairs = [];
  4962. for (var key in obj) {
  4963. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  4964. var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
  4965. pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
  4966. }
  4967. }
  4968. return '{' + pairs.join(', ') + '}';
  4969. }
  4970. } else if (typeof obj === 'string') {
  4971. return JSON.stringify(obj);
  4972. } else if (typeof obj === 'function') {
  4973. return '[function object]';
  4974. }
  4975. // Differs from JSON.stringify in that undefined because undefined and that
  4976. // inf and nan don't become null
  4977. return String(obj);
  4978. }
  4979. var styleMutationWarning = {};
  4980. function checkAndWarnForMutatedStyle(style1, style2, component) {
  4981. if (style1 == null || style2 == null) {
  4982. return;
  4983. }
  4984. if (shallowEqual(style1, style2)) {
  4985. return;
  4986. }
  4987. var componentName = component._tag;
  4988. var owner = component._currentElement._owner;
  4989. var ownerName;
  4990. if (owner) {
  4991. ownerName = owner.getName();
  4992. }
  4993. var hash = ownerName + '|' + componentName;
  4994. if (styleMutationWarning.hasOwnProperty(hash)) {
  4995. return;
  4996. }
  4997. styleMutationWarning[hash] = true;
  4998. "development" !== '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)) : void 0;
  4999. }
  5000. /**
  5001. * @param {object} component
  5002. * @param {?object} props
  5003. */
  5004. function assertValidProps(component, props) {
  5005. if (!props) {
  5006. return;
  5007. }
  5008. // Note the use of `==` which checks for null or undefined.
  5009. if (voidElementTags[component._tag]) {
  5010. !(props.children == null && props.dangerouslySetInnerHTML == null) ? "development" !== 'production' ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : _prodInvariant('137', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : void 0;
  5011. }
  5012. if (props.dangerouslySetInnerHTML != null) {
  5013. !(props.children == null) ? "development" !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : _prodInvariant('60') : void 0;
  5014. !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? "development" !== '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.') : _prodInvariant('61') : void 0;
  5015. }
  5016. if ("development" !== 'production') {
  5017. "development" !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : void 0;
  5018. "development" !== 'production' ? warning(props.suppressContentEditableWarning || !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.') : void 0;
  5019. "development" !== 'production' ? warning(props.onFocusIn == null && props.onFocusOut == null, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.') : void 0;
  5020. }
  5021. !(props.style == null || typeof props.style === 'object') ? "development" !== '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)) : _prodInvariant('62', getDeclarationErrorAddendum(component)) : void 0;
  5022. }
  5023. function enqueuePutListener(inst, registrationName, listener, transaction) {
  5024. if (transaction instanceof ReactServerRenderingTransaction) {
  5025. return;
  5026. }
  5027. if ("development" !== 'production') {
  5028. // IE8 has no API for event capturing and the `onScroll` event doesn't
  5029. // bubble.
  5030. "development" !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), "This browser doesn't support the `onScroll` event") : void 0;
  5031. }
  5032. var containerInfo = inst._hostContainerInfo;
  5033. var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE;
  5034. var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument;
  5035. listenTo(registrationName, doc);
  5036. transaction.getReactMountReady().enqueue(putListener, {
  5037. inst: inst,
  5038. registrationName: registrationName,
  5039. listener: listener
  5040. });
  5041. }
  5042. function putListener() {
  5043. var listenerToPut = this;
  5044. EventPluginHub.putListener(listenerToPut.inst, listenerToPut.registrationName, listenerToPut.listener);
  5045. }
  5046. function inputPostMount() {
  5047. var inst = this;
  5048. ReactDOMInput.postMountWrapper(inst);
  5049. }
  5050. function textareaPostMount() {
  5051. var inst = this;
  5052. ReactDOMTextarea.postMountWrapper(inst);
  5053. }
  5054. function optionPostMount() {
  5055. var inst = this;
  5056. ReactDOMOption.postMountWrapper(inst);
  5057. }
  5058. var setAndValidateContentChildDev = emptyFunction;
  5059. if ("development" !== 'production') {
  5060. setAndValidateContentChildDev = function (content) {
  5061. var hasExistingContent = this._contentDebugID != null;
  5062. var debugID = this._debugID;
  5063. // This ID represents the inlined child that has no backing instance:
  5064. var contentDebugID = -debugID;
  5065. if (content == null) {
  5066. if (hasExistingContent) {
  5067. ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID);
  5068. }
  5069. this._contentDebugID = null;
  5070. return;
  5071. }
  5072. validateDOMNesting(null, String(content), this, this._ancestorInfo);
  5073. this._contentDebugID = contentDebugID;
  5074. if (hasExistingContent) {
  5075. ReactInstrumentation.debugTool.onBeforeUpdateComponent(contentDebugID, content);
  5076. ReactInstrumentation.debugTool.onUpdateComponent(contentDebugID);
  5077. } else {
  5078. ReactInstrumentation.debugTool.onBeforeMountComponent(contentDebugID, content, debugID);
  5079. ReactInstrumentation.debugTool.onMountComponent(contentDebugID);
  5080. ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]);
  5081. }
  5082. };
  5083. }
  5084. // There are so many media events, it makes sense to just
  5085. // maintain a list rather than create a `trapBubbledEvent` for each
  5086. var mediaEvents = {
  5087. topAbort: 'abort',
  5088. topCanPlay: 'canplay',
  5089. topCanPlayThrough: 'canplaythrough',
  5090. topDurationChange: 'durationchange',
  5091. topEmptied: 'emptied',
  5092. topEncrypted: 'encrypted',
  5093. topEnded: 'ended',
  5094. topError: 'error',
  5095. topLoadedData: 'loadeddata',
  5096. topLoadedMetadata: 'loadedmetadata',
  5097. topLoadStart: 'loadstart',
  5098. topPause: 'pause',
  5099. topPlay: 'play',
  5100. topPlaying: 'playing',
  5101. topProgress: 'progress',
  5102. topRateChange: 'ratechange',
  5103. topSeeked: 'seeked',
  5104. topSeeking: 'seeking',
  5105. topStalled: 'stalled',
  5106. topSuspend: 'suspend',
  5107. topTimeUpdate: 'timeupdate',
  5108. topVolumeChange: 'volumechange',
  5109. topWaiting: 'waiting'
  5110. };
  5111. function trackInputValue() {
  5112. inputValueTracking.track(this);
  5113. }
  5114. function trapBubbledEventsLocal() {
  5115. var inst = this;
  5116. // If a component renders to null or if another component fatals and causes
  5117. // the state of the tree to be corrupted, `node` here can be null.
  5118. !inst._rootNodeID ? "development" !== 'production' ? invariant(false, 'Must be mounted to trap events') : _prodInvariant('63') : void 0;
  5119. var node = getNode(inst);
  5120. !node ? "development" !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : _prodInvariant('64') : void 0;
  5121. switch (inst._tag) {
  5122. case 'iframe':
  5123. case 'object':
  5124. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)];
  5125. break;
  5126. case 'video':
  5127. case 'audio':
  5128. inst._wrapperState.listeners = [];
  5129. // Create listener for each media event
  5130. for (var event in mediaEvents) {
  5131. if (mediaEvents.hasOwnProperty(event)) {
  5132. inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(event, mediaEvents[event], node));
  5133. }
  5134. }
  5135. break;
  5136. case 'source':
  5137. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node)];
  5138. break;
  5139. case 'img':
  5140. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node), ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)];
  5141. break;
  5142. case 'form':
  5143. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topReset', 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent('topSubmit', 'submit', node)];
  5144. break;
  5145. case 'input':
  5146. case 'select':
  5147. case 'textarea':
  5148. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topInvalid', 'invalid', node)];
  5149. break;
  5150. }
  5151. }
  5152. function postUpdateSelectWrapper() {
  5153. ReactDOMSelect.postUpdateWrapper(this);
  5154. }
  5155. // For HTML, certain tags should omit their close tag. We keep a whitelist for
  5156. // those special-case tags.
  5157. var omittedCloseTags = {
  5158. area: true,
  5159. base: true,
  5160. br: true,
  5161. col: true,
  5162. embed: true,
  5163. hr: true,
  5164. img: true,
  5165. input: true,
  5166. keygen: true,
  5167. link: true,
  5168. meta: true,
  5169. param: true,
  5170. source: true,
  5171. track: true,
  5172. wbr: true
  5173. // NOTE: menuitem's close tag should be omitted, but that causes problems.
  5174. };
  5175. var newlineEatingTags = {
  5176. listing: true,
  5177. pre: true,
  5178. textarea: true
  5179. };
  5180. // For HTML, certain tags cannot have children. This has the same purpose as
  5181. // `omittedCloseTags` except that `menuitem` should still have its closing tag.
  5182. var voidElementTags = _assign({
  5183. menuitem: true
  5184. }, omittedCloseTags);
  5185. // We accept any tag to be rendered but since this gets injected into arbitrary
  5186. // HTML, we want to make sure that it's a safe tag.
  5187. // http://www.w3.org/TR/REC-xml/#NT-Name
  5188. var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
  5189. var validatedTagCache = {};
  5190. var hasOwnProperty = {}.hasOwnProperty;
  5191. function validateDangerousTag(tag) {
  5192. if (!hasOwnProperty.call(validatedTagCache, tag)) {
  5193. !VALID_TAG_REGEX.test(tag) ? "development" !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : _prodInvariant('65', tag) : void 0;
  5194. validatedTagCache[tag] = true;
  5195. }
  5196. }
  5197. function isCustomComponent(tagName, props) {
  5198. return tagName.indexOf('-') >= 0 || props.is != null;
  5199. }
  5200. var globalIdCounter = 1;
  5201. /**
  5202. * Creates a new React class that is idempotent and capable of containing other
  5203. * React components. It accepts event listeners and DOM properties that are
  5204. * valid according to `DOMProperty`.
  5205. *
  5206. * - Event listeners: `onClick`, `onMouseDown`, etc.
  5207. * - DOM properties: `className`, `name`, `title`, etc.
  5208. *
  5209. * The `style` property functions differently from the DOM API. It accepts an
  5210. * object mapping of style properties to values.
  5211. *
  5212. * @constructor ReactDOMComponent
  5213. * @extends ReactMultiChild
  5214. */
  5215. function ReactDOMComponent(element) {
  5216. var tag = element.type;
  5217. validateDangerousTag(tag);
  5218. this._currentElement = element;
  5219. this._tag = tag.toLowerCase();
  5220. this._namespaceURI = null;
  5221. this._renderedChildren = null;
  5222. this._previousStyle = null;
  5223. this._previousStyleCopy = null;
  5224. this._hostNode = null;
  5225. this._hostParent = null;
  5226. this._rootNodeID = 0;
  5227. this._domID = 0;
  5228. this._hostContainerInfo = null;
  5229. this._wrapperState = null;
  5230. this._topLevelWrapper = null;
  5231. this._flags = 0;
  5232. if ("development" !== 'production') {
  5233. this._ancestorInfo = null;
  5234. setAndValidateContentChildDev.call(this, null);
  5235. }
  5236. }
  5237. ReactDOMComponent.displayName = 'ReactDOMComponent';
  5238. ReactDOMComponent.Mixin = {
  5239. /**
  5240. * Generates root tag markup then recurses. This method has side effects and
  5241. * is not idempotent.
  5242. *
  5243. * @internal
  5244. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  5245. * @param {?ReactDOMComponent} the parent component instance
  5246. * @param {?object} info about the host container
  5247. * @param {object} context
  5248. * @return {string} The computed markup.
  5249. */
  5250. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  5251. this._rootNodeID = globalIdCounter++;
  5252. this._domID = hostContainerInfo._idCounter++;
  5253. this._hostParent = hostParent;
  5254. this._hostContainerInfo = hostContainerInfo;
  5255. var props = this._currentElement.props;
  5256. switch (this._tag) {
  5257. case 'audio':
  5258. case 'form':
  5259. case 'iframe':
  5260. case 'img':
  5261. case 'link':
  5262. case 'object':
  5263. case 'source':
  5264. case 'video':
  5265. this._wrapperState = {
  5266. listeners: null
  5267. };
  5268. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  5269. break;
  5270. case 'input':
  5271. ReactDOMInput.mountWrapper(this, props, hostParent);
  5272. props = ReactDOMInput.getHostProps(this, props);
  5273. transaction.getReactMountReady().enqueue(trackInputValue, this);
  5274. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  5275. break;
  5276. case 'option':
  5277. ReactDOMOption.mountWrapper(this, props, hostParent);
  5278. props = ReactDOMOption.getHostProps(this, props);
  5279. break;
  5280. case 'select':
  5281. ReactDOMSelect.mountWrapper(this, props, hostParent);
  5282. props = ReactDOMSelect.getHostProps(this, props);
  5283. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  5284. break;
  5285. case 'textarea':
  5286. ReactDOMTextarea.mountWrapper(this, props, hostParent);
  5287. props = ReactDOMTextarea.getHostProps(this, props);
  5288. transaction.getReactMountReady().enqueue(trackInputValue, this);
  5289. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  5290. break;
  5291. }
  5292. assertValidProps(this, props);
  5293. // We create tags in the namespace of their parent container, except HTML
  5294. // tags get no namespace.
  5295. var namespaceURI;
  5296. var parentTag;
  5297. if (hostParent != null) {
  5298. namespaceURI = hostParent._namespaceURI;
  5299. parentTag = hostParent._tag;
  5300. } else if (hostContainerInfo._tag) {
  5301. namespaceURI = hostContainerInfo._namespaceURI;
  5302. parentTag = hostContainerInfo._tag;
  5303. }
  5304. if (namespaceURI == null || namespaceURI === DOMNamespaces.svg && parentTag === 'foreignobject') {
  5305. namespaceURI = DOMNamespaces.html;
  5306. }
  5307. if (namespaceURI === DOMNamespaces.html) {
  5308. if (this._tag === 'svg') {
  5309. namespaceURI = DOMNamespaces.svg;
  5310. } else if (this._tag === 'math') {
  5311. namespaceURI = DOMNamespaces.mathml;
  5312. }
  5313. }
  5314. this._namespaceURI = namespaceURI;
  5315. if ("development" !== 'production') {
  5316. var parentInfo;
  5317. if (hostParent != null) {
  5318. parentInfo = hostParent._ancestorInfo;
  5319. } else if (hostContainerInfo._tag) {
  5320. parentInfo = hostContainerInfo._ancestorInfo;
  5321. }
  5322. if (parentInfo) {
  5323. // parentInfo should always be present except for the top-level
  5324. // component when server rendering
  5325. validateDOMNesting(this._tag, null, this, parentInfo);
  5326. }
  5327. this._ancestorInfo = validateDOMNesting.updatedAncestorInfo(parentInfo, this._tag, this);
  5328. }
  5329. var mountImage;
  5330. if (transaction.useCreateElement) {
  5331. var ownerDocument = hostContainerInfo._ownerDocument;
  5332. var el;
  5333. if (namespaceURI === DOMNamespaces.html) {
  5334. if (this._tag === 'script') {
  5335. // Create the script via .innerHTML so its "parser-inserted" flag is
  5336. // set to true and it does not execute
  5337. var div = ownerDocument.createElement('div');
  5338. var type = this._currentElement.type;
  5339. div.innerHTML = '<' + type + '></' + type + '>';
  5340. el = div.removeChild(div.firstChild);
  5341. } else if (props.is) {
  5342. el = ownerDocument.createElement(this._currentElement.type, props.is);
  5343. } else {
  5344. // Separate else branch instead of using `props.is || undefined` above becuase of a Firefox bug.
  5345. // See discussion in https://github.com/facebook/react/pull/6896
  5346. // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
  5347. el = ownerDocument.createElement(this._currentElement.type);
  5348. }
  5349. } else {
  5350. el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type);
  5351. }
  5352. ReactDOMComponentTree.precacheNode(this, el);
  5353. this._flags |= Flags.hasCachedChildNodes;
  5354. if (!this._hostParent) {
  5355. DOMPropertyOperations.setAttributeForRoot(el);
  5356. }
  5357. this._updateDOMProperties(null, props, transaction);
  5358. var lazyTree = DOMLazyTree(el);
  5359. this._createInitialChildren(transaction, props, context, lazyTree);
  5360. mountImage = lazyTree;
  5361. } else {
  5362. var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
  5363. var tagContent = this._createContentMarkup(transaction, props, context);
  5364. if (!tagContent && omittedCloseTags[this._tag]) {
  5365. mountImage = tagOpen + '/>';
  5366. } else {
  5367. mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
  5368. }
  5369. }
  5370. switch (this._tag) {
  5371. case 'input':
  5372. transaction.getReactMountReady().enqueue(inputPostMount, this);
  5373. if (props.autoFocus) {
  5374. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  5375. }
  5376. break;
  5377. case 'textarea':
  5378. transaction.getReactMountReady().enqueue(textareaPostMount, this);
  5379. if (props.autoFocus) {
  5380. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  5381. }
  5382. break;
  5383. case 'select':
  5384. if (props.autoFocus) {
  5385. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  5386. }
  5387. break;
  5388. case 'button':
  5389. if (props.autoFocus) {
  5390. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  5391. }
  5392. break;
  5393. case 'option':
  5394. transaction.getReactMountReady().enqueue(optionPostMount, this);
  5395. break;
  5396. }
  5397. return mountImage;
  5398. },
  5399. /**
  5400. * Creates markup for the open tag and all attributes.
  5401. *
  5402. * This method has side effects because events get registered.
  5403. *
  5404. * Iterating over object properties is faster than iterating over arrays.
  5405. * @see http://jsperf.com/obj-vs-arr-iteration
  5406. *
  5407. * @private
  5408. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  5409. * @param {object} props
  5410. * @return {string} Markup of opening tag.
  5411. */
  5412. _createOpenTagMarkupAndPutListeners: function (transaction, props) {
  5413. var ret = '<' + this._currentElement.type;
  5414. for (var propKey in props) {
  5415. if (!props.hasOwnProperty(propKey)) {
  5416. continue;
  5417. }
  5418. var propValue = props[propKey];
  5419. if (propValue == null) {
  5420. continue;
  5421. }
  5422. if (registrationNameModules.hasOwnProperty(propKey)) {
  5423. if (propValue) {
  5424. enqueuePutListener(this, propKey, propValue, transaction);
  5425. }
  5426. } else {
  5427. if (propKey === STYLE) {
  5428. if (propValue) {
  5429. if ("development" !== 'production') {
  5430. // See `_updateDOMProperties`. style block
  5431. this._previousStyle = propValue;
  5432. }
  5433. propValue = this._previousStyleCopy = _assign({}, props.style);
  5434. }
  5435. propValue = CSSPropertyOperations.createMarkupForStyles(propValue, this);
  5436. }
  5437. var markup = null;
  5438. if (this._tag != null && isCustomComponent(this._tag, props)) {
  5439. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  5440. markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
  5441. }
  5442. } else {
  5443. markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
  5444. }
  5445. if (markup) {
  5446. ret += ' ' + markup;
  5447. }
  5448. }
  5449. }
  5450. // For static pages, no need to put React ID and checksum. Saves lots of
  5451. // bytes.
  5452. if (transaction.renderToStaticMarkup) {
  5453. return ret;
  5454. }
  5455. if (!this._hostParent) {
  5456. ret += ' ' + DOMPropertyOperations.createMarkupForRoot();
  5457. }
  5458. ret += ' ' + DOMPropertyOperations.createMarkupForID(this._domID);
  5459. return ret;
  5460. },
  5461. /**
  5462. * Creates markup for the content between the tags.
  5463. *
  5464. * @private
  5465. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  5466. * @param {object} props
  5467. * @param {object} context
  5468. * @return {string} Content markup.
  5469. */
  5470. _createContentMarkup: function (transaction, props, context) {
  5471. var ret = '';
  5472. // Intentional use of != to avoid catching zero/false.
  5473. var innerHTML = props.dangerouslySetInnerHTML;
  5474. if (innerHTML != null) {
  5475. if (innerHTML.__html != null) {
  5476. ret = innerHTML.__html;
  5477. }
  5478. } else {
  5479. var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
  5480. var childrenToUse = contentToUse != null ? null : props.children;
  5481. if (contentToUse != null) {
  5482. // TODO: Validate that text is allowed as a child of this node
  5483. ret = escapeTextContentForBrowser(contentToUse);
  5484. if ("development" !== 'production') {
  5485. setAndValidateContentChildDev.call(this, contentToUse);
  5486. }
  5487. } else if (childrenToUse != null) {
  5488. var mountImages = this.mountChildren(childrenToUse, transaction, context);
  5489. ret = mountImages.join('');
  5490. }
  5491. }
  5492. if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
  5493. // text/html ignores the first character in these tags if it's a newline
  5494. // Prefer to break application/xml over text/html (for now) by adding
  5495. // a newline specifically to get eaten by the parser. (Alternately for
  5496. // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
  5497. // \r is normalized out by HTMLTextAreaElement#value.)
  5498. // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
  5499. // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
  5500. // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
  5501. // See: Parsing of "textarea" "listing" and "pre" elements
  5502. // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
  5503. return '\n' + ret;
  5504. } else {
  5505. return ret;
  5506. }
  5507. },
  5508. _createInitialChildren: function (transaction, props, context, lazyTree) {
  5509. // Intentional use of != to avoid catching zero/false.
  5510. var innerHTML = props.dangerouslySetInnerHTML;
  5511. if (innerHTML != null) {
  5512. if (innerHTML.__html != null) {
  5513. DOMLazyTree.queueHTML(lazyTree, innerHTML.__html);
  5514. }
  5515. } else {
  5516. var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
  5517. var childrenToUse = contentToUse != null ? null : props.children;
  5518. // TODO: Validate that text is allowed as a child of this node
  5519. if (contentToUse != null) {
  5520. // Avoid setting textContent when the text is empty. In IE11 setting
  5521. // textContent on a text area will cause the placeholder to not
  5522. // show within the textarea until it has been focused and blurred again.
  5523. // https://github.com/facebook/react/issues/6731#issuecomment-254874553
  5524. if (contentToUse !== '') {
  5525. if ("development" !== 'production') {
  5526. setAndValidateContentChildDev.call(this, contentToUse);
  5527. }
  5528. DOMLazyTree.queueText(lazyTree, contentToUse);
  5529. }
  5530. } else if (childrenToUse != null) {
  5531. var mountImages = this.mountChildren(childrenToUse, transaction, context);
  5532. for (var i = 0; i < mountImages.length; i++) {
  5533. DOMLazyTree.queueChild(lazyTree, mountImages[i]);
  5534. }
  5535. }
  5536. }
  5537. },
  5538. /**
  5539. * Receives a next element and updates the component.
  5540. *
  5541. * @internal
  5542. * @param {ReactElement} nextElement
  5543. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  5544. * @param {object} context
  5545. */
  5546. receiveComponent: function (nextElement, transaction, context) {
  5547. var prevElement = this._currentElement;
  5548. this._currentElement = nextElement;
  5549. this.updateComponent(transaction, prevElement, nextElement, context);
  5550. },
  5551. /**
  5552. * Updates a DOM component after it has already been allocated and
  5553. * attached to the DOM. Reconciles the root DOM node, then recurses.
  5554. *
  5555. * @param {ReactReconcileTransaction} transaction
  5556. * @param {ReactElement} prevElement
  5557. * @param {ReactElement} nextElement
  5558. * @internal
  5559. * @overridable
  5560. */
  5561. updateComponent: function (transaction, prevElement, nextElement, context) {
  5562. var lastProps = prevElement.props;
  5563. var nextProps = this._currentElement.props;
  5564. switch (this._tag) {
  5565. case 'input':
  5566. lastProps = ReactDOMInput.getHostProps(this, lastProps);
  5567. nextProps = ReactDOMInput.getHostProps(this, nextProps);
  5568. break;
  5569. case 'option':
  5570. lastProps = ReactDOMOption.getHostProps(this, lastProps);
  5571. nextProps = ReactDOMOption.getHostProps(this, nextProps);
  5572. break;
  5573. case 'select':
  5574. lastProps = ReactDOMSelect.getHostProps(this, lastProps);
  5575. nextProps = ReactDOMSelect.getHostProps(this, nextProps);
  5576. break;
  5577. case 'textarea':
  5578. lastProps = ReactDOMTextarea.getHostProps(this, lastProps);
  5579. nextProps = ReactDOMTextarea.getHostProps(this, nextProps);
  5580. break;
  5581. }
  5582. assertValidProps(this, nextProps);
  5583. this._updateDOMProperties(lastProps, nextProps, transaction);
  5584. this._updateDOMChildren(lastProps, nextProps, transaction, context);
  5585. switch (this._tag) {
  5586. case 'input':
  5587. // Update the wrapper around inputs *after* updating props. This has to
  5588. // happen after `_updateDOMProperties`. Otherwise HTML5 input validations
  5589. // raise warnings and prevent the new value from being assigned.
  5590. ReactDOMInput.updateWrapper(this);
  5591. break;
  5592. case 'textarea':
  5593. ReactDOMTextarea.updateWrapper(this);
  5594. break;
  5595. case 'select':
  5596. // <select> value update needs to occur after <option> children
  5597. // reconciliation
  5598. transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
  5599. break;
  5600. }
  5601. },
  5602. /**
  5603. * Reconciles the properties by detecting differences in property values and
  5604. * updating the DOM as necessary. This function is probably the single most
  5605. * critical path for performance optimization.
  5606. *
  5607. * TODO: Benchmark whether checking for changed values in memory actually
  5608. * improves performance (especially statically positioned elements).
  5609. * TODO: Benchmark the effects of putting this at the top since 99% of props
  5610. * do not change for a given reconciliation.
  5611. * TODO: Benchmark areas that can be improved with caching.
  5612. *
  5613. * @private
  5614. * @param {object} lastProps
  5615. * @param {object} nextProps
  5616. * @param {?DOMElement} node
  5617. */
  5618. _updateDOMProperties: function (lastProps, nextProps, transaction) {
  5619. var propKey;
  5620. var styleName;
  5621. var styleUpdates;
  5622. for (propKey in lastProps) {
  5623. if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
  5624. continue;
  5625. }
  5626. if (propKey === STYLE) {
  5627. var lastStyle = this._previousStyleCopy;
  5628. for (styleName in lastStyle) {
  5629. if (lastStyle.hasOwnProperty(styleName)) {
  5630. styleUpdates = styleUpdates || {};
  5631. styleUpdates[styleName] = '';
  5632. }
  5633. }
  5634. this._previousStyleCopy = null;
  5635. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  5636. if (lastProps[propKey]) {
  5637. // Only call deleteListener if there was a listener previously or
  5638. // else willDeleteListener gets called when there wasn't actually a
  5639. // listener (e.g., onClick={null})
  5640. deleteListener(this, propKey);
  5641. }
  5642. } else if (isCustomComponent(this._tag, lastProps)) {
  5643. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  5644. DOMPropertyOperations.deleteValueForAttribute(getNode(this), propKey);
  5645. }
  5646. } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
  5647. DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey);
  5648. }
  5649. }
  5650. for (propKey in nextProps) {
  5651. var nextProp = nextProps[propKey];
  5652. var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps != null ? lastProps[propKey] : undefined;
  5653. if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
  5654. continue;
  5655. }
  5656. if (propKey === STYLE) {
  5657. if (nextProp) {
  5658. if ("development" !== 'production') {
  5659. checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
  5660. this._previousStyle = nextProp;
  5661. }
  5662. nextProp = this._previousStyleCopy = _assign({}, nextProp);
  5663. } else {
  5664. this._previousStyleCopy = null;
  5665. }
  5666. if (lastProp) {
  5667. // Unset styles on `lastProp` but not on `nextProp`.
  5668. for (styleName in lastProp) {
  5669. if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
  5670. styleUpdates = styleUpdates || {};
  5671. styleUpdates[styleName] = '';
  5672. }
  5673. }
  5674. // Update styles that changed since `lastProp`.
  5675. for (styleName in nextProp) {
  5676. if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
  5677. styleUpdates = styleUpdates || {};
  5678. styleUpdates[styleName] = nextProp[styleName];
  5679. }
  5680. }
  5681. } else {
  5682. // Relies on `updateStylesByID` not mutating `styleUpdates`.
  5683. styleUpdates = nextProp;
  5684. }
  5685. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  5686. if (nextProp) {
  5687. enqueuePutListener(this, propKey, nextProp, transaction);
  5688. } else if (lastProp) {
  5689. deleteListener(this, propKey);
  5690. }
  5691. } else if (isCustomComponent(this._tag, nextProps)) {
  5692. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  5693. DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp);
  5694. }
  5695. } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
  5696. var node = getNode(this);
  5697. // If we're updating to null or undefined, we should remove the property
  5698. // from the DOM node instead of inadvertently setting to a string. This
  5699. // brings us in line with the same behavior we have on initial render.
  5700. if (nextProp != null) {
  5701. DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
  5702. } else {
  5703. DOMPropertyOperations.deleteValueForProperty(node, propKey);
  5704. }
  5705. }
  5706. }
  5707. if (styleUpdates) {
  5708. CSSPropertyOperations.setValueForStyles(getNode(this), styleUpdates, this);
  5709. }
  5710. },
  5711. /**
  5712. * Reconciles the children with the various properties that affect the
  5713. * children content.
  5714. *
  5715. * @param {object} lastProps
  5716. * @param {object} nextProps
  5717. * @param {ReactReconcileTransaction} transaction
  5718. * @param {object} context
  5719. */
  5720. _updateDOMChildren: function (lastProps, nextProps, transaction, context) {
  5721. var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
  5722. var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
  5723. var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
  5724. var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
  5725. // Note the use of `!=` which checks for null or undefined.
  5726. var lastChildren = lastContent != null ? null : lastProps.children;
  5727. var nextChildren = nextContent != null ? null : nextProps.children;
  5728. // If we're switching from children to content/html or vice versa, remove
  5729. // the old content
  5730. var lastHasContentOrHtml = lastContent != null || lastHtml != null;
  5731. var nextHasContentOrHtml = nextContent != null || nextHtml != null;
  5732. if (lastChildren != null && nextChildren == null) {
  5733. this.updateChildren(null, transaction, context);
  5734. } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
  5735. this.updateTextContent('');
  5736. if ("development" !== 'production') {
  5737. ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
  5738. }
  5739. }
  5740. if (nextContent != null) {
  5741. if (lastContent !== nextContent) {
  5742. this.updateTextContent('' + nextContent);
  5743. if ("development" !== 'production') {
  5744. setAndValidateContentChildDev.call(this, nextContent);
  5745. }
  5746. }
  5747. } else if (nextHtml != null) {
  5748. if (lastHtml !== nextHtml) {
  5749. this.updateMarkup('' + nextHtml);
  5750. }
  5751. if ("development" !== 'production') {
  5752. ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
  5753. }
  5754. } else if (nextChildren != null) {
  5755. if ("development" !== 'production') {
  5756. setAndValidateContentChildDev.call(this, null);
  5757. }
  5758. this.updateChildren(nextChildren, transaction, context);
  5759. }
  5760. },
  5761. getHostNode: function () {
  5762. return getNode(this);
  5763. },
  5764. /**
  5765. * Destroys all event registrations for this instance. Does not remove from
  5766. * the DOM. That must be done by the parent.
  5767. *
  5768. * @internal
  5769. */
  5770. unmountComponent: function (safely) {
  5771. switch (this._tag) {
  5772. case 'audio':
  5773. case 'form':
  5774. case 'iframe':
  5775. case 'img':
  5776. case 'link':
  5777. case 'object':
  5778. case 'source':
  5779. case 'video':
  5780. var listeners = this._wrapperState.listeners;
  5781. if (listeners) {
  5782. for (var i = 0; i < listeners.length; i++) {
  5783. listeners[i].remove();
  5784. }
  5785. }
  5786. break;
  5787. case 'input':
  5788. case 'textarea':
  5789. inputValueTracking.stopTracking(this);
  5790. break;
  5791. case 'html':
  5792. case 'head':
  5793. case 'body':
  5794. /**
  5795. * Components like <html> <head> and <body> can't be removed or added
  5796. * easily in a cross-browser way, however it's valuable to be able to
  5797. * take advantage of React's reconciliation for styling and <title>
  5798. * management. So we just document it and throw in dangerous cases.
  5799. */
  5800. !false ? "development" !== '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) : _prodInvariant('66', this._tag) : void 0;
  5801. break;
  5802. }
  5803. this.unmountChildren(safely);
  5804. ReactDOMComponentTree.uncacheNode(this);
  5805. EventPluginHub.deleteAllListeners(this);
  5806. this._rootNodeID = 0;
  5807. this._domID = 0;
  5808. this._wrapperState = null;
  5809. if ("development" !== 'production') {
  5810. setAndValidateContentChildDev.call(this, null);
  5811. }
  5812. },
  5813. getPublicInstance: function () {
  5814. return getNode(this);
  5815. }
  5816. };
  5817. _assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
  5818. module.exports = ReactDOMComponent;
  5819. },{"10":10,"107":107,"11":11,"12":12,"120":120,"122":122,"126":126,"132":132,"144":144,"152":152,"158":158,"159":159,"160":160,"17":17,"18":18,"2":2,"26":26,"33":33,"34":34,"39":39,"42":42,"43":43,"46":46,"5":5,"64":64,"68":68,"77":77,"9":9}],33:[function(_dereq_,module,exports){
  5820. /**
  5821. * Copyright 2015-present, Facebook, Inc.
  5822. * All rights reserved.
  5823. *
  5824. * This source code is licensed under the BSD-style license found in the
  5825. * LICENSE file in the root directory of this source tree. An additional grant
  5826. * of patent rights can be found in the PATENTS file in the same directory.
  5827. *
  5828. */
  5829. 'use strict';
  5830. var ReactDOMComponentFlags = {
  5831. hasCachedChildNodes: 1 << 0
  5832. };
  5833. module.exports = ReactDOMComponentFlags;
  5834. },{}],34:[function(_dereq_,module,exports){
  5835. /**
  5836. * Copyright 2013-present, Facebook, Inc.
  5837. * All rights reserved.
  5838. *
  5839. * This source code is licensed under the BSD-style license found in the
  5840. * LICENSE file in the root directory of this source tree. An additional grant
  5841. * of patent rights can be found in the PATENTS file in the same directory.
  5842. *
  5843. */
  5844. 'use strict';
  5845. var _prodInvariant = _dereq_(126);
  5846. var DOMProperty = _dereq_(11);
  5847. var ReactDOMComponentFlags = _dereq_(33);
  5848. var invariant = _dereq_(152);
  5849. var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
  5850. var Flags = ReactDOMComponentFlags;
  5851. var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2);
  5852. /**
  5853. * Check if a given node should be cached.
  5854. */
  5855. function shouldPrecacheNode(node, nodeID) {
  5856. return node.nodeType === 1 && node.getAttribute(ATTR_NAME) === String(nodeID) || node.nodeType === 8 && node.nodeValue === ' react-text: ' + nodeID + ' ' || node.nodeType === 8 && node.nodeValue === ' react-empty: ' + nodeID + ' ';
  5857. }
  5858. /**
  5859. * Drill down (through composites and empty components) until we get a host or
  5860. * host text component.
  5861. *
  5862. * This is pretty polymorphic but unavoidable with the current structure we have
  5863. * for `_renderedChildren`.
  5864. */
  5865. function getRenderedHostOrTextFromComponent(component) {
  5866. var rendered;
  5867. while (rendered = component._renderedComponent) {
  5868. component = rendered;
  5869. }
  5870. return component;
  5871. }
  5872. /**
  5873. * Populate `_hostNode` on the rendered host/text component with the given
  5874. * DOM node. The passed `inst` can be a composite.
  5875. */
  5876. function precacheNode(inst, node) {
  5877. var hostInst = getRenderedHostOrTextFromComponent(inst);
  5878. hostInst._hostNode = node;
  5879. node[internalInstanceKey] = hostInst;
  5880. }
  5881. function uncacheNode(inst) {
  5882. var node = inst._hostNode;
  5883. if (node) {
  5884. delete node[internalInstanceKey];
  5885. inst._hostNode = null;
  5886. }
  5887. }
  5888. /**
  5889. * Populate `_hostNode` on each child of `inst`, assuming that the children
  5890. * match up with the DOM (element) children of `node`.
  5891. *
  5892. * We cache entire levels at once to avoid an n^2 problem where we access the
  5893. * children of a node sequentially and have to walk from the start to our target
  5894. * node every time.
  5895. *
  5896. * Since we update `_renderedChildren` and the actual DOM at (slightly)
  5897. * different times, we could race here and see a newer `_renderedChildren` than
  5898. * the DOM nodes we see. To avoid this, ReactMultiChild calls
  5899. * `prepareToManageChildren` before we change `_renderedChildren`, at which
  5900. * time the container's child nodes are always cached (until it unmounts).
  5901. */
  5902. function precacheChildNodes(inst, node) {
  5903. if (inst._flags & Flags.hasCachedChildNodes) {
  5904. return;
  5905. }
  5906. var children = inst._renderedChildren;
  5907. var childNode = node.firstChild;
  5908. outer: for (var name in children) {
  5909. if (!children.hasOwnProperty(name)) {
  5910. continue;
  5911. }
  5912. var childInst = children[name];
  5913. var childID = getRenderedHostOrTextFromComponent(childInst)._domID;
  5914. if (childID === 0) {
  5915. // We're currently unmounting this child in ReactMultiChild; skip it.
  5916. continue;
  5917. }
  5918. // We assume the child nodes are in the same order as the child instances.
  5919. for (; childNode !== null; childNode = childNode.nextSibling) {
  5920. if (shouldPrecacheNode(childNode, childID)) {
  5921. precacheNode(childInst, childNode);
  5922. continue outer;
  5923. }
  5924. }
  5925. // We reached the end of the DOM children without finding an ID match.
  5926. !false ? "development" !== 'production' ? invariant(false, 'Unable to find element with ID %s.', childID) : _prodInvariant('32', childID) : void 0;
  5927. }
  5928. inst._flags |= Flags.hasCachedChildNodes;
  5929. }
  5930. /**
  5931. * Given a DOM node, return the closest ReactDOMComponent or
  5932. * ReactDOMTextComponent instance ancestor.
  5933. */
  5934. function getClosestInstanceFromNode(node) {
  5935. if (node[internalInstanceKey]) {
  5936. return node[internalInstanceKey];
  5937. }
  5938. // Walk up the tree until we find an ancestor whose instance we have cached.
  5939. var parents = [];
  5940. while (!node[internalInstanceKey]) {
  5941. parents.push(node);
  5942. if (node.parentNode) {
  5943. node = node.parentNode;
  5944. } else {
  5945. // Top of the tree. This node must not be part of a React tree (or is
  5946. // unmounted, potentially).
  5947. return null;
  5948. }
  5949. }
  5950. var closest;
  5951. var inst;
  5952. for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) {
  5953. closest = inst;
  5954. if (parents.length) {
  5955. precacheChildNodes(inst, node);
  5956. }
  5957. }
  5958. return closest;
  5959. }
  5960. /**
  5961. * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
  5962. * instance, or null if the node was not rendered by this React.
  5963. */
  5964. function getInstanceFromNode(node) {
  5965. var inst = getClosestInstanceFromNode(node);
  5966. if (inst != null && inst._hostNode === node) {
  5967. return inst;
  5968. } else {
  5969. return null;
  5970. }
  5971. }
  5972. /**
  5973. * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
  5974. * DOM node.
  5975. */
  5976. function getNodeFromInstance(inst) {
  5977. // Without this first invariant, passing a non-DOM-component triggers the next
  5978. // invariant for a missing parent, which is super confusing.
  5979. !(inst._hostNode !== undefined) ? "development" !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  5980. if (inst._hostNode) {
  5981. return inst._hostNode;
  5982. }
  5983. // Walk up the tree until we find an ancestor whose DOM node we have cached.
  5984. var parents = [];
  5985. while (!inst._hostNode) {
  5986. parents.push(inst);
  5987. !inst._hostParent ? "development" !== 'production' ? invariant(false, 'React DOM tree root should always have a node reference.') : _prodInvariant('34') : void 0;
  5988. inst = inst._hostParent;
  5989. }
  5990. // Now parents contains each ancestor that does *not* have a cached native
  5991. // node, and `inst` is the deepest ancestor that does.
  5992. for (; parents.length; inst = parents.pop()) {
  5993. precacheChildNodes(inst, inst._hostNode);
  5994. }
  5995. return inst._hostNode;
  5996. }
  5997. var ReactDOMComponentTree = {
  5998. getClosestInstanceFromNode: getClosestInstanceFromNode,
  5999. getInstanceFromNode: getInstanceFromNode,
  6000. getNodeFromInstance: getNodeFromInstance,
  6001. precacheChildNodes: precacheChildNodes,
  6002. precacheNode: precacheNode,
  6003. uncacheNode: uncacheNode
  6004. };
  6005. module.exports = ReactDOMComponentTree;
  6006. },{"11":11,"126":126,"152":152,"33":33}],35:[function(_dereq_,module,exports){
  6007. /**
  6008. * Copyright 2013-present, Facebook, Inc.
  6009. * All rights reserved.
  6010. *
  6011. * This source code is licensed under the BSD-style license found in the
  6012. * LICENSE file in the root directory of this source tree. An additional grant
  6013. * of patent rights can be found in the PATENTS file in the same directory.
  6014. *
  6015. */
  6016. 'use strict';
  6017. var validateDOMNesting = _dereq_(132);
  6018. var DOC_NODE_TYPE = 9;
  6019. function ReactDOMContainerInfo(topLevelWrapper, node) {
  6020. var info = {
  6021. _topLevelWrapper: topLevelWrapper,
  6022. _idCounter: 1,
  6023. _ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null,
  6024. _node: node,
  6025. _tag: node ? node.nodeName.toLowerCase() : null,
  6026. _namespaceURI: node ? node.namespaceURI : null
  6027. };
  6028. if ("development" !== 'production') {
  6029. info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null;
  6030. }
  6031. return info;
  6032. }
  6033. module.exports = ReactDOMContainerInfo;
  6034. },{"132":132}],36:[function(_dereq_,module,exports){
  6035. /**
  6036. * Copyright 2014-present, Facebook, Inc.
  6037. * All rights reserved.
  6038. *
  6039. * This source code is licensed under the BSD-style license found in the
  6040. * LICENSE file in the root directory of this source tree. An additional grant
  6041. * of patent rights can be found in the PATENTS file in the same directory.
  6042. *
  6043. */
  6044. 'use strict';
  6045. var _assign = _dereq_(160);
  6046. var DOMLazyTree = _dereq_(9);
  6047. var ReactDOMComponentTree = _dereq_(34);
  6048. var ReactDOMEmptyComponent = function (instantiate) {
  6049. // ReactCompositeComponent uses this:
  6050. this._currentElement = null;
  6051. // ReactDOMComponentTree uses these:
  6052. this._hostNode = null;
  6053. this._hostParent = null;
  6054. this._hostContainerInfo = null;
  6055. this._domID = 0;
  6056. };
  6057. _assign(ReactDOMEmptyComponent.prototype, {
  6058. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  6059. var domID = hostContainerInfo._idCounter++;
  6060. this._domID = domID;
  6061. this._hostParent = hostParent;
  6062. this._hostContainerInfo = hostContainerInfo;
  6063. var nodeValue = ' react-empty: ' + this._domID + ' ';
  6064. if (transaction.useCreateElement) {
  6065. var ownerDocument = hostContainerInfo._ownerDocument;
  6066. var node = ownerDocument.createComment(nodeValue);
  6067. ReactDOMComponentTree.precacheNode(this, node);
  6068. return DOMLazyTree(node);
  6069. } else {
  6070. if (transaction.renderToStaticMarkup) {
  6071. // Normally we'd insert a comment node, but since this is a situation
  6072. // where React won't take over (static pages), we can simply return
  6073. // nothing.
  6074. return '';
  6075. }
  6076. return '<!--' + nodeValue + '-->';
  6077. }
  6078. },
  6079. receiveComponent: function () {},
  6080. getHostNode: function () {
  6081. return ReactDOMComponentTree.getNodeFromInstance(this);
  6082. },
  6083. unmountComponent: function () {
  6084. ReactDOMComponentTree.uncacheNode(this);
  6085. }
  6086. });
  6087. module.exports = ReactDOMEmptyComponent;
  6088. },{"160":160,"34":34,"9":9}],37:[function(_dereq_,module,exports){
  6089. /**
  6090. * Copyright 2013-present, Facebook, Inc.
  6091. * All rights reserved.
  6092. *
  6093. * This source code is licensed under the BSD-style license found in the
  6094. * LICENSE file in the root directory of this source tree. An additional grant
  6095. * of patent rights can be found in the PATENTS file in the same directory.
  6096. *
  6097. */
  6098. 'use strict';
  6099. var ReactDOMFeatureFlags = {
  6100. useCreateElement: true,
  6101. useFiber: false
  6102. };
  6103. module.exports = ReactDOMFeatureFlags;
  6104. },{}],38:[function(_dereq_,module,exports){
  6105. /**
  6106. * Copyright 2013-present, Facebook, Inc.
  6107. * All rights reserved.
  6108. *
  6109. * This source code is licensed under the BSD-style license found in the
  6110. * LICENSE file in the root directory of this source tree. An additional grant
  6111. * of patent rights can be found in the PATENTS file in the same directory.
  6112. *
  6113. */
  6114. 'use strict';
  6115. var DOMChildrenOperations = _dereq_(8);
  6116. var ReactDOMComponentTree = _dereq_(34);
  6117. /**
  6118. * Operations used to process updates to DOM nodes.
  6119. */
  6120. var ReactDOMIDOperations = {
  6121. /**
  6122. * Updates a component's children by processing a series of updates.
  6123. *
  6124. * @param {array<object>} updates List of update configurations.
  6125. * @internal
  6126. */
  6127. dangerouslyProcessChildrenUpdates: function (parentInst, updates) {
  6128. var node = ReactDOMComponentTree.getNodeFromInstance(parentInst);
  6129. DOMChildrenOperations.processUpdates(node, updates);
  6130. }
  6131. };
  6132. module.exports = ReactDOMIDOperations;
  6133. },{"34":34,"8":8}],39:[function(_dereq_,module,exports){
  6134. /**
  6135. * Copyright 2013-present, Facebook, Inc.
  6136. * All rights reserved.
  6137. *
  6138. * This source code is licensed under the BSD-style license found in the
  6139. * LICENSE file in the root directory of this source tree. An additional grant
  6140. * of patent rights can be found in the PATENTS file in the same directory.
  6141. *
  6142. */
  6143. 'use strict';
  6144. var _prodInvariant = _dereq_(126),
  6145. _assign = _dereq_(160);
  6146. var DOMPropertyOperations = _dereq_(12);
  6147. var LinkedValueUtils = _dereq_(24);
  6148. var ReactDOMComponentTree = _dereq_(34);
  6149. var ReactUpdates = _dereq_(82);
  6150. var invariant = _dereq_(152);
  6151. var warning = _dereq_(159);
  6152. var didWarnValueLink = false;
  6153. var didWarnCheckedLink = false;
  6154. var didWarnValueDefaultValue = false;
  6155. var didWarnCheckedDefaultChecked = false;
  6156. var didWarnControlledToUncontrolled = false;
  6157. var didWarnUncontrolledToControlled = false;
  6158. function forceUpdateIfMounted() {
  6159. if (this._rootNodeID) {
  6160. // DOM component is still mounted; update
  6161. ReactDOMInput.updateWrapper(this);
  6162. }
  6163. }
  6164. function isControlled(props) {
  6165. var usesChecked = props.type === 'checkbox' || props.type === 'radio';
  6166. return usesChecked ? props.checked != null : props.value != null;
  6167. }
  6168. /**
  6169. * Implements an <input> host component that allows setting these optional
  6170. * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
  6171. *
  6172. * If `checked` or `value` are not supplied (or null/undefined), user actions
  6173. * that affect the checked state or value will trigger updates to the element.
  6174. *
  6175. * If they are supplied (and not null/undefined), the rendered element will not
  6176. * trigger updates to the element. Instead, the props must change in order for
  6177. * the rendered element to be updated.
  6178. *
  6179. * The rendered element will be initialized as unchecked (or `defaultChecked`)
  6180. * with an empty value (or `defaultValue`).
  6181. *
  6182. * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
  6183. */
  6184. var ReactDOMInput = {
  6185. getHostProps: function (inst, props) {
  6186. var value = LinkedValueUtils.getValue(props);
  6187. var checked = LinkedValueUtils.getChecked(props);
  6188. var hostProps = _assign({
  6189. // Make sure we set .type before any other properties (setting .value
  6190. // before .type means .value is lost in IE11 and below)
  6191. type: undefined,
  6192. // Make sure we set .step before .value (setting .value before .step
  6193. // means .value is rounded on mount, based upon step precision)
  6194. step: undefined,
  6195. // Make sure we set .min & .max before .value (to ensure proper order
  6196. // in corner cases such as min or max deriving from value, e.g. Issue #7170)
  6197. min: undefined,
  6198. max: undefined
  6199. }, props, {
  6200. defaultChecked: undefined,
  6201. defaultValue: undefined,
  6202. value: value != null ? value : inst._wrapperState.initialValue,
  6203. checked: checked != null ? checked : inst._wrapperState.initialChecked,
  6204. onChange: inst._wrapperState.onChange
  6205. });
  6206. return hostProps;
  6207. },
  6208. mountWrapper: function (inst, props) {
  6209. if ("development" !== 'production') {
  6210. LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
  6211. var owner = inst._currentElement._owner;
  6212. if (props.valueLink !== undefined && !didWarnValueLink) {
  6213. "development" !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
  6214. didWarnValueLink = true;
  6215. }
  6216. if (props.checkedLink !== undefined && !didWarnCheckedLink) {
  6217. "development" !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
  6218. didWarnCheckedLink = true;
  6219. }
  6220. if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
  6221. "development" !== 'production' ? warning(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
  6222. didWarnCheckedDefaultChecked = true;
  6223. }
  6224. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
  6225. "development" !== 'production' ? warning(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
  6226. didWarnValueDefaultValue = true;
  6227. }
  6228. }
  6229. var defaultValue = props.defaultValue;
  6230. inst._wrapperState = {
  6231. initialChecked: props.checked != null ? props.checked : props.defaultChecked,
  6232. initialValue: props.value != null ? props.value : defaultValue,
  6233. listeners: null,
  6234. onChange: _handleChange.bind(inst),
  6235. controlled: isControlled(props)
  6236. };
  6237. },
  6238. updateWrapper: function (inst) {
  6239. var props = inst._currentElement.props;
  6240. if ("development" !== 'production') {
  6241. var controlled = isControlled(props);
  6242. var owner = inst._currentElement._owner;
  6243. if (!inst._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) {
  6244. "development" !== 'production' ? warning(false, '%s is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
  6245. didWarnUncontrolledToControlled = true;
  6246. }
  6247. if (inst._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) {
  6248. "development" !== 'production' ? warning(false, '%s is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
  6249. didWarnControlledToUncontrolled = true;
  6250. }
  6251. }
  6252. // TODO: Shouldn't this be getChecked(props)?
  6253. var checked = props.checked;
  6254. if (checked != null) {
  6255. DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'checked', checked || false);
  6256. }
  6257. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  6258. var value = LinkedValueUtils.getValue(props);
  6259. if (value != null) {
  6260. if (value === 0 && node.value === '') {
  6261. node.value = '0';
  6262. // Note: IE9 reports a number inputs as 'text', so check props instead.
  6263. } else if (props.type === 'number') {
  6264. // Simulate `input.valueAsNumber`. IE9 does not support it
  6265. var valueAsNumber = parseFloat(node.value, 10) || 0;
  6266. if (
  6267. // eslint-disable-next-line
  6268. value != valueAsNumber ||
  6269. // eslint-disable-next-line
  6270. value == valueAsNumber && node.value != value) {
  6271. // Cast `value` to a string to ensure the value is set correctly. While
  6272. // browsers typically do this as necessary, jsdom doesn't.
  6273. node.value = '' + value;
  6274. }
  6275. } else if (node.value !== '' + value) {
  6276. // Cast `value` to a string to ensure the value is set correctly. While
  6277. // browsers typically do this as necessary, jsdom doesn't.
  6278. node.value = '' + value;
  6279. }
  6280. } else {
  6281. if (props.value == null && props.defaultValue != null) {
  6282. // In Chrome, assigning defaultValue to certain input types triggers input validation.
  6283. // For number inputs, the display value loses trailing decimal points. For email inputs,
  6284. // Chrome raises "The specified value <x> is not a valid email address".
  6285. //
  6286. // Here we check to see if the defaultValue has actually changed, avoiding these problems
  6287. // when the user is inputting text
  6288. //
  6289. // https://github.com/facebook/react/issues/7253
  6290. if (node.defaultValue !== '' + props.defaultValue) {
  6291. node.defaultValue = '' + props.defaultValue;
  6292. }
  6293. }
  6294. if (props.checked == null && props.defaultChecked != null) {
  6295. node.defaultChecked = !!props.defaultChecked;
  6296. }
  6297. }
  6298. },
  6299. postMountWrapper: function (inst) {
  6300. var props = inst._currentElement.props;
  6301. // This is in postMount because we need access to the DOM node, which is not
  6302. // available until after the component has mounted.
  6303. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  6304. // Detach value from defaultValue. We won't do anything if we're working on
  6305. // submit or reset inputs as those values & defaultValues are linked. They
  6306. // are not resetable nodes so this operation doesn't matter and actually
  6307. // removes browser-default values (eg "Submit Query") when no value is
  6308. // provided.
  6309. switch (props.type) {
  6310. case 'submit':
  6311. case 'reset':
  6312. break;
  6313. case 'color':
  6314. case 'date':
  6315. case 'datetime':
  6316. case 'datetime-local':
  6317. case 'month':
  6318. case 'time':
  6319. case 'week':
  6320. // This fixes the no-show issue on iOS Safari and Android Chrome:
  6321. // https://github.com/facebook/react/issues/7233
  6322. node.value = '';
  6323. node.value = node.defaultValue;
  6324. break;
  6325. default:
  6326. node.value = node.value;
  6327. break;
  6328. }
  6329. // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
  6330. // this is needed to work around a chrome bug where setting defaultChecked
  6331. // will sometimes influence the value of checked (even after detachment).
  6332. // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
  6333. // We need to temporarily unset name to avoid disrupting radio button groups.
  6334. var name = node.name;
  6335. if (name !== '') {
  6336. node.name = '';
  6337. }
  6338. node.defaultChecked = !node.defaultChecked;
  6339. node.defaultChecked = !node.defaultChecked;
  6340. if (name !== '') {
  6341. node.name = name;
  6342. }
  6343. }
  6344. };
  6345. function _handleChange(event) {
  6346. var props = this._currentElement.props;
  6347. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  6348. // Here we use asap to wait until all updates have propagated, which
  6349. // is important when using controlled components within layers:
  6350. // https://github.com/facebook/react/issues/1698
  6351. ReactUpdates.asap(forceUpdateIfMounted, this);
  6352. var name = props.name;
  6353. if (props.type === 'radio' && name != null) {
  6354. var rootNode = ReactDOMComponentTree.getNodeFromInstance(this);
  6355. var queryRoot = rootNode;
  6356. while (queryRoot.parentNode) {
  6357. queryRoot = queryRoot.parentNode;
  6358. }
  6359. // If `rootNode.form` was non-null, then we could try `form.elements`,
  6360. // but that sometimes behaves strangely in IE8. We could also try using
  6361. // `form.getElementsByName`, but that will only return direct children
  6362. // and won't include inputs that use the HTML5 `form=` attribute. Since
  6363. // the input might not even be in a form, let's just use the global
  6364. // `querySelectorAll` to ensure we don't miss anything.
  6365. var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
  6366. for (var i = 0; i < group.length; i++) {
  6367. var otherNode = group[i];
  6368. if (otherNode === rootNode || otherNode.form !== rootNode.form) {
  6369. continue;
  6370. }
  6371. // This will throw if radio buttons rendered by different copies of React
  6372. // and the same name are rendered into the same form (same as #1939).
  6373. // That's probably okay; we don't support it just as we don't support
  6374. // mixing React radio buttons with non-React ones.
  6375. var otherInstance = ReactDOMComponentTree.getInstanceFromNode(otherNode);
  6376. !otherInstance ? "development" !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : _prodInvariant('90') : void 0;
  6377. // If this is a controlled radio button group, forcing the input that
  6378. // was previously checked to update will cause it to be come re-checked
  6379. // as appropriate.
  6380. ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
  6381. }
  6382. }
  6383. return returnValue;
  6384. }
  6385. module.exports = ReactDOMInput;
  6386. },{"12":12,"126":126,"152":152,"159":159,"160":160,"24":24,"34":34,"82":82}],40:[function(_dereq_,module,exports){
  6387. /**
  6388. * Copyright 2013-present, Facebook, Inc.
  6389. * All rights reserved.
  6390. *
  6391. * This source code is licensed under the BSD-style license found in the
  6392. * LICENSE file in the root directory of this source tree. An additional grant
  6393. * of patent rights can be found in the PATENTS file in the same directory.
  6394. *
  6395. */
  6396. 'use strict';
  6397. var DOMProperty = _dereq_(11);
  6398. var ReactComponentTreeHook = _dereq_(133);
  6399. var warning = _dereq_(159);
  6400. var warnedProperties = {};
  6401. var rARIA = new RegExp('^(aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$');
  6402. function validateProperty(tagName, name, debugID) {
  6403. if (warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
  6404. return true;
  6405. }
  6406. if (rARIA.test(name)) {
  6407. var lowerCasedName = name.toLowerCase();
  6408. var standardName = DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
  6409. // If this is an aria-* attribute, but is not listed in the known DOM
  6410. // DOM properties, then it is an invalid aria-* attribute.
  6411. if (standardName == null) {
  6412. warnedProperties[name] = true;
  6413. return false;
  6414. }
  6415. // aria-* attributes should be lowercase; suggest the lowercase version.
  6416. if (name !== standardName) {
  6417. "development" !== 'production' ? warning(false, 'Unknown ARIA attribute %s. Did you mean %s?%s', name, standardName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
  6418. warnedProperties[name] = true;
  6419. return true;
  6420. }
  6421. }
  6422. return true;
  6423. }
  6424. function warnInvalidARIAProps(debugID, element) {
  6425. var invalidProps = [];
  6426. for (var key in element.props) {
  6427. var isValid = validateProperty(element.type, key, debugID);
  6428. if (!isValid) {
  6429. invalidProps.push(key);
  6430. }
  6431. }
  6432. var unknownPropString = invalidProps.map(function (prop) {
  6433. return '`' + prop + '`';
  6434. }).join(', ');
  6435. if (invalidProps.length === 1) {
  6436. "development" !== 'production' ? warning(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
  6437. } else if (invalidProps.length > 1) {
  6438. "development" !== 'production' ? warning(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
  6439. }
  6440. }
  6441. function handleElement(debugID, element) {
  6442. if (element == null || typeof element.type !== 'string') {
  6443. return;
  6444. }
  6445. if (element.type.indexOf('-') >= 0 || element.props.is) {
  6446. return;
  6447. }
  6448. warnInvalidARIAProps(debugID, element);
  6449. }
  6450. var ReactDOMInvalidARIAHook = {
  6451. onBeforeMountComponent: function (debugID, element) {
  6452. if ("development" !== 'production') {
  6453. handleElement(debugID, element);
  6454. }
  6455. },
  6456. onBeforeUpdateComponent: function (debugID, element) {
  6457. if ("development" !== 'production') {
  6458. handleElement(debugID, element);
  6459. }
  6460. }
  6461. };
  6462. module.exports = ReactDOMInvalidARIAHook;
  6463. },{"11":11,"133":133,"159":159}],41:[function(_dereq_,module,exports){
  6464. /**
  6465. * Copyright 2013-present, Facebook, Inc.
  6466. * All rights reserved.
  6467. *
  6468. * This source code is licensed under the BSD-style license found in the
  6469. * LICENSE file in the root directory of this source tree. An additional grant
  6470. * of patent rights can be found in the PATENTS file in the same directory.
  6471. *
  6472. */
  6473. 'use strict';
  6474. var ReactComponentTreeHook = _dereq_(133);
  6475. var warning = _dereq_(159);
  6476. var didWarnValueNull = false;
  6477. function handleElement(debugID, element) {
  6478. if (element == null) {
  6479. return;
  6480. }
  6481. if (element.type !== 'input' && element.type !== 'textarea' && element.type !== 'select') {
  6482. return;
  6483. }
  6484. if (element.props != null && element.props.value === null && !didWarnValueNull) {
  6485. "development" !== 'production' ? warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.%s', element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
  6486. didWarnValueNull = true;
  6487. }
  6488. }
  6489. var ReactDOMNullInputValuePropHook = {
  6490. onBeforeMountComponent: function (debugID, element) {
  6491. handleElement(debugID, element);
  6492. },
  6493. onBeforeUpdateComponent: function (debugID, element) {
  6494. handleElement(debugID, element);
  6495. }
  6496. };
  6497. module.exports = ReactDOMNullInputValuePropHook;
  6498. },{"133":133,"159":159}],42:[function(_dereq_,module,exports){
  6499. /**
  6500. * Copyright 2013-present, Facebook, Inc.
  6501. * All rights reserved.
  6502. *
  6503. * This source code is licensed under the BSD-style license found in the
  6504. * LICENSE file in the root directory of this source tree. An additional grant
  6505. * of patent rights can be found in the PATENTS file in the same directory.
  6506. *
  6507. */
  6508. 'use strict';
  6509. var _assign = _dereq_(160);
  6510. var React = _dereq_(135);
  6511. var ReactDOMComponentTree = _dereq_(34);
  6512. var ReactDOMSelect = _dereq_(43);
  6513. var warning = _dereq_(159);
  6514. var didWarnInvalidOptionChildren = false;
  6515. function flattenChildren(children) {
  6516. var content = '';
  6517. // Flatten children and warn if they aren't strings or numbers;
  6518. // invalid types are ignored.
  6519. React.Children.forEach(children, function (child) {
  6520. if (child == null) {
  6521. return;
  6522. }
  6523. if (typeof child === 'string' || typeof child === 'number') {
  6524. content += child;
  6525. } else if (!didWarnInvalidOptionChildren) {
  6526. didWarnInvalidOptionChildren = true;
  6527. "development" !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : void 0;
  6528. }
  6529. });
  6530. return content;
  6531. }
  6532. /**
  6533. * Implements an <option> host component that warns when `selected` is set.
  6534. */
  6535. var ReactDOMOption = {
  6536. mountWrapper: function (inst, props, hostParent) {
  6537. // TODO (yungsters): Remove support for `selected` in <option>.
  6538. if ("development" !== 'production') {
  6539. "development" !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : void 0;
  6540. }
  6541. // Look up whether this option is 'selected'
  6542. var selectValue = null;
  6543. if (hostParent != null) {
  6544. var selectParent = hostParent;
  6545. if (selectParent._tag === 'optgroup') {
  6546. selectParent = selectParent._hostParent;
  6547. }
  6548. if (selectParent != null && selectParent._tag === 'select') {
  6549. selectValue = ReactDOMSelect.getSelectValueContext(selectParent);
  6550. }
  6551. }
  6552. // If the value is null (e.g., no specified value or after initial mount)
  6553. // or missing (e.g., for <datalist>), we don't change props.selected
  6554. var selected = null;
  6555. if (selectValue != null) {
  6556. var value;
  6557. if (props.value != null) {
  6558. value = props.value + '';
  6559. } else {
  6560. value = flattenChildren(props.children);
  6561. }
  6562. selected = false;
  6563. if (Array.isArray(selectValue)) {
  6564. // multiple
  6565. for (var i = 0; i < selectValue.length; i++) {
  6566. if ('' + selectValue[i] === value) {
  6567. selected = true;
  6568. break;
  6569. }
  6570. }
  6571. } else {
  6572. selected = '' + selectValue === value;
  6573. }
  6574. }
  6575. inst._wrapperState = { selected: selected };
  6576. },
  6577. postMountWrapper: function (inst) {
  6578. // value="" should make a value attribute (#6219)
  6579. var props = inst._currentElement.props;
  6580. if (props.value != null) {
  6581. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  6582. node.setAttribute('value', props.value);
  6583. }
  6584. },
  6585. getHostProps: function (inst, props) {
  6586. var hostProps = _assign({ selected: undefined, children: undefined }, props);
  6587. // Read state only from initial mount because <select> updates value
  6588. // manually; we need the initial state only for server rendering
  6589. if (inst._wrapperState.selected != null) {
  6590. hostProps.selected = inst._wrapperState.selected;
  6591. }
  6592. var content = flattenChildren(props.children);
  6593. if (content) {
  6594. hostProps.children = content;
  6595. }
  6596. return hostProps;
  6597. }
  6598. };
  6599. module.exports = ReactDOMOption;
  6600. },{"135":135,"159":159,"160":160,"34":34,"43":43}],43:[function(_dereq_,module,exports){
  6601. /**
  6602. * Copyright 2013-present, Facebook, Inc.
  6603. * All rights reserved.
  6604. *
  6605. * This source code is licensed under the BSD-style license found in the
  6606. * LICENSE file in the root directory of this source tree. An additional grant
  6607. * of patent rights can be found in the PATENTS file in the same directory.
  6608. *
  6609. */
  6610. 'use strict';
  6611. var _assign = _dereq_(160);
  6612. var LinkedValueUtils = _dereq_(24);
  6613. var ReactDOMComponentTree = _dereq_(34);
  6614. var ReactUpdates = _dereq_(82);
  6615. var warning = _dereq_(159);
  6616. var didWarnValueLink = false;
  6617. var didWarnValueDefaultValue = false;
  6618. function updateOptionsIfPendingUpdateAndMounted() {
  6619. if (this._rootNodeID && this._wrapperState.pendingUpdate) {
  6620. this._wrapperState.pendingUpdate = false;
  6621. var props = this._currentElement.props;
  6622. var value = LinkedValueUtils.getValue(props);
  6623. if (value != null) {
  6624. updateOptions(this, Boolean(props.multiple), value);
  6625. }
  6626. }
  6627. }
  6628. function getDeclarationErrorAddendum(owner) {
  6629. if (owner) {
  6630. var name = owner.getName();
  6631. if (name) {
  6632. return ' Check the render method of `' + name + '`.';
  6633. }
  6634. }
  6635. return '';
  6636. }
  6637. var valuePropNames = ['value', 'defaultValue'];
  6638. /**
  6639. * Validation function for `value` and `defaultValue`.
  6640. * @private
  6641. */
  6642. function checkSelectPropTypes(inst, props) {
  6643. var owner = inst._currentElement._owner;
  6644. LinkedValueUtils.checkPropTypes('select', props, owner);
  6645. if (props.valueLink !== undefined && !didWarnValueLink) {
  6646. "development" !== 'production' ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0;
  6647. didWarnValueLink = true;
  6648. }
  6649. for (var i = 0; i < valuePropNames.length; i++) {
  6650. var propName = valuePropNames[i];
  6651. if (props[propName] == null) {
  6652. continue;
  6653. }
  6654. var isArray = Array.isArray(props[propName]);
  6655. if (props.multiple && !isArray) {
  6656. "development" !== 'production' ? warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
  6657. } else if (!props.multiple && isArray) {
  6658. "development" !== 'production' ? warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
  6659. }
  6660. }
  6661. }
  6662. /**
  6663. * @param {ReactDOMComponent} inst
  6664. * @param {boolean} multiple
  6665. * @param {*} propValue A stringable (with `multiple`, a list of stringables).
  6666. * @private
  6667. */
  6668. function updateOptions(inst, multiple, propValue) {
  6669. var selectedValue, i;
  6670. var options = ReactDOMComponentTree.getNodeFromInstance(inst).options;
  6671. if (multiple) {
  6672. selectedValue = {};
  6673. for (i = 0; i < propValue.length; i++) {
  6674. selectedValue['' + propValue[i]] = true;
  6675. }
  6676. for (i = 0; i < options.length; i++) {
  6677. var selected = selectedValue.hasOwnProperty(options[i].value);
  6678. if (options[i].selected !== selected) {
  6679. options[i].selected = selected;
  6680. }
  6681. }
  6682. } else {
  6683. // Do not set `select.value` as exact behavior isn't consistent across all
  6684. // browsers for all cases.
  6685. selectedValue = '' + propValue;
  6686. for (i = 0; i < options.length; i++) {
  6687. if (options[i].value === selectedValue) {
  6688. options[i].selected = true;
  6689. return;
  6690. }
  6691. }
  6692. if (options.length) {
  6693. options[0].selected = true;
  6694. }
  6695. }
  6696. }
  6697. /**
  6698. * Implements a <select> host component that allows optionally setting the
  6699. * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
  6700. * stringable. If `multiple` is true, the prop must be an array of stringables.
  6701. *
  6702. * If `value` is not supplied (or null/undefined), user actions that change the
  6703. * selected option will trigger updates to the rendered options.
  6704. *
  6705. * If it is supplied (and not null/undefined), the rendered options will not
  6706. * update in response to user actions. Instead, the `value` prop must change in
  6707. * order for the rendered options to update.
  6708. *
  6709. * If `defaultValue` is provided, any options with the supplied values will be
  6710. * selected.
  6711. */
  6712. var ReactDOMSelect = {
  6713. getHostProps: function (inst, props) {
  6714. return _assign({}, props, {
  6715. onChange: inst._wrapperState.onChange,
  6716. value: undefined
  6717. });
  6718. },
  6719. mountWrapper: function (inst, props) {
  6720. if ("development" !== 'production') {
  6721. checkSelectPropTypes(inst, props);
  6722. }
  6723. var value = LinkedValueUtils.getValue(props);
  6724. inst._wrapperState = {
  6725. pendingUpdate: false,
  6726. initialValue: value != null ? value : props.defaultValue,
  6727. listeners: null,
  6728. onChange: _handleChange.bind(inst),
  6729. wasMultiple: Boolean(props.multiple)
  6730. };
  6731. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
  6732. "development" !== 'production' ? warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0;
  6733. didWarnValueDefaultValue = true;
  6734. }
  6735. },
  6736. getSelectValueContext: function (inst) {
  6737. // ReactDOMOption looks at this initial value so the initial generated
  6738. // markup has correct `selected` attributes
  6739. return inst._wrapperState.initialValue;
  6740. },
  6741. postUpdateWrapper: function (inst) {
  6742. var props = inst._currentElement.props;
  6743. // After the initial mount, we control selected-ness manually so don't pass
  6744. // this value down
  6745. inst._wrapperState.initialValue = undefined;
  6746. var wasMultiple = inst._wrapperState.wasMultiple;
  6747. inst._wrapperState.wasMultiple = Boolean(props.multiple);
  6748. var value = LinkedValueUtils.getValue(props);
  6749. if (value != null) {
  6750. inst._wrapperState.pendingUpdate = false;
  6751. updateOptions(inst, Boolean(props.multiple), value);
  6752. } else if (wasMultiple !== Boolean(props.multiple)) {
  6753. // For simplicity, reapply `defaultValue` if `multiple` is toggled.
  6754. if (props.defaultValue != null) {
  6755. updateOptions(inst, Boolean(props.multiple), props.defaultValue);
  6756. } else {
  6757. // Revert the select back to its default unselected state.
  6758. updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
  6759. }
  6760. }
  6761. }
  6762. };
  6763. function _handleChange(event) {
  6764. var props = this._currentElement.props;
  6765. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  6766. if (this._rootNodeID) {
  6767. this._wrapperState.pendingUpdate = true;
  6768. }
  6769. ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
  6770. return returnValue;
  6771. }
  6772. module.exports = ReactDOMSelect;
  6773. },{"159":159,"160":160,"24":24,"34":34,"82":82}],44:[function(_dereq_,module,exports){
  6774. /**
  6775. * Copyright 2013-present, Facebook, Inc.
  6776. * All rights reserved.
  6777. *
  6778. * This source code is licensed under the BSD-style license found in the
  6779. * LICENSE file in the root directory of this source tree. An additional grant
  6780. * of patent rights can be found in the PATENTS file in the same directory.
  6781. *
  6782. */
  6783. 'use strict';
  6784. var ExecutionEnvironment = _dereq_(138);
  6785. var getNodeForCharacterOffset = _dereq_(117);
  6786. var getTextContentAccessor = _dereq_(118);
  6787. /**
  6788. * While `isCollapsed` is available on the Selection object and `collapsed`
  6789. * is available on the Range object, IE11 sometimes gets them wrong.
  6790. * If the anchor/focus nodes and offsets are the same, the range is collapsed.
  6791. */
  6792. function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
  6793. return anchorNode === focusNode && anchorOffset === focusOffset;
  6794. }
  6795. /**
  6796. * Get the appropriate anchor and focus node/offset pairs for IE.
  6797. *
  6798. * The catch here is that IE's selection API doesn't provide information
  6799. * about whether the selection is forward or backward, so we have to
  6800. * behave as though it's always forward.
  6801. *
  6802. * IE text differs from modern selection in that it behaves as though
  6803. * block elements end with a new line. This means character offsets will
  6804. * differ between the two APIs.
  6805. *
  6806. * @param {DOMElement} node
  6807. * @return {object}
  6808. */
  6809. function getIEOffsets(node) {
  6810. var selection = document.selection;
  6811. var selectedRange = selection.createRange();
  6812. var selectedLength = selectedRange.text.length;
  6813. // Duplicate selection so we can move range without breaking user selection.
  6814. var fromStart = selectedRange.duplicate();
  6815. fromStart.moveToElementText(node);
  6816. fromStart.setEndPoint('EndToStart', selectedRange);
  6817. var startOffset = fromStart.text.length;
  6818. var endOffset = startOffset + selectedLength;
  6819. return {
  6820. start: startOffset,
  6821. end: endOffset
  6822. };
  6823. }
  6824. /**
  6825. * @param {DOMElement} node
  6826. * @return {?object}
  6827. */
  6828. function getModernOffsets(node) {
  6829. var selection = window.getSelection && window.getSelection();
  6830. if (!selection || selection.rangeCount === 0) {
  6831. return null;
  6832. }
  6833. var anchorNode = selection.anchorNode;
  6834. var anchorOffset = selection.anchorOffset;
  6835. var focusNode = selection.focusNode;
  6836. var focusOffset = selection.focusOffset;
  6837. var currentRange = selection.getRangeAt(0);
  6838. // In Firefox, range.startContainer and range.endContainer can be "anonymous
  6839. // divs", e.g. the up/down buttons on an <input type="number">. Anonymous
  6840. // divs do not seem to expose properties, triggering a "Permission denied
  6841. // error" if any of its properties are accessed. The only seemingly possible
  6842. // way to avoid erroring is to access a property that typically works for
  6843. // non-anonymous divs and catch any error that may otherwise arise. See
  6844. // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
  6845. try {
  6846. /* eslint-disable no-unused-expressions */
  6847. currentRange.startContainer.nodeType;
  6848. currentRange.endContainer.nodeType;
  6849. /* eslint-enable no-unused-expressions */
  6850. } catch (e) {
  6851. return null;
  6852. }
  6853. // If the node and offset values are the same, the selection is collapsed.
  6854. // `Selection.isCollapsed` is available natively, but IE sometimes gets
  6855. // this value wrong.
  6856. var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
  6857. var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
  6858. var tempRange = currentRange.cloneRange();
  6859. tempRange.selectNodeContents(node);
  6860. tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
  6861. var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
  6862. var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
  6863. var end = start + rangeLength;
  6864. // Detect whether the selection is backward.
  6865. var detectionRange = document.createRange();
  6866. detectionRange.setStart(anchorNode, anchorOffset);
  6867. detectionRange.setEnd(focusNode, focusOffset);
  6868. var isBackward = detectionRange.collapsed;
  6869. return {
  6870. start: isBackward ? end : start,
  6871. end: isBackward ? start : end
  6872. };
  6873. }
  6874. /**
  6875. * @param {DOMElement|DOMTextNode} node
  6876. * @param {object} offsets
  6877. */
  6878. function setIEOffsets(node, offsets) {
  6879. var range = document.selection.createRange().duplicate();
  6880. var start, end;
  6881. if (offsets.end === undefined) {
  6882. start = offsets.start;
  6883. end = start;
  6884. } else if (offsets.start > offsets.end) {
  6885. start = offsets.end;
  6886. end = offsets.start;
  6887. } else {
  6888. start = offsets.start;
  6889. end = offsets.end;
  6890. }
  6891. range.moveToElementText(node);
  6892. range.moveStart('character', start);
  6893. range.setEndPoint('EndToStart', range);
  6894. range.moveEnd('character', end - start);
  6895. range.select();
  6896. }
  6897. /**
  6898. * In modern non-IE browsers, we can support both forward and backward
  6899. * selections.
  6900. *
  6901. * Note: IE10+ supports the Selection object, but it does not support
  6902. * the `extend` method, which means that even in modern IE, it's not possible
  6903. * to programmatically create a backward selection. Thus, for all IE
  6904. * versions, we use the old IE API to create our selections.
  6905. *
  6906. * @param {DOMElement|DOMTextNode} node
  6907. * @param {object} offsets
  6908. */
  6909. function setModernOffsets(node, offsets) {
  6910. if (!window.getSelection) {
  6911. return;
  6912. }
  6913. var selection = window.getSelection();
  6914. var length = node[getTextContentAccessor()].length;
  6915. var start = Math.min(offsets.start, length);
  6916. var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
  6917. // IE 11 uses modern selection, but doesn't support the extend method.
  6918. // Flip backward selections, so we can set with a single range.
  6919. if (!selection.extend && start > end) {
  6920. var temp = end;
  6921. end = start;
  6922. start = temp;
  6923. }
  6924. var startMarker = getNodeForCharacterOffset(node, start);
  6925. var endMarker = getNodeForCharacterOffset(node, end);
  6926. if (startMarker && endMarker) {
  6927. var range = document.createRange();
  6928. range.setStart(startMarker.node, startMarker.offset);
  6929. selection.removeAllRanges();
  6930. if (start > end) {
  6931. selection.addRange(range);
  6932. selection.extend(endMarker.node, endMarker.offset);
  6933. } else {
  6934. range.setEnd(endMarker.node, endMarker.offset);
  6935. selection.addRange(range);
  6936. }
  6937. }
  6938. }
  6939. var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
  6940. var ReactDOMSelection = {
  6941. /**
  6942. * @param {DOMElement} node
  6943. */
  6944. getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
  6945. /**
  6946. * @param {DOMElement|DOMTextNode} node
  6947. * @param {object} offsets
  6948. */
  6949. setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
  6950. };
  6951. module.exports = ReactDOMSelection;
  6952. },{"117":117,"118":118,"138":138}],45:[function(_dereq_,module,exports){
  6953. /**
  6954. * Copyright 2013-present, Facebook, Inc.
  6955. * All rights reserved.
  6956. *
  6957. * This source code is licensed under the BSD-style license found in the
  6958. * LICENSE file in the root directory of this source tree. An additional grant
  6959. * of patent rights can be found in the PATENTS file in the same directory.
  6960. *
  6961. */
  6962. 'use strict';
  6963. var _prodInvariant = _dereq_(126),
  6964. _assign = _dereq_(160);
  6965. var DOMChildrenOperations = _dereq_(8);
  6966. var DOMLazyTree = _dereq_(9);
  6967. var ReactDOMComponentTree = _dereq_(34);
  6968. var escapeTextContentForBrowser = _dereq_(107);
  6969. var invariant = _dereq_(152);
  6970. var validateDOMNesting = _dereq_(132);
  6971. /**
  6972. * Text nodes violate a couple assumptions that React makes about components:
  6973. *
  6974. * - When mounting text into the DOM, adjacent text nodes are merged.
  6975. * - Text nodes cannot be assigned a React root ID.
  6976. *
  6977. * This component is used to wrap strings between comment nodes so that they
  6978. * can undergo the same reconciliation that is applied to elements.
  6979. *
  6980. * TODO: Investigate representing React components in the DOM with text nodes.
  6981. *
  6982. * @class ReactDOMTextComponent
  6983. * @extends ReactComponent
  6984. * @internal
  6985. */
  6986. var ReactDOMTextComponent = function (text) {
  6987. // TODO: This is really a ReactText (ReactNode), not a ReactElement
  6988. this._currentElement = text;
  6989. this._stringText = '' + text;
  6990. // ReactDOMComponentTree uses these:
  6991. this._hostNode = null;
  6992. this._hostParent = null;
  6993. // Properties
  6994. this._domID = 0;
  6995. this._mountIndex = 0;
  6996. this._closingComment = null;
  6997. this._commentNodes = null;
  6998. };
  6999. _assign(ReactDOMTextComponent.prototype, {
  7000. /**
  7001. * Creates the markup for this text node. This node is not intended to have
  7002. * any features besides containing text content.
  7003. *
  7004. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  7005. * @return {string} Markup for this text node.
  7006. * @internal
  7007. */
  7008. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  7009. if ("development" !== 'production') {
  7010. var parentInfo;
  7011. if (hostParent != null) {
  7012. parentInfo = hostParent._ancestorInfo;
  7013. } else if (hostContainerInfo != null) {
  7014. parentInfo = hostContainerInfo._ancestorInfo;
  7015. }
  7016. if (parentInfo) {
  7017. // parentInfo should always be present except for the top-level
  7018. // component when server rendering
  7019. validateDOMNesting(null, this._stringText, this, parentInfo);
  7020. }
  7021. }
  7022. var domID = hostContainerInfo._idCounter++;
  7023. var openingValue = ' react-text: ' + domID + ' ';
  7024. var closingValue = ' /react-text ';
  7025. this._domID = domID;
  7026. this._hostParent = hostParent;
  7027. if (transaction.useCreateElement) {
  7028. var ownerDocument = hostContainerInfo._ownerDocument;
  7029. var openingComment = ownerDocument.createComment(openingValue);
  7030. var closingComment = ownerDocument.createComment(closingValue);
  7031. var lazyTree = DOMLazyTree(ownerDocument.createDocumentFragment());
  7032. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(openingComment));
  7033. if (this._stringText) {
  7034. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(ownerDocument.createTextNode(this._stringText)));
  7035. }
  7036. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(closingComment));
  7037. ReactDOMComponentTree.precacheNode(this, openingComment);
  7038. this._closingComment = closingComment;
  7039. return lazyTree;
  7040. } else {
  7041. var escapedText = escapeTextContentForBrowser(this._stringText);
  7042. if (transaction.renderToStaticMarkup) {
  7043. // Normally we'd wrap this between comment nodes for the reasons stated
  7044. // above, but since this is a situation where React won't take over
  7045. // (static pages), we can simply return the text as it is.
  7046. return escapedText;
  7047. }
  7048. return '<!--' + openingValue + '-->' + escapedText + '<!--' + closingValue + '-->';
  7049. }
  7050. },
  7051. /**
  7052. * Updates this component by updating the text content.
  7053. *
  7054. * @param {ReactText} nextText The next text content
  7055. * @param {ReactReconcileTransaction} transaction
  7056. * @internal
  7057. */
  7058. receiveComponent: function (nextText, transaction) {
  7059. if (nextText !== this._currentElement) {
  7060. this._currentElement = nextText;
  7061. var nextStringText = '' + nextText;
  7062. if (nextStringText !== this._stringText) {
  7063. // TODO: Save this as pending props and use performUpdateIfNecessary
  7064. // and/or updateComponent to do the actual update for consistency with
  7065. // other component types?
  7066. this._stringText = nextStringText;
  7067. var commentNodes = this.getHostNode();
  7068. DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText);
  7069. }
  7070. }
  7071. },
  7072. getHostNode: function () {
  7073. var hostNode = this._commentNodes;
  7074. if (hostNode) {
  7075. return hostNode;
  7076. }
  7077. if (!this._closingComment) {
  7078. var openingComment = ReactDOMComponentTree.getNodeFromInstance(this);
  7079. var node = openingComment.nextSibling;
  7080. while (true) {
  7081. !(node != null) ? "development" !== 'production' ? invariant(false, 'Missing closing comment for text component %s', this._domID) : _prodInvariant('67', this._domID) : void 0;
  7082. if (node.nodeType === 8 && node.nodeValue === ' /react-text ') {
  7083. this._closingComment = node;
  7084. break;
  7085. }
  7086. node = node.nextSibling;
  7087. }
  7088. }
  7089. hostNode = [this._hostNode, this._closingComment];
  7090. this._commentNodes = hostNode;
  7091. return hostNode;
  7092. },
  7093. unmountComponent: function () {
  7094. this._closingComment = null;
  7095. this._commentNodes = null;
  7096. ReactDOMComponentTree.uncacheNode(this);
  7097. }
  7098. });
  7099. module.exports = ReactDOMTextComponent;
  7100. },{"107":107,"126":126,"132":132,"152":152,"160":160,"34":34,"8":8,"9":9}],46:[function(_dereq_,module,exports){
  7101. /**
  7102. * Copyright 2013-present, Facebook, Inc.
  7103. * All rights reserved.
  7104. *
  7105. * This source code is licensed under the BSD-style license found in the
  7106. * LICENSE file in the root directory of this source tree. An additional grant
  7107. * of patent rights can be found in the PATENTS file in the same directory.
  7108. *
  7109. */
  7110. 'use strict';
  7111. var _prodInvariant = _dereq_(126),
  7112. _assign = _dereq_(160);
  7113. var LinkedValueUtils = _dereq_(24);
  7114. var ReactDOMComponentTree = _dereq_(34);
  7115. var ReactUpdates = _dereq_(82);
  7116. var invariant = _dereq_(152);
  7117. var warning = _dereq_(159);
  7118. var didWarnValueLink = false;
  7119. var didWarnValDefaultVal = false;
  7120. function forceUpdateIfMounted() {
  7121. if (this._rootNodeID) {
  7122. // DOM component is still mounted; update
  7123. ReactDOMTextarea.updateWrapper(this);
  7124. }
  7125. }
  7126. /**
  7127. * Implements a <textarea> host component that allows setting `value`, and
  7128. * `defaultValue`. This differs from the traditional DOM API because value is
  7129. * usually set as PCDATA children.
  7130. *
  7131. * If `value` is not supplied (or null/undefined), user actions that affect the
  7132. * value will trigger updates to the element.
  7133. *
  7134. * If `value` is supplied (and not null/undefined), the rendered element will
  7135. * not trigger updates to the element. Instead, the `value` prop must change in
  7136. * order for the rendered element to be updated.
  7137. *
  7138. * The rendered element will be initialized with an empty value, the prop
  7139. * `defaultValue` if specified, or the children content (deprecated).
  7140. */
  7141. var ReactDOMTextarea = {
  7142. getHostProps: function (inst, props) {
  7143. !(props.dangerouslySetInnerHTML == null) ? "development" !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : _prodInvariant('91') : void 0;
  7144. // Always set children to the same thing. In IE9, the selection range will
  7145. // get reset if `textContent` is mutated. We could add a check in setTextContent
  7146. // to only set the value if/when the value differs from the node value (which would
  7147. // completely solve this IE9 bug), but Sebastian+Ben seemed to like this solution.
  7148. // The value can be a boolean or object so that's why it's forced to be a string.
  7149. var hostProps = _assign({}, props, {
  7150. value: undefined,
  7151. defaultValue: undefined,
  7152. children: '' + inst._wrapperState.initialValue,
  7153. onChange: inst._wrapperState.onChange
  7154. });
  7155. return hostProps;
  7156. },
  7157. mountWrapper: function (inst, props) {
  7158. if ("development" !== 'production') {
  7159. LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
  7160. if (props.valueLink !== undefined && !didWarnValueLink) {
  7161. "development" !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : void 0;
  7162. didWarnValueLink = true;
  7163. }
  7164. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
  7165. "development" !== 'production' ? warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0;
  7166. didWarnValDefaultVal = true;
  7167. }
  7168. }
  7169. var value = LinkedValueUtils.getValue(props);
  7170. var initialValue = value;
  7171. // Only bother fetching default value if we're going to use it
  7172. if (value == null) {
  7173. var defaultValue = props.defaultValue;
  7174. // TODO (yungsters): Remove support for children content in <textarea>.
  7175. var children = props.children;
  7176. if (children != null) {
  7177. if ("development" !== 'production') {
  7178. "development" !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : void 0;
  7179. }
  7180. !(defaultValue == null) ? "development" !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : _prodInvariant('92') : void 0;
  7181. if (Array.isArray(children)) {
  7182. !(children.length <= 1) ? "development" !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : _prodInvariant('93') : void 0;
  7183. children = children[0];
  7184. }
  7185. defaultValue = '' + children;
  7186. }
  7187. if (defaultValue == null) {
  7188. defaultValue = '';
  7189. }
  7190. initialValue = defaultValue;
  7191. }
  7192. inst._wrapperState = {
  7193. initialValue: '' + initialValue,
  7194. listeners: null,
  7195. onChange: _handleChange.bind(inst)
  7196. };
  7197. },
  7198. updateWrapper: function (inst) {
  7199. var props = inst._currentElement.props;
  7200. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  7201. var value = LinkedValueUtils.getValue(props);
  7202. if (value != null) {
  7203. // Cast `value` to a string to ensure the value is set correctly. While
  7204. // browsers typically do this as necessary, jsdom doesn't.
  7205. var newValue = '' + value;
  7206. // To avoid side effects (such as losing text selection), only set value if changed
  7207. if (newValue !== node.value) {
  7208. node.value = newValue;
  7209. }
  7210. if (props.defaultValue == null) {
  7211. node.defaultValue = newValue;
  7212. }
  7213. }
  7214. if (props.defaultValue != null) {
  7215. node.defaultValue = props.defaultValue;
  7216. }
  7217. },
  7218. postMountWrapper: function (inst) {
  7219. // This is in postMount because we need access to the DOM node, which is not
  7220. // available until after the component has mounted.
  7221. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  7222. var textContent = node.textContent;
  7223. // Only set node.value if textContent is equal to the expected
  7224. // initial value. In IE10/IE11 there is a bug where the placeholder attribute
  7225. // will populate textContent as well.
  7226. // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
  7227. if (textContent === inst._wrapperState.initialValue) {
  7228. node.value = textContent;
  7229. }
  7230. }
  7231. };
  7232. function _handleChange(event) {
  7233. var props = this._currentElement.props;
  7234. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  7235. ReactUpdates.asap(forceUpdateIfMounted, this);
  7236. return returnValue;
  7237. }
  7238. module.exports = ReactDOMTextarea;
  7239. },{"126":126,"152":152,"159":159,"160":160,"24":24,"34":34,"82":82}],47:[function(_dereq_,module,exports){
  7240. /**
  7241. * Copyright 2015-present, Facebook, Inc.
  7242. * All rights reserved.
  7243. *
  7244. * This source code is licensed under the BSD-style license found in the
  7245. * LICENSE file in the root directory of this source tree. An additional grant
  7246. * of patent rights can be found in the PATENTS file in the same directory.
  7247. *
  7248. */
  7249. 'use strict';
  7250. var _prodInvariant = _dereq_(126);
  7251. var invariant = _dereq_(152);
  7252. /**
  7253. * Return the lowest common ancestor of A and B, or null if they are in
  7254. * different trees.
  7255. */
  7256. function getLowestCommonAncestor(instA, instB) {
  7257. !('_hostNode' in instA) ? "development" !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  7258. !('_hostNode' in instB) ? "development" !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  7259. var depthA = 0;
  7260. for (var tempA = instA; tempA; tempA = tempA._hostParent) {
  7261. depthA++;
  7262. }
  7263. var depthB = 0;
  7264. for (var tempB = instB; tempB; tempB = tempB._hostParent) {
  7265. depthB++;
  7266. }
  7267. // If A is deeper, crawl up.
  7268. while (depthA - depthB > 0) {
  7269. instA = instA._hostParent;
  7270. depthA--;
  7271. }
  7272. // If B is deeper, crawl up.
  7273. while (depthB - depthA > 0) {
  7274. instB = instB._hostParent;
  7275. depthB--;
  7276. }
  7277. // Walk in lockstep until we find a match.
  7278. var depth = depthA;
  7279. while (depth--) {
  7280. if (instA === instB) {
  7281. return instA;
  7282. }
  7283. instA = instA._hostParent;
  7284. instB = instB._hostParent;
  7285. }
  7286. return null;
  7287. }
  7288. /**
  7289. * Return if A is an ancestor of B.
  7290. */
  7291. function isAncestor(instA, instB) {
  7292. !('_hostNode' in instA) ? "development" !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
  7293. !('_hostNode' in instB) ? "development" !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
  7294. while (instB) {
  7295. if (instB === instA) {
  7296. return true;
  7297. }
  7298. instB = instB._hostParent;
  7299. }
  7300. return false;
  7301. }
  7302. /**
  7303. * Return the parent instance of the passed-in instance.
  7304. */
  7305. function getParentInstance(inst) {
  7306. !('_hostNode' in inst) ? "development" !== 'production' ? invariant(false, 'getParentInstance: Invalid argument.') : _prodInvariant('36') : void 0;
  7307. return inst._hostParent;
  7308. }
  7309. /**
  7310. * Simulates the traversal of a two-phase, capture/bubble event dispatch.
  7311. */
  7312. function traverseTwoPhase(inst, fn, arg) {
  7313. var path = [];
  7314. while (inst) {
  7315. path.push(inst);
  7316. inst = inst._hostParent;
  7317. }
  7318. var i;
  7319. for (i = path.length; i-- > 0;) {
  7320. fn(path[i], 'captured', arg);
  7321. }
  7322. for (i = 0; i < path.length; i++) {
  7323. fn(path[i], 'bubbled', arg);
  7324. }
  7325. }
  7326. /**
  7327. * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
  7328. * should would receive a `mouseEnter` or `mouseLeave` event.
  7329. *
  7330. * Does not invoke the callback on the nearest common ancestor because nothing
  7331. * "entered" or "left" that element.
  7332. */
  7333. function traverseEnterLeave(from, to, fn, argFrom, argTo) {
  7334. var common = from && to ? getLowestCommonAncestor(from, to) : null;
  7335. var pathFrom = [];
  7336. while (from && from !== common) {
  7337. pathFrom.push(from);
  7338. from = from._hostParent;
  7339. }
  7340. var pathTo = [];
  7341. while (to && to !== common) {
  7342. pathTo.push(to);
  7343. to = to._hostParent;
  7344. }
  7345. var i;
  7346. for (i = 0; i < pathFrom.length; i++) {
  7347. fn(pathFrom[i], 'bubbled', argFrom);
  7348. }
  7349. for (i = pathTo.length; i-- > 0;) {
  7350. fn(pathTo[i], 'captured', argTo);
  7351. }
  7352. }
  7353. module.exports = {
  7354. isAncestor: isAncestor,
  7355. getLowestCommonAncestor: getLowestCommonAncestor,
  7356. getParentInstance: getParentInstance,
  7357. traverseTwoPhase: traverseTwoPhase,
  7358. traverseEnterLeave: traverseEnterLeave
  7359. };
  7360. },{"126":126,"152":152}],48:[function(_dereq_,module,exports){
  7361. /**
  7362. * Copyright 2013-present, Facebook, Inc.
  7363. * All rights reserved.
  7364. *
  7365. * This source code is licensed under the BSD-style license found in the
  7366. * LICENSE file in the root directory of this source tree. An additional grant
  7367. * of patent rights can be found in the PATENTS file in the same directory.
  7368. *
  7369. */
  7370. 'use strict';
  7371. var React = _dereq_(135);
  7372. var ReactDOM = _dereq_(31);
  7373. var ReactDOMUMDEntry = ReactDOM;
  7374. if ("development" !== 'production') {
  7375. ReactDOMUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
  7376. // ReactPerf and ReactTestUtils currently only work with the DOM renderer
  7377. // so we expose them from here, but only in DEV mode.
  7378. ReactPerf: _dereq_(71),
  7379. ReactTestUtils: _dereq_(80)
  7380. };
  7381. }
  7382. // Inject ReactDOM into React for the addons UMD build that depends on ReactDOM (TransitionGroup).
  7383. // We can remove this after we deprecate and remove the addons UMD build.
  7384. if (React.addons) {
  7385. React.__SECRET_INJECTED_REACT_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMUMDEntry;
  7386. }
  7387. module.exports = ReactDOMUMDEntry;
  7388. },{"135":135,"31":31,"71":71,"80":80}],49:[function(_dereq_,module,exports){
  7389. /**
  7390. * Copyright 2013-present, Facebook, Inc.
  7391. * All rights reserved.
  7392. *
  7393. * This source code is licensed under the BSD-style license found in the
  7394. * LICENSE file in the root directory of this source tree. An additional grant
  7395. * of patent rights can be found in the PATENTS file in the same directory.
  7396. *
  7397. */
  7398. 'use strict';
  7399. var DOMProperty = _dereq_(11);
  7400. var EventPluginRegistry = _dereq_(18);
  7401. var ReactComponentTreeHook = _dereq_(133);
  7402. var warning = _dereq_(159);
  7403. if ("development" !== 'production') {
  7404. var reactProps = {
  7405. children: true,
  7406. dangerouslySetInnerHTML: true,
  7407. key: true,
  7408. ref: true,
  7409. autoFocus: true,
  7410. defaultValue: true,
  7411. valueLink: true,
  7412. defaultChecked: true,
  7413. checkedLink: true,
  7414. innerHTML: true,
  7415. suppressContentEditableWarning: true,
  7416. onFocusIn: true,
  7417. onFocusOut: true
  7418. };
  7419. var warnedProperties = {};
  7420. var validateProperty = function (tagName, name, debugID) {
  7421. if (DOMProperty.properties.hasOwnProperty(name) || DOMProperty.isCustomAttribute(name)) {
  7422. return true;
  7423. }
  7424. if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
  7425. return true;
  7426. }
  7427. if (EventPluginRegistry.registrationNameModules.hasOwnProperty(name)) {
  7428. return true;
  7429. }
  7430. warnedProperties[name] = true;
  7431. var lowerCasedName = name.toLowerCase();
  7432. // data-* attributes should be lowercase; suggest the lowercase version
  7433. var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
  7434. var registrationName = EventPluginRegistry.possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? EventPluginRegistry.possibleRegistrationNames[lowerCasedName] : null;
  7435. if (standardName != null) {
  7436. "development" !== 'production' ? warning(false, 'Unknown DOM property %s. Did you mean %s?%s', name, standardName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
  7437. return true;
  7438. } else if (registrationName != null) {
  7439. "development" !== 'production' ? warning(false, 'Unknown event handler property %s. Did you mean `%s`?%s', name, registrationName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
  7440. return true;
  7441. } else {
  7442. // We were unable to guess which prop the user intended.
  7443. // It is likely that the user was just blindly spreading/forwarding props
  7444. // Components should be careful to only render valid props/attributes.
  7445. // Warning will be invoked in warnUnknownProperties to allow grouping.
  7446. return false;
  7447. }
  7448. };
  7449. }
  7450. var warnUnknownProperties = function (debugID, element) {
  7451. var unknownProps = [];
  7452. for (var key in element.props) {
  7453. var isValid = validateProperty(element.type, key, debugID);
  7454. if (!isValid) {
  7455. unknownProps.push(key);
  7456. }
  7457. }
  7458. var unknownPropString = unknownProps.map(function (prop) {
  7459. return '`' + prop + '`';
  7460. }).join(', ');
  7461. if (unknownProps.length === 1) {
  7462. "development" !== 'production' ? warning(false, 'Unknown prop %s on <%s> tag. Remove this prop from the element. ' + 'For details, see https://fb.me/react-unknown-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
  7463. } else if (unknownProps.length > 1) {
  7464. "development" !== 'production' ? warning(false, 'Unknown props %s on <%s> tag. Remove these props from the element. ' + 'For details, see https://fb.me/react-unknown-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
  7465. }
  7466. };
  7467. function handleElement(debugID, element) {
  7468. if (element == null || typeof element.type !== 'string') {
  7469. return;
  7470. }
  7471. if (element.type.indexOf('-') >= 0 || element.props.is) {
  7472. return;
  7473. }
  7474. warnUnknownProperties(debugID, element);
  7475. }
  7476. var ReactDOMUnknownPropertyHook = {
  7477. onBeforeMountComponent: function (debugID, element) {
  7478. handleElement(debugID, element);
  7479. },
  7480. onBeforeUpdateComponent: function (debugID, element) {
  7481. handleElement(debugID, element);
  7482. }
  7483. };
  7484. module.exports = ReactDOMUnknownPropertyHook;
  7485. },{"11":11,"133":133,"159":159,"18":18}],50:[function(_dereq_,module,exports){
  7486. /**
  7487. * Copyright 2016-present, Facebook, Inc.
  7488. * All rights reserved.
  7489. *
  7490. * This source code is licensed under the BSD-style license found in the
  7491. * LICENSE file in the root directory of this source tree. An additional grant
  7492. * of patent rights can be found in the PATENTS file in the same directory.
  7493. *
  7494. *
  7495. */
  7496. 'use strict';
  7497. var ReactInvalidSetStateWarningHook = _dereq_(65);
  7498. var ReactHostOperationHistoryHook = _dereq_(60);
  7499. var ReactComponentTreeHook = _dereq_(133);
  7500. var ExecutionEnvironment = _dereq_(138);
  7501. var performanceNow = _dereq_(157);
  7502. var warning = _dereq_(159);
  7503. var hooks = [];
  7504. var didHookThrowForEvent = {};
  7505. function callHook(event, fn, context, arg1, arg2, arg3, arg4, arg5) {
  7506. try {
  7507. fn.call(context, arg1, arg2, arg3, arg4, arg5);
  7508. } catch (e) {
  7509. "development" !== 'production' ? warning(didHookThrowForEvent[event], 'Exception thrown by hook while handling %s: %s', event, e + '\n' + e.stack) : void 0;
  7510. didHookThrowForEvent[event] = true;
  7511. }
  7512. }
  7513. function emitEvent(event, arg1, arg2, arg3, arg4, arg5) {
  7514. for (var i = 0; i < hooks.length; i++) {
  7515. var hook = hooks[i];
  7516. var fn = hook[event];
  7517. if (fn) {
  7518. callHook(event, fn, hook, arg1, arg2, arg3, arg4, arg5);
  7519. }
  7520. }
  7521. }
  7522. var isProfiling = false;
  7523. var flushHistory = [];
  7524. var lifeCycleTimerStack = [];
  7525. var currentFlushNesting = 0;
  7526. var currentFlushMeasurements = [];
  7527. var currentFlushStartTime = 0;
  7528. var currentTimerDebugID = null;
  7529. var currentTimerStartTime = 0;
  7530. var currentTimerNestedFlushDuration = 0;
  7531. var currentTimerType = null;
  7532. var lifeCycleTimerHasWarned = false;
  7533. function clearHistory() {
  7534. ReactComponentTreeHook.purgeUnmountedComponents();
  7535. ReactHostOperationHistoryHook.clearHistory();
  7536. }
  7537. function getTreeSnapshot(registeredIDs) {
  7538. return registeredIDs.reduce(function (tree, id) {
  7539. var ownerID = ReactComponentTreeHook.getOwnerID(id);
  7540. var parentID = ReactComponentTreeHook.getParentID(id);
  7541. tree[id] = {
  7542. displayName: ReactComponentTreeHook.getDisplayName(id),
  7543. text: ReactComponentTreeHook.getText(id),
  7544. updateCount: ReactComponentTreeHook.getUpdateCount(id),
  7545. childIDs: ReactComponentTreeHook.getChildIDs(id),
  7546. // Text nodes don't have owners but this is close enough.
  7547. ownerID: ownerID || parentID && ReactComponentTreeHook.getOwnerID(parentID) || 0,
  7548. parentID: parentID
  7549. };
  7550. return tree;
  7551. }, {});
  7552. }
  7553. function resetMeasurements() {
  7554. var previousStartTime = currentFlushStartTime;
  7555. var previousMeasurements = currentFlushMeasurements;
  7556. var previousOperations = ReactHostOperationHistoryHook.getHistory();
  7557. if (currentFlushNesting === 0) {
  7558. currentFlushStartTime = 0;
  7559. currentFlushMeasurements = [];
  7560. clearHistory();
  7561. return;
  7562. }
  7563. if (previousMeasurements.length || previousOperations.length) {
  7564. var registeredIDs = ReactComponentTreeHook.getRegisteredIDs();
  7565. flushHistory.push({
  7566. duration: performanceNow() - previousStartTime,
  7567. measurements: previousMeasurements || [],
  7568. operations: previousOperations || [],
  7569. treeSnapshot: getTreeSnapshot(registeredIDs)
  7570. });
  7571. }
  7572. clearHistory();
  7573. currentFlushStartTime = performanceNow();
  7574. currentFlushMeasurements = [];
  7575. }
  7576. function checkDebugID(debugID) {
  7577. var allowRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  7578. if (allowRoot && debugID === 0) {
  7579. return;
  7580. }
  7581. if (!debugID) {
  7582. "development" !== 'production' ? warning(false, 'ReactDebugTool: debugID may not be empty.') : void 0;
  7583. }
  7584. }
  7585. function beginLifeCycleTimer(debugID, timerType) {
  7586. if (currentFlushNesting === 0) {
  7587. return;
  7588. }
  7589. if (currentTimerType && !lifeCycleTimerHasWarned) {
  7590. "development" !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'Did not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
  7591. lifeCycleTimerHasWarned = true;
  7592. }
  7593. currentTimerStartTime = performanceNow();
  7594. currentTimerNestedFlushDuration = 0;
  7595. currentTimerDebugID = debugID;
  7596. currentTimerType = timerType;
  7597. }
  7598. function endLifeCycleTimer(debugID, timerType) {
  7599. if (currentFlushNesting === 0) {
  7600. return;
  7601. }
  7602. if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) {
  7603. "development" !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
  7604. lifeCycleTimerHasWarned = true;
  7605. }
  7606. if (isProfiling) {
  7607. currentFlushMeasurements.push({
  7608. timerType: timerType,
  7609. instanceID: debugID,
  7610. duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration
  7611. });
  7612. }
  7613. currentTimerStartTime = 0;
  7614. currentTimerNestedFlushDuration = 0;
  7615. currentTimerDebugID = null;
  7616. currentTimerType = null;
  7617. }
  7618. function pauseCurrentLifeCycleTimer() {
  7619. var currentTimer = {
  7620. startTime: currentTimerStartTime,
  7621. nestedFlushStartTime: performanceNow(),
  7622. debugID: currentTimerDebugID,
  7623. timerType: currentTimerType
  7624. };
  7625. lifeCycleTimerStack.push(currentTimer);
  7626. currentTimerStartTime = 0;
  7627. currentTimerNestedFlushDuration = 0;
  7628. currentTimerDebugID = null;
  7629. currentTimerType = null;
  7630. }
  7631. function resumeCurrentLifeCycleTimer() {
  7632. var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(),
  7633. startTime = _lifeCycleTimerStack$.startTime,
  7634. nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime,
  7635. debugID = _lifeCycleTimerStack$.debugID,
  7636. timerType = _lifeCycleTimerStack$.timerType;
  7637. var nestedFlushDuration = performanceNow() - nestedFlushStartTime;
  7638. currentTimerStartTime = startTime;
  7639. currentTimerNestedFlushDuration += nestedFlushDuration;
  7640. currentTimerDebugID = debugID;
  7641. currentTimerType = timerType;
  7642. }
  7643. var lastMarkTimeStamp = 0;
  7644. var canUsePerformanceMeasure = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';
  7645. function shouldMark(debugID) {
  7646. if (!isProfiling || !canUsePerformanceMeasure) {
  7647. return false;
  7648. }
  7649. var element = ReactComponentTreeHook.getElement(debugID);
  7650. if (element == null || typeof element !== 'object') {
  7651. return false;
  7652. }
  7653. var isHostElement = typeof element.type === 'string';
  7654. if (isHostElement) {
  7655. return false;
  7656. }
  7657. return true;
  7658. }
  7659. function markBegin(debugID, markType) {
  7660. if (!shouldMark(debugID)) {
  7661. return;
  7662. }
  7663. var markName = debugID + '::' + markType;
  7664. lastMarkTimeStamp = performanceNow();
  7665. performance.mark(markName);
  7666. }
  7667. function markEnd(debugID, markType) {
  7668. if (!shouldMark(debugID)) {
  7669. return;
  7670. }
  7671. var markName = debugID + '::' + markType;
  7672. var displayName = ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown';
  7673. // Chrome has an issue of dropping markers recorded too fast:
  7674. // https://bugs.chromium.org/p/chromium/issues/detail?id=640652
  7675. // To work around this, we will not report very small measurements.
  7676. // I determined the magic number by tweaking it back and forth.
  7677. // 0.05ms was enough to prevent the issue, but I set it to 0.1ms to be safe.
  7678. // When the bug is fixed, we can `measure()` unconditionally if we want to.
  7679. var timeStamp = performanceNow();
  7680. if (timeStamp - lastMarkTimeStamp > 0.1) {
  7681. var measurementName = displayName + ' [' + markType + ']';
  7682. performance.measure(measurementName, markName);
  7683. }
  7684. performance.clearMarks(markName);
  7685. if (measurementName) {
  7686. performance.clearMeasures(measurementName);
  7687. }
  7688. }
  7689. var ReactDebugTool = {
  7690. addHook: function (hook) {
  7691. hooks.push(hook);
  7692. },
  7693. removeHook: function (hook) {
  7694. for (var i = 0; i < hooks.length; i++) {
  7695. if (hooks[i] === hook) {
  7696. hooks.splice(i, 1);
  7697. i--;
  7698. }
  7699. }
  7700. },
  7701. isProfiling: function () {
  7702. return isProfiling;
  7703. },
  7704. beginProfiling: function () {
  7705. if (isProfiling) {
  7706. return;
  7707. }
  7708. isProfiling = true;
  7709. flushHistory.length = 0;
  7710. resetMeasurements();
  7711. ReactDebugTool.addHook(ReactHostOperationHistoryHook);
  7712. },
  7713. endProfiling: function () {
  7714. if (!isProfiling) {
  7715. return;
  7716. }
  7717. isProfiling = false;
  7718. resetMeasurements();
  7719. ReactDebugTool.removeHook(ReactHostOperationHistoryHook);
  7720. },
  7721. getFlushHistory: function () {
  7722. return flushHistory;
  7723. },
  7724. onBeginFlush: function () {
  7725. currentFlushNesting++;
  7726. resetMeasurements();
  7727. pauseCurrentLifeCycleTimer();
  7728. emitEvent('onBeginFlush');
  7729. },
  7730. onEndFlush: function () {
  7731. resetMeasurements();
  7732. currentFlushNesting--;
  7733. resumeCurrentLifeCycleTimer();
  7734. emitEvent('onEndFlush');
  7735. },
  7736. onBeginLifeCycleTimer: function (debugID, timerType) {
  7737. checkDebugID(debugID);
  7738. emitEvent('onBeginLifeCycleTimer', debugID, timerType);
  7739. markBegin(debugID, timerType);
  7740. beginLifeCycleTimer(debugID, timerType);
  7741. },
  7742. onEndLifeCycleTimer: function (debugID, timerType) {
  7743. checkDebugID(debugID);
  7744. endLifeCycleTimer(debugID, timerType);
  7745. markEnd(debugID, timerType);
  7746. emitEvent('onEndLifeCycleTimer', debugID, timerType);
  7747. },
  7748. onBeginProcessingChildContext: function () {
  7749. emitEvent('onBeginProcessingChildContext');
  7750. },
  7751. onEndProcessingChildContext: function () {
  7752. emitEvent('onEndProcessingChildContext');
  7753. },
  7754. onHostOperation: function (operation) {
  7755. checkDebugID(operation.instanceID);
  7756. emitEvent('onHostOperation', operation);
  7757. },
  7758. onSetState: function () {
  7759. emitEvent('onSetState');
  7760. },
  7761. onSetChildren: function (debugID, childDebugIDs) {
  7762. checkDebugID(debugID);
  7763. childDebugIDs.forEach(checkDebugID);
  7764. emitEvent('onSetChildren', debugID, childDebugIDs);
  7765. },
  7766. onBeforeMountComponent: function (debugID, element, parentDebugID) {
  7767. checkDebugID(debugID);
  7768. checkDebugID(parentDebugID, true);
  7769. emitEvent('onBeforeMountComponent', debugID, element, parentDebugID);
  7770. markBegin(debugID, 'mount');
  7771. },
  7772. onMountComponent: function (debugID) {
  7773. checkDebugID(debugID);
  7774. markEnd(debugID, 'mount');
  7775. emitEvent('onMountComponent', debugID);
  7776. },
  7777. onBeforeUpdateComponent: function (debugID, element) {
  7778. checkDebugID(debugID);
  7779. emitEvent('onBeforeUpdateComponent', debugID, element);
  7780. markBegin(debugID, 'update');
  7781. },
  7782. onUpdateComponent: function (debugID) {
  7783. checkDebugID(debugID);
  7784. markEnd(debugID, 'update');
  7785. emitEvent('onUpdateComponent', debugID);
  7786. },
  7787. onBeforeUnmountComponent: function (debugID) {
  7788. checkDebugID(debugID);
  7789. emitEvent('onBeforeUnmountComponent', debugID);
  7790. markBegin(debugID, 'unmount');
  7791. },
  7792. onUnmountComponent: function (debugID) {
  7793. checkDebugID(debugID);
  7794. markEnd(debugID, 'unmount');
  7795. emitEvent('onUnmountComponent', debugID);
  7796. },
  7797. onTestEvent: function () {
  7798. emitEvent('onTestEvent');
  7799. }
  7800. };
  7801. // TODO remove these when RN/www gets updated
  7802. ReactDebugTool.addDevtool = ReactDebugTool.addHook;
  7803. ReactDebugTool.removeDevtool = ReactDebugTool.removeHook;
  7804. ReactDebugTool.addHook(ReactInvalidSetStateWarningHook);
  7805. ReactDebugTool.addHook(ReactComponentTreeHook);
  7806. var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
  7807. if (/[?&]react_perf\b/.test(url)) {
  7808. ReactDebugTool.beginProfiling();
  7809. }
  7810. module.exports = ReactDebugTool;
  7811. },{"133":133,"138":138,"157":157,"159":159,"60":60,"65":65}],51:[function(_dereq_,module,exports){
  7812. /**
  7813. * Copyright 2013-present, Facebook, Inc.
  7814. * All rights reserved.
  7815. *
  7816. * This source code is licensed under the BSD-style license found in the
  7817. * LICENSE file in the root directory of this source tree. An additional grant
  7818. * of patent rights can be found in the PATENTS file in the same directory.
  7819. *
  7820. */
  7821. 'use strict';
  7822. var _assign = _dereq_(160);
  7823. var ReactUpdates = _dereq_(82);
  7824. var Transaction = _dereq_(100);
  7825. var emptyFunction = _dereq_(144);
  7826. var RESET_BATCHED_UPDATES = {
  7827. initialize: emptyFunction,
  7828. close: function () {
  7829. ReactDefaultBatchingStrategy.isBatchingUpdates = false;
  7830. }
  7831. };
  7832. var FLUSH_BATCHED_UPDATES = {
  7833. initialize: emptyFunction,
  7834. close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
  7835. };
  7836. var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
  7837. function ReactDefaultBatchingStrategyTransaction() {
  7838. this.reinitializeTransaction();
  7839. }
  7840. _assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction, {
  7841. getTransactionWrappers: function () {
  7842. return TRANSACTION_WRAPPERS;
  7843. }
  7844. });
  7845. var transaction = new ReactDefaultBatchingStrategyTransaction();
  7846. var ReactDefaultBatchingStrategy = {
  7847. isBatchingUpdates: false,
  7848. /**
  7849. * Call the provided function in a context within which calls to `setState`
  7850. * and friends are batched such that components aren't updated unnecessarily.
  7851. */
  7852. batchedUpdates: function (callback, a, b, c, d, e) {
  7853. var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
  7854. ReactDefaultBatchingStrategy.isBatchingUpdates = true;
  7855. // The code is written this way to avoid extra allocations
  7856. if (alreadyBatchingUpdates) {
  7857. return callback(a, b, c, d, e);
  7858. } else {
  7859. return transaction.perform(callback, null, a, b, c, d, e);
  7860. }
  7861. }
  7862. };
  7863. module.exports = ReactDefaultBatchingStrategy;
  7864. },{"100":100,"144":144,"160":160,"82":82}],52:[function(_dereq_,module,exports){
  7865. /**
  7866. * Copyright 2013-present, Facebook, Inc.
  7867. * All rights reserved.
  7868. *
  7869. * This source code is licensed under the BSD-style license found in the
  7870. * LICENSE file in the root directory of this source tree. An additional grant
  7871. * of patent rights can be found in the PATENTS file in the same directory.
  7872. *
  7873. */
  7874. 'use strict';
  7875. var ARIADOMPropertyConfig = _dereq_(1);
  7876. var BeforeInputEventPlugin = _dereq_(3);
  7877. var ChangeEventPlugin = _dereq_(7);
  7878. var DefaultEventPluginOrder = _dereq_(14);
  7879. var EnterLeaveEventPlugin = _dereq_(15);
  7880. var HTMLDOMPropertyConfig = _dereq_(22);
  7881. var ReactComponentBrowserEnvironment = _dereq_(28);
  7882. var ReactDOMComponent = _dereq_(32);
  7883. var ReactDOMComponentTree = _dereq_(34);
  7884. var ReactDOMEmptyComponent = _dereq_(36);
  7885. var ReactDOMTreeTraversal = _dereq_(47);
  7886. var ReactDOMTextComponent = _dereq_(45);
  7887. var ReactDefaultBatchingStrategy = _dereq_(51);
  7888. var ReactEventListener = _dereq_(57);
  7889. var ReactInjection = _dereq_(61);
  7890. var ReactReconcileTransaction = _dereq_(74);
  7891. var SVGDOMPropertyConfig = _dereq_(84);
  7892. var SelectEventPlugin = _dereq_(85);
  7893. var SimpleEventPlugin = _dereq_(86);
  7894. var alreadyInjected = false;
  7895. function inject() {
  7896. if (alreadyInjected) {
  7897. // TODO: This is currently true because these injections are shared between
  7898. // the client and the server package. They should be built independently
  7899. // and not share any injection state. Then this problem will be solved.
  7900. return;
  7901. }
  7902. alreadyInjected = true;
  7903. ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
  7904. /**
  7905. * Inject modules for resolving DOM hierarchy and plugin ordering.
  7906. */
  7907. ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
  7908. ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree);
  7909. ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal);
  7910. /**
  7911. * Some important event plugins included by default (without having to require
  7912. * them).
  7913. */
  7914. ReactInjection.EventPluginHub.injectEventPluginsByName({
  7915. SimpleEventPlugin: SimpleEventPlugin,
  7916. EnterLeaveEventPlugin: EnterLeaveEventPlugin,
  7917. ChangeEventPlugin: ChangeEventPlugin,
  7918. SelectEventPlugin: SelectEventPlugin,
  7919. BeforeInputEventPlugin: BeforeInputEventPlugin
  7920. });
  7921. ReactInjection.HostComponent.injectGenericComponentClass(ReactDOMComponent);
  7922. ReactInjection.HostComponent.injectTextComponentClass(ReactDOMTextComponent);
  7923. ReactInjection.DOMProperty.injectDOMPropertyConfig(ARIADOMPropertyConfig);
  7924. ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
  7925. ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
  7926. ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) {
  7927. return new ReactDOMEmptyComponent(instantiate);
  7928. });
  7929. ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
  7930. ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
  7931. ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
  7932. }
  7933. module.exports = {
  7934. inject: inject
  7935. };
  7936. },{"1":1,"14":14,"15":15,"22":22,"28":28,"3":3,"32":32,"34":34,"36":36,"45":45,"47":47,"51":51,"57":57,"61":61,"7":7,"74":74,"84":84,"85":85,"86":86}],53:[function(_dereq_,module,exports){
  7937. /**
  7938. * Copyright 2014-present, Facebook, Inc.
  7939. * All rights reserved.
  7940. *
  7941. * This source code is licensed under the BSD-style license found in the
  7942. * LICENSE file in the root directory of this source tree. An additional grant
  7943. * of patent rights can be found in the PATENTS file in the same directory.
  7944. *
  7945. *
  7946. */
  7947. 'use strict';
  7948. // The Symbol used to tag the ReactElement type. If there is no native Symbol
  7949. // nor polyfill, then a plain number is used for performance.
  7950. var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
  7951. module.exports = REACT_ELEMENT_TYPE;
  7952. },{}],54:[function(_dereq_,module,exports){
  7953. /**
  7954. * Copyright 2014-present, Facebook, Inc.
  7955. * All rights reserved.
  7956. *
  7957. * This source code is licensed under the BSD-style license found in the
  7958. * LICENSE file in the root directory of this source tree. An additional grant
  7959. * of patent rights can be found in the PATENTS file in the same directory.
  7960. *
  7961. */
  7962. 'use strict';
  7963. var emptyComponentFactory;
  7964. var ReactEmptyComponentInjection = {
  7965. injectEmptyComponentFactory: function (factory) {
  7966. emptyComponentFactory = factory;
  7967. }
  7968. };
  7969. var ReactEmptyComponent = {
  7970. create: function (instantiate) {
  7971. return emptyComponentFactory(instantiate);
  7972. }
  7973. };
  7974. ReactEmptyComponent.injection = ReactEmptyComponentInjection;
  7975. module.exports = ReactEmptyComponent;
  7976. },{}],55:[function(_dereq_,module,exports){
  7977. /**
  7978. * Copyright 2013-present, Facebook, Inc.
  7979. * All rights reserved.
  7980. *
  7981. * This source code is licensed under the BSD-style license found in the
  7982. * LICENSE file in the root directory of this source tree. An additional grant
  7983. * of patent rights can be found in the PATENTS file in the same directory.
  7984. *
  7985. *
  7986. */
  7987. 'use strict';
  7988. var caughtError = null;
  7989. /**
  7990. * Call a function while guarding against errors that happens within it.
  7991. *
  7992. * @param {String} name of the guard to use for logging or debugging
  7993. * @param {Function} func The function to invoke
  7994. * @param {*} a First argument
  7995. * @param {*} b Second argument
  7996. */
  7997. function invokeGuardedCallback(name, func, a) {
  7998. try {
  7999. func(a);
  8000. } catch (x) {
  8001. if (caughtError === null) {
  8002. caughtError = x;
  8003. }
  8004. }
  8005. }
  8006. var ReactErrorUtils = {
  8007. invokeGuardedCallback: invokeGuardedCallback,
  8008. /**
  8009. * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
  8010. * handler are sure to be rethrown by rethrowCaughtError.
  8011. */
  8012. invokeGuardedCallbackWithCatch: invokeGuardedCallback,
  8013. /**
  8014. * During execution of guarded functions we will capture the first error which
  8015. * we will rethrow to be handled by the top level error handler.
  8016. */
  8017. rethrowCaughtError: function () {
  8018. if (caughtError) {
  8019. var error = caughtError;
  8020. caughtError = null;
  8021. throw error;
  8022. }
  8023. }
  8024. };
  8025. if ("development" !== 'production') {
  8026. /**
  8027. * To help development we can get better devtools integration by simulating a
  8028. * real browser event.
  8029. */
  8030. if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
  8031. var fakeNode = document.createElement('react');
  8032. ReactErrorUtils.invokeGuardedCallback = function (name, func, a) {
  8033. var boundFunc = func.bind(null, a);
  8034. var evtType = 'react-' + name;
  8035. fakeNode.addEventListener(evtType, boundFunc, false);
  8036. var evt = document.createEvent('Event');
  8037. evt.initEvent(evtType, false, false);
  8038. fakeNode.dispatchEvent(evt);
  8039. fakeNode.removeEventListener(evtType, boundFunc, false);
  8040. };
  8041. }
  8042. }
  8043. module.exports = ReactErrorUtils;
  8044. },{}],56:[function(_dereq_,module,exports){
  8045. /**
  8046. * Copyright 2013-present, Facebook, Inc.
  8047. * All rights reserved.
  8048. *
  8049. * This source code is licensed under the BSD-style license found in the
  8050. * LICENSE file in the root directory of this source tree. An additional grant
  8051. * of patent rights can be found in the PATENTS file in the same directory.
  8052. *
  8053. */
  8054. 'use strict';
  8055. var EventPluginHub = _dereq_(17);
  8056. function runEventQueueInBatch(events) {
  8057. EventPluginHub.enqueueEvents(events);
  8058. EventPluginHub.processEventQueue(false);
  8059. }
  8060. var ReactEventEmitterMixin = {
  8061. /**
  8062. * Streams a fired top-level event to `EventPluginHub` where plugins have the
  8063. * opportunity to create `ReactEvent`s to be dispatched.
  8064. */
  8065. handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  8066. var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
  8067. runEventQueueInBatch(events);
  8068. }
  8069. };
  8070. module.exports = ReactEventEmitterMixin;
  8071. },{"17":17}],57:[function(_dereq_,module,exports){
  8072. /**
  8073. * Copyright 2013-present, Facebook, Inc.
  8074. * All rights reserved.
  8075. *
  8076. * This source code is licensed under the BSD-style license found in the
  8077. * LICENSE file in the root directory of this source tree. An additional grant
  8078. * of patent rights can be found in the PATENTS file in the same directory.
  8079. *
  8080. */
  8081. 'use strict';
  8082. var _assign = _dereq_(160);
  8083. var EventListener = _dereq_(137);
  8084. var ExecutionEnvironment = _dereq_(138);
  8085. var PooledClass = _dereq_(25);
  8086. var ReactDOMComponentTree = _dereq_(34);
  8087. var ReactUpdates = _dereq_(82);
  8088. var getEventTarget = _dereq_(114);
  8089. var getUnboundedScrollPosition = _dereq_(149);
  8090. /**
  8091. * Find the deepest React component completely containing the root of the
  8092. * passed-in instance (for use when entire React trees are nested within each
  8093. * other). If React trees are not nested, returns null.
  8094. */
  8095. function findParent(inst) {
  8096. // TODO: It may be a good idea to cache this to prevent unnecessary DOM
  8097. // traversal, but caching is difficult to do correctly without using a
  8098. // mutation observer to listen for all DOM changes.
  8099. while (inst._hostParent) {
  8100. inst = inst._hostParent;
  8101. }
  8102. var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst);
  8103. var container = rootNode.parentNode;
  8104. return ReactDOMComponentTree.getClosestInstanceFromNode(container);
  8105. }
  8106. // Used to store ancestor hierarchy in top level callback
  8107. function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
  8108. this.topLevelType = topLevelType;
  8109. this.nativeEvent = nativeEvent;
  8110. this.ancestors = [];
  8111. }
  8112. _assign(TopLevelCallbackBookKeeping.prototype, {
  8113. destructor: function () {
  8114. this.topLevelType = null;
  8115. this.nativeEvent = null;
  8116. this.ancestors.length = 0;
  8117. }
  8118. });
  8119. PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
  8120. function handleTopLevelImpl(bookKeeping) {
  8121. var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent);
  8122. var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget);
  8123. // Loop through the hierarchy, in case there's any nested components.
  8124. // It's important that we build the array of ancestors before calling any
  8125. // event handlers, because event handlers can modify the DOM, leading to
  8126. // inconsistencies with ReactMount's node cache. See #1105.
  8127. var ancestor = targetInst;
  8128. do {
  8129. bookKeeping.ancestors.push(ancestor);
  8130. ancestor = ancestor && findParent(ancestor);
  8131. } while (ancestor);
  8132. for (var i = 0; i < bookKeeping.ancestors.length; i++) {
  8133. targetInst = bookKeeping.ancestors[i];
  8134. ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
  8135. }
  8136. }
  8137. function scrollValueMonitor(cb) {
  8138. var scrollPosition = getUnboundedScrollPosition(window);
  8139. cb(scrollPosition);
  8140. }
  8141. var ReactEventListener = {
  8142. _enabled: true,
  8143. _handleTopLevel: null,
  8144. WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
  8145. setHandleTopLevel: function (handleTopLevel) {
  8146. ReactEventListener._handleTopLevel = handleTopLevel;
  8147. },
  8148. setEnabled: function (enabled) {
  8149. ReactEventListener._enabled = !!enabled;
  8150. },
  8151. isEnabled: function () {
  8152. return ReactEventListener._enabled;
  8153. },
  8154. /**
  8155. * Traps top-level events by using event bubbling.
  8156. *
  8157. * @param {string} topLevelType Record from `EventConstants`.
  8158. * @param {string} handlerBaseName Event name (e.g. "click").
  8159. * @param {object} element Element on which to attach listener.
  8160. * @return {?object} An object with a remove function which will forcefully
  8161. * remove the listener.
  8162. * @internal
  8163. */
  8164. trapBubbledEvent: function (topLevelType, handlerBaseName, element) {
  8165. if (!element) {
  8166. return null;
  8167. }
  8168. return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
  8169. },
  8170. /**
  8171. * Traps a top-level event by using event capturing.
  8172. *
  8173. * @param {string} topLevelType Record from `EventConstants`.
  8174. * @param {string} handlerBaseName Event name (e.g. "click").
  8175. * @param {object} element Element on which to attach listener.
  8176. * @return {?object} An object with a remove function which will forcefully
  8177. * remove the listener.
  8178. * @internal
  8179. */
  8180. trapCapturedEvent: function (topLevelType, handlerBaseName, element) {
  8181. if (!element) {
  8182. return null;
  8183. }
  8184. return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
  8185. },
  8186. monitorScrollValue: function (refresh) {
  8187. var callback = scrollValueMonitor.bind(null, refresh);
  8188. EventListener.listen(window, 'scroll', callback);
  8189. },
  8190. dispatchEvent: function (topLevelType, nativeEvent) {
  8191. if (!ReactEventListener._enabled) {
  8192. return;
  8193. }
  8194. var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
  8195. try {
  8196. // Event queue being processed in the same cycle allows
  8197. // `preventDefault`.
  8198. ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
  8199. } finally {
  8200. TopLevelCallbackBookKeeping.release(bookKeeping);
  8201. }
  8202. }
  8203. };
  8204. module.exports = ReactEventListener;
  8205. },{"114":114,"137":137,"138":138,"149":149,"160":160,"25":25,"34":34,"82":82}],58:[function(_dereq_,module,exports){
  8206. /**
  8207. * Copyright 2013-present, Facebook, Inc.
  8208. * All rights reserved.
  8209. *
  8210. * This source code is licensed under the BSD-style license found in the
  8211. * LICENSE file in the root directory of this source tree. An additional grant
  8212. * of patent rights can be found in the PATENTS file in the same directory.
  8213. *
  8214. *
  8215. */
  8216. 'use strict';
  8217. var ReactFeatureFlags = {
  8218. // When true, call console.time() before and .timeEnd() after each top-level
  8219. // render (both initial renders and updates). Useful when looking at prod-mode
  8220. // timeline profiles in Chrome, for example.
  8221. logTopLevelRenders: false
  8222. };
  8223. module.exports = ReactFeatureFlags;
  8224. },{}],59:[function(_dereq_,module,exports){
  8225. /**
  8226. * Copyright 2014-present, Facebook, Inc.
  8227. * All rights reserved.
  8228. *
  8229. * This source code is licensed under the BSD-style license found in the
  8230. * LICENSE file in the root directory of this source tree. An additional grant
  8231. * of patent rights can be found in the PATENTS file in the same directory.
  8232. *
  8233. */
  8234. 'use strict';
  8235. var _prodInvariant = _dereq_(126);
  8236. var invariant = _dereq_(152);
  8237. var genericComponentClass = null;
  8238. var textComponentClass = null;
  8239. var ReactHostComponentInjection = {
  8240. // This accepts a class that receives the tag string. This is a catch all
  8241. // that can render any kind of tag.
  8242. injectGenericComponentClass: function (componentClass) {
  8243. genericComponentClass = componentClass;
  8244. },
  8245. // This accepts a text component class that takes the text string to be
  8246. // rendered as props.
  8247. injectTextComponentClass: function (componentClass) {
  8248. textComponentClass = componentClass;
  8249. }
  8250. };
  8251. /**
  8252. * Get a host internal component class for a specific tag.
  8253. *
  8254. * @param {ReactElement} element The element to create.
  8255. * @return {function} The internal class constructor function.
  8256. */
  8257. function createInternalComponent(element) {
  8258. !genericComponentClass ? "development" !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : _prodInvariant('111', element.type) : void 0;
  8259. return new genericComponentClass(element);
  8260. }
  8261. /**
  8262. * @param {ReactText} text
  8263. * @return {ReactComponent}
  8264. */
  8265. function createInstanceForText(text) {
  8266. return new textComponentClass(text);
  8267. }
  8268. /**
  8269. * @param {ReactComponent} component
  8270. * @return {boolean}
  8271. */
  8272. function isTextComponent(component) {
  8273. return component instanceof textComponentClass;
  8274. }
  8275. var ReactHostComponent = {
  8276. createInternalComponent: createInternalComponent,
  8277. createInstanceForText: createInstanceForText,
  8278. isTextComponent: isTextComponent,
  8279. injection: ReactHostComponentInjection
  8280. };
  8281. module.exports = ReactHostComponent;
  8282. },{"126":126,"152":152}],60:[function(_dereq_,module,exports){
  8283. /**
  8284. * Copyright 2016-present, Facebook, Inc.
  8285. * All rights reserved.
  8286. *
  8287. * This source code is licensed under the BSD-style license found in the
  8288. * LICENSE file in the root directory of this source tree. An additional grant
  8289. * of patent rights can be found in the PATENTS file in the same directory.
  8290. *
  8291. *
  8292. */
  8293. 'use strict';
  8294. var history = [];
  8295. var ReactHostOperationHistoryHook = {
  8296. onHostOperation: function (operation) {
  8297. history.push(operation);
  8298. },
  8299. clearHistory: function () {
  8300. if (ReactHostOperationHistoryHook._preventClearing) {
  8301. // Should only be used for tests.
  8302. return;
  8303. }
  8304. history = [];
  8305. },
  8306. getHistory: function () {
  8307. return history;
  8308. }
  8309. };
  8310. module.exports = ReactHostOperationHistoryHook;
  8311. },{}],61:[function(_dereq_,module,exports){
  8312. /**
  8313. * Copyright 2013-present, Facebook, Inc.
  8314. * All rights reserved.
  8315. *
  8316. * This source code is licensed under the BSD-style license found in the
  8317. * LICENSE file in the root directory of this source tree. An additional grant
  8318. * of patent rights can be found in the PATENTS file in the same directory.
  8319. *
  8320. */
  8321. 'use strict';
  8322. var DOMProperty = _dereq_(11);
  8323. var EventPluginHub = _dereq_(17);
  8324. var EventPluginUtils = _dereq_(19);
  8325. var ReactComponentEnvironment = _dereq_(29);
  8326. var ReactEmptyComponent = _dereq_(54);
  8327. var ReactBrowserEventEmitter = _dereq_(26);
  8328. var ReactHostComponent = _dereq_(59);
  8329. var ReactUpdates = _dereq_(82);
  8330. var ReactInjection = {
  8331. Component: ReactComponentEnvironment.injection,
  8332. DOMProperty: DOMProperty.injection,
  8333. EmptyComponent: ReactEmptyComponent.injection,
  8334. EventPluginHub: EventPluginHub.injection,
  8335. EventPluginUtils: EventPluginUtils.injection,
  8336. EventEmitter: ReactBrowserEventEmitter.injection,
  8337. HostComponent: ReactHostComponent.injection,
  8338. Updates: ReactUpdates.injection
  8339. };
  8340. module.exports = ReactInjection;
  8341. },{"11":11,"17":17,"19":19,"26":26,"29":29,"54":54,"59":59,"82":82}],62:[function(_dereq_,module,exports){
  8342. /**
  8343. * Copyright 2013-present, Facebook, Inc.
  8344. * All rights reserved.
  8345. *
  8346. * This source code is licensed under the BSD-style license found in the
  8347. * LICENSE file in the root directory of this source tree. An additional grant
  8348. * of patent rights can be found in the PATENTS file in the same directory.
  8349. *
  8350. */
  8351. 'use strict';
  8352. var ReactDOMSelection = _dereq_(44);
  8353. var containsNode = _dereq_(141);
  8354. var focusNode = _dereq_(146);
  8355. var getActiveElement = _dereq_(147);
  8356. function isInDocument(node) {
  8357. return containsNode(document.documentElement, node);
  8358. }
  8359. /**
  8360. * @ReactInputSelection: React input selection module. Based on Selection.js,
  8361. * but modified to be suitable for react and has a couple of bug fixes (doesn't
  8362. * assume buttons have range selections allowed).
  8363. * Input selection module for React.
  8364. */
  8365. var ReactInputSelection = {
  8366. hasSelectionCapabilities: function (elem) {
  8367. var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
  8368. return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
  8369. },
  8370. getSelectionInformation: function () {
  8371. var focusedElem = getActiveElement();
  8372. return {
  8373. focusedElem: focusedElem,
  8374. selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
  8375. };
  8376. },
  8377. /**
  8378. * @restoreSelection: If any selection information was potentially lost,
  8379. * restore it. This is useful when performing operations that could remove dom
  8380. * nodes and place them back in, resulting in focus being lost.
  8381. */
  8382. restoreSelection: function (priorSelectionInformation) {
  8383. var curFocusedElem = getActiveElement();
  8384. var priorFocusedElem = priorSelectionInformation.focusedElem;
  8385. var priorSelectionRange = priorSelectionInformation.selectionRange;
  8386. if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
  8387. if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
  8388. ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
  8389. }
  8390. focusNode(priorFocusedElem);
  8391. }
  8392. },
  8393. /**
  8394. * @getSelection: Gets the selection bounds of a focused textarea, input or
  8395. * contentEditable node.
  8396. * -@input: Look up selection bounds of this input
  8397. * -@return {start: selectionStart, end: selectionEnd}
  8398. */
  8399. getSelection: function (input) {
  8400. var selection;
  8401. if ('selectionStart' in input) {
  8402. // Modern browser with input or textarea.
  8403. selection = {
  8404. start: input.selectionStart,
  8405. end: input.selectionEnd
  8406. };
  8407. } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
  8408. // IE8 input.
  8409. var range = document.selection.createRange();
  8410. // There can only be one selection per document in IE, so it must
  8411. // be in our element.
  8412. if (range.parentElement() === input) {
  8413. selection = {
  8414. start: -range.moveStart('character', -input.value.length),
  8415. end: -range.moveEnd('character', -input.value.length)
  8416. };
  8417. }
  8418. } else {
  8419. // Content editable or old IE textarea.
  8420. selection = ReactDOMSelection.getOffsets(input);
  8421. }
  8422. return selection || { start: 0, end: 0 };
  8423. },
  8424. /**
  8425. * @setSelection: Sets the selection bounds of a textarea or input and focuses
  8426. * the input.
  8427. * -@input Set selection bounds of this input or textarea
  8428. * -@offsets Object of same form that is returned from get*
  8429. */
  8430. setSelection: function (input, offsets) {
  8431. var start = offsets.start;
  8432. var end = offsets.end;
  8433. if (end === undefined) {
  8434. end = start;
  8435. }
  8436. if ('selectionStart' in input) {
  8437. input.selectionStart = start;
  8438. input.selectionEnd = Math.min(end, input.value.length);
  8439. } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
  8440. var range = input.createTextRange();
  8441. range.collapse(true);
  8442. range.moveStart('character', start);
  8443. range.moveEnd('character', end - start);
  8444. range.select();
  8445. } else {
  8446. ReactDOMSelection.setOffsets(input, offsets);
  8447. }
  8448. }
  8449. };
  8450. module.exports = ReactInputSelection;
  8451. },{"141":141,"146":146,"147":147,"44":44}],63:[function(_dereq_,module,exports){
  8452. /**
  8453. * Copyright 2013-present, Facebook, Inc.
  8454. * All rights reserved.
  8455. *
  8456. * This source code is licensed under the BSD-style license found in the
  8457. * LICENSE file in the root directory of this source tree. An additional grant
  8458. * of patent rights can be found in the PATENTS file in the same directory.
  8459. *
  8460. */
  8461. 'use strict';
  8462. /**
  8463. * `ReactInstanceMap` maintains a mapping from a public facing stateful
  8464. * instance (key) and the internal representation (value). This allows public
  8465. * methods to accept the user facing instance as an argument and map them back
  8466. * to internal methods.
  8467. */
  8468. // TODO: Replace this with ES6: var ReactInstanceMap = new Map();
  8469. var ReactInstanceMap = {
  8470. /**
  8471. * This API should be called `delete` but we'd have to make sure to always
  8472. * transform these to strings for IE support. When this transform is fully
  8473. * supported we can rename it.
  8474. */
  8475. remove: function (key) {
  8476. key._reactInternalInstance = undefined;
  8477. },
  8478. get: function (key) {
  8479. return key._reactInternalInstance;
  8480. },
  8481. has: function (key) {
  8482. return key._reactInternalInstance !== undefined;
  8483. },
  8484. set: function (key, value) {
  8485. key._reactInternalInstance = value;
  8486. }
  8487. };
  8488. module.exports = ReactInstanceMap;
  8489. },{}],64:[function(_dereq_,module,exports){
  8490. /**
  8491. * Copyright 2016-present, Facebook, Inc.
  8492. * All rights reserved.
  8493. *
  8494. * This source code is licensed under the BSD-style license found in the
  8495. * LICENSE file in the root directory of this source tree. An additional grant
  8496. * of patent rights can be found in the PATENTS file in the same directory.
  8497. *
  8498. *
  8499. */
  8500. 'use strict';
  8501. // Trust the developer to only use ReactInstrumentation with a __DEV__ check
  8502. var debugTool = null;
  8503. if ("development" !== 'production') {
  8504. var ReactDebugTool = _dereq_(50);
  8505. debugTool = ReactDebugTool;
  8506. }
  8507. module.exports = { debugTool: debugTool };
  8508. },{"50":50}],65:[function(_dereq_,module,exports){
  8509. /**
  8510. * Copyright 2016-present, Facebook, Inc.
  8511. * All rights reserved.
  8512. *
  8513. * This source code is licensed under the BSD-style license found in the
  8514. * LICENSE file in the root directory of this source tree. An additional grant
  8515. * of patent rights can be found in the PATENTS file in the same directory.
  8516. *
  8517. *
  8518. */
  8519. 'use strict';
  8520. var warning = _dereq_(159);
  8521. if ("development" !== 'production') {
  8522. var processingChildContext = false;
  8523. var warnInvalidSetState = function () {
  8524. "development" !== 'production' ? warning(!processingChildContext, 'setState(...): Cannot call setState() inside getChildContext()') : void 0;
  8525. };
  8526. }
  8527. var ReactInvalidSetStateWarningHook = {
  8528. onBeginProcessingChildContext: function () {
  8529. processingChildContext = true;
  8530. },
  8531. onEndProcessingChildContext: function () {
  8532. processingChildContext = false;
  8533. },
  8534. onSetState: function () {
  8535. warnInvalidSetState();
  8536. }
  8537. };
  8538. module.exports = ReactInvalidSetStateWarningHook;
  8539. },{"159":159}],66:[function(_dereq_,module,exports){
  8540. /**
  8541. * Copyright 2013-present, Facebook, Inc.
  8542. * All rights reserved.
  8543. *
  8544. * This source code is licensed under the BSD-style license found in the
  8545. * LICENSE file in the root directory of this source tree. An additional grant
  8546. * of patent rights can be found in the PATENTS file in the same directory.
  8547. *
  8548. */
  8549. 'use strict';
  8550. var adler32 = _dereq_(103);
  8551. var TAG_END = /\/?>/;
  8552. var COMMENT_START = /^<\!\-\-/;
  8553. var ReactMarkupChecksum = {
  8554. CHECKSUM_ATTR_NAME: 'data-react-checksum',
  8555. /**
  8556. * @param {string} markup Markup string
  8557. * @return {string} Markup string with checksum attribute attached
  8558. */
  8559. addChecksumToMarkup: function (markup) {
  8560. var checksum = adler32(markup);
  8561. // Add checksum (handle both parent tags, comments and self-closing tags)
  8562. if (COMMENT_START.test(markup)) {
  8563. return markup;
  8564. } else {
  8565. return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
  8566. }
  8567. },
  8568. /**
  8569. * @param {string} markup to use
  8570. * @param {DOMElement} element root React element
  8571. * @returns {boolean} whether or not the markup is the same
  8572. */
  8573. canReuseMarkup: function (markup, element) {
  8574. var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  8575. existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
  8576. var markupChecksum = adler32(markup);
  8577. return markupChecksum === existingChecksum;
  8578. }
  8579. };
  8580. module.exports = ReactMarkupChecksum;
  8581. },{"103":103}],67:[function(_dereq_,module,exports){
  8582. /**
  8583. * Copyright 2013-present, Facebook, Inc.
  8584. * All rights reserved.
  8585. *
  8586. * This source code is licensed under the BSD-style license found in the
  8587. * LICENSE file in the root directory of this source tree. An additional grant
  8588. * of patent rights can be found in the PATENTS file in the same directory.
  8589. *
  8590. */
  8591. 'use strict';
  8592. var _prodInvariant = _dereq_(126);
  8593. var DOMLazyTree = _dereq_(9);
  8594. var DOMProperty = _dereq_(11);
  8595. var React = _dereq_(135);
  8596. var ReactBrowserEventEmitter = _dereq_(26);
  8597. var ReactCurrentOwner = _dereq_(134);
  8598. var ReactDOMComponentTree = _dereq_(34);
  8599. var ReactDOMContainerInfo = _dereq_(35);
  8600. var ReactDOMFeatureFlags = _dereq_(37);
  8601. var ReactFeatureFlags = _dereq_(58);
  8602. var ReactInstanceMap = _dereq_(63);
  8603. var ReactInstrumentation = _dereq_(64);
  8604. var ReactMarkupChecksum = _dereq_(66);
  8605. var ReactReconciler = _dereq_(75);
  8606. var ReactUpdateQueue = _dereq_(81);
  8607. var ReactUpdates = _dereq_(82);
  8608. var emptyObject = _dereq_(145);
  8609. var instantiateReactComponent = _dereq_(121);
  8610. var invariant = _dereq_(152);
  8611. var setInnerHTML = _dereq_(128);
  8612. var shouldUpdateReactComponent = _dereq_(130);
  8613. var warning = _dereq_(159);
  8614. var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
  8615. var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME;
  8616. var ELEMENT_NODE_TYPE = 1;
  8617. var DOC_NODE_TYPE = 9;
  8618. var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
  8619. var instancesByReactRootID = {};
  8620. /**
  8621. * Finds the index of the first character
  8622. * that's not common between the two given strings.
  8623. *
  8624. * @return {number} the index of the character where the strings diverge
  8625. */
  8626. function firstDifferenceIndex(string1, string2) {
  8627. var minLen = Math.min(string1.length, string2.length);
  8628. for (var i = 0; i < minLen; i++) {
  8629. if (string1.charAt(i) !== string2.charAt(i)) {
  8630. return i;
  8631. }
  8632. }
  8633. return string1.length === string2.length ? -1 : minLen;
  8634. }
  8635. /**
  8636. * @param {DOMElement|DOMDocument} container DOM element that may contain
  8637. * a React component
  8638. * @return {?*} DOM element that may have the reactRoot ID, or null.
  8639. */
  8640. function getReactRootElementInContainer(container) {
  8641. if (!container) {
  8642. return null;
  8643. }
  8644. if (container.nodeType === DOC_NODE_TYPE) {
  8645. return container.documentElement;
  8646. } else {
  8647. return container.firstChild;
  8648. }
  8649. }
  8650. function internalGetID(node) {
  8651. // If node is something like a window, document, or text node, none of
  8652. // which support attributes or a .getAttribute method, gracefully return
  8653. // the empty string, as if the attribute were missing.
  8654. return node.getAttribute && node.getAttribute(ATTR_NAME) || '';
  8655. }
  8656. /**
  8657. * Mounts this component and inserts it into the DOM.
  8658. *
  8659. * @param {ReactComponent} componentInstance The instance to mount.
  8660. * @param {DOMElement} container DOM element to mount into.
  8661. * @param {ReactReconcileTransaction} transaction
  8662. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  8663. */
  8664. function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) {
  8665. var markerName;
  8666. if (ReactFeatureFlags.logTopLevelRenders) {
  8667. var wrappedElement = wrapperInstance._currentElement.props.child;
  8668. var type = wrappedElement.type;
  8669. markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name);
  8670. console.time(markerName);
  8671. }
  8672. var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */
  8673. );
  8674. if (markerName) {
  8675. console.timeEnd(markerName);
  8676. }
  8677. wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance;
  8678. ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction);
  8679. }
  8680. /**
  8681. * Batched mount.
  8682. *
  8683. * @param {ReactComponent} componentInstance The instance to mount.
  8684. * @param {DOMElement} container DOM element to mount into.
  8685. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  8686. */
  8687. function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) {
  8688. var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
  8689. /* useCreateElement */
  8690. !shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement);
  8691. transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context);
  8692. ReactUpdates.ReactReconcileTransaction.release(transaction);
  8693. }
  8694. /**
  8695. * Unmounts a component and removes it from the DOM.
  8696. *
  8697. * @param {ReactComponent} instance React component instance.
  8698. * @param {DOMElement} container DOM element to unmount from.
  8699. * @final
  8700. * @internal
  8701. * @see {ReactMount.unmountComponentAtNode}
  8702. */
  8703. function unmountComponentFromNode(instance, container, safely) {
  8704. if ("development" !== 'production') {
  8705. ReactInstrumentation.debugTool.onBeginFlush();
  8706. }
  8707. ReactReconciler.unmountComponent(instance, safely);
  8708. if ("development" !== 'production') {
  8709. ReactInstrumentation.debugTool.onEndFlush();
  8710. }
  8711. if (container.nodeType === DOC_NODE_TYPE) {
  8712. container = container.documentElement;
  8713. }
  8714. // http://jsperf.com/emptying-a-node
  8715. while (container.lastChild) {
  8716. container.removeChild(container.lastChild);
  8717. }
  8718. }
  8719. /**
  8720. * True if the supplied DOM node has a direct React-rendered child that is
  8721. * not a React root element. Useful for warning in `render`,
  8722. * `unmountComponentAtNode`, etc.
  8723. *
  8724. * @param {?DOMElement} node The candidate DOM node.
  8725. * @return {boolean} True if the DOM element contains a direct child that was
  8726. * rendered by React but is not a root element.
  8727. * @internal
  8728. */
  8729. function hasNonRootReactChild(container) {
  8730. var rootEl = getReactRootElementInContainer(container);
  8731. if (rootEl) {
  8732. var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl);
  8733. return !!(inst && inst._hostParent);
  8734. }
  8735. }
  8736. /**
  8737. * True if the supplied DOM node is a React DOM element and
  8738. * it has been rendered by another copy of React.
  8739. *
  8740. * @param {?DOMElement} node The candidate DOM node.
  8741. * @return {boolean} True if the DOM has been rendered by another copy of React
  8742. * @internal
  8743. */
  8744. function nodeIsRenderedByOtherInstance(container) {
  8745. var rootEl = getReactRootElementInContainer(container);
  8746. return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl));
  8747. }
  8748. /**
  8749. * True if the supplied DOM node is a valid node element.
  8750. *
  8751. * @param {?DOMElement} node The candidate DOM node.
  8752. * @return {boolean} True if the DOM is a valid DOM node.
  8753. * @internal
  8754. */
  8755. function isValidContainer(node) {
  8756. return !!(node && (node.nodeType === ELEMENT_NODE_TYPE || node.nodeType === DOC_NODE_TYPE || node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE));
  8757. }
  8758. /**
  8759. * True if the supplied DOM node is a valid React node element.
  8760. *
  8761. * @param {?DOMElement} node The candidate DOM node.
  8762. * @return {boolean} True if the DOM is a valid React DOM node.
  8763. * @internal
  8764. */
  8765. function isReactNode(node) {
  8766. return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME));
  8767. }
  8768. function getHostRootInstanceInContainer(container) {
  8769. var rootEl = getReactRootElementInContainer(container);
  8770. var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl);
  8771. return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null;
  8772. }
  8773. function getTopLevelWrapperInContainer(container) {
  8774. var root = getHostRootInstanceInContainer(container);
  8775. return root ? root._hostContainerInfo._topLevelWrapper : null;
  8776. }
  8777. /**
  8778. * Temporary (?) hack so that we can store all top-level pending updates on
  8779. * composites instead of having to worry about different types of components
  8780. * here.
  8781. */
  8782. var topLevelRootCounter = 1;
  8783. var TopLevelWrapper = function () {
  8784. this.rootID = topLevelRootCounter++;
  8785. };
  8786. TopLevelWrapper.prototype.isReactComponent = {};
  8787. if ("development" !== 'production') {
  8788. TopLevelWrapper.displayName = 'TopLevelWrapper';
  8789. }
  8790. TopLevelWrapper.prototype.render = function () {
  8791. return this.props.child;
  8792. };
  8793. TopLevelWrapper.isReactTopLevelWrapper = true;
  8794. /**
  8795. * Mounting is the process of initializing a React component by creating its
  8796. * representative DOM elements and inserting them into a supplied `container`.
  8797. * Any prior content inside `container` is destroyed in the process.
  8798. *
  8799. * ReactMount.render(
  8800. * component,
  8801. * document.getElementById('container')
  8802. * );
  8803. *
  8804. * <div id="container"> <-- Supplied `container`.
  8805. * <div data-reactid=".3"> <-- Rendered reactRoot of React
  8806. * // ... component.
  8807. * </div>
  8808. * </div>
  8809. *
  8810. * Inside of `container`, the first element rendered is the "reactRoot".
  8811. */
  8812. var ReactMount = {
  8813. TopLevelWrapper: TopLevelWrapper,
  8814. /**
  8815. * Used by devtools. The keys are not important.
  8816. */
  8817. _instancesByReactRootID: instancesByReactRootID,
  8818. /**
  8819. * This is a hook provided to support rendering React components while
  8820. * ensuring that the apparent scroll position of its `container` does not
  8821. * change.
  8822. *
  8823. * @param {DOMElement} container The `container` being rendered into.
  8824. * @param {function} renderCallback This must be called once to do the render.
  8825. */
  8826. scrollMonitor: function (container, renderCallback) {
  8827. renderCallback();
  8828. },
  8829. /**
  8830. * Take a component that's already mounted into the DOM and replace its props
  8831. * @param {ReactComponent} prevComponent component instance already in the DOM
  8832. * @param {ReactElement} nextElement component instance to render
  8833. * @param {DOMElement} container container to render into
  8834. * @param {?function} callback function triggered on completion
  8835. */
  8836. _updateRootComponent: function (prevComponent, nextElement, nextContext, container, callback) {
  8837. ReactMount.scrollMonitor(container, function () {
  8838. ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext);
  8839. if (callback) {
  8840. ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
  8841. }
  8842. });
  8843. return prevComponent;
  8844. },
  8845. /**
  8846. * Render a new component into the DOM. Hooked by hooks!
  8847. *
  8848. * @param {ReactElement} nextElement element to render
  8849. * @param {DOMElement} container container to render into
  8850. * @param {boolean} shouldReuseMarkup if we should skip the markup insertion
  8851. * @return {ReactComponent} nextComponent
  8852. */
  8853. _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
  8854. // Various parts of our code (such as ReactCompositeComponent's
  8855. // _renderValidatedComponent) assume that calls to render aren't nested;
  8856. // verify that that's the case.
  8857. "development" !== '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') : void 0;
  8858. !isValidContainer(container) ? "development" !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0;
  8859. ReactBrowserEventEmitter.ensureScrollValueMonitoring();
  8860. var componentInstance = instantiateReactComponent(nextElement, false);
  8861. // The initial render is synchronous but any updates that happen during
  8862. // rendering, in componentWillMount or componentDidMount, will be batched
  8863. // according to the current batching strategy.
  8864. ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context);
  8865. var wrapperID = componentInstance._instance.rootID;
  8866. instancesByReactRootID[wrapperID] = componentInstance;
  8867. return componentInstance;
  8868. },
  8869. /**
  8870. * Renders a React component into the DOM in the supplied `container`.
  8871. *
  8872. * If the React component was previously rendered into `container`, this will
  8873. * perform an update on it and only mutate the DOM as necessary to reflect the
  8874. * latest React component.
  8875. *
  8876. * @param {ReactComponent} parentComponent The conceptual parent of this render tree.
  8877. * @param {ReactElement} nextElement Component element to render.
  8878. * @param {DOMElement} container DOM element to render into.
  8879. * @param {?function} callback function triggered on completion
  8880. * @return {ReactComponent} Component instance rendered in `container`.
  8881. */
  8882. renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
  8883. !(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? "development" !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0;
  8884. return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
  8885. },
  8886. _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
  8887. ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render');
  8888. !React.isValidElement(nextElement) ? "development" !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? " Instead of passing a string like 'div', pass " + "React.createElement('div') or <div />." : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : // Check if it quacks like an element
  8889. nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : _prodInvariant('39', typeof nextElement === 'string' ? " Instead of passing a string like 'div', pass " + "React.createElement('div') or <div />." : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : void 0;
  8890. "development" !== '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.') : void 0;
  8891. var nextWrappedElement = React.createElement(TopLevelWrapper, {
  8892. child: nextElement
  8893. });
  8894. var nextContext;
  8895. if (parentComponent) {
  8896. var parentInst = ReactInstanceMap.get(parentComponent);
  8897. nextContext = parentInst._processChildContext(parentInst._context);
  8898. } else {
  8899. nextContext = emptyObject;
  8900. }
  8901. var prevComponent = getTopLevelWrapperInContainer(container);
  8902. if (prevComponent) {
  8903. var prevWrappedElement = prevComponent._currentElement;
  8904. var prevElement = prevWrappedElement.props.child;
  8905. if (shouldUpdateReactComponent(prevElement, nextElement)) {
  8906. var publicInst = prevComponent._renderedComponent.getPublicInstance();
  8907. var updatedCallback = callback && function () {
  8908. callback.call(publicInst);
  8909. };
  8910. ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback);
  8911. return publicInst;
  8912. } else {
  8913. ReactMount.unmountComponentAtNode(container);
  8914. }
  8915. }
  8916. var reactRootElement = getReactRootElementInContainer(container);
  8917. var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
  8918. var containerHasNonRootReactChild = hasNonRootReactChild(container);
  8919. if ("development" !== 'production') {
  8920. "development" !== '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.') : void 0;
  8921. if (!containerHasReactMarkup || reactRootElement.nextSibling) {
  8922. var rootElementSibling = reactRootElement;
  8923. while (rootElementSibling) {
  8924. if (internalGetID(rootElementSibling)) {
  8925. "development" !== '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.') : void 0;
  8926. break;
  8927. }
  8928. rootElementSibling = rootElementSibling.nextSibling;
  8929. }
  8930. }
  8931. }
  8932. var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
  8933. var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance();
  8934. if (callback) {
  8935. callback.call(component);
  8936. }
  8937. return component;
  8938. },
  8939. /**
  8940. * Renders a React component into the DOM in the supplied `container`.
  8941. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render
  8942. *
  8943. * If the React component was previously rendered into `container`, this will
  8944. * perform an update on it and only mutate the DOM as necessary to reflect the
  8945. * latest React component.
  8946. *
  8947. * @param {ReactElement} nextElement Component element to render.
  8948. * @param {DOMElement} container DOM element to render into.
  8949. * @param {?function} callback function triggered on completion
  8950. * @return {ReactComponent} Component instance rendered in `container`.
  8951. */
  8952. render: function (nextElement, container, callback) {
  8953. return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
  8954. },
  8955. /**
  8956. * Unmounts and destroys the React component rendered in the `container`.
  8957. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode
  8958. *
  8959. * @param {DOMElement} container DOM element containing a React component.
  8960. * @return {boolean} True if a component was found in and unmounted from
  8961. * `container`
  8962. */
  8963. unmountComponentAtNode: function (container) {
  8964. // Various parts of our code (such as ReactCompositeComponent's
  8965. // _renderValidatedComponent) assume that calls to render aren't nested;
  8966. // verify that that's the case. (Strictly speaking, unmounting won't cause a
  8967. // render but we still don't expect to be in a render call here.)
  8968. "development" !== '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') : void 0;
  8969. !isValidContainer(container) ? "development" !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0;
  8970. if ("development" !== 'production') {
  8971. "development" !== 'production' ? warning(!nodeIsRenderedByOtherInstance(container), "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.') : void 0;
  8972. }
  8973. var prevComponent = getTopLevelWrapperInContainer(container);
  8974. if (!prevComponent) {
  8975. // Check if the node being unmounted was rendered by React, but isn't a
  8976. // root node.
  8977. var containerHasNonRootReactChild = hasNonRootReactChild(container);
  8978. // Check if the container itself is a React root node.
  8979. var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME);
  8980. if ("development" !== 'production') {
  8981. "development" !== '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.') : void 0;
  8982. }
  8983. return false;
  8984. }
  8985. delete instancesByReactRootID[prevComponent._instance.rootID];
  8986. ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false);
  8987. return true;
  8988. },
  8989. _mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) {
  8990. !isValidContainer(container) ? "development" !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0;
  8991. if (shouldReuseMarkup) {
  8992. var rootElement = getReactRootElementInContainer(container);
  8993. if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
  8994. ReactDOMComponentTree.precacheNode(instance, rootElement);
  8995. return;
  8996. } else {
  8997. var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  8998. rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  8999. var rootMarkup = rootElement.outerHTML;
  9000. rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
  9001. var normalizedMarkup = markup;
  9002. if ("development" !== 'production') {
  9003. // because rootMarkup is retrieved from the DOM, various normalizations
  9004. // will have occurred which will not be present in `markup`. Here,
  9005. // insert markup into a <div> or <iframe> depending on the container
  9006. // type to perform the same normalizations before comparing.
  9007. var normalizer;
  9008. if (container.nodeType === ELEMENT_NODE_TYPE) {
  9009. normalizer = document.createElement('div');
  9010. normalizer.innerHTML = markup;
  9011. normalizedMarkup = normalizer.innerHTML;
  9012. } else {
  9013. normalizer = document.createElement('iframe');
  9014. document.body.appendChild(normalizer);
  9015. normalizer.contentDocument.write(markup);
  9016. normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
  9017. document.body.removeChild(normalizer);
  9018. }
  9019. }
  9020. var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
  9021. var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
  9022. !(container.nodeType !== DOC_NODE_TYPE) ? "development" !== '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) : _prodInvariant('42', difference) : void 0;
  9023. if ("development" !== 'production') {
  9024. "development" !== '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) : void 0;
  9025. }
  9026. }
  9027. }
  9028. !(container.nodeType !== DOC_NODE_TYPE) ? "development" !== '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.') : _prodInvariant('43') : void 0;
  9029. if (transaction.useCreateElement) {
  9030. while (container.lastChild) {
  9031. container.removeChild(container.lastChild);
  9032. }
  9033. DOMLazyTree.insertTreeBefore(container, markup, null);
  9034. } else {
  9035. setInnerHTML(container, markup);
  9036. ReactDOMComponentTree.precacheNode(instance, container.firstChild);
  9037. }
  9038. if ("development" !== 'production') {
  9039. var hostNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild);
  9040. if (hostNode._debugID !== 0) {
  9041. ReactInstrumentation.debugTool.onHostOperation({
  9042. instanceID: hostNode._debugID,
  9043. type: 'mount',
  9044. payload: markup.toString()
  9045. });
  9046. }
  9047. }
  9048. }
  9049. };
  9050. module.exports = ReactMount;
  9051. },{"11":11,"121":121,"126":126,"128":128,"130":130,"134":134,"135":135,"145":145,"152":152,"159":159,"26":26,"34":34,"35":35,"37":37,"58":58,"63":63,"64":64,"66":66,"75":75,"81":81,"82":82,"9":9}],68:[function(_dereq_,module,exports){
  9052. /**
  9053. * Copyright 2013-present, Facebook, Inc.
  9054. * All rights reserved.
  9055. *
  9056. * This source code is licensed under the BSD-style license found in the
  9057. * LICENSE file in the root directory of this source tree. An additional grant
  9058. * of patent rights can be found in the PATENTS file in the same directory.
  9059. *
  9060. */
  9061. 'use strict';
  9062. var _prodInvariant = _dereq_(126);
  9063. var ReactComponentEnvironment = _dereq_(29);
  9064. var ReactInstanceMap = _dereq_(63);
  9065. var ReactInstrumentation = _dereq_(64);
  9066. var ReactCurrentOwner = _dereq_(134);
  9067. var ReactReconciler = _dereq_(75);
  9068. var ReactChildReconciler = _dereq_(27);
  9069. var emptyFunction = _dereq_(144);
  9070. var flattenChildren = _dereq_(109);
  9071. var invariant = _dereq_(152);
  9072. /**
  9073. * Make an update for markup to be rendered and inserted at a supplied index.
  9074. *
  9075. * @param {string} markup Markup that renders into an element.
  9076. * @param {number} toIndex Destination index.
  9077. * @private
  9078. */
  9079. function makeInsertMarkup(markup, afterNode, toIndex) {
  9080. // NOTE: Null values reduce hidden classes.
  9081. return {
  9082. type: 'INSERT_MARKUP',
  9083. content: markup,
  9084. fromIndex: null,
  9085. fromNode: null,
  9086. toIndex: toIndex,
  9087. afterNode: afterNode
  9088. };
  9089. }
  9090. /**
  9091. * Make an update for moving an existing element to another index.
  9092. *
  9093. * @param {number} fromIndex Source index of the existing element.
  9094. * @param {number} toIndex Destination index of the element.
  9095. * @private
  9096. */
  9097. function makeMove(child, afterNode, toIndex) {
  9098. // NOTE: Null values reduce hidden classes.
  9099. return {
  9100. type: 'MOVE_EXISTING',
  9101. content: null,
  9102. fromIndex: child._mountIndex,
  9103. fromNode: ReactReconciler.getHostNode(child),
  9104. toIndex: toIndex,
  9105. afterNode: afterNode
  9106. };
  9107. }
  9108. /**
  9109. * Make an update for removing an element at an index.
  9110. *
  9111. * @param {number} fromIndex Index of the element to remove.
  9112. * @private
  9113. */
  9114. function makeRemove(child, node) {
  9115. // NOTE: Null values reduce hidden classes.
  9116. return {
  9117. type: 'REMOVE_NODE',
  9118. content: null,
  9119. fromIndex: child._mountIndex,
  9120. fromNode: node,
  9121. toIndex: null,
  9122. afterNode: null
  9123. };
  9124. }
  9125. /**
  9126. * Make an update for setting the markup of a node.
  9127. *
  9128. * @param {string} markup Markup that renders into an element.
  9129. * @private
  9130. */
  9131. function makeSetMarkup(markup) {
  9132. // NOTE: Null values reduce hidden classes.
  9133. return {
  9134. type: 'SET_MARKUP',
  9135. content: markup,
  9136. fromIndex: null,
  9137. fromNode: null,
  9138. toIndex: null,
  9139. afterNode: null
  9140. };
  9141. }
  9142. /**
  9143. * Make an update for setting the text content.
  9144. *
  9145. * @param {string} textContent Text content to set.
  9146. * @private
  9147. */
  9148. function makeTextContent(textContent) {
  9149. // NOTE: Null values reduce hidden classes.
  9150. return {
  9151. type: 'TEXT_CONTENT',
  9152. content: textContent,
  9153. fromIndex: null,
  9154. fromNode: null,
  9155. toIndex: null,
  9156. afterNode: null
  9157. };
  9158. }
  9159. /**
  9160. * Push an update, if any, onto the queue. Creates a new queue if none is
  9161. * passed and always returns the queue. Mutative.
  9162. */
  9163. function enqueue(queue, update) {
  9164. if (update) {
  9165. queue = queue || [];
  9166. queue.push(update);
  9167. }
  9168. return queue;
  9169. }
  9170. /**
  9171. * Processes any enqueued updates.
  9172. *
  9173. * @private
  9174. */
  9175. function processQueue(inst, updateQueue) {
  9176. ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue);
  9177. }
  9178. var setChildrenForInstrumentation = emptyFunction;
  9179. if ("development" !== 'production') {
  9180. var getDebugID = function (inst) {
  9181. if (!inst._debugID) {
  9182. // Check for ART-like instances. TODO: This is silly/gross.
  9183. var internal;
  9184. if (internal = ReactInstanceMap.get(inst)) {
  9185. inst = internal;
  9186. }
  9187. }
  9188. return inst._debugID;
  9189. };
  9190. setChildrenForInstrumentation = function (children) {
  9191. var debugID = getDebugID(this);
  9192. // TODO: React Native empty components are also multichild.
  9193. // This means they still get into this method but don't have _debugID.
  9194. if (debugID !== 0) {
  9195. ReactInstrumentation.debugTool.onSetChildren(debugID, children ? Object.keys(children).map(function (key) {
  9196. return children[key]._debugID;
  9197. }) : []);
  9198. }
  9199. };
  9200. }
  9201. /**
  9202. * ReactMultiChild are capable of reconciling multiple children.
  9203. *
  9204. * @class ReactMultiChild
  9205. * @internal
  9206. */
  9207. var ReactMultiChild = {
  9208. /**
  9209. * Provides common functionality for components that must reconcile multiple
  9210. * children. This is used by `ReactDOMComponent` to mount, update, and
  9211. * unmount child components.
  9212. *
  9213. * @lends {ReactMultiChild.prototype}
  9214. */
  9215. Mixin: {
  9216. _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
  9217. if ("development" !== 'production') {
  9218. var selfDebugID = getDebugID(this);
  9219. if (this._currentElement) {
  9220. try {
  9221. ReactCurrentOwner.current = this._currentElement._owner;
  9222. return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context, selfDebugID);
  9223. } finally {
  9224. ReactCurrentOwner.current = null;
  9225. }
  9226. }
  9227. }
  9228. return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
  9229. },
  9230. _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context) {
  9231. var nextChildren;
  9232. var selfDebugID = 0;
  9233. if ("development" !== 'production') {
  9234. selfDebugID = getDebugID(this);
  9235. if (this._currentElement) {
  9236. try {
  9237. ReactCurrentOwner.current = this._currentElement._owner;
  9238. nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
  9239. } finally {
  9240. ReactCurrentOwner.current = null;
  9241. }
  9242. ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
  9243. return nextChildren;
  9244. }
  9245. }
  9246. nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
  9247. ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
  9248. return nextChildren;
  9249. },
  9250. /**
  9251. * Generates a "mount image" for each of the supplied children. In the case
  9252. * of `ReactDOMComponent`, a mount image is a string of markup.
  9253. *
  9254. * @param {?object} nestedChildren Nested child maps.
  9255. * @return {array} An array of mounted representations.
  9256. * @internal
  9257. */
  9258. mountChildren: function (nestedChildren, transaction, context) {
  9259. var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
  9260. this._renderedChildren = children;
  9261. var mountImages = [];
  9262. var index = 0;
  9263. for (var name in children) {
  9264. if (children.hasOwnProperty(name)) {
  9265. var child = children[name];
  9266. var selfDebugID = 0;
  9267. if ("development" !== 'production') {
  9268. selfDebugID = getDebugID(this);
  9269. }
  9270. var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context, selfDebugID);
  9271. child._mountIndex = index++;
  9272. mountImages.push(mountImage);
  9273. }
  9274. }
  9275. if ("development" !== 'production') {
  9276. setChildrenForInstrumentation.call(this, children);
  9277. }
  9278. return mountImages;
  9279. },
  9280. /**
  9281. * Replaces any rendered children with a text content string.
  9282. *
  9283. * @param {string} nextContent String of content.
  9284. * @internal
  9285. */
  9286. updateTextContent: function (nextContent) {
  9287. var prevChildren = this._renderedChildren;
  9288. // Remove any rendered children.
  9289. ReactChildReconciler.unmountChildren(prevChildren, false);
  9290. for (var name in prevChildren) {
  9291. if (prevChildren.hasOwnProperty(name)) {
  9292. !false ? "development" !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
  9293. }
  9294. }
  9295. // Set new text content.
  9296. var updates = [makeTextContent(nextContent)];
  9297. processQueue(this, updates);
  9298. },
  9299. /**
  9300. * Replaces any rendered children with a markup string.
  9301. *
  9302. * @param {string} nextMarkup String of markup.
  9303. * @internal
  9304. */
  9305. updateMarkup: function (nextMarkup) {
  9306. var prevChildren = this._renderedChildren;
  9307. // Remove any rendered children.
  9308. ReactChildReconciler.unmountChildren(prevChildren, false);
  9309. for (var name in prevChildren) {
  9310. if (prevChildren.hasOwnProperty(name)) {
  9311. !false ? "development" !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
  9312. }
  9313. }
  9314. var updates = [makeSetMarkup(nextMarkup)];
  9315. processQueue(this, updates);
  9316. },
  9317. /**
  9318. * Updates the rendered children with new children.
  9319. *
  9320. * @param {?object} nextNestedChildrenElements Nested child element maps.
  9321. * @param {ReactReconcileTransaction} transaction
  9322. * @internal
  9323. */
  9324. updateChildren: function (nextNestedChildrenElements, transaction, context) {
  9325. // Hook used by React ART
  9326. this._updateChildren(nextNestedChildrenElements, transaction, context);
  9327. },
  9328. /**
  9329. * @param {?object} nextNestedChildrenElements Nested child element maps.
  9330. * @param {ReactReconcileTransaction} transaction
  9331. * @final
  9332. * @protected
  9333. */
  9334. _updateChildren: function (nextNestedChildrenElements, transaction, context) {
  9335. var prevChildren = this._renderedChildren;
  9336. var removedNodes = {};
  9337. var mountImages = [];
  9338. var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context);
  9339. if (!nextChildren && !prevChildren) {
  9340. return;
  9341. }
  9342. var updates = null;
  9343. var name;
  9344. // `nextIndex` will increment for each child in `nextChildren`, but
  9345. // `lastIndex` will be the last index visited in `prevChildren`.
  9346. var nextIndex = 0;
  9347. var lastIndex = 0;
  9348. // `nextMountIndex` will increment for each newly mounted child.
  9349. var nextMountIndex = 0;
  9350. var lastPlacedNode = null;
  9351. for (name in nextChildren) {
  9352. if (!nextChildren.hasOwnProperty(name)) {
  9353. continue;
  9354. }
  9355. var prevChild = prevChildren && prevChildren[name];
  9356. var nextChild = nextChildren[name];
  9357. if (prevChild === nextChild) {
  9358. updates = enqueue(updates, this.moveChild(prevChild, lastPlacedNode, nextIndex, lastIndex));
  9359. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  9360. prevChild._mountIndex = nextIndex;
  9361. } else {
  9362. if (prevChild) {
  9363. // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
  9364. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  9365. // The `removedNodes` loop below will actually remove the child.
  9366. }
  9367. // The child must be instantiated before it's mounted.
  9368. updates = enqueue(updates, this._mountChildAtIndex(nextChild, mountImages[nextMountIndex], lastPlacedNode, nextIndex, transaction, context));
  9369. nextMountIndex++;
  9370. }
  9371. nextIndex++;
  9372. lastPlacedNode = ReactReconciler.getHostNode(nextChild);
  9373. }
  9374. // Remove children that are no longer present.
  9375. for (name in removedNodes) {
  9376. if (removedNodes.hasOwnProperty(name)) {
  9377. updates = enqueue(updates, this._unmountChild(prevChildren[name], removedNodes[name]));
  9378. }
  9379. }
  9380. if (updates) {
  9381. processQueue(this, updates);
  9382. }
  9383. this._renderedChildren = nextChildren;
  9384. if ("development" !== 'production') {
  9385. setChildrenForInstrumentation.call(this, nextChildren);
  9386. }
  9387. },
  9388. /**
  9389. * Unmounts all rendered children. This should be used to clean up children
  9390. * when this component is unmounted. It does not actually perform any
  9391. * backend operations.
  9392. *
  9393. * @internal
  9394. */
  9395. unmountChildren: function (safely) {
  9396. var renderedChildren = this._renderedChildren;
  9397. ReactChildReconciler.unmountChildren(renderedChildren, safely);
  9398. this._renderedChildren = null;
  9399. },
  9400. /**
  9401. * Moves a child component to the supplied index.
  9402. *
  9403. * @param {ReactComponent} child Component to move.
  9404. * @param {number} toIndex Destination index of the element.
  9405. * @param {number} lastIndex Last index visited of the siblings of `child`.
  9406. * @protected
  9407. */
  9408. moveChild: function (child, afterNode, toIndex, lastIndex) {
  9409. // If the index of `child` is less than `lastIndex`, then it needs to
  9410. // be moved. Otherwise, we do not need to move it because a child will be
  9411. // inserted or moved before `child`.
  9412. if (child._mountIndex < lastIndex) {
  9413. return makeMove(child, afterNode, toIndex);
  9414. }
  9415. },
  9416. /**
  9417. * Creates a child component.
  9418. *
  9419. * @param {ReactComponent} child Component to create.
  9420. * @param {string} mountImage Markup to insert.
  9421. * @protected
  9422. */
  9423. createChild: function (child, afterNode, mountImage) {
  9424. return makeInsertMarkup(mountImage, afterNode, child._mountIndex);
  9425. },
  9426. /**
  9427. * Removes a child component.
  9428. *
  9429. * @param {ReactComponent} child Child to remove.
  9430. * @protected
  9431. */
  9432. removeChild: function (child, node) {
  9433. return makeRemove(child, node);
  9434. },
  9435. /**
  9436. * Mounts a child with the supplied name.
  9437. *
  9438. * NOTE: This is part of `updateChildren` and is here for readability.
  9439. *
  9440. * @param {ReactComponent} child Component to mount.
  9441. * @param {string} name Name of the child.
  9442. * @param {number} index Index at which to insert the child.
  9443. * @param {ReactReconcileTransaction} transaction
  9444. * @private
  9445. */
  9446. _mountChildAtIndex: function (child, mountImage, afterNode, index, transaction, context) {
  9447. child._mountIndex = index;
  9448. return this.createChild(child, afterNode, mountImage);
  9449. },
  9450. /**
  9451. * Unmounts a rendered child.
  9452. *
  9453. * NOTE: This is part of `updateChildren` and is here for readability.
  9454. *
  9455. * @param {ReactComponent} child Component to unmount.
  9456. * @private
  9457. */
  9458. _unmountChild: function (child, node) {
  9459. var update = this.removeChild(child, node);
  9460. child._mountIndex = null;
  9461. return update;
  9462. }
  9463. }
  9464. };
  9465. module.exports = ReactMultiChild;
  9466. },{"109":109,"126":126,"134":134,"144":144,"152":152,"27":27,"29":29,"63":63,"64":64,"75":75}],69:[function(_dereq_,module,exports){
  9467. /**
  9468. * Copyright 2013-present, Facebook, Inc.
  9469. * All rights reserved.
  9470. *
  9471. * This source code is licensed under the BSD-style license found in the
  9472. * LICENSE file in the root directory of this source tree. An additional grant
  9473. * of patent rights can be found in the PATENTS file in the same directory.
  9474. *
  9475. *
  9476. */
  9477. 'use strict';
  9478. var _prodInvariant = _dereq_(126);
  9479. var React = _dereq_(135);
  9480. var invariant = _dereq_(152);
  9481. var ReactNodeTypes = {
  9482. HOST: 0,
  9483. COMPOSITE: 1,
  9484. EMPTY: 2,
  9485. getType: function (node) {
  9486. if (node === null || node === false) {
  9487. return ReactNodeTypes.EMPTY;
  9488. } else if (React.isValidElement(node)) {
  9489. if (typeof node.type === 'function') {
  9490. return ReactNodeTypes.COMPOSITE;
  9491. } else {
  9492. return ReactNodeTypes.HOST;
  9493. }
  9494. }
  9495. !false ? "development" !== 'production' ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0;
  9496. }
  9497. };
  9498. module.exports = ReactNodeTypes;
  9499. },{"126":126,"135":135,"152":152}],70:[function(_dereq_,module,exports){
  9500. /**
  9501. * Copyright 2013-present, Facebook, Inc.
  9502. * All rights reserved.
  9503. *
  9504. * This source code is licensed under the BSD-style license found in the
  9505. * LICENSE file in the root directory of this source tree. An additional grant
  9506. * of patent rights can be found in the PATENTS file in the same directory.
  9507. *
  9508. *
  9509. */
  9510. 'use strict';
  9511. var _prodInvariant = _dereq_(126);
  9512. var invariant = _dereq_(152);
  9513. /**
  9514. * @param {?object} object
  9515. * @return {boolean} True if `object` is a valid owner.
  9516. * @final
  9517. */
  9518. function isValidOwner(object) {
  9519. return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
  9520. }
  9521. /**
  9522. * ReactOwners are capable of storing references to owned components.
  9523. *
  9524. * All components are capable of //being// referenced by owner components, but
  9525. * only ReactOwner components are capable of //referencing// owned components.
  9526. * The named reference is known as a "ref".
  9527. *
  9528. * Refs are available when mounted and updated during reconciliation.
  9529. *
  9530. * var MyComponent = React.createClass({
  9531. * render: function() {
  9532. * return (
  9533. * <div onClick={this.handleClick}>
  9534. * <CustomComponent ref="custom" />
  9535. * </div>
  9536. * );
  9537. * },
  9538. * handleClick: function() {
  9539. * this.refs.custom.handleClick();
  9540. * },
  9541. * componentDidMount: function() {
  9542. * this.refs.custom.initialize();
  9543. * }
  9544. * });
  9545. *
  9546. * Refs should rarely be used. When refs are used, they should only be done to
  9547. * control data that is not handled by React's data flow.
  9548. *
  9549. * @class ReactOwner
  9550. */
  9551. var ReactOwner = {
  9552. /**
  9553. * Adds a component by ref to an owner component.
  9554. *
  9555. * @param {ReactComponent} component Component to reference.
  9556. * @param {string} ref Name by which to refer to the component.
  9557. * @param {ReactOwner} owner Component on which to record the ref.
  9558. * @final
  9559. * @internal
  9560. */
  9561. addComponentAsRefTo: function (component, ref, owner) {
  9562. !isValidOwner(owner) ? "development" !== '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).') : _prodInvariant('119') : void 0;
  9563. owner.attachRef(ref, component);
  9564. },
  9565. /**
  9566. * Removes a component by ref from an owner component.
  9567. *
  9568. * @param {ReactComponent} component Component to dereference.
  9569. * @param {string} ref Name of the ref to remove.
  9570. * @param {ReactOwner} owner Component on which the ref is recorded.
  9571. * @final
  9572. * @internal
  9573. */
  9574. removeComponentAsRefFrom: function (component, ref, owner) {
  9575. !isValidOwner(owner) ? "development" !== '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).') : _prodInvariant('120') : void 0;
  9576. var ownerPublicInstance = owner.getPublicInstance();
  9577. // Check that `component`'s owner is still alive and that `component` is still the current ref
  9578. // because we do not want to detach the ref if another component stole it.
  9579. if (ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance()) {
  9580. owner.detachRef(ref);
  9581. }
  9582. }
  9583. };
  9584. module.exports = ReactOwner;
  9585. },{"126":126,"152":152}],71:[function(_dereq_,module,exports){
  9586. /**
  9587. * Copyright 2016-present, Facebook, Inc.
  9588. * All rights reserved.
  9589. *
  9590. * This source code is licensed under the BSD-style license found in the
  9591. * LICENSE file in the root directory of this source tree. An additional grant
  9592. * of patent rights can be found in the PATENTS file in the same directory.
  9593. *
  9594. *
  9595. */
  9596. 'use strict';
  9597. var _assign = _dereq_(160);
  9598. var _extends = _assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  9599. var ReactDebugTool = _dereq_(50);
  9600. var lowPriorityWarning = _dereq_(124);
  9601. var alreadyWarned = false;
  9602. function roundFloat(val) {
  9603. var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  9604. var n = Math.pow(10, base);
  9605. return Math.floor(val * n) / n;
  9606. }
  9607. // Flow type definition of console.table is too strict right now, see
  9608. // https://github.com/facebook/flow/pull/2353 for updates
  9609. function consoleTable(table) {
  9610. console.table(table);
  9611. }
  9612. function warnInProduction() {
  9613. if (alreadyWarned) {
  9614. return;
  9615. }
  9616. alreadyWarned = true;
  9617. if (typeof console !== 'undefined') {
  9618. console.error('ReactPerf is not supported in the production builds of React. ' + 'To collect measurements, please use the development build of React instead.');
  9619. }
  9620. }
  9621. function getLastMeasurements() {
  9622. if (!("development" !== 'production')) {
  9623. warnInProduction();
  9624. return [];
  9625. }
  9626. return ReactDebugTool.getFlushHistory();
  9627. }
  9628. function getExclusive() {
  9629. var flushHistory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getLastMeasurements();
  9630. if (!("development" !== 'production')) {
  9631. warnInProduction();
  9632. return [];
  9633. }
  9634. var aggregatedStats = {};
  9635. var affectedIDs = {};
  9636. function updateAggregatedStats(treeSnapshot, instanceID, timerType, applyUpdate) {
  9637. var displayName = treeSnapshot[instanceID].displayName;
  9638. var key = displayName;
  9639. var stats = aggregatedStats[key];
  9640. if (!stats) {
  9641. affectedIDs[key] = {};
  9642. stats = aggregatedStats[key] = {
  9643. key: key,
  9644. instanceCount: 0,
  9645. counts: {},
  9646. durations: {},
  9647. totalDuration: 0
  9648. };
  9649. }
  9650. if (!stats.durations[timerType]) {
  9651. stats.durations[timerType] = 0;
  9652. }
  9653. if (!stats.counts[timerType]) {
  9654. stats.counts[timerType] = 0;
  9655. }
  9656. affectedIDs[key][instanceID] = true;
  9657. applyUpdate(stats);
  9658. }
  9659. flushHistory.forEach(function (flush) {
  9660. var measurements = flush.measurements,
  9661. treeSnapshot = flush.treeSnapshot;
  9662. measurements.forEach(function (measurement) {
  9663. var duration = measurement.duration,
  9664. instanceID = measurement.instanceID,
  9665. timerType = measurement.timerType;
  9666. updateAggregatedStats(treeSnapshot, instanceID, timerType, function (stats) {
  9667. stats.totalDuration += duration;
  9668. stats.durations[timerType] += duration;
  9669. stats.counts[timerType]++;
  9670. });
  9671. });
  9672. });
  9673. return Object.keys(aggregatedStats).map(function (key) {
  9674. return _extends({}, aggregatedStats[key], {
  9675. instanceCount: Object.keys(affectedIDs[key]).length
  9676. });
  9677. }).sort(function (a, b) {
  9678. return b.totalDuration - a.totalDuration;
  9679. });
  9680. }
  9681. function getInclusive() {
  9682. var flushHistory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getLastMeasurements();
  9683. if (!("development" !== 'production')) {
  9684. warnInProduction();
  9685. return [];
  9686. }
  9687. var aggregatedStats = {};
  9688. var affectedIDs = {};
  9689. function updateAggregatedStats(treeSnapshot, instanceID, applyUpdate) {
  9690. var _treeSnapshot$instanc = treeSnapshot[instanceID],
  9691. displayName = _treeSnapshot$instanc.displayName,
  9692. ownerID = _treeSnapshot$instanc.ownerID;
  9693. var owner = treeSnapshot[ownerID];
  9694. var key = (owner ? owner.displayName + ' > ' : '') + displayName;
  9695. var stats = aggregatedStats[key];
  9696. if (!stats) {
  9697. affectedIDs[key] = {};
  9698. stats = aggregatedStats[key] = {
  9699. key: key,
  9700. instanceCount: 0,
  9701. inclusiveRenderDuration: 0,
  9702. renderCount: 0
  9703. };
  9704. }
  9705. affectedIDs[key][instanceID] = true;
  9706. applyUpdate(stats);
  9707. }
  9708. var isCompositeByID = {};
  9709. flushHistory.forEach(function (flush) {
  9710. var measurements = flush.measurements;
  9711. measurements.forEach(function (measurement) {
  9712. var instanceID = measurement.instanceID,
  9713. timerType = measurement.timerType;
  9714. if (timerType !== 'render') {
  9715. return;
  9716. }
  9717. isCompositeByID[instanceID] = true;
  9718. });
  9719. });
  9720. flushHistory.forEach(function (flush) {
  9721. var measurements = flush.measurements,
  9722. treeSnapshot = flush.treeSnapshot;
  9723. measurements.forEach(function (measurement) {
  9724. var duration = measurement.duration,
  9725. instanceID = measurement.instanceID,
  9726. timerType = measurement.timerType;
  9727. if (timerType !== 'render') {
  9728. return;
  9729. }
  9730. updateAggregatedStats(treeSnapshot, instanceID, function (stats) {
  9731. stats.renderCount++;
  9732. });
  9733. var nextParentID = instanceID;
  9734. while (nextParentID) {
  9735. // As we traverse parents, only count inclusive time towards composites.
  9736. // We know something is a composite if its render() was called.
  9737. if (isCompositeByID[nextParentID]) {
  9738. updateAggregatedStats(treeSnapshot, nextParentID, function (stats) {
  9739. stats.inclusiveRenderDuration += duration;
  9740. });
  9741. }
  9742. nextParentID = treeSnapshot[nextParentID].parentID;
  9743. }
  9744. });
  9745. });
  9746. return Object.keys(aggregatedStats).map(function (key) {
  9747. return _extends({}, aggregatedStats[key], {
  9748. instanceCount: Object.keys(affectedIDs[key]).length
  9749. });
  9750. }).sort(function (a, b) {
  9751. return b.inclusiveRenderDuration - a.inclusiveRenderDuration;
  9752. });
  9753. }
  9754. function getWasted() {
  9755. var flushHistory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getLastMeasurements();
  9756. if (!("development" !== 'production')) {
  9757. warnInProduction();
  9758. return [];
  9759. }
  9760. var aggregatedStats = {};
  9761. var affectedIDs = {};
  9762. function updateAggregatedStats(treeSnapshot, instanceID, applyUpdate) {
  9763. var _treeSnapshot$instanc2 = treeSnapshot[instanceID],
  9764. displayName = _treeSnapshot$instanc2.displayName,
  9765. ownerID = _treeSnapshot$instanc2.ownerID;
  9766. var owner = treeSnapshot[ownerID];
  9767. var key = (owner ? owner.displayName + ' > ' : '') + displayName;
  9768. var stats = aggregatedStats[key];
  9769. if (!stats) {
  9770. affectedIDs[key] = {};
  9771. stats = aggregatedStats[key] = {
  9772. key: key,
  9773. instanceCount: 0,
  9774. inclusiveRenderDuration: 0,
  9775. renderCount: 0
  9776. };
  9777. }
  9778. affectedIDs[key][instanceID] = true;
  9779. applyUpdate(stats);
  9780. }
  9781. flushHistory.forEach(function (flush) {
  9782. var measurements = flush.measurements,
  9783. treeSnapshot = flush.treeSnapshot,
  9784. operations = flush.operations;
  9785. var isDefinitelyNotWastedByID = {};
  9786. // Find host components associated with an operation in this batch.
  9787. // Mark all components in their parent tree as definitely not wasted.
  9788. operations.forEach(function (operation) {
  9789. var instanceID = operation.instanceID;
  9790. var nextParentID = instanceID;
  9791. while (nextParentID) {
  9792. isDefinitelyNotWastedByID[nextParentID] = true;
  9793. nextParentID = treeSnapshot[nextParentID].parentID;
  9794. }
  9795. });
  9796. // Find composite components that rendered in this batch.
  9797. // These are potential candidates for being wasted renders.
  9798. var renderedCompositeIDs = {};
  9799. measurements.forEach(function (measurement) {
  9800. var instanceID = measurement.instanceID,
  9801. timerType = measurement.timerType;
  9802. if (timerType !== 'render') {
  9803. return;
  9804. }
  9805. renderedCompositeIDs[instanceID] = true;
  9806. });
  9807. measurements.forEach(function (measurement) {
  9808. var duration = measurement.duration,
  9809. instanceID = measurement.instanceID,
  9810. timerType = measurement.timerType;
  9811. if (timerType !== 'render') {
  9812. return;
  9813. }
  9814. // If there was a DOM update below this component, or it has just been
  9815. // mounted, its render() is not considered wasted.
  9816. var updateCount = treeSnapshot[instanceID].updateCount;
  9817. if (isDefinitelyNotWastedByID[instanceID] || updateCount === 0) {
  9818. return;
  9819. }
  9820. // We consider this render() wasted.
  9821. updateAggregatedStats(treeSnapshot, instanceID, function (stats) {
  9822. stats.renderCount++;
  9823. });
  9824. var nextParentID = instanceID;
  9825. while (nextParentID) {
  9826. // Any parents rendered during this batch are considered wasted
  9827. // unless we previously marked them as dirty.
  9828. var isWasted = renderedCompositeIDs[nextParentID] && !isDefinitelyNotWastedByID[nextParentID];
  9829. if (isWasted) {
  9830. updateAggregatedStats(treeSnapshot, nextParentID, function (stats) {
  9831. stats.inclusiveRenderDuration += duration;
  9832. });
  9833. }
  9834. nextParentID = treeSnapshot[nextParentID].parentID;
  9835. }
  9836. });
  9837. });
  9838. return Object.keys(aggregatedStats).map(function (key) {
  9839. return _extends({}, aggregatedStats[key], {
  9840. instanceCount: Object.keys(affectedIDs[key]).length
  9841. });
  9842. }).sort(function (a, b) {
  9843. return b.inclusiveRenderDuration - a.inclusiveRenderDuration;
  9844. });
  9845. }
  9846. function getOperations() {
  9847. var flushHistory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getLastMeasurements();
  9848. if (!("development" !== 'production')) {
  9849. warnInProduction();
  9850. return [];
  9851. }
  9852. var stats = [];
  9853. flushHistory.forEach(function (flush, flushIndex) {
  9854. var operations = flush.operations,
  9855. treeSnapshot = flush.treeSnapshot;
  9856. operations.forEach(function (operation) {
  9857. var instanceID = operation.instanceID,
  9858. type = operation.type,
  9859. payload = operation.payload;
  9860. var _treeSnapshot$instanc3 = treeSnapshot[instanceID],
  9861. displayName = _treeSnapshot$instanc3.displayName,
  9862. ownerID = _treeSnapshot$instanc3.ownerID;
  9863. var owner = treeSnapshot[ownerID];
  9864. var key = (owner ? owner.displayName + ' > ' : '') + displayName;
  9865. stats.push({
  9866. flushIndex: flushIndex,
  9867. instanceID: instanceID,
  9868. key: key,
  9869. type: type,
  9870. ownerID: ownerID,
  9871. payload: payload
  9872. });
  9873. });
  9874. });
  9875. return stats;
  9876. }
  9877. function printExclusive(flushHistory) {
  9878. if (!("development" !== 'production')) {
  9879. warnInProduction();
  9880. return;
  9881. }
  9882. var stats = getExclusive(flushHistory);
  9883. var table = stats.map(function (item) {
  9884. var key = item.key,
  9885. instanceCount = item.instanceCount,
  9886. totalDuration = item.totalDuration;
  9887. var renderCount = item.counts.render || 0;
  9888. var renderDuration = item.durations.render || 0;
  9889. return {
  9890. Component: key,
  9891. 'Total time (ms)': roundFloat(totalDuration),
  9892. 'Instance count': instanceCount,
  9893. 'Total render time (ms)': roundFloat(renderDuration),
  9894. 'Average render time (ms)': renderCount ? roundFloat(renderDuration / renderCount) : undefined,
  9895. 'Render count': renderCount,
  9896. 'Total lifecycle time (ms)': roundFloat(totalDuration - renderDuration)
  9897. };
  9898. });
  9899. consoleTable(table);
  9900. }
  9901. function printInclusive(flushHistory) {
  9902. if (!("development" !== 'production')) {
  9903. warnInProduction();
  9904. return;
  9905. }
  9906. var stats = getInclusive(flushHistory);
  9907. var table = stats.map(function (item) {
  9908. var key = item.key,
  9909. instanceCount = item.instanceCount,
  9910. inclusiveRenderDuration = item.inclusiveRenderDuration,
  9911. renderCount = item.renderCount;
  9912. return {
  9913. 'Owner > Component': key,
  9914. 'Inclusive render time (ms)': roundFloat(inclusiveRenderDuration),
  9915. 'Instance count': instanceCount,
  9916. 'Render count': renderCount
  9917. };
  9918. });
  9919. consoleTable(table);
  9920. }
  9921. function printWasted(flushHistory) {
  9922. if (!("development" !== 'production')) {
  9923. warnInProduction();
  9924. return;
  9925. }
  9926. var stats = getWasted(flushHistory);
  9927. var table = stats.map(function (item) {
  9928. var key = item.key,
  9929. instanceCount = item.instanceCount,
  9930. inclusiveRenderDuration = item.inclusiveRenderDuration,
  9931. renderCount = item.renderCount;
  9932. return {
  9933. 'Owner > Component': key,
  9934. 'Inclusive wasted time (ms)': roundFloat(inclusiveRenderDuration),
  9935. 'Instance count': instanceCount,
  9936. 'Render count': renderCount
  9937. };
  9938. });
  9939. consoleTable(table);
  9940. }
  9941. function printOperations(flushHistory) {
  9942. if (!("development" !== 'production')) {
  9943. warnInProduction();
  9944. return;
  9945. }
  9946. var stats = getOperations(flushHistory);
  9947. var table = stats.map(function (stat) {
  9948. return {
  9949. 'Owner > Node': stat.key,
  9950. Operation: stat.type,
  9951. Payload: typeof stat.payload === 'object' ? JSON.stringify(stat.payload) : stat.payload,
  9952. 'Flush index': stat.flushIndex,
  9953. 'Owner Component ID': stat.ownerID,
  9954. 'DOM Component ID': stat.instanceID
  9955. };
  9956. });
  9957. consoleTable(table);
  9958. }
  9959. var warnedAboutPrintDOM = false;
  9960. function printDOM(measurements) {
  9961. lowPriorityWarning(warnedAboutPrintDOM, '`ReactPerf.printDOM(...)` is deprecated. Use ' + '`ReactPerf.printOperations(...)` instead.');
  9962. warnedAboutPrintDOM = true;
  9963. return printOperations(measurements);
  9964. }
  9965. var warnedAboutGetMeasurementsSummaryMap = false;
  9966. function getMeasurementsSummaryMap(measurements) {
  9967. lowPriorityWarning(warnedAboutGetMeasurementsSummaryMap, '`ReactPerf.getMeasurementsSummaryMap(...)` is deprecated. Use ' + '`ReactPerf.getWasted(...)` instead.');
  9968. warnedAboutGetMeasurementsSummaryMap = true;
  9969. return getWasted(measurements);
  9970. }
  9971. function start() {
  9972. if (!("development" !== 'production')) {
  9973. warnInProduction();
  9974. return;
  9975. }
  9976. ReactDebugTool.beginProfiling();
  9977. }
  9978. function stop() {
  9979. if (!("development" !== 'production')) {
  9980. warnInProduction();
  9981. return;
  9982. }
  9983. ReactDebugTool.endProfiling();
  9984. }
  9985. function isRunning() {
  9986. if (!("development" !== 'production')) {
  9987. warnInProduction();
  9988. return false;
  9989. }
  9990. return ReactDebugTool.isProfiling();
  9991. }
  9992. var ReactPerfAnalysis = {
  9993. getLastMeasurements: getLastMeasurements,
  9994. getExclusive: getExclusive,
  9995. getInclusive: getInclusive,
  9996. getWasted: getWasted,
  9997. getOperations: getOperations,
  9998. printExclusive: printExclusive,
  9999. printInclusive: printInclusive,
  10000. printWasted: printWasted,
  10001. printOperations: printOperations,
  10002. start: start,
  10003. stop: stop,
  10004. isRunning: isRunning,
  10005. // Deprecated:
  10006. printDOM: printDOM,
  10007. getMeasurementsSummaryMap: getMeasurementsSummaryMap
  10008. };
  10009. module.exports = ReactPerfAnalysis;
  10010. },{"124":124,"160":160,"50":50}],72:[function(_dereq_,module,exports){
  10011. /**
  10012. * Copyright 2013-present, Facebook, Inc.
  10013. * All rights reserved.
  10014. *
  10015. * This source code is licensed under the BSD-style license found in the
  10016. * LICENSE file in the root directory of this source tree. An additional grant
  10017. * of patent rights can be found in the PATENTS file in the same directory.
  10018. *
  10019. *
  10020. */
  10021. 'use strict';
  10022. var ReactPropTypeLocationNames = {};
  10023. if ("development" !== 'production') {
  10024. ReactPropTypeLocationNames = {
  10025. prop: 'prop',
  10026. context: 'context',
  10027. childContext: 'child context'
  10028. };
  10029. }
  10030. module.exports = ReactPropTypeLocationNames;
  10031. },{}],73:[function(_dereq_,module,exports){
  10032. /**
  10033. * Copyright 2013-present, Facebook, Inc.
  10034. * All rights reserved.
  10035. *
  10036. * This source code is licensed under the BSD-style license found in the
  10037. * LICENSE file in the root directory of this source tree. An additional grant
  10038. * of patent rights can be found in the PATENTS file in the same directory.
  10039. *
  10040. *
  10041. */
  10042. 'use strict';
  10043. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  10044. module.exports = ReactPropTypesSecret;
  10045. },{}],74:[function(_dereq_,module,exports){
  10046. /**
  10047. * Copyright 2013-present, Facebook, Inc.
  10048. * All rights reserved.
  10049. *
  10050. * This source code is licensed under the BSD-style license found in the
  10051. * LICENSE file in the root directory of this source tree. An additional grant
  10052. * of patent rights can be found in the PATENTS file in the same directory.
  10053. *
  10054. */
  10055. 'use strict';
  10056. var _assign = _dereq_(160);
  10057. var CallbackQueue = _dereq_(6);
  10058. var PooledClass = _dereq_(25);
  10059. var ReactBrowserEventEmitter = _dereq_(26);
  10060. var ReactInputSelection = _dereq_(62);
  10061. var ReactInstrumentation = _dereq_(64);
  10062. var Transaction = _dereq_(100);
  10063. var ReactUpdateQueue = _dereq_(81);
  10064. /**
  10065. * Ensures that, when possible, the selection range (currently selected text
  10066. * input) is not disturbed by performing the transaction.
  10067. */
  10068. var SELECTION_RESTORATION = {
  10069. /**
  10070. * @return {Selection} Selection information.
  10071. */
  10072. initialize: ReactInputSelection.getSelectionInformation,
  10073. /**
  10074. * @param {Selection} sel Selection information returned from `initialize`.
  10075. */
  10076. close: ReactInputSelection.restoreSelection
  10077. };
  10078. /**
  10079. * Suppresses events (blur/focus) that could be inadvertently dispatched due to
  10080. * high level DOM manipulations (like temporarily removing a text input from the
  10081. * DOM).
  10082. */
  10083. var EVENT_SUPPRESSION = {
  10084. /**
  10085. * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
  10086. * the reconciliation.
  10087. */
  10088. initialize: function () {
  10089. var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
  10090. ReactBrowserEventEmitter.setEnabled(false);
  10091. return currentlyEnabled;
  10092. },
  10093. /**
  10094. * @param {boolean} previouslyEnabled Enabled status of
  10095. * `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
  10096. * restores the previous value.
  10097. */
  10098. close: function (previouslyEnabled) {
  10099. ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
  10100. }
  10101. };
  10102. /**
  10103. * Provides a queue for collecting `componentDidMount` and
  10104. * `componentDidUpdate` callbacks during the transaction.
  10105. */
  10106. var ON_DOM_READY_QUEUEING = {
  10107. /**
  10108. * Initializes the internal `onDOMReady` queue.
  10109. */
  10110. initialize: function () {
  10111. this.reactMountReady.reset();
  10112. },
  10113. /**
  10114. * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
  10115. */
  10116. close: function () {
  10117. this.reactMountReady.notifyAll();
  10118. }
  10119. };
  10120. /**
  10121. * Executed within the scope of the `Transaction` instance. Consider these as
  10122. * being member methods, but with an implied ordering while being isolated from
  10123. * each other.
  10124. */
  10125. var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
  10126. if ("development" !== 'production') {
  10127. TRANSACTION_WRAPPERS.push({
  10128. initialize: ReactInstrumentation.debugTool.onBeginFlush,
  10129. close: ReactInstrumentation.debugTool.onEndFlush
  10130. });
  10131. }
  10132. /**
  10133. * Currently:
  10134. * - The order that these are listed in the transaction is critical:
  10135. * - Suppresses events.
  10136. * - Restores selection range.
  10137. *
  10138. * Future:
  10139. * - Restore document/overflow scroll positions that were unintentionally
  10140. * modified via DOM insertions above the top viewport boundary.
  10141. * - Implement/integrate with customized constraint based layout system and keep
  10142. * track of which dimensions must be remeasured.
  10143. *
  10144. * @class ReactReconcileTransaction
  10145. */
  10146. function ReactReconcileTransaction(useCreateElement) {
  10147. this.reinitializeTransaction();
  10148. // Only server-side rendering really needs this option (see
  10149. // `ReactServerRendering`), but server-side uses
  10150. // `ReactServerRenderingTransaction` instead. This option is here so that it's
  10151. // accessible and defaults to false when `ReactDOMComponent` and
  10152. // `ReactDOMTextComponent` checks it in `mountComponent`.`
  10153. this.renderToStaticMarkup = false;
  10154. this.reactMountReady = CallbackQueue.getPooled(null);
  10155. this.useCreateElement = useCreateElement;
  10156. }
  10157. var Mixin = {
  10158. /**
  10159. * @see Transaction
  10160. * @abstract
  10161. * @final
  10162. * @return {array<object>} List of operation wrap procedures.
  10163. * TODO: convert to array<TransactionWrapper>
  10164. */
  10165. getTransactionWrappers: function () {
  10166. return TRANSACTION_WRAPPERS;
  10167. },
  10168. /**
  10169. * @return {object} The queue to collect `onDOMReady` callbacks with.
  10170. */
  10171. getReactMountReady: function () {
  10172. return this.reactMountReady;
  10173. },
  10174. /**
  10175. * @return {object} The queue to collect React async events.
  10176. */
  10177. getUpdateQueue: function () {
  10178. return ReactUpdateQueue;
  10179. },
  10180. /**
  10181. * Save current transaction state -- if the return value from this method is
  10182. * passed to `rollback`, the transaction will be reset to that state.
  10183. */
  10184. checkpoint: function () {
  10185. // reactMountReady is the our only stateful wrapper
  10186. return this.reactMountReady.checkpoint();
  10187. },
  10188. rollback: function (checkpoint) {
  10189. this.reactMountReady.rollback(checkpoint);
  10190. },
  10191. /**
  10192. * `PooledClass` looks for this, and will invoke this before allowing this
  10193. * instance to be reused.
  10194. */
  10195. destructor: function () {
  10196. CallbackQueue.release(this.reactMountReady);
  10197. this.reactMountReady = null;
  10198. }
  10199. };
  10200. _assign(ReactReconcileTransaction.prototype, Transaction, Mixin);
  10201. PooledClass.addPoolingTo(ReactReconcileTransaction);
  10202. module.exports = ReactReconcileTransaction;
  10203. },{"100":100,"160":160,"25":25,"26":26,"6":6,"62":62,"64":64,"81":81}],75:[function(_dereq_,module,exports){
  10204. /**
  10205. * Copyright 2013-present, Facebook, Inc.
  10206. * All rights reserved.
  10207. *
  10208. * This source code is licensed under the BSD-style license found in the
  10209. * LICENSE file in the root directory of this source tree. An additional grant
  10210. * of patent rights can be found in the PATENTS file in the same directory.
  10211. *
  10212. */
  10213. 'use strict';
  10214. var ReactRef = _dereq_(76);
  10215. var ReactInstrumentation = _dereq_(64);
  10216. var warning = _dereq_(159);
  10217. /**
  10218. * Helper to call ReactRef.attachRefs with this composite component, split out
  10219. * to avoid allocations in the transaction mount-ready queue.
  10220. */
  10221. function attachRefs() {
  10222. ReactRef.attachRefs(this, this._currentElement);
  10223. }
  10224. var ReactReconciler = {
  10225. /**
  10226. * Initializes the component, renders markup, and registers event listeners.
  10227. *
  10228. * @param {ReactComponent} internalInstance
  10229. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  10230. * @param {?object} the containing host component instance
  10231. * @param {?object} info about the host container
  10232. * @return {?string} Rendered markup to be inserted into the DOM.
  10233. * @final
  10234. * @internal
  10235. */
  10236. mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID) // 0 in production and for roots
  10237. {
  10238. if ("development" !== 'production') {
  10239. if (internalInstance._debugID !== 0) {
  10240. ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID);
  10241. }
  10242. }
  10243. var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID);
  10244. if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
  10245. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  10246. }
  10247. if ("development" !== 'production') {
  10248. if (internalInstance._debugID !== 0) {
  10249. ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID);
  10250. }
  10251. }
  10252. return markup;
  10253. },
  10254. /**
  10255. * Returns a value that can be passed to
  10256. * ReactComponentEnvironment.replaceNodeWithMarkup.
  10257. */
  10258. getHostNode: function (internalInstance) {
  10259. return internalInstance.getHostNode();
  10260. },
  10261. /**
  10262. * Releases any resources allocated by `mountComponent`.
  10263. *
  10264. * @final
  10265. * @internal
  10266. */
  10267. unmountComponent: function (internalInstance, safely) {
  10268. if ("development" !== 'production') {
  10269. if (internalInstance._debugID !== 0) {
  10270. ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID);
  10271. }
  10272. }
  10273. ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
  10274. internalInstance.unmountComponent(safely);
  10275. if ("development" !== 'production') {
  10276. if (internalInstance._debugID !== 0) {
  10277. ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID);
  10278. }
  10279. }
  10280. },
  10281. /**
  10282. * Update a component using a new element.
  10283. *
  10284. * @param {ReactComponent} internalInstance
  10285. * @param {ReactElement} nextElement
  10286. * @param {ReactReconcileTransaction} transaction
  10287. * @param {object} context
  10288. * @internal
  10289. */
  10290. receiveComponent: function (internalInstance, nextElement, transaction, context) {
  10291. var prevElement = internalInstance._currentElement;
  10292. if (nextElement === prevElement && context === internalInstance._context) {
  10293. // Since elements are immutable after the owner is rendered,
  10294. // we can do a cheap identity compare here to determine if this is a
  10295. // superfluous reconcile. It's possible for state to be mutable but such
  10296. // change should trigger an update of the owner which would recreate
  10297. // the element. We explicitly check for the existence of an owner since
  10298. // it's possible for an element created outside a composite to be
  10299. // deeply mutated and reused.
  10300. // TODO: Bailing out early is just a perf optimization right?
  10301. // TODO: Removing the return statement should affect correctness?
  10302. return;
  10303. }
  10304. if ("development" !== 'production') {
  10305. if (internalInstance._debugID !== 0) {
  10306. ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement);
  10307. }
  10308. }
  10309. var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
  10310. if (refsChanged) {
  10311. ReactRef.detachRefs(internalInstance, prevElement);
  10312. }
  10313. internalInstance.receiveComponent(nextElement, transaction, context);
  10314. if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
  10315. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  10316. }
  10317. if ("development" !== 'production') {
  10318. if (internalInstance._debugID !== 0) {
  10319. ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
  10320. }
  10321. }
  10322. },
  10323. /**
  10324. * Flush any dirty changes in a component.
  10325. *
  10326. * @param {ReactComponent} internalInstance
  10327. * @param {ReactReconcileTransaction} transaction
  10328. * @internal
  10329. */
  10330. performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) {
  10331. if (internalInstance._updateBatchNumber !== updateBatchNumber) {
  10332. // The component's enqueued batch number should always be the current
  10333. // batch or the following one.
  10334. "development" !== 'production' ? warning(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1, 'performUpdateIfNecessary: Unexpected batch number (current %s, ' + 'pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : void 0;
  10335. return;
  10336. }
  10337. if ("development" !== 'production') {
  10338. if (internalInstance._debugID !== 0) {
  10339. ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement);
  10340. }
  10341. }
  10342. internalInstance.performUpdateIfNecessary(transaction);
  10343. if ("development" !== 'production') {
  10344. if (internalInstance._debugID !== 0) {
  10345. ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
  10346. }
  10347. }
  10348. }
  10349. };
  10350. module.exports = ReactReconciler;
  10351. },{"159":159,"64":64,"76":76}],76:[function(_dereq_,module,exports){
  10352. /**
  10353. * Copyright 2013-present, Facebook, Inc.
  10354. * All rights reserved.
  10355. *
  10356. * This source code is licensed under the BSD-style license found in the
  10357. * LICENSE file in the root directory of this source tree. An additional grant
  10358. * of patent rights can be found in the PATENTS file in the same directory.
  10359. *
  10360. *
  10361. */
  10362. 'use strict';
  10363. var ReactOwner = _dereq_(70);
  10364. var ReactRef = {};
  10365. function attachRef(ref, component, owner) {
  10366. if (typeof ref === 'function') {
  10367. ref(component.getPublicInstance());
  10368. } else {
  10369. // Legacy ref
  10370. ReactOwner.addComponentAsRefTo(component, ref, owner);
  10371. }
  10372. }
  10373. function detachRef(ref, component, owner) {
  10374. if (typeof ref === 'function') {
  10375. ref(null);
  10376. } else {
  10377. // Legacy ref
  10378. ReactOwner.removeComponentAsRefFrom(component, ref, owner);
  10379. }
  10380. }
  10381. ReactRef.attachRefs = function (instance, element) {
  10382. if (element === null || typeof element !== 'object') {
  10383. return;
  10384. }
  10385. var ref = element.ref;
  10386. if (ref != null) {
  10387. attachRef(ref, instance, element._owner);
  10388. }
  10389. };
  10390. ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
  10391. // If either the owner or a `ref` has changed, make sure the newest owner
  10392. // has stored a reference to `this`, and the previous owner (if different)
  10393. // has forgotten the reference to `this`. We use the element instead
  10394. // of the public this.props because the post processing cannot determine
  10395. // a ref. The ref conceptually lives on the element.
  10396. // TODO: Should this even be possible? The owner cannot change because
  10397. // it's forbidden by shouldUpdateReactComponent. The ref can change
  10398. // if you swap the keys of but not the refs. Reconsider where this check
  10399. // is made. It probably belongs where the key checking and
  10400. // instantiateReactComponent is done.
  10401. var prevRef = null;
  10402. var prevOwner = null;
  10403. if (prevElement !== null && typeof prevElement === 'object') {
  10404. prevRef = prevElement.ref;
  10405. prevOwner = prevElement._owner;
  10406. }
  10407. var nextRef = null;
  10408. var nextOwner = null;
  10409. if (nextElement !== null && typeof nextElement === 'object') {
  10410. nextRef = nextElement.ref;
  10411. nextOwner = nextElement._owner;
  10412. }
  10413. return prevRef !== nextRef ||
  10414. // If owner changes but we have an unchanged function ref, don't update refs
  10415. typeof nextRef === 'string' && nextOwner !== prevOwner;
  10416. };
  10417. ReactRef.detachRefs = function (instance, element) {
  10418. if (element === null || typeof element !== 'object') {
  10419. return;
  10420. }
  10421. var ref = element.ref;
  10422. if (ref != null) {
  10423. detachRef(ref, instance, element._owner);
  10424. }
  10425. };
  10426. module.exports = ReactRef;
  10427. },{"70":70}],77:[function(_dereq_,module,exports){
  10428. /**
  10429. * Copyright 2014-present, Facebook, Inc.
  10430. * All rights reserved.
  10431. *
  10432. * This source code is licensed under the BSD-style license found in the
  10433. * LICENSE file in the root directory of this source tree. An additional grant
  10434. * of patent rights can be found in the PATENTS file in the same directory.
  10435. *
  10436. */
  10437. 'use strict';
  10438. var _assign = _dereq_(160);
  10439. var PooledClass = _dereq_(25);
  10440. var Transaction = _dereq_(100);
  10441. var ReactInstrumentation = _dereq_(64);
  10442. var ReactServerUpdateQueue = _dereq_(78);
  10443. /**
  10444. * Executed within the scope of the `Transaction` instance. Consider these as
  10445. * being member methods, but with an implied ordering while being isolated from
  10446. * each other.
  10447. */
  10448. var TRANSACTION_WRAPPERS = [];
  10449. if ("development" !== 'production') {
  10450. TRANSACTION_WRAPPERS.push({
  10451. initialize: ReactInstrumentation.debugTool.onBeginFlush,
  10452. close: ReactInstrumentation.debugTool.onEndFlush
  10453. });
  10454. }
  10455. var noopCallbackQueue = {
  10456. enqueue: function () {}
  10457. };
  10458. /**
  10459. * @class ReactServerRenderingTransaction
  10460. * @param {boolean} renderToStaticMarkup
  10461. */
  10462. function ReactServerRenderingTransaction(renderToStaticMarkup) {
  10463. this.reinitializeTransaction();
  10464. this.renderToStaticMarkup = renderToStaticMarkup;
  10465. this.useCreateElement = false;
  10466. this.updateQueue = new ReactServerUpdateQueue(this);
  10467. }
  10468. var Mixin = {
  10469. /**
  10470. * @see Transaction
  10471. * @abstract
  10472. * @final
  10473. * @return {array} Empty list of operation wrap procedures.
  10474. */
  10475. getTransactionWrappers: function () {
  10476. return TRANSACTION_WRAPPERS;
  10477. },
  10478. /**
  10479. * @return {object} The queue to collect `onDOMReady` callbacks with.
  10480. */
  10481. getReactMountReady: function () {
  10482. return noopCallbackQueue;
  10483. },
  10484. /**
  10485. * @return {object} The queue to collect React async events.
  10486. */
  10487. getUpdateQueue: function () {
  10488. return this.updateQueue;
  10489. },
  10490. /**
  10491. * `PooledClass` looks for this, and will invoke this before allowing this
  10492. * instance to be reused.
  10493. */
  10494. destructor: function () {},
  10495. checkpoint: function () {},
  10496. rollback: function () {}
  10497. };
  10498. _assign(ReactServerRenderingTransaction.prototype, Transaction, Mixin);
  10499. PooledClass.addPoolingTo(ReactServerRenderingTransaction);
  10500. module.exports = ReactServerRenderingTransaction;
  10501. },{"100":100,"160":160,"25":25,"64":64,"78":78}],78:[function(_dereq_,module,exports){
  10502. /**
  10503. * Copyright 2015-present, Facebook, Inc.
  10504. * All rights reserved.
  10505. *
  10506. * This source code is licensed under the BSD-style license found in the
  10507. * LICENSE file in the root directory of this source tree. An additional grant
  10508. * of patent rights can be found in the PATENTS file in the same directory.
  10509. *
  10510. *
  10511. */
  10512. 'use strict';
  10513. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  10514. var ReactUpdateQueue = _dereq_(81);
  10515. var warning = _dereq_(159);
  10516. function warnNoop(publicInstance, callerName) {
  10517. if ("development" !== 'production') {
  10518. var constructor = publicInstance.constructor;
  10519. "development" !== 'production' ? warning(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
  10520. }
  10521. }
  10522. /**
  10523. * This is the update queue used for server rendering.
  10524. * It delegates to ReactUpdateQueue while server rendering is in progress and
  10525. * switches to ReactNoopUpdateQueue after the transaction has completed.
  10526. * @class ReactServerUpdateQueue
  10527. * @param {Transaction} transaction
  10528. */
  10529. var ReactServerUpdateQueue = function () {
  10530. function ReactServerUpdateQueue(transaction) {
  10531. _classCallCheck(this, ReactServerUpdateQueue);
  10532. this.transaction = transaction;
  10533. }
  10534. /**
  10535. * Checks whether or not this composite component is mounted.
  10536. * @param {ReactClass} publicInstance The instance we want to test.
  10537. * @return {boolean} True if mounted, false otherwise.
  10538. * @protected
  10539. * @final
  10540. */
  10541. ReactServerUpdateQueue.prototype.isMounted = function isMounted(publicInstance) {
  10542. return false;
  10543. };
  10544. /**
  10545. * Enqueue a callback that will be executed after all the pending updates
  10546. * have processed.
  10547. *
  10548. * @param {ReactClass} publicInstance The instance to use as `this` context.
  10549. * @param {?function} callback Called after state is updated.
  10550. * @internal
  10551. */
  10552. ReactServerUpdateQueue.prototype.enqueueCallback = function enqueueCallback(publicInstance, callback, callerName) {
  10553. if (this.transaction.isInTransaction()) {
  10554. ReactUpdateQueue.enqueueCallback(publicInstance, callback, callerName);
  10555. }
  10556. };
  10557. /**
  10558. * Forces an update. This should only be invoked when it is known with
  10559. * certainty that we are **not** in a DOM transaction.
  10560. *
  10561. * You may want to call this when you know that some deeper aspect of the
  10562. * component's state has changed but `setState` was not called.
  10563. *
  10564. * This will not invoke `shouldComponentUpdate`, but it will invoke
  10565. * `componentWillUpdate` and `componentDidUpdate`.
  10566. *
  10567. * @param {ReactClass} publicInstance The instance that should rerender.
  10568. * @internal
  10569. */
  10570. ReactServerUpdateQueue.prototype.enqueueForceUpdate = function enqueueForceUpdate(publicInstance) {
  10571. if (this.transaction.isInTransaction()) {
  10572. ReactUpdateQueue.enqueueForceUpdate(publicInstance);
  10573. } else {
  10574. warnNoop(publicInstance, 'forceUpdate');
  10575. }
  10576. };
  10577. /**
  10578. * Replaces all of the state. Always use this or `setState` to mutate state.
  10579. * You should treat `this.state` as immutable.
  10580. *
  10581. * There is no guarantee that `this.state` will be immediately updated, so
  10582. * accessing `this.state` after calling this method may return the old value.
  10583. *
  10584. * @param {ReactClass} publicInstance The instance that should rerender.
  10585. * @param {object|function} completeState Next state.
  10586. * @internal
  10587. */
  10588. ReactServerUpdateQueue.prototype.enqueueReplaceState = function enqueueReplaceState(publicInstance, completeState) {
  10589. if (this.transaction.isInTransaction()) {
  10590. ReactUpdateQueue.enqueueReplaceState(publicInstance, completeState);
  10591. } else {
  10592. warnNoop(publicInstance, 'replaceState');
  10593. }
  10594. };
  10595. /**
  10596. * Sets a subset of the state. This only exists because _pendingState is
  10597. * internal. This provides a merging strategy that is not available to deep
  10598. * properties which is confusing. TODO: Expose pendingState or don't use it
  10599. * during the merge.
  10600. *
  10601. * @param {ReactClass} publicInstance The instance that should rerender.
  10602. * @param {object|function} partialState Next partial state to be merged with state.
  10603. * @internal
  10604. */
  10605. ReactServerUpdateQueue.prototype.enqueueSetState = function enqueueSetState(publicInstance, partialState) {
  10606. if (this.transaction.isInTransaction()) {
  10607. ReactUpdateQueue.enqueueSetState(publicInstance, partialState);
  10608. } else {
  10609. warnNoop(publicInstance, 'setState');
  10610. }
  10611. };
  10612. return ReactServerUpdateQueue;
  10613. }();
  10614. module.exports = ReactServerUpdateQueue;
  10615. },{"159":159,"81":81}],79:[function(_dereq_,module,exports){
  10616. /**
  10617. * Copyright 2013-present, Facebook, Inc.
  10618. * All rights reserved.
  10619. *
  10620. * This source code is licensed under the BSD-style license found in the
  10621. * LICENSE file in the root directory of this source tree. An additional grant
  10622. * of patent rights can be found in the PATENTS file in the same directory.
  10623. *
  10624. */
  10625. 'use strict';
  10626. var _prodInvariant = _dereq_(126),
  10627. _assign = _dereq_(160);
  10628. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  10629. var React = _dereq_(135);
  10630. var ReactCompositeComponent = _dereq_(30);
  10631. var ReactDefaultBatchingStrategy = _dereq_(51);
  10632. var ReactReconciler = _dereq_(75);
  10633. var ReactReconcileTransaction = _dereq_(74);
  10634. var ReactUpdates = _dereq_(82);
  10635. var emptyObject = _dereq_(145);
  10636. var getNextDebugID = _dereq_(136);
  10637. var invariant = _dereq_(152);
  10638. function injectDefaults() {
  10639. ReactUpdates.injection.injectReconcileTransaction(ReactReconcileTransaction);
  10640. ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
  10641. }
  10642. var NoopInternalComponent = function () {
  10643. function NoopInternalComponent(element) {
  10644. _classCallCheck(this, NoopInternalComponent);
  10645. this._renderedOutput = element;
  10646. this._currentElement = element;
  10647. if ("development" !== 'production') {
  10648. this._debugID = getNextDebugID();
  10649. }
  10650. }
  10651. NoopInternalComponent.prototype.mountComponent = function mountComponent() {};
  10652. NoopInternalComponent.prototype.receiveComponent = function receiveComponent(element) {
  10653. this._renderedOutput = element;
  10654. this._currentElement = element;
  10655. };
  10656. NoopInternalComponent.prototype.unmountComponent = function unmountComponent() {};
  10657. NoopInternalComponent.prototype.getHostNode = function getHostNode() {
  10658. return undefined;
  10659. };
  10660. NoopInternalComponent.prototype.getPublicInstance = function getPublicInstance() {
  10661. return null;
  10662. };
  10663. return NoopInternalComponent;
  10664. }();
  10665. var ShallowComponentWrapper = function (element) {
  10666. // TODO: Consolidate with instantiateReactComponent
  10667. if ("development" !== 'production') {
  10668. this._debugID = getNextDebugID();
  10669. }
  10670. this.construct(element);
  10671. };
  10672. _assign(ShallowComponentWrapper.prototype, ReactCompositeComponent, {
  10673. _constructComponent: ReactCompositeComponent._constructComponentWithoutOwner,
  10674. _instantiateReactComponent: function (element) {
  10675. return new NoopInternalComponent(element);
  10676. },
  10677. _replaceNodeWithMarkup: function () {},
  10678. _renderValidatedComponent: ReactCompositeComponent._renderValidatedComponentWithoutOwnerOrContext
  10679. });
  10680. function _batchedRender(renderer, element, context) {
  10681. var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(true);
  10682. renderer._render(element, transaction, context);
  10683. ReactUpdates.ReactReconcileTransaction.release(transaction);
  10684. }
  10685. var ReactShallowRenderer = function () {
  10686. function ReactShallowRenderer() {
  10687. _classCallCheck(this, ReactShallowRenderer);
  10688. this._instance = null;
  10689. }
  10690. ReactShallowRenderer.prototype.getMountedInstance = function getMountedInstance() {
  10691. return this._instance ? this._instance._instance : null;
  10692. };
  10693. ReactShallowRenderer.prototype.render = function render(element, context) {
  10694. // Ensure we've done the default injections. This might not be true in the
  10695. // case of a simple test that only requires React and the TestUtils in
  10696. // conjunction with an inline-requires transform.
  10697. injectDefaults();
  10698. !React.isValidElement(element) ? "development" !== '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.' : '') : _prodInvariant('12', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : void 0;
  10699. !(typeof element.type !== 'string') ? "development" !== '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) : _prodInvariant('13', element.type) : void 0;
  10700. if (!context) {
  10701. context = emptyObject;
  10702. }
  10703. ReactUpdates.batchedUpdates(_batchedRender, this, element, context);
  10704. return this.getRenderOutput();
  10705. };
  10706. ReactShallowRenderer.prototype.getRenderOutput = function getRenderOutput() {
  10707. return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null;
  10708. };
  10709. ReactShallowRenderer.prototype.unmount = function unmount() {
  10710. if (this._instance) {
  10711. ReactReconciler.unmountComponent(this._instance, false);
  10712. }
  10713. };
  10714. ReactShallowRenderer.prototype.unstable_batchedUpdates = function unstable_batchedUpdates(callback, bookkeeping) {
  10715. // This is used by Enzyme for fake-simulating events in shallow mode.
  10716. injectDefaults();
  10717. return ReactUpdates.batchedUpdates(callback, bookkeeping);
  10718. };
  10719. ReactShallowRenderer.prototype._render = function _render(element, transaction, context) {
  10720. if (this._instance) {
  10721. ReactReconciler.receiveComponent(this._instance, element, transaction, context);
  10722. } else {
  10723. var instance = new ShallowComponentWrapper(element);
  10724. ReactReconciler.mountComponent(instance, transaction, null, null, context, 0);
  10725. this._instance = instance;
  10726. }
  10727. };
  10728. return ReactShallowRenderer;
  10729. }();
  10730. ReactShallowRenderer.createRenderer = function () {
  10731. return new ReactShallowRenderer();
  10732. };
  10733. module.exports = ReactShallowRenderer;
  10734. },{"126":126,"135":135,"136":136,"145":145,"152":152,"160":160,"30":30,"51":51,"74":74,"75":75,"82":82}],80:[function(_dereq_,module,exports){
  10735. /**
  10736. * Copyright 2013-present, Facebook, Inc.
  10737. * All rights reserved.
  10738. *
  10739. * This source code is licensed under the BSD-style license found in the
  10740. * LICENSE file in the root directory of this source tree. An additional grant
  10741. * of patent rights can be found in the PATENTS file in the same directory.
  10742. *
  10743. */
  10744. 'use strict';
  10745. var _prodInvariant = _dereq_(126),
  10746. _assign = _dereq_(160);
  10747. var EventConstants = _dereq_(16);
  10748. var EventPluginHub = _dereq_(17);
  10749. var EventPluginRegistry = _dereq_(18);
  10750. var EventPropagators = _dereq_(20);
  10751. var React = _dereq_(135);
  10752. var ReactDOM = _dereq_(31);
  10753. var ReactDOMComponentTree = _dereq_(34);
  10754. var ReactBrowserEventEmitter = _dereq_(26);
  10755. var ReactInstanceMap = _dereq_(63);
  10756. var ReactUpdates = _dereq_(82);
  10757. var SyntheticEvent = _dereq_(91);
  10758. var ReactShallowRenderer = _dereq_(79);
  10759. var findDOMNode = _dereq_(108);
  10760. var invariant = _dereq_(152);
  10761. var warning = _dereq_(159);
  10762. var topLevelTypes = EventConstants.topLevelTypes;
  10763. function Event(suffix) {}
  10764. // In react 16+ shallowRenderer will not be accessible via ReactTestUtils.createRenderer()
  10765. // Instead it will be available via react-test-renderer/shallow
  10766. // Maintain backwards compat for 15.5.0 release, but warn about using the deprecated method
  10767. var hasWarnedAboutCreateRenderer = false;
  10768. function createRendererWithWarning() {
  10769. "development" !== 'production' ? warning(hasWarnedAboutCreateRenderer, 'Shallow renderer has been moved to react-test-renderer/shallow. ' + 'Update references to remove this warning.') : void 0;
  10770. hasWarnedAboutCreateRenderer = true;
  10771. return new ReactShallowRenderer();
  10772. }
  10773. /**
  10774. * @class ReactTestUtils
  10775. */
  10776. function findAllInRenderedTreeInternal(inst, test) {
  10777. if (!inst || !inst.getPublicInstance) {
  10778. return [];
  10779. }
  10780. var publicInst = inst.getPublicInstance();
  10781. var ret = test(publicInst) ? [publicInst] : [];
  10782. var currentElement = inst._currentElement;
  10783. if (ReactTestUtils.isDOMComponent(publicInst)) {
  10784. var renderedChildren = inst._renderedChildren;
  10785. var key;
  10786. for (key in renderedChildren) {
  10787. if (!renderedChildren.hasOwnProperty(key)) {
  10788. continue;
  10789. }
  10790. ret = ret.concat(findAllInRenderedTreeInternal(renderedChildren[key], test));
  10791. }
  10792. } else if (React.isValidElement(currentElement) && typeof currentElement.type === 'function') {
  10793. ret = ret.concat(findAllInRenderedTreeInternal(inst._renderedComponent, test));
  10794. }
  10795. return ret;
  10796. }
  10797. /**
  10798. * Utilities for making it easy to test React components.
  10799. *
  10800. * See https://facebook.github.io/react/docs/test-utils.html
  10801. *
  10802. * Todo: Support the entire DOM.scry query syntax. For now, these simple
  10803. * utilities will suffice for testing purposes.
  10804. * @lends ReactTestUtils
  10805. */
  10806. var ReactTestUtils = {
  10807. renderIntoDocument: function (element) {
  10808. var div = document.createElement('div');
  10809. // None of our tests actually require attaching the container to the
  10810. // DOM, and doing so creates a mess that we rely on test isolation to
  10811. // clean up, so we're going to stop honoring the name of this method
  10812. // (and probably rename it eventually) if no problems arise.
  10813. // document.documentElement.appendChild(div);
  10814. return ReactDOM.render(element, div);
  10815. },
  10816. isElement: function (element) {
  10817. return React.isValidElement(element);
  10818. },
  10819. isElementOfType: function (inst, convenienceConstructor) {
  10820. return React.isValidElement(inst) && inst.type === convenienceConstructor;
  10821. },
  10822. isDOMComponent: function (inst) {
  10823. return !!(inst && inst.nodeType === 1 && inst.tagName);
  10824. },
  10825. isDOMComponentElement: function (inst) {
  10826. return !!(inst && React.isValidElement(inst) && !!inst.tagName);
  10827. },
  10828. isCompositeComponent: function (inst) {
  10829. if (ReactTestUtils.isDOMComponent(inst)) {
  10830. // Accessing inst.setState warns; just return false as that'll be what
  10831. // this returns when we have DOM nodes as refs directly
  10832. return false;
  10833. }
  10834. return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
  10835. },
  10836. isCompositeComponentWithType: function (inst, type) {
  10837. if (!ReactTestUtils.isCompositeComponent(inst)) {
  10838. return false;
  10839. }
  10840. var internalInstance = ReactInstanceMap.get(inst);
  10841. var constructor = internalInstance._currentElement.type;
  10842. return constructor === type;
  10843. },
  10844. isCompositeComponentElement: function (inst) {
  10845. if (!React.isValidElement(inst)) {
  10846. return false;
  10847. }
  10848. // We check the prototype of the type that will get mounted, not the
  10849. // instance itself. This is a future proof way of duck typing.
  10850. var prototype = inst.type.prototype;
  10851. return typeof prototype.render === 'function' && typeof prototype.setState === 'function';
  10852. },
  10853. isCompositeComponentElementWithType: function (inst, type) {
  10854. var internalInstance = ReactInstanceMap.get(inst);
  10855. var constructor = internalInstance._currentElement.type;
  10856. return !!(ReactTestUtils.isCompositeComponentElement(inst) && constructor === type);
  10857. },
  10858. getRenderedChildOfCompositeComponent: function (inst) {
  10859. if (!ReactTestUtils.isCompositeComponent(inst)) {
  10860. return null;
  10861. }
  10862. var internalInstance = ReactInstanceMap.get(inst);
  10863. return internalInstance._renderedComponent.getPublicInstance();
  10864. },
  10865. findAllInRenderedTree: function (inst, test) {
  10866. if (!inst) {
  10867. return [];
  10868. }
  10869. !ReactTestUtils.isCompositeComponent(inst) ? "development" !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : _prodInvariant('10') : void 0;
  10870. return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test);
  10871. },
  10872. /**
  10873. * Finds all instance of components in the rendered tree that are DOM
  10874. * components with the class name matching `className`.
  10875. * @return {array} an array of all the matches.
  10876. */
  10877. scryRenderedDOMComponentsWithClass: function (root, classNames) {
  10878. return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
  10879. if (ReactTestUtils.isDOMComponent(inst)) {
  10880. var className = inst.className;
  10881. if (typeof className !== 'string') {
  10882. // SVG, probably.
  10883. className = inst.getAttribute('class') || '';
  10884. }
  10885. var classList = className.split(/\s+/);
  10886. if (!Array.isArray(classNames)) {
  10887. !(classNames !== undefined) ? "development" !== 'production' ? invariant(false, 'TestUtils.scryRenderedDOMComponentsWithClass expects a className as a second argument.') : _prodInvariant('11') : void 0;
  10888. classNames = classNames.split(/\s+/);
  10889. }
  10890. return classNames.every(function (name) {
  10891. return classList.indexOf(name) !== -1;
  10892. });
  10893. }
  10894. return false;
  10895. });
  10896. },
  10897. /**
  10898. * Like scryRenderedDOMComponentsWithClass but expects there to be one result,
  10899. * and returns that one result, or throws exception if there is any other
  10900. * number of matches besides one.
  10901. * @return {!ReactDOMComponent} The one match.
  10902. */
  10903. findRenderedDOMComponentWithClass: function (root, className) {
  10904. var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
  10905. if (all.length !== 1) {
  10906. throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for class:' + className);
  10907. }
  10908. return all[0];
  10909. },
  10910. /**
  10911. * Finds all instance of components in the rendered tree that are DOM
  10912. * components with the tag name matching `tagName`.
  10913. * @return {array} an array of all the matches.
  10914. */
  10915. scryRenderedDOMComponentsWithTag: function (root, tagName) {
  10916. return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
  10917. return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
  10918. });
  10919. },
  10920. /**
  10921. * Like scryRenderedDOMComponentsWithTag but expects there to be one result,
  10922. * and returns that one result, or throws exception if there is any other
  10923. * number of matches besides one.
  10924. * @return {!ReactDOMComponent} The one match.
  10925. */
  10926. findRenderedDOMComponentWithTag: function (root, tagName) {
  10927. var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
  10928. if (all.length !== 1) {
  10929. throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for tag:' + tagName);
  10930. }
  10931. return all[0];
  10932. },
  10933. /**
  10934. * Finds all instances of components with type equal to `componentType`.
  10935. * @return {array} an array of all the matches.
  10936. */
  10937. scryRenderedComponentsWithType: function (root, componentType) {
  10938. return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
  10939. return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
  10940. });
  10941. },
  10942. /**
  10943. * Same as `scryRenderedComponentsWithType` but expects there to be one result
  10944. * and returns that one result, or throws exception if there is any other
  10945. * number of matches besides one.
  10946. * @return {!ReactComponent} The one match.
  10947. */
  10948. findRenderedComponentWithType: function (root, componentType) {
  10949. var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
  10950. if (all.length !== 1) {
  10951. throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for componentType:' + componentType);
  10952. }
  10953. return all[0];
  10954. },
  10955. /**
  10956. * Pass a mocked component module to this method to augment it with
  10957. * useful methods that allow it to be used as a dummy React component.
  10958. * Instead of rendering as usual, the component will become a simple
  10959. * <div> containing any provided children.
  10960. *
  10961. * @param {object} module the mock function object exported from a
  10962. * module that defines the component to be mocked
  10963. * @param {?string} mockTagName optional dummy root tag name to return
  10964. * from render method (overrides
  10965. * module.mockTagName if provided)
  10966. * @return {object} the ReactTestUtils object (for chaining)
  10967. */
  10968. mockComponent: function (module, mockTagName) {
  10969. mockTagName = mockTagName || module.mockTagName || 'div';
  10970. module.prototype.render.mockImplementation(function () {
  10971. return React.createElement(mockTagName, null, this.props.children);
  10972. });
  10973. return this;
  10974. },
  10975. /**
  10976. * Simulates a top level event being dispatched from a raw event that occurred
  10977. * on an `Element` node.
  10978. * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`
  10979. * @param {!Element} node The dom to simulate an event occurring on.
  10980. * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
  10981. */
  10982. simulateNativeEventOnNode: function (topLevelType, node, fakeNativeEvent) {
  10983. fakeNativeEvent.target = node;
  10984. fakeNativeEvent.simulated = true;
  10985. ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
  10986. },
  10987. /**
  10988. * Simulates a top level event being dispatched from a raw event that occurred
  10989. * on the `ReactDOMComponent` `comp`.
  10990. * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`.
  10991. * @param {!ReactDOMComponent} comp
  10992. * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
  10993. */
  10994. simulateNativeEventOnDOMComponent: function (topLevelType, comp, fakeNativeEvent) {
  10995. ReactTestUtils.simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent);
  10996. },
  10997. nativeTouchData: function (x, y) {
  10998. return {
  10999. touches: [{ pageX: x, pageY: y }]
  11000. };
  11001. },
  11002. createRenderer: createRendererWithWarning,
  11003. Simulate: null,
  11004. SimulateNative: {}
  11005. };
  11006. /**
  11007. * Exports:
  11008. *
  11009. * - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`
  11010. * - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)`
  11011. * - `ReactTestUtils.Simulate.change(Element/ReactDOMComponent)`
  11012. * - ... (All keys from event plugin `eventTypes` objects)
  11013. */
  11014. function makeSimulator(eventType) {
  11015. return function (domComponentOrNode, eventData) {
  11016. var node;
  11017. !!React.isValidElement(domComponentOrNode) ? "development" !== 'production' ? invariant(false, 'TestUtils.Simulate expects a component instance and not a ReactElement.TestUtils.Simulate will not work if you are using shallow rendering.') : _prodInvariant('14') : void 0;
  11018. if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
  11019. node = findDOMNode(domComponentOrNode);
  11020. } else if (domComponentOrNode.tagName) {
  11021. node = domComponentOrNode;
  11022. }
  11023. var dispatchConfig = EventPluginRegistry.eventNameDispatchConfigs[eventType];
  11024. var fakeNativeEvent = new Event();
  11025. fakeNativeEvent.target = node;
  11026. fakeNativeEvent.type = eventType.toLowerCase();
  11027. // We don't use SyntheticEvent.getPooled in order to not have to worry about
  11028. // properly destroying any properties assigned from `eventData` upon release
  11029. var event = new SyntheticEvent(dispatchConfig, ReactDOMComponentTree.getInstanceFromNode(node), fakeNativeEvent, node);
  11030. // Since we aren't using pooling, always persist the event. This will make
  11031. // sure it's marked and won't warn when setting additional properties.
  11032. event.persist();
  11033. _assign(event, eventData);
  11034. if (dispatchConfig.phasedRegistrationNames) {
  11035. EventPropagators.accumulateTwoPhaseDispatches(event);
  11036. } else {
  11037. EventPropagators.accumulateDirectDispatches(event);
  11038. }
  11039. ReactUpdates.batchedUpdates(function () {
  11040. EventPluginHub.enqueueEvents(event);
  11041. EventPluginHub.processEventQueue(true);
  11042. });
  11043. };
  11044. }
  11045. function buildSimulators() {
  11046. ReactTestUtils.Simulate = {};
  11047. var eventType;
  11048. for (eventType in EventPluginRegistry.eventNameDispatchConfigs) {
  11049. /**
  11050. * @param {!Element|ReactDOMComponent} domComponentOrNode
  11051. * @param {?object} eventData Fake event data to use in SyntheticEvent.
  11052. */
  11053. ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
  11054. }
  11055. }
  11056. // Rebuild ReactTestUtils.Simulate whenever event plugins are injected
  11057. var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder;
  11058. EventPluginHub.injection.injectEventPluginOrder = function () {
  11059. oldInjectEventPluginOrder.apply(this, arguments);
  11060. buildSimulators();
  11061. };
  11062. var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
  11063. EventPluginHub.injection.injectEventPluginsByName = function () {
  11064. oldInjectEventPlugins.apply(this, arguments);
  11065. buildSimulators();
  11066. };
  11067. buildSimulators();
  11068. /**
  11069. * Exports:
  11070. *
  11071. * - `ReactTestUtils.SimulateNative.click(Element/ReactDOMComponent)`
  11072. * - `ReactTestUtils.SimulateNative.mouseMove(Element/ReactDOMComponent)`
  11073. * - `ReactTestUtils.SimulateNative.mouseIn/ReactDOMComponent)`
  11074. * - `ReactTestUtils.SimulateNative.mouseOut(Element/ReactDOMComponent)`
  11075. * - ... (All keys from `EventConstants.topLevelTypes`)
  11076. *
  11077. * Note: Top level event types are a subset of the entire set of handler types
  11078. * (which include a broader set of "synthetic" events). For example, onDragDone
  11079. * is a synthetic event. Except when testing an event plugin or React's event
  11080. * handling code specifically, you probably want to use ReactTestUtils.Simulate
  11081. * to dispatch synthetic events.
  11082. */
  11083. function makeNativeSimulator(eventType) {
  11084. return function (domComponentOrNode, nativeEventData) {
  11085. var fakeNativeEvent = new Event(eventType);
  11086. _assign(fakeNativeEvent, nativeEventData);
  11087. if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
  11088. ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent);
  11089. } else if (domComponentOrNode.tagName) {
  11090. // Will allow on actual dom nodes.
  11091. ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent);
  11092. }
  11093. };
  11094. }
  11095. Object.keys(topLevelTypes).forEach(function (eventType) {
  11096. // Event type is stored as 'topClick' - we transform that to 'click'
  11097. var convenienceName = eventType.indexOf('top') === 0 ? eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
  11098. /**
  11099. * @param {!Element|ReactDOMComponent} domComponentOrNode
  11100. * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
  11101. */
  11102. ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType);
  11103. });
  11104. module.exports = ReactTestUtils;
  11105. },{"108":108,"126":126,"135":135,"152":152,"159":159,"16":16,"160":160,"17":17,"18":18,"20":20,"26":26,"31":31,"34":34,"63":63,"79":79,"82":82,"91":91}],81:[function(_dereq_,module,exports){
  11106. /**
  11107. * Copyright 2015-present, Facebook, Inc.
  11108. * All rights reserved.
  11109. *
  11110. * This source code is licensed under the BSD-style license found in the
  11111. * LICENSE file in the root directory of this source tree. An additional grant
  11112. * of patent rights can be found in the PATENTS file in the same directory.
  11113. *
  11114. */
  11115. 'use strict';
  11116. var _prodInvariant = _dereq_(126);
  11117. var ReactCurrentOwner = _dereq_(134);
  11118. var ReactInstanceMap = _dereq_(63);
  11119. var ReactInstrumentation = _dereq_(64);
  11120. var ReactUpdates = _dereq_(82);
  11121. var invariant = _dereq_(152);
  11122. var warning = _dereq_(159);
  11123. function enqueueUpdate(internalInstance) {
  11124. ReactUpdates.enqueueUpdate(internalInstance);
  11125. }
  11126. function formatUnexpectedArgument(arg) {
  11127. var type = typeof arg;
  11128. if (type !== 'object') {
  11129. return type;
  11130. }
  11131. var displayName = arg.constructor && arg.constructor.name || type;
  11132. var keys = Object.keys(arg);
  11133. if (keys.length > 0 && keys.length < 20) {
  11134. return displayName + ' (keys: ' + keys.join(', ') + ')';
  11135. }
  11136. return displayName;
  11137. }
  11138. function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
  11139. var internalInstance = ReactInstanceMap.get(publicInstance);
  11140. if (!internalInstance) {
  11141. if ("development" !== 'production') {
  11142. var ctor = publicInstance.constructor;
  11143. // Only warn when we have a callerName. Otherwise we should be silent.
  11144. // We're probably calling from enqueueCallback. We don't want to warn
  11145. // there because we already warned for the corresponding lifecycle method.
  11146. "development" !== '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, ctor && (ctor.displayName || ctor.name) || 'ReactClass') : void 0;
  11147. }
  11148. return null;
  11149. }
  11150. if ("development" !== 'production') {
  11151. "development" !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition (such as ' + "within `render` or another component's constructor). Render methods " + 'should be a pure function of props and state; constructor ' + 'side-effects are an anti-pattern, but can be moved to ' + '`componentWillMount`.', callerName) : void 0;
  11152. }
  11153. return internalInstance;
  11154. }
  11155. /**
  11156. * ReactUpdateQueue allows for state updates to be scheduled into a later
  11157. * reconciliation step.
  11158. */
  11159. var ReactUpdateQueue = {
  11160. /**
  11161. * Checks whether or not this composite component is mounted.
  11162. * @param {ReactClass} publicInstance The instance we want to test.
  11163. * @return {boolean} True if mounted, false otherwise.
  11164. * @protected
  11165. * @final
  11166. */
  11167. isMounted: function (publicInstance) {
  11168. if ("development" !== 'production') {
  11169. var owner = ReactCurrentOwner.current;
  11170. if (owner !== null) {
  11171. "development" !== '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') : void 0;
  11172. owner._warnedAboutRefsInRender = true;
  11173. }
  11174. }
  11175. var internalInstance = ReactInstanceMap.get(publicInstance);
  11176. if (internalInstance) {
  11177. // During componentWillMount and render this will still be null but after
  11178. // that will always render to something. At least for now. So we can use
  11179. // this hack.
  11180. return !!internalInstance._renderedComponent;
  11181. } else {
  11182. return false;
  11183. }
  11184. },
  11185. /**
  11186. * Enqueue a callback that will be executed after all the pending updates
  11187. * have processed.
  11188. *
  11189. * @param {ReactClass} publicInstance The instance to use as `this` context.
  11190. * @param {?function} callback Called after state is updated.
  11191. * @param {string} callerName Name of the calling function in the public API.
  11192. * @internal
  11193. */
  11194. enqueueCallback: function (publicInstance, callback, callerName) {
  11195. ReactUpdateQueue.validateCallback(callback, callerName);
  11196. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
  11197. // Previously we would throw an error if we didn't have an internal
  11198. // instance. Since we want to make it a no-op instead, we mirror the same
  11199. // behavior we have in other enqueue* methods.
  11200. // We also need to ignore callbacks in componentWillMount. See
  11201. // enqueueUpdates.
  11202. if (!internalInstance) {
  11203. return null;
  11204. }
  11205. if (internalInstance._pendingCallbacks) {
  11206. internalInstance._pendingCallbacks.push(callback);
  11207. } else {
  11208. internalInstance._pendingCallbacks = [callback];
  11209. }
  11210. // TODO: The callback here is ignored when setState is called from
  11211. // componentWillMount. Either fix it or disallow doing so completely in
  11212. // favor of getInitialState. Alternatively, we can disallow
  11213. // componentWillMount during server-side rendering.
  11214. enqueueUpdate(internalInstance);
  11215. },
  11216. enqueueCallbackInternal: function (internalInstance, callback) {
  11217. if (internalInstance._pendingCallbacks) {
  11218. internalInstance._pendingCallbacks.push(callback);
  11219. } else {
  11220. internalInstance._pendingCallbacks = [callback];
  11221. }
  11222. enqueueUpdate(internalInstance);
  11223. },
  11224. /**
  11225. * Forces an update. This should only be invoked when it is known with
  11226. * certainty that we are **not** in a DOM transaction.
  11227. *
  11228. * You may want to call this when you know that some deeper aspect of the
  11229. * component's state has changed but `setState` was not called.
  11230. *
  11231. * This will not invoke `shouldComponentUpdate`, but it will invoke
  11232. * `componentWillUpdate` and `componentDidUpdate`.
  11233. *
  11234. * @param {ReactClass} publicInstance The instance that should rerender.
  11235. * @internal
  11236. */
  11237. enqueueForceUpdate: function (publicInstance) {
  11238. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
  11239. if (!internalInstance) {
  11240. return;
  11241. }
  11242. internalInstance._pendingForceUpdate = true;
  11243. enqueueUpdate(internalInstance);
  11244. },
  11245. /**
  11246. * Replaces all of the state. Always use this or `setState` to mutate state.
  11247. * You should treat `this.state` as immutable.
  11248. *
  11249. * There is no guarantee that `this.state` will be immediately updated, so
  11250. * accessing `this.state` after calling this method may return the old value.
  11251. *
  11252. * @param {ReactClass} publicInstance The instance that should rerender.
  11253. * @param {object} completeState Next state.
  11254. * @internal
  11255. */
  11256. enqueueReplaceState: function (publicInstance, completeState, callback) {
  11257. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
  11258. if (!internalInstance) {
  11259. return;
  11260. }
  11261. internalInstance._pendingStateQueue = [completeState];
  11262. internalInstance._pendingReplaceState = true;
  11263. // Future-proof 15.5
  11264. if (callback !== undefined && callback !== null) {
  11265. ReactUpdateQueue.validateCallback(callback, 'replaceState');
  11266. if (internalInstance._pendingCallbacks) {
  11267. internalInstance._pendingCallbacks.push(callback);
  11268. } else {
  11269. internalInstance._pendingCallbacks = [callback];
  11270. }
  11271. }
  11272. enqueueUpdate(internalInstance);
  11273. },
  11274. /**
  11275. * Sets a subset of the state. This only exists because _pendingState is
  11276. * internal. This provides a merging strategy that is not available to deep
  11277. * properties which is confusing. TODO: Expose pendingState or don't use it
  11278. * during the merge.
  11279. *
  11280. * @param {ReactClass} publicInstance The instance that should rerender.
  11281. * @param {object} partialState Next partial state to be merged with state.
  11282. * @internal
  11283. */
  11284. enqueueSetState: function (publicInstance, partialState) {
  11285. if ("development" !== 'production') {
  11286. ReactInstrumentation.debugTool.onSetState();
  11287. "development" !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0;
  11288. }
  11289. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
  11290. if (!internalInstance) {
  11291. return;
  11292. }
  11293. var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
  11294. queue.push(partialState);
  11295. enqueueUpdate(internalInstance);
  11296. },
  11297. enqueueElementInternal: function (internalInstance, nextElement, nextContext) {
  11298. internalInstance._pendingElement = nextElement;
  11299. // TODO: introduce _pendingContext instead of setting it directly.
  11300. internalInstance._context = nextContext;
  11301. enqueueUpdate(internalInstance);
  11302. },
  11303. validateCallback: function (callback, callerName) {
  11304. !(!callback || typeof callback === 'function') ? "development" !== 'production' ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : _prodInvariant('122', callerName, formatUnexpectedArgument(callback)) : void 0;
  11305. }
  11306. };
  11307. module.exports = ReactUpdateQueue;
  11308. },{"126":126,"134":134,"152":152,"159":159,"63":63,"64":64,"82":82}],82:[function(_dereq_,module,exports){
  11309. /**
  11310. * Copyright 2013-present, Facebook, Inc.
  11311. * All rights reserved.
  11312. *
  11313. * This source code is licensed under the BSD-style license found in the
  11314. * LICENSE file in the root directory of this source tree. An additional grant
  11315. * of patent rights can be found in the PATENTS file in the same directory.
  11316. *
  11317. */
  11318. 'use strict';
  11319. var _prodInvariant = _dereq_(126),
  11320. _assign = _dereq_(160);
  11321. var CallbackQueue = _dereq_(6);
  11322. var PooledClass = _dereq_(25);
  11323. var ReactFeatureFlags = _dereq_(58);
  11324. var ReactReconciler = _dereq_(75);
  11325. var Transaction = _dereq_(100);
  11326. var invariant = _dereq_(152);
  11327. var dirtyComponents = [];
  11328. var updateBatchNumber = 0;
  11329. var asapCallbackQueue = CallbackQueue.getPooled();
  11330. var asapEnqueued = false;
  11331. var batchingStrategy = null;
  11332. function ensureInjected() {
  11333. !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0;
  11334. }
  11335. var NESTED_UPDATES = {
  11336. initialize: function () {
  11337. this.dirtyComponentsLength = dirtyComponents.length;
  11338. },
  11339. close: function () {
  11340. if (this.dirtyComponentsLength !== dirtyComponents.length) {
  11341. // Additional updates were enqueued by componentDidUpdate handlers or
  11342. // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
  11343. // these new updates so that if A's componentDidUpdate calls setState on
  11344. // B, B will update before the callback A's updater provided when calling
  11345. // setState.
  11346. dirtyComponents.splice(0, this.dirtyComponentsLength);
  11347. flushBatchedUpdates();
  11348. } else {
  11349. dirtyComponents.length = 0;
  11350. }
  11351. }
  11352. };
  11353. var UPDATE_QUEUEING = {
  11354. initialize: function () {
  11355. this.callbackQueue.reset();
  11356. },
  11357. close: function () {
  11358. this.callbackQueue.notifyAll();
  11359. }
  11360. };
  11361. var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
  11362. function ReactUpdatesFlushTransaction() {
  11363. this.reinitializeTransaction();
  11364. this.dirtyComponentsLength = null;
  11365. this.callbackQueue = CallbackQueue.getPooled();
  11366. this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(
  11367. /* useCreateElement */true);
  11368. }
  11369. _assign(ReactUpdatesFlushTransaction.prototype, Transaction, {
  11370. getTransactionWrappers: function () {
  11371. return TRANSACTION_WRAPPERS;
  11372. },
  11373. destructor: function () {
  11374. this.dirtyComponentsLength = null;
  11375. CallbackQueue.release(this.callbackQueue);
  11376. this.callbackQueue = null;
  11377. ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
  11378. this.reconcileTransaction = null;
  11379. },
  11380. perform: function (method, scope, a) {
  11381. // Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
  11382. // with this transaction's wrappers around it.
  11383. return Transaction.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
  11384. }
  11385. });
  11386. PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
  11387. function batchedUpdates(callback, a, b, c, d, e) {
  11388. ensureInjected();
  11389. return batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
  11390. }
  11391. /**
  11392. * Array comparator for ReactComponents by mount ordering.
  11393. *
  11394. * @param {ReactComponent} c1 first component you're comparing
  11395. * @param {ReactComponent} c2 second component you're comparing
  11396. * @return {number} Return value usable by Array.prototype.sort().
  11397. */
  11398. function mountOrderComparator(c1, c2) {
  11399. return c1._mountOrder - c2._mountOrder;
  11400. }
  11401. function runBatchedUpdates(transaction) {
  11402. var len = transaction.dirtyComponentsLength;
  11403. !(len === dirtyComponents.length) ? "development" !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to match dirty-components array length (%s).', len, dirtyComponents.length) : _prodInvariant('124', len, dirtyComponents.length) : void 0;
  11404. // Since reconciling a component higher in the owner hierarchy usually (not
  11405. // always -- see shouldComponentUpdate()) will reconcile children, reconcile
  11406. // them before their children by sorting the array.
  11407. dirtyComponents.sort(mountOrderComparator);
  11408. // Any updates enqueued while reconciling must be performed after this entire
  11409. // batch. Otherwise, if dirtyComponents is [A, B] where A has children B and
  11410. // C, B could update twice in a single batch if C's render enqueues an update
  11411. // to B (since B would have already updated, we should skip it, and the only
  11412. // way we can know to do so is by checking the batch counter).
  11413. updateBatchNumber++;
  11414. for (var i = 0; i < len; i++) {
  11415. // If a component is unmounted before pending changes apply, it will still
  11416. // be here, but we assume that it has cleared its _pendingCallbacks and
  11417. // that performUpdateIfNecessary is a noop.
  11418. var component = dirtyComponents[i];
  11419. // If performUpdateIfNecessary happens to enqueue any new updates, we
  11420. // shouldn't execute the callbacks until the next render happens, so
  11421. // stash the callbacks first
  11422. var callbacks = component._pendingCallbacks;
  11423. component._pendingCallbacks = null;
  11424. var markerName;
  11425. if (ReactFeatureFlags.logTopLevelRenders) {
  11426. var namedComponent = component;
  11427. // Duck type TopLevelWrapper. This is probably always true.
  11428. if (component._currentElement.type.isReactTopLevelWrapper) {
  11429. namedComponent = component._renderedComponent;
  11430. }
  11431. markerName = 'React update: ' + namedComponent.getName();
  11432. console.time(markerName);
  11433. }
  11434. ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber);
  11435. if (markerName) {
  11436. console.timeEnd(markerName);
  11437. }
  11438. if (callbacks) {
  11439. for (var j = 0; j < callbacks.length; j++) {
  11440. transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
  11441. }
  11442. }
  11443. }
  11444. }
  11445. var flushBatchedUpdates = function () {
  11446. // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
  11447. // array and perform any updates enqueued by mount-ready handlers (i.e.,
  11448. // componentDidUpdate) but we need to check here too in order to catch
  11449. // updates enqueued by setState callbacks and asap calls.
  11450. while (dirtyComponents.length || asapEnqueued) {
  11451. if (dirtyComponents.length) {
  11452. var transaction = ReactUpdatesFlushTransaction.getPooled();
  11453. transaction.perform(runBatchedUpdates, null, transaction);
  11454. ReactUpdatesFlushTransaction.release(transaction);
  11455. }
  11456. if (asapEnqueued) {
  11457. asapEnqueued = false;
  11458. var queue = asapCallbackQueue;
  11459. asapCallbackQueue = CallbackQueue.getPooled();
  11460. queue.notifyAll();
  11461. CallbackQueue.release(queue);
  11462. }
  11463. }
  11464. };
  11465. /**
  11466. * Mark a component as needing a rerender, adding an optional callback to a
  11467. * list of functions which will be executed once the rerender occurs.
  11468. */
  11469. function enqueueUpdate(component) {
  11470. ensureInjected();
  11471. // Various parts of our code (such as ReactCompositeComponent's
  11472. // _renderValidatedComponent) assume that calls to render aren't nested;
  11473. // verify that that's the case. (This is called by each top-level update
  11474. // function, like setState, forceUpdate, etc.; creation and
  11475. // destruction of top-level components is guarded in ReactMount.)
  11476. if (!batchingStrategy.isBatchingUpdates) {
  11477. batchingStrategy.batchedUpdates(enqueueUpdate, component);
  11478. return;
  11479. }
  11480. dirtyComponents.push(component);
  11481. if (component._updateBatchNumber == null) {
  11482. component._updateBatchNumber = updateBatchNumber + 1;
  11483. }
  11484. }
  11485. /**
  11486. * Enqueue a callback to be run at the end of the current batching cycle. Throws
  11487. * if no updates are currently being performed.
  11488. */
  11489. function asap(callback, context) {
  11490. !batchingStrategy.isBatchingUpdates ? "development" !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context whereupdates are not being batched.') : _prodInvariant('125') : void 0;
  11491. asapCallbackQueue.enqueue(callback, context);
  11492. asapEnqueued = true;
  11493. }
  11494. var ReactUpdatesInjection = {
  11495. injectReconcileTransaction: function (ReconcileTransaction) {
  11496. !ReconcileTransaction ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0;
  11497. ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
  11498. },
  11499. injectBatchingStrategy: function (_batchingStrategy) {
  11500. !_batchingStrategy ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0;
  11501. !(typeof _batchingStrategy.batchedUpdates === 'function') ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0;
  11502. !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : _prodInvariant('129') : void 0;
  11503. batchingStrategy = _batchingStrategy;
  11504. }
  11505. };
  11506. var ReactUpdates = {
  11507. /**
  11508. * React references `ReactReconcileTransaction` using this property in order
  11509. * to allow dependency injection.
  11510. *
  11511. * @internal
  11512. */
  11513. ReactReconcileTransaction: null,
  11514. batchedUpdates: batchedUpdates,
  11515. enqueueUpdate: enqueueUpdate,
  11516. flushBatchedUpdates: flushBatchedUpdates,
  11517. injection: ReactUpdatesInjection,
  11518. asap: asap
  11519. };
  11520. module.exports = ReactUpdates;
  11521. },{"100":100,"126":126,"152":152,"160":160,"25":25,"58":58,"6":6,"75":75}],83:[function(_dereq_,module,exports){
  11522. /**
  11523. * Copyright 2013-present, Facebook, Inc.
  11524. * All rights reserved.
  11525. *
  11526. * This source code is licensed under the BSD-style license found in the
  11527. * LICENSE file in the root directory of this source tree. An additional grant
  11528. * of patent rights can be found in the PATENTS file in the same directory.
  11529. *
  11530. */
  11531. 'use strict';
  11532. module.exports = '15.6.1';
  11533. },{}],84:[function(_dereq_,module,exports){
  11534. /**
  11535. * Copyright 2013-present, Facebook, Inc.
  11536. * All rights reserved.
  11537. *
  11538. * This source code is licensed under the BSD-style license found in the
  11539. * LICENSE file in the root directory of this source tree. An additional grant
  11540. * of patent rights can be found in the PATENTS file in the same directory.
  11541. *
  11542. */
  11543. 'use strict';
  11544. var NS = {
  11545. xlink: 'http://www.w3.org/1999/xlink',
  11546. xml: 'http://www.w3.org/XML/1998/namespace'
  11547. };
  11548. // We use attributes for everything SVG so let's avoid some duplication and run
  11549. // code instead.
  11550. // The following are all specified in the HTML config already so we exclude here.
  11551. // - class (as className)
  11552. // - color
  11553. // - height
  11554. // - id
  11555. // - lang
  11556. // - max
  11557. // - media
  11558. // - method
  11559. // - min
  11560. // - name
  11561. // - style
  11562. // - target
  11563. // - type
  11564. // - width
  11565. var ATTRS = {
  11566. accentHeight: 'accent-height',
  11567. accumulate: 0,
  11568. additive: 0,
  11569. alignmentBaseline: 'alignment-baseline',
  11570. allowReorder: 'allowReorder',
  11571. alphabetic: 0,
  11572. amplitude: 0,
  11573. arabicForm: 'arabic-form',
  11574. ascent: 0,
  11575. attributeName: 'attributeName',
  11576. attributeType: 'attributeType',
  11577. autoReverse: 'autoReverse',
  11578. azimuth: 0,
  11579. baseFrequency: 'baseFrequency',
  11580. baseProfile: 'baseProfile',
  11581. baselineShift: 'baseline-shift',
  11582. bbox: 0,
  11583. begin: 0,
  11584. bias: 0,
  11585. by: 0,
  11586. calcMode: 'calcMode',
  11587. capHeight: 'cap-height',
  11588. clip: 0,
  11589. clipPath: 'clip-path',
  11590. clipRule: 'clip-rule',
  11591. clipPathUnits: 'clipPathUnits',
  11592. colorInterpolation: 'color-interpolation',
  11593. colorInterpolationFilters: 'color-interpolation-filters',
  11594. colorProfile: 'color-profile',
  11595. colorRendering: 'color-rendering',
  11596. contentScriptType: 'contentScriptType',
  11597. contentStyleType: 'contentStyleType',
  11598. cursor: 0,
  11599. cx: 0,
  11600. cy: 0,
  11601. d: 0,
  11602. decelerate: 0,
  11603. descent: 0,
  11604. diffuseConstant: 'diffuseConstant',
  11605. direction: 0,
  11606. display: 0,
  11607. divisor: 0,
  11608. dominantBaseline: 'dominant-baseline',
  11609. dur: 0,
  11610. dx: 0,
  11611. dy: 0,
  11612. edgeMode: 'edgeMode',
  11613. elevation: 0,
  11614. enableBackground: 'enable-background',
  11615. end: 0,
  11616. exponent: 0,
  11617. externalResourcesRequired: 'externalResourcesRequired',
  11618. fill: 0,
  11619. fillOpacity: 'fill-opacity',
  11620. fillRule: 'fill-rule',
  11621. filter: 0,
  11622. filterRes: 'filterRes',
  11623. filterUnits: 'filterUnits',
  11624. floodColor: 'flood-color',
  11625. floodOpacity: 'flood-opacity',
  11626. focusable: 0,
  11627. fontFamily: 'font-family',
  11628. fontSize: 'font-size',
  11629. fontSizeAdjust: 'font-size-adjust',
  11630. fontStretch: 'font-stretch',
  11631. fontStyle: 'font-style',
  11632. fontVariant: 'font-variant',
  11633. fontWeight: 'font-weight',
  11634. format: 0,
  11635. from: 0,
  11636. fx: 0,
  11637. fy: 0,
  11638. g1: 0,
  11639. g2: 0,
  11640. glyphName: 'glyph-name',
  11641. glyphOrientationHorizontal: 'glyph-orientation-horizontal',
  11642. glyphOrientationVertical: 'glyph-orientation-vertical',
  11643. glyphRef: 'glyphRef',
  11644. gradientTransform: 'gradientTransform',
  11645. gradientUnits: 'gradientUnits',
  11646. hanging: 0,
  11647. horizAdvX: 'horiz-adv-x',
  11648. horizOriginX: 'horiz-origin-x',
  11649. ideographic: 0,
  11650. imageRendering: 'image-rendering',
  11651. 'in': 0,
  11652. in2: 0,
  11653. intercept: 0,
  11654. k: 0,
  11655. k1: 0,
  11656. k2: 0,
  11657. k3: 0,
  11658. k4: 0,
  11659. kernelMatrix: 'kernelMatrix',
  11660. kernelUnitLength: 'kernelUnitLength',
  11661. kerning: 0,
  11662. keyPoints: 'keyPoints',
  11663. keySplines: 'keySplines',
  11664. keyTimes: 'keyTimes',
  11665. lengthAdjust: 'lengthAdjust',
  11666. letterSpacing: 'letter-spacing',
  11667. lightingColor: 'lighting-color',
  11668. limitingConeAngle: 'limitingConeAngle',
  11669. local: 0,
  11670. markerEnd: 'marker-end',
  11671. markerMid: 'marker-mid',
  11672. markerStart: 'marker-start',
  11673. markerHeight: 'markerHeight',
  11674. markerUnits: 'markerUnits',
  11675. markerWidth: 'markerWidth',
  11676. mask: 0,
  11677. maskContentUnits: 'maskContentUnits',
  11678. maskUnits: 'maskUnits',
  11679. mathematical: 0,
  11680. mode: 0,
  11681. numOctaves: 'numOctaves',
  11682. offset: 0,
  11683. opacity: 0,
  11684. operator: 0,
  11685. order: 0,
  11686. orient: 0,
  11687. orientation: 0,
  11688. origin: 0,
  11689. overflow: 0,
  11690. overlinePosition: 'overline-position',
  11691. overlineThickness: 'overline-thickness',
  11692. paintOrder: 'paint-order',
  11693. panose1: 'panose-1',
  11694. pathLength: 'pathLength',
  11695. patternContentUnits: 'patternContentUnits',
  11696. patternTransform: 'patternTransform',
  11697. patternUnits: 'patternUnits',
  11698. pointerEvents: 'pointer-events',
  11699. points: 0,
  11700. pointsAtX: 'pointsAtX',
  11701. pointsAtY: 'pointsAtY',
  11702. pointsAtZ: 'pointsAtZ',
  11703. preserveAlpha: 'preserveAlpha',
  11704. preserveAspectRatio: 'preserveAspectRatio',
  11705. primitiveUnits: 'primitiveUnits',
  11706. r: 0,
  11707. radius: 0,
  11708. refX: 'refX',
  11709. refY: 'refY',
  11710. renderingIntent: 'rendering-intent',
  11711. repeatCount: 'repeatCount',
  11712. repeatDur: 'repeatDur',
  11713. requiredExtensions: 'requiredExtensions',
  11714. requiredFeatures: 'requiredFeatures',
  11715. restart: 0,
  11716. result: 0,
  11717. rotate: 0,
  11718. rx: 0,
  11719. ry: 0,
  11720. scale: 0,
  11721. seed: 0,
  11722. shapeRendering: 'shape-rendering',
  11723. slope: 0,
  11724. spacing: 0,
  11725. specularConstant: 'specularConstant',
  11726. specularExponent: 'specularExponent',
  11727. speed: 0,
  11728. spreadMethod: 'spreadMethod',
  11729. startOffset: 'startOffset',
  11730. stdDeviation: 'stdDeviation',
  11731. stemh: 0,
  11732. stemv: 0,
  11733. stitchTiles: 'stitchTiles',
  11734. stopColor: 'stop-color',
  11735. stopOpacity: 'stop-opacity',
  11736. strikethroughPosition: 'strikethrough-position',
  11737. strikethroughThickness: 'strikethrough-thickness',
  11738. string: 0,
  11739. stroke: 0,
  11740. strokeDasharray: 'stroke-dasharray',
  11741. strokeDashoffset: 'stroke-dashoffset',
  11742. strokeLinecap: 'stroke-linecap',
  11743. strokeLinejoin: 'stroke-linejoin',
  11744. strokeMiterlimit: 'stroke-miterlimit',
  11745. strokeOpacity: 'stroke-opacity',
  11746. strokeWidth: 'stroke-width',
  11747. surfaceScale: 'surfaceScale',
  11748. systemLanguage: 'systemLanguage',
  11749. tableValues: 'tableValues',
  11750. targetX: 'targetX',
  11751. targetY: 'targetY',
  11752. textAnchor: 'text-anchor',
  11753. textDecoration: 'text-decoration',
  11754. textRendering: 'text-rendering',
  11755. textLength: 'textLength',
  11756. to: 0,
  11757. transform: 0,
  11758. u1: 0,
  11759. u2: 0,
  11760. underlinePosition: 'underline-position',
  11761. underlineThickness: 'underline-thickness',
  11762. unicode: 0,
  11763. unicodeBidi: 'unicode-bidi',
  11764. unicodeRange: 'unicode-range',
  11765. unitsPerEm: 'units-per-em',
  11766. vAlphabetic: 'v-alphabetic',
  11767. vHanging: 'v-hanging',
  11768. vIdeographic: 'v-ideographic',
  11769. vMathematical: 'v-mathematical',
  11770. values: 0,
  11771. vectorEffect: 'vector-effect',
  11772. version: 0,
  11773. vertAdvY: 'vert-adv-y',
  11774. vertOriginX: 'vert-origin-x',
  11775. vertOriginY: 'vert-origin-y',
  11776. viewBox: 'viewBox',
  11777. viewTarget: 'viewTarget',
  11778. visibility: 0,
  11779. widths: 0,
  11780. wordSpacing: 'word-spacing',
  11781. writingMode: 'writing-mode',
  11782. x: 0,
  11783. xHeight: 'x-height',
  11784. x1: 0,
  11785. x2: 0,
  11786. xChannelSelector: 'xChannelSelector',
  11787. xlinkActuate: 'xlink:actuate',
  11788. xlinkArcrole: 'xlink:arcrole',
  11789. xlinkHref: 'xlink:href',
  11790. xlinkRole: 'xlink:role',
  11791. xlinkShow: 'xlink:show',
  11792. xlinkTitle: 'xlink:title',
  11793. xlinkType: 'xlink:type',
  11794. xmlBase: 'xml:base',
  11795. xmlns: 0,
  11796. xmlnsXlink: 'xmlns:xlink',
  11797. xmlLang: 'xml:lang',
  11798. xmlSpace: 'xml:space',
  11799. y: 0,
  11800. y1: 0,
  11801. y2: 0,
  11802. yChannelSelector: 'yChannelSelector',
  11803. z: 0,
  11804. zoomAndPan: 'zoomAndPan'
  11805. };
  11806. var SVGDOMPropertyConfig = {
  11807. Properties: {},
  11808. DOMAttributeNamespaces: {
  11809. xlinkActuate: NS.xlink,
  11810. xlinkArcrole: NS.xlink,
  11811. xlinkHref: NS.xlink,
  11812. xlinkRole: NS.xlink,
  11813. xlinkShow: NS.xlink,
  11814. xlinkTitle: NS.xlink,
  11815. xlinkType: NS.xlink,
  11816. xmlBase: NS.xml,
  11817. xmlLang: NS.xml,
  11818. xmlSpace: NS.xml
  11819. },
  11820. DOMAttributeNames: {}
  11821. };
  11822. Object.keys(ATTRS).forEach(function (key) {
  11823. SVGDOMPropertyConfig.Properties[key] = 0;
  11824. if (ATTRS[key]) {
  11825. SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key];
  11826. }
  11827. });
  11828. module.exports = SVGDOMPropertyConfig;
  11829. },{}],85:[function(_dereq_,module,exports){
  11830. /**
  11831. * Copyright 2013-present, Facebook, Inc.
  11832. * All rights reserved.
  11833. *
  11834. * This source code is licensed under the BSD-style license found in the
  11835. * LICENSE file in the root directory of this source tree. An additional grant
  11836. * of patent rights can be found in the PATENTS file in the same directory.
  11837. *
  11838. */
  11839. 'use strict';
  11840. var EventPropagators = _dereq_(20);
  11841. var ExecutionEnvironment = _dereq_(138);
  11842. var ReactDOMComponentTree = _dereq_(34);
  11843. var ReactInputSelection = _dereq_(62);
  11844. var SyntheticEvent = _dereq_(91);
  11845. var getActiveElement = _dereq_(147);
  11846. var isTextInputElement = _dereq_(123);
  11847. var shallowEqual = _dereq_(158);
  11848. var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
  11849. var eventTypes = {
  11850. select: {
  11851. phasedRegistrationNames: {
  11852. bubbled: 'onSelect',
  11853. captured: 'onSelectCapture'
  11854. },
  11855. dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange']
  11856. }
  11857. };
  11858. var activeElement = null;
  11859. var activeElementInst = null;
  11860. var lastSelection = null;
  11861. var mouseDown = false;
  11862. // Track whether a listener exists for this plugin. If none exist, we do
  11863. // not extract events. See #3639.
  11864. var hasListener = false;
  11865. /**
  11866. * Get an object which is a unique representation of the current selection.
  11867. *
  11868. * The return value will not be consistent across nodes or browsers, but
  11869. * two identical selections on the same node will return identical objects.
  11870. *
  11871. * @param {DOMElement} node
  11872. * @return {object}
  11873. */
  11874. function getSelection(node) {
  11875. if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
  11876. return {
  11877. start: node.selectionStart,
  11878. end: node.selectionEnd
  11879. };
  11880. } else if (window.getSelection) {
  11881. var selection = window.getSelection();
  11882. return {
  11883. anchorNode: selection.anchorNode,
  11884. anchorOffset: selection.anchorOffset,
  11885. focusNode: selection.focusNode,
  11886. focusOffset: selection.focusOffset
  11887. };
  11888. } else if (document.selection) {
  11889. var range = document.selection.createRange();
  11890. return {
  11891. parentElement: range.parentElement(),
  11892. text: range.text,
  11893. top: range.boundingTop,
  11894. left: range.boundingLeft
  11895. };
  11896. }
  11897. }
  11898. /**
  11899. * Poll selection to see whether it's changed.
  11900. *
  11901. * @param {object} nativeEvent
  11902. * @return {?SyntheticEvent}
  11903. */
  11904. function constructSelectEvent(nativeEvent, nativeEventTarget) {
  11905. // Ensure we have the right element, and that the user is not dragging a
  11906. // selection (this matches native `select` event behavior). In HTML5, select
  11907. // fires only on input and textarea thus if there's no focused element we
  11908. // won't dispatch.
  11909. if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
  11910. return null;
  11911. }
  11912. // Only fire when selection has actually changed.
  11913. var currentSelection = getSelection(activeElement);
  11914. if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
  11915. lastSelection = currentSelection;
  11916. var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget);
  11917. syntheticEvent.type = 'select';
  11918. syntheticEvent.target = activeElement;
  11919. EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
  11920. return syntheticEvent;
  11921. }
  11922. return null;
  11923. }
  11924. /**
  11925. * This plugin creates an `onSelect` event that normalizes select events
  11926. * across form elements.
  11927. *
  11928. * Supported elements are:
  11929. * - input (see `isTextInputElement`)
  11930. * - textarea
  11931. * - contentEditable
  11932. *
  11933. * This differs from native browser implementations in the following ways:
  11934. * - Fires on contentEditable fields as well as inputs.
  11935. * - Fires for collapsed selection.
  11936. * - Fires after user input.
  11937. */
  11938. var SelectEventPlugin = {
  11939. eventTypes: eventTypes,
  11940. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  11941. if (!hasListener) {
  11942. return null;
  11943. }
  11944. var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
  11945. switch (topLevelType) {
  11946. // Track the input node that has focus.
  11947. case 'topFocus':
  11948. if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
  11949. activeElement = targetNode;
  11950. activeElementInst = targetInst;
  11951. lastSelection = null;
  11952. }
  11953. break;
  11954. case 'topBlur':
  11955. activeElement = null;
  11956. activeElementInst = null;
  11957. lastSelection = null;
  11958. break;
  11959. // Don't fire the event while the user is dragging. This matches the
  11960. // semantics of the native select event.
  11961. case 'topMouseDown':
  11962. mouseDown = true;
  11963. break;
  11964. case 'topContextMenu':
  11965. case 'topMouseUp':
  11966. mouseDown = false;
  11967. return constructSelectEvent(nativeEvent, nativeEventTarget);
  11968. // Chrome and IE fire non-standard event when selection is changed (and
  11969. // sometimes when it hasn't). IE's event fires out of order with respect
  11970. // to key and input events on deletion, so we discard it.
  11971. //
  11972. // Firefox doesn't support selectionchange, so check selection status
  11973. // after each key entry. The selection changes after keydown and before
  11974. // keyup, but we check on keydown as well in the case of holding down a
  11975. // key, when multiple keydown events are fired but only one keyup is.
  11976. // This is also our approach for IE handling, for the reason above.
  11977. case 'topSelectionChange':
  11978. if (skipSelectionChangeEvent) {
  11979. break;
  11980. }
  11981. // falls through
  11982. case 'topKeyDown':
  11983. case 'topKeyUp':
  11984. return constructSelectEvent(nativeEvent, nativeEventTarget);
  11985. }
  11986. return null;
  11987. },
  11988. didPutListener: function (inst, registrationName, listener) {
  11989. if (registrationName === 'onSelect') {
  11990. hasListener = true;
  11991. }
  11992. }
  11993. };
  11994. module.exports = SelectEventPlugin;
  11995. },{"123":123,"138":138,"147":147,"158":158,"20":20,"34":34,"62":62,"91":91}],86:[function(_dereq_,module,exports){
  11996. /**
  11997. * Copyright 2013-present, Facebook, Inc.
  11998. * All rights reserved.
  11999. *
  12000. * This source code is licensed under the BSD-style license found in the
  12001. * LICENSE file in the root directory of this source tree. An additional grant
  12002. * of patent rights can be found in the PATENTS file in the same directory.
  12003. *
  12004. *
  12005. */
  12006. 'use strict';
  12007. var _prodInvariant = _dereq_(126);
  12008. var EventListener = _dereq_(137);
  12009. var EventPropagators = _dereq_(20);
  12010. var ReactDOMComponentTree = _dereq_(34);
  12011. var SyntheticAnimationEvent = _dereq_(87);
  12012. var SyntheticClipboardEvent = _dereq_(88);
  12013. var SyntheticEvent = _dereq_(91);
  12014. var SyntheticFocusEvent = _dereq_(92);
  12015. var SyntheticKeyboardEvent = _dereq_(94);
  12016. var SyntheticMouseEvent = _dereq_(95);
  12017. var SyntheticDragEvent = _dereq_(90);
  12018. var SyntheticTouchEvent = _dereq_(96);
  12019. var SyntheticTransitionEvent = _dereq_(97);
  12020. var SyntheticUIEvent = _dereq_(98);
  12021. var SyntheticWheelEvent = _dereq_(99);
  12022. var emptyFunction = _dereq_(144);
  12023. var getEventCharCode = _dereq_(111);
  12024. var invariant = _dereq_(152);
  12025. /**
  12026. * Turns
  12027. * ['abort', ...]
  12028. * into
  12029. * eventTypes = {
  12030. * 'abort': {
  12031. * phasedRegistrationNames: {
  12032. * bubbled: 'onAbort',
  12033. * captured: 'onAbortCapture',
  12034. * },
  12035. * dependencies: ['topAbort'],
  12036. * },
  12037. * ...
  12038. * };
  12039. * topLevelEventsToDispatchConfig = {
  12040. * 'topAbort': { sameConfig }
  12041. * };
  12042. */
  12043. var eventTypes = {};
  12044. var topLevelEventsToDispatchConfig = {};
  12045. ['abort', 'animationEnd', 'animationIteration', 'animationStart', 'blur', 'canPlay', 'canPlayThrough', 'click', 'contextMenu', 'copy', 'cut', 'doubleClick', 'drag', 'dragEnd', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'dragStart', 'drop', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'focus', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'mouseDown', 'mouseMove', 'mouseOut', 'mouseOver', 'mouseUp', 'paste', 'pause', 'play', 'playing', 'progress', 'rateChange', 'reset', 'scroll', 'seeked', 'seeking', 'stalled', 'submit', 'suspend', 'timeUpdate', 'touchCancel', 'touchEnd', 'touchMove', 'touchStart', 'transitionEnd', 'volumeChange', 'waiting', 'wheel'].forEach(function (event) {
  12046. var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
  12047. var onEvent = 'on' + capitalizedEvent;
  12048. var topEvent = 'top' + capitalizedEvent;
  12049. var type = {
  12050. phasedRegistrationNames: {
  12051. bubbled: onEvent,
  12052. captured: onEvent + 'Capture'
  12053. },
  12054. dependencies: [topEvent]
  12055. };
  12056. eventTypes[event] = type;
  12057. topLevelEventsToDispatchConfig[topEvent] = type;
  12058. });
  12059. var onClickListeners = {};
  12060. function getDictionaryKey(inst) {
  12061. // Prevents V8 performance issue:
  12062. // https://github.com/facebook/react/pull/7232
  12063. return '.' + inst._rootNodeID;
  12064. }
  12065. function isInteractive(tag) {
  12066. return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
  12067. }
  12068. var SimpleEventPlugin = {
  12069. eventTypes: eventTypes,
  12070. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  12071. var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
  12072. if (!dispatchConfig) {
  12073. return null;
  12074. }
  12075. var EventConstructor;
  12076. switch (topLevelType) {
  12077. case 'topAbort':
  12078. case 'topCanPlay':
  12079. case 'topCanPlayThrough':
  12080. case 'topDurationChange':
  12081. case 'topEmptied':
  12082. case 'topEncrypted':
  12083. case 'topEnded':
  12084. case 'topError':
  12085. case 'topInput':
  12086. case 'topInvalid':
  12087. case 'topLoad':
  12088. case 'topLoadedData':
  12089. case 'topLoadedMetadata':
  12090. case 'topLoadStart':
  12091. case 'topPause':
  12092. case 'topPlay':
  12093. case 'topPlaying':
  12094. case 'topProgress':
  12095. case 'topRateChange':
  12096. case 'topReset':
  12097. case 'topSeeked':
  12098. case 'topSeeking':
  12099. case 'topStalled':
  12100. case 'topSubmit':
  12101. case 'topSuspend':
  12102. case 'topTimeUpdate':
  12103. case 'topVolumeChange':
  12104. case 'topWaiting':
  12105. // HTML Events
  12106. // @see http://www.w3.org/TR/html5/index.html#events-0
  12107. EventConstructor = SyntheticEvent;
  12108. break;
  12109. case 'topKeyPress':
  12110. // Firefox creates a keypress event for function keys too. This removes
  12111. // the unwanted keypress events. Enter is however both printable and
  12112. // non-printable. One would expect Tab to be as well (but it isn't).
  12113. if (getEventCharCode(nativeEvent) === 0) {
  12114. return null;
  12115. }
  12116. /* falls through */
  12117. case 'topKeyDown':
  12118. case 'topKeyUp':
  12119. EventConstructor = SyntheticKeyboardEvent;
  12120. break;
  12121. case 'topBlur':
  12122. case 'topFocus':
  12123. EventConstructor = SyntheticFocusEvent;
  12124. break;
  12125. case 'topClick':
  12126. // Firefox creates a click event on right mouse clicks. This removes the
  12127. // unwanted click events.
  12128. if (nativeEvent.button === 2) {
  12129. return null;
  12130. }
  12131. /* falls through */
  12132. case 'topDoubleClick':
  12133. case 'topMouseDown':
  12134. case 'topMouseMove':
  12135. case 'topMouseUp':
  12136. // TODO: Disabled elements should not respond to mouse events
  12137. /* falls through */
  12138. case 'topMouseOut':
  12139. case 'topMouseOver':
  12140. case 'topContextMenu':
  12141. EventConstructor = SyntheticMouseEvent;
  12142. break;
  12143. case 'topDrag':
  12144. case 'topDragEnd':
  12145. case 'topDragEnter':
  12146. case 'topDragExit':
  12147. case 'topDragLeave':
  12148. case 'topDragOver':
  12149. case 'topDragStart':
  12150. case 'topDrop':
  12151. EventConstructor = SyntheticDragEvent;
  12152. break;
  12153. case 'topTouchCancel':
  12154. case 'topTouchEnd':
  12155. case 'topTouchMove':
  12156. case 'topTouchStart':
  12157. EventConstructor = SyntheticTouchEvent;
  12158. break;
  12159. case 'topAnimationEnd':
  12160. case 'topAnimationIteration':
  12161. case 'topAnimationStart':
  12162. EventConstructor = SyntheticAnimationEvent;
  12163. break;
  12164. case 'topTransitionEnd':
  12165. EventConstructor = SyntheticTransitionEvent;
  12166. break;
  12167. case 'topScroll':
  12168. EventConstructor = SyntheticUIEvent;
  12169. break;
  12170. case 'topWheel':
  12171. EventConstructor = SyntheticWheelEvent;
  12172. break;
  12173. case 'topCopy':
  12174. case 'topCut':
  12175. case 'topPaste':
  12176. EventConstructor = SyntheticClipboardEvent;
  12177. break;
  12178. }
  12179. !EventConstructor ? "development" !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : _prodInvariant('86', topLevelType) : void 0;
  12180. var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
  12181. EventPropagators.accumulateTwoPhaseDispatches(event);
  12182. return event;
  12183. },
  12184. didPutListener: function (inst, registrationName, listener) {
  12185. // Mobile Safari does not fire properly bubble click events on
  12186. // non-interactive elements, which means delegated click listeners do not
  12187. // fire. The workaround for this bug involves attaching an empty click
  12188. // listener on the target node.
  12189. // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  12190. if (registrationName === 'onClick' && !isInteractive(inst._tag)) {
  12191. var key = getDictionaryKey(inst);
  12192. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  12193. if (!onClickListeners[key]) {
  12194. onClickListeners[key] = EventListener.listen(node, 'click', emptyFunction);
  12195. }
  12196. }
  12197. },
  12198. willDeleteListener: function (inst, registrationName) {
  12199. if (registrationName === 'onClick' && !isInteractive(inst._tag)) {
  12200. var key = getDictionaryKey(inst);
  12201. onClickListeners[key].remove();
  12202. delete onClickListeners[key];
  12203. }
  12204. }
  12205. };
  12206. module.exports = SimpleEventPlugin;
  12207. },{"111":111,"126":126,"137":137,"144":144,"152":152,"20":20,"34":34,"87":87,"88":88,"90":90,"91":91,"92":92,"94":94,"95":95,"96":96,"97":97,"98":98,"99":99}],87:[function(_dereq_,module,exports){
  12208. /**
  12209. * Copyright 2013-present, Facebook, Inc.
  12210. * All rights reserved.
  12211. *
  12212. * This source code is licensed under the BSD-style license found in the
  12213. * LICENSE file in the root directory of this source tree. An additional grant
  12214. * of patent rights can be found in the PATENTS file in the same directory.
  12215. *
  12216. */
  12217. 'use strict';
  12218. var SyntheticEvent = _dereq_(91);
  12219. /**
  12220. * @interface Event
  12221. * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
  12222. * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
  12223. */
  12224. var AnimationEventInterface = {
  12225. animationName: null,
  12226. elapsedTime: null,
  12227. pseudoElement: null
  12228. };
  12229. /**
  12230. * @param {object} dispatchConfig Configuration used to dispatch this event.
  12231. * @param {string} dispatchMarker Marker identifying the event target.
  12232. * @param {object} nativeEvent Native browser event.
  12233. * @extends {SyntheticEvent}
  12234. */
  12235. function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  12236. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  12237. }
  12238. SyntheticEvent.augmentClass(SyntheticAnimationEvent, AnimationEventInterface);
  12239. module.exports = SyntheticAnimationEvent;
  12240. },{"91":91}],88:[function(_dereq_,module,exports){
  12241. /**
  12242. * Copyright 2013-present, Facebook, Inc.
  12243. * All rights reserved.
  12244. *
  12245. * This source code is licensed under the BSD-style license found in the
  12246. * LICENSE file in the root directory of this source tree. An additional grant
  12247. * of patent rights can be found in the PATENTS file in the same directory.
  12248. *
  12249. */
  12250. 'use strict';
  12251. var SyntheticEvent = _dereq_(91);
  12252. /**
  12253. * @interface Event
  12254. * @see http://www.w3.org/TR/clipboard-apis/
  12255. */
  12256. var ClipboardEventInterface = {
  12257. clipboardData: function (event) {
  12258. return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
  12259. }
  12260. };
  12261. /**
  12262. * @param {object} dispatchConfig Configuration used to dispatch this event.
  12263. * @param {string} dispatchMarker Marker identifying the event target.
  12264. * @param {object} nativeEvent Native browser event.
  12265. * @extends {SyntheticUIEvent}
  12266. */
  12267. function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  12268. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  12269. }
  12270. SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
  12271. module.exports = SyntheticClipboardEvent;
  12272. },{"91":91}],89:[function(_dereq_,module,exports){
  12273. /**
  12274. * Copyright 2013-present, Facebook, Inc.
  12275. * All rights reserved.
  12276. *
  12277. * This source code is licensed under the BSD-style license found in the
  12278. * LICENSE file in the root directory of this source tree. An additional grant
  12279. * of patent rights can be found in the PATENTS file in the same directory.
  12280. *
  12281. */
  12282. 'use strict';
  12283. var SyntheticEvent = _dereq_(91);
  12284. /**
  12285. * @interface Event
  12286. * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
  12287. */
  12288. var CompositionEventInterface = {
  12289. data: null
  12290. };
  12291. /**
  12292. * @param {object} dispatchConfig Configuration used to dispatch this event.
  12293. * @param {string} dispatchMarker Marker identifying the event target.
  12294. * @param {object} nativeEvent Native browser event.
  12295. * @extends {SyntheticUIEvent}
  12296. */
  12297. function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  12298. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  12299. }
  12300. SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
  12301. module.exports = SyntheticCompositionEvent;
  12302. },{"91":91}],90:[function(_dereq_,module,exports){
  12303. /**
  12304. * Copyright 2013-present, Facebook, Inc.
  12305. * All rights reserved.
  12306. *
  12307. * This source code is licensed under the BSD-style license found in the
  12308. * LICENSE file in the root directory of this source tree. An additional grant
  12309. * of patent rights can be found in the PATENTS file in the same directory.
  12310. *
  12311. */
  12312. 'use strict';
  12313. var SyntheticMouseEvent = _dereq_(95);
  12314. /**
  12315. * @interface DragEvent
  12316. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  12317. */
  12318. var DragEventInterface = {
  12319. dataTransfer: null
  12320. };
  12321. /**
  12322. * @param {object} dispatchConfig Configuration used to dispatch this event.
  12323. * @param {string} dispatchMarker Marker identifying the event target.
  12324. * @param {object} nativeEvent Native browser event.
  12325. * @extends {SyntheticUIEvent}
  12326. */
  12327. function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  12328. return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  12329. }
  12330. SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
  12331. module.exports = SyntheticDragEvent;
  12332. },{"95":95}],91:[function(_dereq_,module,exports){
  12333. /**
  12334. * Copyright 2013-present, Facebook, Inc.
  12335. * All rights reserved.
  12336. *
  12337. * This source code is licensed under the BSD-style license found in the
  12338. * LICENSE file in the root directory of this source tree. An additional grant
  12339. * of patent rights can be found in the PATENTS file in the same directory.
  12340. *
  12341. */
  12342. 'use strict';
  12343. var _assign = _dereq_(160);
  12344. var PooledClass = _dereq_(25);
  12345. var emptyFunction = _dereq_(144);
  12346. var warning = _dereq_(159);
  12347. var didWarnForAddedNewProperty = false;
  12348. var isProxySupported = typeof Proxy === 'function';
  12349. var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
  12350. /**
  12351. * @interface Event
  12352. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  12353. */
  12354. var EventInterface = {
  12355. type: null,
  12356. target: null,
  12357. // currentTarget is set when dispatching; no use in copying it here
  12358. currentTarget: emptyFunction.thatReturnsNull,
  12359. eventPhase: null,
  12360. bubbles: null,
  12361. cancelable: null,
  12362. timeStamp: function (event) {
  12363. return event.timeStamp || Date.now();
  12364. },
  12365. defaultPrevented: null,
  12366. isTrusted: null
  12367. };
  12368. /**
  12369. * Synthetic events are dispatched by event plugins, typically in response to a
  12370. * top-level event delegation handler.
  12371. *
  12372. * These systems should generally use pooling to reduce the frequency of garbage
  12373. * collection. The system should check `isPersistent` to determine whether the
  12374. * event should be released into the pool after being dispatched. Users that
  12375. * need a persisted event should invoke `persist`.
  12376. *
  12377. * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
  12378. * normalizing browser quirks. Subclasses do not necessarily have to implement a
  12379. * DOM interface; custom application-specific events can also subclass this.
  12380. *
  12381. * @param {object} dispatchConfig Configuration used to dispatch this event.
  12382. * @param {*} targetInst Marker identifying the event target.
  12383. * @param {object} nativeEvent Native browser event.
  12384. * @param {DOMEventTarget} nativeEventTarget Target node.
  12385. */
  12386. function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
  12387. if ("development" !== 'production') {
  12388. // these have a getter/setter for warnings
  12389. delete this.nativeEvent;
  12390. delete this.preventDefault;
  12391. delete this.stopPropagation;
  12392. }
  12393. this.dispatchConfig = dispatchConfig;
  12394. this._targetInst = targetInst;
  12395. this.nativeEvent = nativeEvent;
  12396. var Interface = this.constructor.Interface;
  12397. for (var propName in Interface) {
  12398. if (!Interface.hasOwnProperty(propName)) {
  12399. continue;
  12400. }
  12401. if ("development" !== 'production') {
  12402. delete this[propName]; // this has a getter/setter for warnings
  12403. }
  12404. var normalize = Interface[propName];
  12405. if (normalize) {
  12406. this[propName] = normalize(nativeEvent);
  12407. } else {
  12408. if (propName === 'target') {
  12409. this.target = nativeEventTarget;
  12410. } else {
  12411. this[propName] = nativeEvent[propName];
  12412. }
  12413. }
  12414. }
  12415. var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
  12416. if (defaultPrevented) {
  12417. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  12418. } else {
  12419. this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
  12420. }
  12421. this.isPropagationStopped = emptyFunction.thatReturnsFalse;
  12422. return this;
  12423. }
  12424. _assign(SyntheticEvent.prototype, {
  12425. preventDefault: function () {
  12426. this.defaultPrevented = true;
  12427. var event = this.nativeEvent;
  12428. if (!event) {
  12429. return;
  12430. }
  12431. if (event.preventDefault) {
  12432. event.preventDefault();
  12433. // eslint-disable-next-line valid-typeof
  12434. } else if (typeof event.returnValue !== 'unknown') {
  12435. event.returnValue = false;
  12436. }
  12437. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  12438. },
  12439. stopPropagation: function () {
  12440. var event = this.nativeEvent;
  12441. if (!event) {
  12442. return;
  12443. }
  12444. if (event.stopPropagation) {
  12445. event.stopPropagation();
  12446. // eslint-disable-next-line valid-typeof
  12447. } else if (typeof event.cancelBubble !== 'unknown') {
  12448. // The ChangeEventPlugin registers a "propertychange" event for
  12449. // IE. This event does not support bubbling or cancelling, and
  12450. // any references to cancelBubble throw "Member not found". A
  12451. // typeof check of "unknown" circumvents this issue (and is also
  12452. // IE specific).
  12453. event.cancelBubble = true;
  12454. }
  12455. this.isPropagationStopped = emptyFunction.thatReturnsTrue;
  12456. },
  12457. /**
  12458. * We release all dispatched `SyntheticEvent`s after each event loop, adding
  12459. * them back into the pool. This allows a way to hold onto a reference that
  12460. * won't be added back into the pool.
  12461. */
  12462. persist: function () {
  12463. this.isPersistent = emptyFunction.thatReturnsTrue;
  12464. },
  12465. /**
  12466. * Checks if this event should be released back into the pool.
  12467. *
  12468. * @return {boolean} True if this should not be released, false otherwise.
  12469. */
  12470. isPersistent: emptyFunction.thatReturnsFalse,
  12471. /**
  12472. * `PooledClass` looks for `destructor` on each instance it releases.
  12473. */
  12474. destructor: function () {
  12475. var Interface = this.constructor.Interface;
  12476. for (var propName in Interface) {
  12477. if ("development" !== 'production') {
  12478. Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
  12479. } else {
  12480. this[propName] = null;
  12481. }
  12482. }
  12483. for (var i = 0; i < shouldBeReleasedProperties.length; i++) {
  12484. this[shouldBeReleasedProperties[i]] = null;
  12485. }
  12486. if ("development" !== 'production') {
  12487. Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
  12488. Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction));
  12489. Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));
  12490. }
  12491. }
  12492. });
  12493. SyntheticEvent.Interface = EventInterface;
  12494. if ("development" !== 'production') {
  12495. if (isProxySupported) {
  12496. /*eslint-disable no-func-assign */
  12497. SyntheticEvent = new Proxy(SyntheticEvent, {
  12498. construct: function (target, args) {
  12499. return this.apply(target, Object.create(target.prototype), args);
  12500. },
  12501. apply: function (constructor, that, args) {
  12502. return new Proxy(constructor.apply(that, args), {
  12503. set: function (target, prop, value) {
  12504. if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
  12505. "development" !== 'production' ? warning(didWarnForAddedNewProperty || target.isPersistent(), "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0;
  12506. didWarnForAddedNewProperty = true;
  12507. }
  12508. target[prop] = value;
  12509. return true;
  12510. }
  12511. });
  12512. }
  12513. });
  12514. /*eslint-enable no-func-assign */
  12515. }
  12516. }
  12517. /**
  12518. * Helper to reduce boilerplate when creating subclasses.
  12519. *
  12520. * @param {function} Class
  12521. * @param {?object} Interface
  12522. */
  12523. SyntheticEvent.augmentClass = function (Class, Interface) {
  12524. var Super = this;
  12525. var E = function () {};
  12526. E.prototype = Super.prototype;
  12527. var prototype = new E();
  12528. _assign(prototype, Class.prototype);
  12529. Class.prototype = prototype;
  12530. Class.prototype.constructor = Class;
  12531. Class.Interface = _assign({}, Super.Interface, Interface);
  12532. Class.augmentClass = Super.augmentClass;
  12533. PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
  12534. };
  12535. PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
  12536. module.exports = SyntheticEvent;
  12537. /**
  12538. * Helper to nullify syntheticEvent instance properties when destructing
  12539. *
  12540. * @param {object} SyntheticEvent
  12541. * @param {String} propName
  12542. * @return {object} defineProperty object
  12543. */
  12544. function getPooledWarningPropertyDefinition(propName, getVal) {
  12545. var isFunction = typeof getVal === 'function';
  12546. return {
  12547. configurable: true,
  12548. set: set,
  12549. get: get
  12550. };
  12551. function set(val) {
  12552. var action = isFunction ? 'setting the method' : 'setting the property';
  12553. warn(action, 'This is effectively a no-op');
  12554. return val;
  12555. }
  12556. function get() {
  12557. var action = isFunction ? 'accessing the method' : 'accessing the property';
  12558. var result = isFunction ? 'This is a no-op function' : 'This is set to null';
  12559. warn(action, result);
  12560. return getVal;
  12561. }
  12562. function warn(action, result) {
  12563. var warningCondition = false;
  12564. "development" !== 'production' ? warning(warningCondition, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
  12565. }
  12566. }
  12567. },{"144":144,"159":159,"160":160,"25":25}],92:[function(_dereq_,module,exports){
  12568. /**
  12569. * Copyright 2013-present, Facebook, Inc.
  12570. * All rights reserved.
  12571. *
  12572. * This source code is licensed under the BSD-style license found in the
  12573. * LICENSE file in the root directory of this source tree. An additional grant
  12574. * of patent rights can be found in the PATENTS file in the same directory.
  12575. *
  12576. */
  12577. 'use strict';
  12578. var SyntheticUIEvent = _dereq_(98);
  12579. /**
  12580. * @interface FocusEvent
  12581. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  12582. */
  12583. var FocusEventInterface = {
  12584. relatedTarget: null
  12585. };
  12586. /**
  12587. * @param {object} dispatchConfig Configuration used to dispatch this event.
  12588. * @param {string} dispatchMarker Marker identifying the event target.
  12589. * @param {object} nativeEvent Native browser event.
  12590. * @extends {SyntheticUIEvent}
  12591. */
  12592. function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  12593. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  12594. }
  12595. SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
  12596. module.exports = SyntheticFocusEvent;
  12597. },{"98":98}],93:[function(_dereq_,module,exports){
  12598. /**
  12599. * Copyright 2013-present, Facebook, Inc.
  12600. * All rights reserved.
  12601. *
  12602. * This source code is licensed under the BSD-style license found in the
  12603. * LICENSE file in the root directory of this source tree. An additional grant
  12604. * of patent rights can be found in the PATENTS file in the same directory.
  12605. *
  12606. */
  12607. 'use strict';
  12608. var SyntheticEvent = _dereq_(91);
  12609. /**
  12610. * @interface Event
  12611. * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
  12612. * /#events-inputevents
  12613. */
  12614. var InputEventInterface = {
  12615. data: null
  12616. };
  12617. /**
  12618. * @param {object} dispatchConfig Configuration used to dispatch this event.
  12619. * @param {string} dispatchMarker Marker identifying the event target.
  12620. * @param {object} nativeEvent Native browser event.
  12621. * @extends {SyntheticUIEvent}
  12622. */
  12623. function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  12624. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  12625. }
  12626. SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
  12627. module.exports = SyntheticInputEvent;
  12628. },{"91":91}],94:[function(_dereq_,module,exports){
  12629. /**
  12630. * Copyright 2013-present, Facebook, Inc.
  12631. * All rights reserved.
  12632. *
  12633. * This source code is licensed under the BSD-style license found in the
  12634. * LICENSE file in the root directory of this source tree. An additional grant
  12635. * of patent rights can be found in the PATENTS file in the same directory.
  12636. *
  12637. */
  12638. 'use strict';
  12639. var SyntheticUIEvent = _dereq_(98);
  12640. var getEventCharCode = _dereq_(111);
  12641. var getEventKey = _dereq_(112);
  12642. var getEventModifierState = _dereq_(113);
  12643. /**
  12644. * @interface KeyboardEvent
  12645. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  12646. */
  12647. var KeyboardEventInterface = {
  12648. key: getEventKey,
  12649. location: null,
  12650. ctrlKey: null,
  12651. shiftKey: null,
  12652. altKey: null,
  12653. metaKey: null,
  12654. repeat: null,
  12655. locale: null,
  12656. getModifierState: getEventModifierState,
  12657. // Legacy Interface
  12658. charCode: function (event) {
  12659. // `charCode` is the result of a KeyPress event and represents the value of
  12660. // the actual printable character.
  12661. // KeyPress is deprecated, but its replacement is not yet final and not
  12662. // implemented in any major browser. Only KeyPress has charCode.
  12663. if (event.type === 'keypress') {
  12664. return getEventCharCode(event);
  12665. }
  12666. return 0;
  12667. },
  12668. keyCode: function (event) {
  12669. // `keyCode` is the result of a KeyDown/Up event and represents the value of
  12670. // physical keyboard key.
  12671. // The actual meaning of the value depends on the users' keyboard layout
  12672. // which cannot be detected. Assuming that it is a US keyboard layout
  12673. // provides a surprisingly accurate mapping for US and European users.
  12674. // Due to this, it is left to the user to implement at this time.
  12675. if (event.type === 'keydown' || event.type === 'keyup') {
  12676. return event.keyCode;
  12677. }
  12678. return 0;
  12679. },
  12680. which: function (event) {
  12681. // `which` is an alias for either `keyCode` or `charCode` depending on the
  12682. // type of the event.
  12683. if (event.type === 'keypress') {
  12684. return getEventCharCode(event);
  12685. }
  12686. if (event.type === 'keydown' || event.type === 'keyup') {
  12687. return event.keyCode;
  12688. }
  12689. return 0;
  12690. }
  12691. };
  12692. /**
  12693. * @param {object} dispatchConfig Configuration used to dispatch this event.
  12694. * @param {string} dispatchMarker Marker identifying the event target.
  12695. * @param {object} nativeEvent Native browser event.
  12696. * @extends {SyntheticUIEvent}
  12697. */
  12698. function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  12699. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  12700. }
  12701. SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
  12702. module.exports = SyntheticKeyboardEvent;
  12703. },{"111":111,"112":112,"113":113,"98":98}],95:[function(_dereq_,module,exports){
  12704. /**
  12705. * Copyright 2013-present, Facebook, Inc.
  12706. * All rights reserved.
  12707. *
  12708. * This source code is licensed under the BSD-style license found in the
  12709. * LICENSE file in the root directory of this source tree. An additional grant
  12710. * of patent rights can be found in the PATENTS file in the same directory.
  12711. *
  12712. */
  12713. 'use strict';
  12714. var SyntheticUIEvent = _dereq_(98);
  12715. var ViewportMetrics = _dereq_(101);
  12716. var getEventModifierState = _dereq_(113);
  12717. /**
  12718. * @interface MouseEvent
  12719. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  12720. */
  12721. var MouseEventInterface = {
  12722. screenX: null,
  12723. screenY: null,
  12724. clientX: null,
  12725. clientY: null,
  12726. ctrlKey: null,
  12727. shiftKey: null,
  12728. altKey: null,
  12729. metaKey: null,
  12730. getModifierState: getEventModifierState,
  12731. button: function (event) {
  12732. // Webkit, Firefox, IE9+
  12733. // which: 1 2 3
  12734. // button: 0 1 2 (standard)
  12735. var button = event.button;
  12736. if ('which' in event) {
  12737. return button;
  12738. }
  12739. // IE<9
  12740. // which: undefined
  12741. // button: 0 0 0
  12742. // button: 1 4 2 (onmouseup)
  12743. return button === 2 ? 2 : button === 4 ? 1 : 0;
  12744. },
  12745. buttons: null,
  12746. relatedTarget: function (event) {
  12747. return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
  12748. },
  12749. // "Proprietary" Interface.
  12750. pageX: function (event) {
  12751. return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
  12752. },
  12753. pageY: function (event) {
  12754. return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
  12755. }
  12756. };
  12757. /**
  12758. * @param {object} dispatchConfig Configuration used to dispatch this event.
  12759. * @param {string} dispatchMarker Marker identifying the event target.
  12760. * @param {object} nativeEvent Native browser event.
  12761. * @extends {SyntheticUIEvent}
  12762. */
  12763. function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  12764. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  12765. }
  12766. SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
  12767. module.exports = SyntheticMouseEvent;
  12768. },{"101":101,"113":113,"98":98}],96:[function(_dereq_,module,exports){
  12769. /**
  12770. * Copyright 2013-present, Facebook, Inc.
  12771. * All rights reserved.
  12772. *
  12773. * This source code is licensed under the BSD-style license found in the
  12774. * LICENSE file in the root directory of this source tree. An additional grant
  12775. * of patent rights can be found in the PATENTS file in the same directory.
  12776. *
  12777. */
  12778. 'use strict';
  12779. var SyntheticUIEvent = _dereq_(98);
  12780. var getEventModifierState = _dereq_(113);
  12781. /**
  12782. * @interface TouchEvent
  12783. * @see http://www.w3.org/TR/touch-events/
  12784. */
  12785. var TouchEventInterface = {
  12786. touches: null,
  12787. targetTouches: null,
  12788. changedTouches: null,
  12789. altKey: null,
  12790. metaKey: null,
  12791. ctrlKey: null,
  12792. shiftKey: null,
  12793. getModifierState: getEventModifierState
  12794. };
  12795. /**
  12796. * @param {object} dispatchConfig Configuration used to dispatch this event.
  12797. * @param {string} dispatchMarker Marker identifying the event target.
  12798. * @param {object} nativeEvent Native browser event.
  12799. * @extends {SyntheticUIEvent}
  12800. */
  12801. function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  12802. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  12803. }
  12804. SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
  12805. module.exports = SyntheticTouchEvent;
  12806. },{"113":113,"98":98}],97:[function(_dereq_,module,exports){
  12807. /**
  12808. * Copyright 2013-present, Facebook, Inc.
  12809. * All rights reserved.
  12810. *
  12811. * This source code is licensed under the BSD-style license found in the
  12812. * LICENSE file in the root directory of this source tree. An additional grant
  12813. * of patent rights can be found in the PATENTS file in the same directory.
  12814. *
  12815. */
  12816. 'use strict';
  12817. var SyntheticEvent = _dereq_(91);
  12818. /**
  12819. * @interface Event
  12820. * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
  12821. * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
  12822. */
  12823. var TransitionEventInterface = {
  12824. propertyName: null,
  12825. elapsedTime: null,
  12826. pseudoElement: null
  12827. };
  12828. /**
  12829. * @param {object} dispatchConfig Configuration used to dispatch this event.
  12830. * @param {string} dispatchMarker Marker identifying the event target.
  12831. * @param {object} nativeEvent Native browser event.
  12832. * @extends {SyntheticEvent}
  12833. */
  12834. function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  12835. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  12836. }
  12837. SyntheticEvent.augmentClass(SyntheticTransitionEvent, TransitionEventInterface);
  12838. module.exports = SyntheticTransitionEvent;
  12839. },{"91":91}],98:[function(_dereq_,module,exports){
  12840. /**
  12841. * Copyright 2013-present, Facebook, Inc.
  12842. * All rights reserved.
  12843. *
  12844. * This source code is licensed under the BSD-style license found in the
  12845. * LICENSE file in the root directory of this source tree. An additional grant
  12846. * of patent rights can be found in the PATENTS file in the same directory.
  12847. *
  12848. */
  12849. 'use strict';
  12850. var SyntheticEvent = _dereq_(91);
  12851. var getEventTarget = _dereq_(114);
  12852. /**
  12853. * @interface UIEvent
  12854. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  12855. */
  12856. var UIEventInterface = {
  12857. view: function (event) {
  12858. if (event.view) {
  12859. return event.view;
  12860. }
  12861. var target = getEventTarget(event);
  12862. if (target.window === target) {
  12863. // target is a window object
  12864. return target;
  12865. }
  12866. var doc = target.ownerDocument;
  12867. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  12868. if (doc) {
  12869. return doc.defaultView || doc.parentWindow;
  12870. } else {
  12871. return window;
  12872. }
  12873. },
  12874. detail: function (event) {
  12875. return event.detail || 0;
  12876. }
  12877. };
  12878. /**
  12879. * @param {object} dispatchConfig Configuration used to dispatch this event.
  12880. * @param {string} dispatchMarker Marker identifying the event target.
  12881. * @param {object} nativeEvent Native browser event.
  12882. * @extends {SyntheticEvent}
  12883. */
  12884. function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  12885. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  12886. }
  12887. SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
  12888. module.exports = SyntheticUIEvent;
  12889. },{"114":114,"91":91}],99:[function(_dereq_,module,exports){
  12890. /**
  12891. * Copyright 2013-present, Facebook, Inc.
  12892. * All rights reserved.
  12893. *
  12894. * This source code is licensed under the BSD-style license found in the
  12895. * LICENSE file in the root directory of this source tree. An additional grant
  12896. * of patent rights can be found in the PATENTS file in the same directory.
  12897. *
  12898. */
  12899. 'use strict';
  12900. var SyntheticMouseEvent = _dereq_(95);
  12901. /**
  12902. * @interface WheelEvent
  12903. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  12904. */
  12905. var WheelEventInterface = {
  12906. deltaX: function (event) {
  12907. return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
  12908. 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
  12909. },
  12910. deltaY: function (event) {
  12911. return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
  12912. 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
  12913. 'wheelDelta' in event ? -event.wheelDelta : 0;
  12914. },
  12915. deltaZ: null,
  12916. // Browsers without "deltaMode" is reporting in raw wheel delta where one
  12917. // notch on the scroll is always +/- 120, roughly equivalent to pixels.
  12918. // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
  12919. // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
  12920. deltaMode: null
  12921. };
  12922. /**
  12923. * @param {object} dispatchConfig Configuration used to dispatch this event.
  12924. * @param {string} dispatchMarker Marker identifying the event target.
  12925. * @param {object} nativeEvent Native browser event.
  12926. * @extends {SyntheticMouseEvent}
  12927. */
  12928. function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  12929. return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  12930. }
  12931. SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
  12932. module.exports = SyntheticWheelEvent;
  12933. },{"95":95}],100:[function(_dereq_,module,exports){
  12934. /**
  12935. * Copyright 2013-present, Facebook, Inc.
  12936. * All rights reserved.
  12937. *
  12938. * This source code is licensed under the BSD-style license found in the
  12939. * LICENSE file in the root directory of this source tree. An additional grant
  12940. * of patent rights can be found in the PATENTS file in the same directory.
  12941. *
  12942. *
  12943. */
  12944. 'use strict';
  12945. var _prodInvariant = _dereq_(126);
  12946. var invariant = _dereq_(152);
  12947. var OBSERVED_ERROR = {};
  12948. /**
  12949. * `Transaction` creates a black box that is able to wrap any method such that
  12950. * certain invariants are maintained before and after the method is invoked
  12951. * (Even if an exception is thrown while invoking the wrapped method). Whoever
  12952. * instantiates a transaction can provide enforcers of the invariants at
  12953. * creation time. The `Transaction` class itself will supply one additional
  12954. * automatic invariant for you - the invariant that any transaction instance
  12955. * should not be run while it is already being run. You would typically create a
  12956. * single instance of a `Transaction` for reuse multiple times, that potentially
  12957. * is used to wrap several different methods. Wrappers are extremely simple -
  12958. * they only require implementing two methods.
  12959. *
  12960. * <pre>
  12961. * wrappers (injected at creation time)
  12962. * + +
  12963. * | |
  12964. * +-----------------|--------|--------------+
  12965. * | v | |
  12966. * | +---------------+ | |
  12967. * | +--| wrapper1 |---|----+ |
  12968. * | | +---------------+ v | |
  12969. * | | +-------------+ | |
  12970. * | | +----| wrapper2 |--------+ |
  12971. * | | | +-------------+ | | |
  12972. * | | | | | |
  12973. * | v v v v | wrapper
  12974. * | +---+ +---+ +---------+ +---+ +---+ | invariants
  12975. * perform(anyMethod) | | | | | | | | | | | | maintained
  12976. * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
  12977. * | | | | | | | | | | | |
  12978. * | | | | | | | | | | | |
  12979. * | | | | | | | | | | | |
  12980. * | +---+ +---+ +---------+ +---+ +---+ |
  12981. * | initialize close |
  12982. * +-----------------------------------------+
  12983. * </pre>
  12984. *
  12985. * Use cases:
  12986. * - Preserving the input selection ranges before/after reconciliation.
  12987. * Restoring selection even in the event of an unexpected error.
  12988. * - Deactivating events while rearranging the DOM, preventing blurs/focuses,
  12989. * while guaranteeing that afterwards, the event system is reactivated.
  12990. * - Flushing a queue of collected DOM mutations to the main UI thread after a
  12991. * reconciliation takes place in a worker thread.
  12992. * - Invoking any collected `componentDidUpdate` callbacks after rendering new
  12993. * content.
  12994. * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
  12995. * to preserve the `scrollTop` (an automatic scroll aware DOM).
  12996. * - (Future use case): Layout calculations before and after DOM updates.
  12997. *
  12998. * Transactional plugin API:
  12999. * - A module that has an `initialize` method that returns any precomputation.
  13000. * - and a `close` method that accepts the precomputation. `close` is invoked
  13001. * when the wrapped process is completed, or has failed.
  13002. *
  13003. * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
  13004. * that implement `initialize` and `close`.
  13005. * @return {Transaction} Single transaction for reuse in thread.
  13006. *
  13007. * @class Transaction
  13008. */
  13009. var TransactionImpl = {
  13010. /**
  13011. * Sets up this instance so that it is prepared for collecting metrics. Does
  13012. * so such that this setup method may be used on an instance that is already
  13013. * initialized, in a way that does not consume additional memory upon reuse.
  13014. * That can be useful if you decide to make your subclass of this mixin a
  13015. * "PooledClass".
  13016. */
  13017. reinitializeTransaction: function () {
  13018. this.transactionWrappers = this.getTransactionWrappers();
  13019. if (this.wrapperInitData) {
  13020. this.wrapperInitData.length = 0;
  13021. } else {
  13022. this.wrapperInitData = [];
  13023. }
  13024. this._isInTransaction = false;
  13025. },
  13026. _isInTransaction: false,
  13027. /**
  13028. * @abstract
  13029. * @return {Array<TransactionWrapper>} Array of transaction wrappers.
  13030. */
  13031. getTransactionWrappers: null,
  13032. isInTransaction: function () {
  13033. return !!this._isInTransaction;
  13034. },
  13035. /* eslint-disable space-before-function-paren */
  13036. /**
  13037. * Executes the function within a safety window. Use this for the top level
  13038. * methods that result in large amounts of computation/mutations that would
  13039. * need to be safety checked. The optional arguments helps prevent the need
  13040. * to bind in many cases.
  13041. *
  13042. * @param {function} method Member of scope to call.
  13043. * @param {Object} scope Scope to invoke from.
  13044. * @param {Object?=} a Argument to pass to the method.
  13045. * @param {Object?=} b Argument to pass to the method.
  13046. * @param {Object?=} c Argument to pass to the method.
  13047. * @param {Object?=} d Argument to pass to the method.
  13048. * @param {Object?=} e Argument to pass to the method.
  13049. * @param {Object?=} f Argument to pass to the method.
  13050. *
  13051. * @return {*} Return value from `method`.
  13052. */
  13053. perform: function (method, scope, a, b, c, d, e, f) {
  13054. /* eslint-enable space-before-function-paren */
  13055. !!this.isInTransaction() ? "development" !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there is already an outstanding transaction.') : _prodInvariant('27') : void 0;
  13056. var errorThrown;
  13057. var ret;
  13058. try {
  13059. this._isInTransaction = true;
  13060. // Catching errors makes debugging more difficult, so we start with
  13061. // errorThrown set to true before setting it to false after calling
  13062. // close -- if it's still set to true in the finally block, it means
  13063. // one of these calls threw.
  13064. errorThrown = true;
  13065. this.initializeAll(0);
  13066. ret = method.call(scope, a, b, c, d, e, f);
  13067. errorThrown = false;
  13068. } finally {
  13069. try {
  13070. if (errorThrown) {
  13071. // If `method` throws, prefer to show that stack trace over any thrown
  13072. // by invoking `closeAll`.
  13073. try {
  13074. this.closeAll(0);
  13075. } catch (err) {}
  13076. } else {
  13077. // Since `method` didn't throw, we don't want to silence the exception
  13078. // here.
  13079. this.closeAll(0);
  13080. }
  13081. } finally {
  13082. this._isInTransaction = false;
  13083. }
  13084. }
  13085. return ret;
  13086. },
  13087. initializeAll: function (startIndex) {
  13088. var transactionWrappers = this.transactionWrappers;
  13089. for (var i = startIndex; i < transactionWrappers.length; i++) {
  13090. var wrapper = transactionWrappers[i];
  13091. try {
  13092. // Catching errors makes debugging more difficult, so we start with the
  13093. // OBSERVED_ERROR state before overwriting it with the real return value
  13094. // of initialize -- if it's still set to OBSERVED_ERROR in the finally
  13095. // block, it means wrapper.initialize threw.
  13096. this.wrapperInitData[i] = OBSERVED_ERROR;
  13097. this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
  13098. } finally {
  13099. if (this.wrapperInitData[i] === OBSERVED_ERROR) {
  13100. // The initializer for wrapper i threw an error; initialize the
  13101. // remaining wrappers but silence any exceptions from them to ensure
  13102. // that the first error is the one to bubble up.
  13103. try {
  13104. this.initializeAll(i + 1);
  13105. } catch (err) {}
  13106. }
  13107. }
  13108. }
  13109. },
  13110. /**
  13111. * Invokes each of `this.transactionWrappers.close[i]` functions, passing into
  13112. * them the respective return values of `this.transactionWrappers.init[i]`
  13113. * (`close`rs that correspond to initializers that failed will not be
  13114. * invoked).
  13115. */
  13116. closeAll: function (startIndex) {
  13117. !this.isInTransaction() ? "development" !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0;
  13118. var transactionWrappers = this.transactionWrappers;
  13119. for (var i = startIndex; i < transactionWrappers.length; i++) {
  13120. var wrapper = transactionWrappers[i];
  13121. var initData = this.wrapperInitData[i];
  13122. var errorThrown;
  13123. try {
  13124. // Catching errors makes debugging more difficult, so we start with
  13125. // errorThrown set to true before setting it to false after calling
  13126. // close -- if it's still set to true in the finally block, it means
  13127. // wrapper.close threw.
  13128. errorThrown = true;
  13129. if (initData !== OBSERVED_ERROR && wrapper.close) {
  13130. wrapper.close.call(this, initData);
  13131. }
  13132. errorThrown = false;
  13133. } finally {
  13134. if (errorThrown) {
  13135. // The closer for wrapper i threw an error; close the remaining
  13136. // wrappers but silence any exceptions from them to ensure that the
  13137. // first error is the one to bubble up.
  13138. try {
  13139. this.closeAll(i + 1);
  13140. } catch (e) {}
  13141. }
  13142. }
  13143. }
  13144. this.wrapperInitData.length = 0;
  13145. }
  13146. };
  13147. module.exports = TransactionImpl;
  13148. },{"126":126,"152":152}],101:[function(_dereq_,module,exports){
  13149. /**
  13150. * Copyright 2013-present, Facebook, Inc.
  13151. * All rights reserved.
  13152. *
  13153. * This source code is licensed under the BSD-style license found in the
  13154. * LICENSE file in the root directory of this source tree. An additional grant
  13155. * of patent rights can be found in the PATENTS file in the same directory.
  13156. *
  13157. */
  13158. 'use strict';
  13159. var ViewportMetrics = {
  13160. currentScrollLeft: 0,
  13161. currentScrollTop: 0,
  13162. refreshScrollValues: function (scrollPosition) {
  13163. ViewportMetrics.currentScrollLeft = scrollPosition.x;
  13164. ViewportMetrics.currentScrollTop = scrollPosition.y;
  13165. }
  13166. };
  13167. module.exports = ViewportMetrics;
  13168. },{}],102:[function(_dereq_,module,exports){
  13169. /**
  13170. * Copyright 2014-present, Facebook, Inc.
  13171. * All rights reserved.
  13172. *
  13173. * This source code is licensed under the BSD-style license found in the
  13174. * LICENSE file in the root directory of this source tree. An additional grant
  13175. * of patent rights can be found in the PATENTS file in the same directory.
  13176. *
  13177. *
  13178. */
  13179. 'use strict';
  13180. var _prodInvariant = _dereq_(126);
  13181. var invariant = _dereq_(152);
  13182. /**
  13183. * Accumulates items that must not be null or undefined into the first one. This
  13184. * is used to conserve memory by avoiding array allocations, and thus sacrifices
  13185. * API cleanness. Since `current` can be null before being passed in and not
  13186. * null after this function, make sure to assign it back to `current`:
  13187. *
  13188. * `a = accumulateInto(a, b);`
  13189. *
  13190. * This API should be sparingly used. Try `accumulate` for something cleaner.
  13191. *
  13192. * @return {*|array<*>} An accumulation of items.
  13193. */
  13194. function accumulateInto(current, next) {
  13195. !(next != null) ? "development" !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0;
  13196. if (current == null) {
  13197. return next;
  13198. }
  13199. // Both are not empty. Warning: Never call x.concat(y) when you are not
  13200. // certain that x is an Array (x could be a string with concat method).
  13201. if (Array.isArray(current)) {
  13202. if (Array.isArray(next)) {
  13203. current.push.apply(current, next);
  13204. return current;
  13205. }
  13206. current.push(next);
  13207. return current;
  13208. }
  13209. if (Array.isArray(next)) {
  13210. // A bit too dangerous to mutate `next`.
  13211. return [current].concat(next);
  13212. }
  13213. return [current, next];
  13214. }
  13215. module.exports = accumulateInto;
  13216. },{"126":126,"152":152}],103:[function(_dereq_,module,exports){
  13217. /**
  13218. * Copyright 2013-present, Facebook, Inc.
  13219. * All rights reserved.
  13220. *
  13221. * This source code is licensed under the BSD-style license found in the
  13222. * LICENSE file in the root directory of this source tree. An additional grant
  13223. * of patent rights can be found in the PATENTS file in the same directory.
  13224. *
  13225. *
  13226. */
  13227. 'use strict';
  13228. var MOD = 65521;
  13229. // adler32 is not cryptographically strong, and is only used to sanity check that
  13230. // markup generated on the server matches the markup generated on the client.
  13231. // This implementation (a modified version of the SheetJS version) has been optimized
  13232. // for our use case, at the expense of conforming to the adler32 specification
  13233. // for non-ascii inputs.
  13234. function adler32(data) {
  13235. var a = 1;
  13236. var b = 0;
  13237. var i = 0;
  13238. var l = data.length;
  13239. var m = l & ~0x3;
  13240. while (i < m) {
  13241. var n = Math.min(i + 4096, m);
  13242. for (; i < n; i += 4) {
  13243. b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
  13244. }
  13245. a %= MOD;
  13246. b %= MOD;
  13247. }
  13248. for (; i < l; i++) {
  13249. b += a += data.charCodeAt(i);
  13250. }
  13251. a %= MOD;
  13252. b %= MOD;
  13253. return a | b << 16;
  13254. }
  13255. module.exports = adler32;
  13256. },{}],104:[function(_dereq_,module,exports){
  13257. (function (process){
  13258. /**
  13259. * Copyright 2013-present, Facebook, Inc.
  13260. * All rights reserved.
  13261. *
  13262. * This source code is licensed under the BSD-style license found in the
  13263. * LICENSE file in the root directory of this source tree. An additional grant
  13264. * of patent rights can be found in the PATENTS file in the same directory.
  13265. *
  13266. */
  13267. 'use strict';
  13268. var _prodInvariant = _dereq_(126);
  13269. var ReactPropTypeLocationNames = _dereq_(72);
  13270. var ReactPropTypesSecret = _dereq_(73);
  13271. var invariant = _dereq_(152);
  13272. var warning = _dereq_(159);
  13273. var ReactComponentTreeHook;
  13274. if (typeof process !== 'undefined' && process.env && "development" === 'test') {
  13275. // Temporary hack.
  13276. // Inline requires don't work well with Jest:
  13277. // https://github.com/facebook/react/issues/7240
  13278. // Remove the inline requires when we don't need them anymore:
  13279. // https://github.com/facebook/react/pull/7178
  13280. ReactComponentTreeHook = _dereq_(133);
  13281. }
  13282. var loggedTypeFailures = {};
  13283. /**
  13284. * Assert that the values match with the type specs.
  13285. * Error messages are memorized and will only be shown once.
  13286. *
  13287. * @param {object} typeSpecs Map of name to a ReactPropType
  13288. * @param {object} values Runtime values that need to be type-checked
  13289. * @param {string} location e.g. "prop", "context", "child context"
  13290. * @param {string} componentName Name of the component for error messages.
  13291. * @param {?object} element The React element that is being type-checked
  13292. * @param {?number} debugID The React component instance that is being type-checked
  13293. * @private
  13294. */
  13295. function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) {
  13296. for (var typeSpecName in typeSpecs) {
  13297. if (typeSpecs.hasOwnProperty(typeSpecName)) {
  13298. var error;
  13299. // Prop type validation may throw. In case they do, we don't want to
  13300. // fail the render phase where it didn't fail before. So we log it.
  13301. // After these have been cleaned up, we'll let them throw.
  13302. try {
  13303. // This is intentionally an invariant that gets caught. It's the same
  13304. // behavior as without this statement except with a better message.
  13305. !(typeof typeSpecs[typeSpecName] === 'function') ? "development" !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0;
  13306. error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
  13307. } catch (ex) {
  13308. error = ex;
  13309. }
  13310. "development" !== '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], typeSpecName, typeof error) : void 0;
  13311. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  13312. // Only monitor this failure once because there tends to be a lot of the
  13313. // same error.
  13314. loggedTypeFailures[error.message] = true;
  13315. var componentStackInfo = '';
  13316. if ("development" !== 'production') {
  13317. if (!ReactComponentTreeHook) {
  13318. ReactComponentTreeHook = _dereq_(133);
  13319. }
  13320. if (debugID !== null) {
  13321. componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID);
  13322. } else if (element !== null) {
  13323. componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element);
  13324. }
  13325. }
  13326. "development" !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0;
  13327. }
  13328. }
  13329. }
  13330. }
  13331. module.exports = checkReactTypeSpec;
  13332. }).call(this,undefined)
  13333. },{"126":126,"133":133,"152":152,"159":159,"72":72,"73":73}],105:[function(_dereq_,module,exports){
  13334. /**
  13335. * Copyright 2013-present, Facebook, Inc.
  13336. * All rights reserved.
  13337. *
  13338. * This source code is licensed under the BSD-style license found in the
  13339. * LICENSE file in the root directory of this source tree. An additional grant
  13340. * of patent rights can be found in the PATENTS file in the same directory.
  13341. *
  13342. */
  13343. /* globals MSApp */
  13344. 'use strict';
  13345. /**
  13346. * Create a function which has 'unsafe' privileges (required by windows8 apps)
  13347. */
  13348. var createMicrosoftUnsafeLocalFunction = function (func) {
  13349. if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
  13350. return function (arg0, arg1, arg2, arg3) {
  13351. MSApp.execUnsafeLocalFunction(function () {
  13352. return func(arg0, arg1, arg2, arg3);
  13353. });
  13354. };
  13355. } else {
  13356. return func;
  13357. }
  13358. };
  13359. module.exports = createMicrosoftUnsafeLocalFunction;
  13360. },{}],106:[function(_dereq_,module,exports){
  13361. /**
  13362. * Copyright 2013-present, Facebook, Inc.
  13363. * All rights reserved.
  13364. *
  13365. * This source code is licensed under the BSD-style license found in the
  13366. * LICENSE file in the root directory of this source tree. An additional grant
  13367. * of patent rights can be found in the PATENTS file in the same directory.
  13368. *
  13369. */
  13370. 'use strict';
  13371. var CSSProperty = _dereq_(4);
  13372. var warning = _dereq_(159);
  13373. var isUnitlessNumber = CSSProperty.isUnitlessNumber;
  13374. var styleWarnings = {};
  13375. /**
  13376. * Convert a value into the proper css writable value. The style name `name`
  13377. * should be logical (no hyphens), as specified
  13378. * in `CSSProperty.isUnitlessNumber`.
  13379. *
  13380. * @param {string} name CSS property name such as `topMargin`.
  13381. * @param {*} value CSS property value such as `10px`.
  13382. * @param {ReactDOMComponent} component
  13383. * @return {string} Normalized style value with dimensions applied.
  13384. */
  13385. function dangerousStyleValue(name, value, component, isCustomProperty) {
  13386. // Note that we've removed escapeTextForBrowser() calls here since the
  13387. // whole string will be escaped when the attribute is injected into
  13388. // the markup. If you provide unsafe user data here they can inject
  13389. // arbitrary CSS which may be problematic (I couldn't repro this):
  13390. // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
  13391. // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
  13392. // This is not an XSS hole but instead a potential CSS injection issue
  13393. // which has lead to a greater discussion about how we're going to
  13394. // trust URLs moving forward. See #2115901
  13395. var isEmpty = value == null || typeof value === 'boolean' || value === '';
  13396. if (isEmpty) {
  13397. return '';
  13398. }
  13399. var isNonNumeric = isNaN(value);
  13400. if (isCustomProperty || isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
  13401. return '' + value; // cast to string
  13402. }
  13403. if (typeof value === 'string') {
  13404. if ("development" !== 'production') {
  13405. // Allow '0' to pass through without warning. 0 is already special and
  13406. // doesn't require units, so we don't need to warn about it.
  13407. if (component && value !== '0') {
  13408. var owner = component._currentElement._owner;
  13409. var ownerName = owner ? owner.getName() : null;
  13410. if (ownerName && !styleWarnings[ownerName]) {
  13411. styleWarnings[ownerName] = {};
  13412. }
  13413. var warned = false;
  13414. if (ownerName) {
  13415. var warnings = styleWarnings[ownerName];
  13416. warned = warnings[name];
  13417. if (!warned) {
  13418. warnings[name] = true;
  13419. }
  13420. }
  13421. if (!warned) {
  13422. "development" !== 'production' ? warning(false, 'a `%s` tag (owner: `%s`) was passed a numeric string value ' + 'for CSS property `%s` (value: `%s`) which will be treated ' + 'as a unitless number in a future version of React.', component._currentElement.type, ownerName || 'unknown', name, value) : void 0;
  13423. }
  13424. }
  13425. }
  13426. value = value.trim();
  13427. }
  13428. return value + 'px';
  13429. }
  13430. module.exports = dangerousStyleValue;
  13431. },{"159":159,"4":4}],107:[function(_dereq_,module,exports){
  13432. /**
  13433. * Copyright 2016-present, Facebook, Inc.
  13434. * All rights reserved.
  13435. *
  13436. * This source code is licensed under the BSD-style license found in the
  13437. * LICENSE file in the root directory of this source tree. An additional grant
  13438. * of patent rights can be found in the PATENTS file in the same directory.
  13439. *
  13440. * Based on the escape-html library, which is used under the MIT License below:
  13441. *
  13442. * Copyright (c) 2012-2013 TJ Holowaychuk
  13443. * Copyright (c) 2015 Andreas Lubbe
  13444. * Copyright (c) 2015 Tiancheng "Timothy" Gu
  13445. *
  13446. * Permission is hereby granted, free of charge, to any person obtaining
  13447. * a copy of this software and associated documentation files (the
  13448. * 'Software'), to deal in the Software without restriction, including
  13449. * without limitation the rights to use, copy, modify, merge, publish,
  13450. * distribute, sublicense, and/or sell copies of the Software, and to
  13451. * permit persons to whom the Software is furnished to do so, subject to
  13452. * the following conditions:
  13453. *
  13454. * The above copyright notice and this permission notice shall be
  13455. * included in all copies or substantial portions of the Software.
  13456. *
  13457. * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  13458. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13459. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  13460. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  13461. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  13462. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  13463. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  13464. *
  13465. */
  13466. 'use strict';
  13467. // code copied and modified from escape-html
  13468. /**
  13469. * Module variables.
  13470. * @private
  13471. */
  13472. var matchHtmlRegExp = /["'&<>]/;
  13473. /**
  13474. * Escape special characters in the given string of html.
  13475. *
  13476. * @param {string} string The string to escape for inserting into HTML
  13477. * @return {string}
  13478. * @public
  13479. */
  13480. function escapeHtml(string) {
  13481. var str = '' + string;
  13482. var match = matchHtmlRegExp.exec(str);
  13483. if (!match) {
  13484. return str;
  13485. }
  13486. var escape;
  13487. var html = '';
  13488. var index = 0;
  13489. var lastIndex = 0;
  13490. for (index = match.index; index < str.length; index++) {
  13491. switch (str.charCodeAt(index)) {
  13492. case 34:
  13493. // "
  13494. escape = '&quot;';
  13495. break;
  13496. case 38:
  13497. // &
  13498. escape = '&amp;';
  13499. break;
  13500. case 39:
  13501. // '
  13502. escape = '&#x27;'; // modified from escape-html; used to be '&#39'
  13503. break;
  13504. case 60:
  13505. // <
  13506. escape = '&lt;';
  13507. break;
  13508. case 62:
  13509. // >
  13510. escape = '&gt;';
  13511. break;
  13512. default:
  13513. continue;
  13514. }
  13515. if (lastIndex !== index) {
  13516. html += str.substring(lastIndex, index);
  13517. }
  13518. lastIndex = index + 1;
  13519. html += escape;
  13520. }
  13521. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  13522. }
  13523. // end code copied and modified from escape-html
  13524. /**
  13525. * Escapes text to prevent scripting attacks.
  13526. *
  13527. * @param {*} text Text value to escape.
  13528. * @return {string} An escaped string.
  13529. */
  13530. function escapeTextContentForBrowser(text) {
  13531. if (typeof text === 'boolean' || typeof text === 'number') {
  13532. // this shortcircuit helps perf for types that we know will never have
  13533. // special characters, especially given that this function is used often
  13534. // for numeric dom ids.
  13535. return '' + text;
  13536. }
  13537. return escapeHtml(text);
  13538. }
  13539. module.exports = escapeTextContentForBrowser;
  13540. },{}],108:[function(_dereq_,module,exports){
  13541. /**
  13542. * Copyright 2013-present, Facebook, Inc.
  13543. * All rights reserved.
  13544. *
  13545. * This source code is licensed under the BSD-style license found in the
  13546. * LICENSE file in the root directory of this source tree. An additional grant
  13547. * of patent rights can be found in the PATENTS file in the same directory.
  13548. *
  13549. */
  13550. 'use strict';
  13551. var _prodInvariant = _dereq_(126);
  13552. var ReactCurrentOwner = _dereq_(134);
  13553. var ReactDOMComponentTree = _dereq_(34);
  13554. var ReactInstanceMap = _dereq_(63);
  13555. var getHostComponentFromComposite = _dereq_(115);
  13556. var invariant = _dereq_(152);
  13557. var warning = _dereq_(159);
  13558. /**
  13559. * Returns the DOM node rendered by this element.
  13560. *
  13561. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode
  13562. *
  13563. * @param {ReactComponent|DOMElement} componentOrElement
  13564. * @return {?DOMElement} The root node of this element.
  13565. */
  13566. function findDOMNode(componentOrElement) {
  13567. if ("development" !== 'production') {
  13568. var owner = ReactCurrentOwner.current;
  13569. if (owner !== null) {
  13570. "development" !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing 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') : void 0;
  13571. owner._warnedAboutRefsInRender = true;
  13572. }
  13573. }
  13574. if (componentOrElement == null) {
  13575. return null;
  13576. }
  13577. if (componentOrElement.nodeType === 1) {
  13578. return componentOrElement;
  13579. }
  13580. var inst = ReactInstanceMap.get(componentOrElement);
  13581. if (inst) {
  13582. inst = getHostComponentFromComposite(inst);
  13583. return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null;
  13584. }
  13585. if (typeof componentOrElement.render === 'function') {
  13586. !false ? "development" !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : _prodInvariant('44') : void 0;
  13587. } else {
  13588. !false ? "development" !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : _prodInvariant('45', Object.keys(componentOrElement)) : void 0;
  13589. }
  13590. }
  13591. module.exports = findDOMNode;
  13592. },{"115":115,"126":126,"134":134,"152":152,"159":159,"34":34,"63":63}],109:[function(_dereq_,module,exports){
  13593. (function (process){
  13594. /**
  13595. * Copyright 2013-present, Facebook, Inc.
  13596. * All rights reserved.
  13597. *
  13598. * This source code is licensed under the BSD-style license found in the
  13599. * LICENSE file in the root directory of this source tree. An additional grant
  13600. * of patent rights can be found in the PATENTS file in the same directory.
  13601. *
  13602. *
  13603. */
  13604. 'use strict';
  13605. var KeyEscapeUtils = _dereq_(23);
  13606. var traverseAllChildren = _dereq_(131);
  13607. var warning = _dereq_(159);
  13608. var ReactComponentTreeHook;
  13609. if (typeof process !== 'undefined' && process.env && "development" === 'test') {
  13610. // Temporary hack.
  13611. // Inline requires don't work well with Jest:
  13612. // https://github.com/facebook/react/issues/7240
  13613. // Remove the inline requires when we don't need them anymore:
  13614. // https://github.com/facebook/react/pull/7178
  13615. ReactComponentTreeHook = _dereq_(133);
  13616. }
  13617. /**
  13618. * @param {function} traverseContext Context passed through traversal.
  13619. * @param {?ReactComponent} child React child component.
  13620. * @param {!string} name String name of key path to child.
  13621. * @param {number=} selfDebugID Optional debugID of the current internal instance.
  13622. */
  13623. function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) {
  13624. // We found a component instance.
  13625. if (traverseContext && typeof traverseContext === 'object') {
  13626. var result = traverseContext;
  13627. var keyUnique = result[name] === undefined;
  13628. if ("development" !== 'production') {
  13629. if (!ReactComponentTreeHook) {
  13630. ReactComponentTreeHook = _dereq_(133);
  13631. }
  13632. if (!keyUnique) {
  13633. "development" !== 'production' ? warning(false, '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.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0;
  13634. }
  13635. }
  13636. if (keyUnique && child != null) {
  13637. result[name] = child;
  13638. }
  13639. }
  13640. }
  13641. /**
  13642. * Flattens children that are typically specified as `props.children`. Any null
  13643. * children will not be included in the resulting object.
  13644. * @return {!object} flattened children keyed by name.
  13645. */
  13646. function flattenChildren(children, selfDebugID) {
  13647. if (children == null) {
  13648. return children;
  13649. }
  13650. var result = {};
  13651. if ("development" !== 'production') {
  13652. traverseAllChildren(children, function (traverseContext, child, name) {
  13653. return flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID);
  13654. }, result);
  13655. } else {
  13656. traverseAllChildren(children, flattenSingleChildIntoContext, result);
  13657. }
  13658. return result;
  13659. }
  13660. module.exports = flattenChildren;
  13661. }).call(this,undefined)
  13662. },{"131":131,"133":133,"159":159,"23":23}],110:[function(_dereq_,module,exports){
  13663. /**
  13664. * Copyright 2013-present, Facebook, Inc.
  13665. * All rights reserved.
  13666. *
  13667. * This source code is licensed under the BSD-style license found in the
  13668. * LICENSE file in the root directory of this source tree. An additional grant
  13669. * of patent rights can be found in the PATENTS file in the same directory.
  13670. *
  13671. *
  13672. */
  13673. 'use strict';
  13674. /**
  13675. * @param {array} arr an "accumulation" of items which is either an Array or
  13676. * a single item. Useful when paired with the `accumulate` module. This is a
  13677. * simple utility that allows us to reason about a collection of items, but
  13678. * handling the case when there is exactly one item (and we do not need to
  13679. * allocate an array).
  13680. */
  13681. function forEachAccumulated(arr, cb, scope) {
  13682. if (Array.isArray(arr)) {
  13683. arr.forEach(cb, scope);
  13684. } else if (arr) {
  13685. cb.call(scope, arr);
  13686. }
  13687. }
  13688. module.exports = forEachAccumulated;
  13689. },{}],111:[function(_dereq_,module,exports){
  13690. /**
  13691. * Copyright 2013-present, Facebook, Inc.
  13692. * All rights reserved.
  13693. *
  13694. * This source code is licensed under the BSD-style license found in the
  13695. * LICENSE file in the root directory of this source tree. An additional grant
  13696. * of patent rights can be found in the PATENTS file in the same directory.
  13697. *
  13698. */
  13699. 'use strict';
  13700. /**
  13701. * `charCode` represents the actual "character code" and is safe to use with
  13702. * `String.fromCharCode`. As such, only keys that correspond to printable
  13703. * characters produce a valid `charCode`, the only exception to this is Enter.
  13704. * The Tab-key is considered non-printable and does not have a `charCode`,
  13705. * presumably because it does not produce a tab-character in browsers.
  13706. *
  13707. * @param {object} nativeEvent Native browser event.
  13708. * @return {number} Normalized `charCode` property.
  13709. */
  13710. function getEventCharCode(nativeEvent) {
  13711. var charCode;
  13712. var keyCode = nativeEvent.keyCode;
  13713. if ('charCode' in nativeEvent) {
  13714. charCode = nativeEvent.charCode;
  13715. // FF does not set `charCode` for the Enter-key, check against `keyCode`.
  13716. if (charCode === 0 && keyCode === 13) {
  13717. charCode = 13;
  13718. }
  13719. } else {
  13720. // IE8 does not implement `charCode`, but `keyCode` has the correct value.
  13721. charCode = keyCode;
  13722. }
  13723. // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
  13724. // Must not discard the (non-)printable Enter-key.
  13725. if (charCode >= 32 || charCode === 13) {
  13726. return charCode;
  13727. }
  13728. return 0;
  13729. }
  13730. module.exports = getEventCharCode;
  13731. },{}],112:[function(_dereq_,module,exports){
  13732. /**
  13733. * Copyright 2013-present, Facebook, Inc.
  13734. * All rights reserved.
  13735. *
  13736. * This source code is licensed under the BSD-style license found in the
  13737. * LICENSE file in the root directory of this source tree. An additional grant
  13738. * of patent rights can be found in the PATENTS file in the same directory.
  13739. *
  13740. */
  13741. 'use strict';
  13742. var getEventCharCode = _dereq_(111);
  13743. /**
  13744. * Normalization of deprecated HTML5 `key` values
  13745. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  13746. */
  13747. var normalizeKey = {
  13748. Esc: 'Escape',
  13749. Spacebar: ' ',
  13750. Left: 'ArrowLeft',
  13751. Up: 'ArrowUp',
  13752. Right: 'ArrowRight',
  13753. Down: 'ArrowDown',
  13754. Del: 'Delete',
  13755. Win: 'OS',
  13756. Menu: 'ContextMenu',
  13757. Apps: 'ContextMenu',
  13758. Scroll: 'ScrollLock',
  13759. MozPrintableKey: 'Unidentified'
  13760. };
  13761. /**
  13762. * Translation from legacy `keyCode` to HTML5 `key`
  13763. * Only special keys supported, all others depend on keyboard layout or browser
  13764. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  13765. */
  13766. var translateToKey = {
  13767. 8: 'Backspace',
  13768. 9: 'Tab',
  13769. 12: 'Clear',
  13770. 13: 'Enter',
  13771. 16: 'Shift',
  13772. 17: 'Control',
  13773. 18: 'Alt',
  13774. 19: 'Pause',
  13775. 20: 'CapsLock',
  13776. 27: 'Escape',
  13777. 32: ' ',
  13778. 33: 'PageUp',
  13779. 34: 'PageDown',
  13780. 35: 'End',
  13781. 36: 'Home',
  13782. 37: 'ArrowLeft',
  13783. 38: 'ArrowUp',
  13784. 39: 'ArrowRight',
  13785. 40: 'ArrowDown',
  13786. 45: 'Insert',
  13787. 46: 'Delete',
  13788. 112: 'F1',
  13789. 113: 'F2',
  13790. 114: 'F3',
  13791. 115: 'F4',
  13792. 116: 'F5',
  13793. 117: 'F6',
  13794. 118: 'F7',
  13795. 119: 'F8',
  13796. 120: 'F9',
  13797. 121: 'F10',
  13798. 122: 'F11',
  13799. 123: 'F12',
  13800. 144: 'NumLock',
  13801. 145: 'ScrollLock',
  13802. 224: 'Meta'
  13803. };
  13804. /**
  13805. * @param {object} nativeEvent Native browser event.
  13806. * @return {string} Normalized `key` property.
  13807. */
  13808. function getEventKey(nativeEvent) {
  13809. if (nativeEvent.key) {
  13810. // Normalize inconsistent values reported by browsers due to
  13811. // implementations of a working draft specification.
  13812. // FireFox implements `key` but returns `MozPrintableKey` for all
  13813. // printable characters (normalized to `Unidentified`), ignore it.
  13814. var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
  13815. if (key !== 'Unidentified') {
  13816. return key;
  13817. }
  13818. }
  13819. // Browser does not implement `key`, polyfill as much of it as we can.
  13820. if (nativeEvent.type === 'keypress') {
  13821. var charCode = getEventCharCode(nativeEvent);
  13822. // The enter-key is technically both printable and non-printable and can
  13823. // thus be captured by `keypress`, no other non-printable key should.
  13824. return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
  13825. }
  13826. if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
  13827. // While user keyboard layout determines the actual meaning of each
  13828. // `keyCode` value, almost all function keys have a universal value.
  13829. return translateToKey[nativeEvent.keyCode] || 'Unidentified';
  13830. }
  13831. return '';
  13832. }
  13833. module.exports = getEventKey;
  13834. },{"111":111}],113:[function(_dereq_,module,exports){
  13835. /**
  13836. * Copyright 2013-present, Facebook, Inc.
  13837. * All rights reserved.
  13838. *
  13839. * This source code is licensed under the BSD-style license found in the
  13840. * LICENSE file in the root directory of this source tree. An additional grant
  13841. * of patent rights can be found in the PATENTS file in the same directory.
  13842. *
  13843. */
  13844. 'use strict';
  13845. /**
  13846. * Translation from modifier key to the associated property in the event.
  13847. * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
  13848. */
  13849. var modifierKeyToProp = {
  13850. Alt: 'altKey',
  13851. Control: 'ctrlKey',
  13852. Meta: 'metaKey',
  13853. Shift: 'shiftKey'
  13854. };
  13855. // IE8 does not implement getModifierState so we simply map it to the only
  13856. // modifier keys exposed by the event itself, does not support Lock-keys.
  13857. // Currently, all major browsers except Chrome seems to support Lock-keys.
  13858. function modifierStateGetter(keyArg) {
  13859. var syntheticEvent = this;
  13860. var nativeEvent = syntheticEvent.nativeEvent;
  13861. if (nativeEvent.getModifierState) {
  13862. return nativeEvent.getModifierState(keyArg);
  13863. }
  13864. var keyProp = modifierKeyToProp[keyArg];
  13865. return keyProp ? !!nativeEvent[keyProp] : false;
  13866. }
  13867. function getEventModifierState(nativeEvent) {
  13868. return modifierStateGetter;
  13869. }
  13870. module.exports = getEventModifierState;
  13871. },{}],114:[function(_dereq_,module,exports){
  13872. /**
  13873. * Copyright 2013-present, Facebook, Inc.
  13874. * All rights reserved.
  13875. *
  13876. * This source code is licensed under the BSD-style license found in the
  13877. * LICENSE file in the root directory of this source tree. An additional grant
  13878. * of patent rights can be found in the PATENTS file in the same directory.
  13879. *
  13880. */
  13881. 'use strict';
  13882. /**
  13883. * Gets the target node from a native browser event by accounting for
  13884. * inconsistencies in browser DOM APIs.
  13885. *
  13886. * @param {object} nativeEvent Native browser event.
  13887. * @return {DOMEventTarget} Target node.
  13888. */
  13889. function getEventTarget(nativeEvent) {
  13890. var target = nativeEvent.target || nativeEvent.srcElement || window;
  13891. // Normalize SVG <use> element events #4963
  13892. if (target.correspondingUseElement) {
  13893. target = target.correspondingUseElement;
  13894. }
  13895. // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
  13896. // @see http://www.quirksmode.org/js/events_properties.html
  13897. return target.nodeType === 3 ? target.parentNode : target;
  13898. }
  13899. module.exports = getEventTarget;
  13900. },{}],115:[function(_dereq_,module,exports){
  13901. /**
  13902. * Copyright 2013-present, Facebook, Inc.
  13903. * All rights reserved.
  13904. *
  13905. * This source code is licensed under the BSD-style license found in the
  13906. * LICENSE file in the root directory of this source tree. An additional grant
  13907. * of patent rights can be found in the PATENTS file in the same directory.
  13908. *
  13909. */
  13910. 'use strict';
  13911. var ReactNodeTypes = _dereq_(69);
  13912. function getHostComponentFromComposite(inst) {
  13913. var type;
  13914. while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) {
  13915. inst = inst._renderedComponent;
  13916. }
  13917. if (type === ReactNodeTypes.HOST) {
  13918. return inst._renderedComponent;
  13919. } else if (type === ReactNodeTypes.EMPTY) {
  13920. return null;
  13921. }
  13922. }
  13923. module.exports = getHostComponentFromComposite;
  13924. },{"69":69}],116:[function(_dereq_,module,exports){
  13925. /**
  13926. * Copyright 2013-present, Facebook, Inc.
  13927. * All rights reserved.
  13928. *
  13929. * This source code is licensed under the BSD-style license found in the
  13930. * LICENSE file in the root directory of this source tree. An additional grant
  13931. * of patent rights can be found in the PATENTS file in the same directory.
  13932. *
  13933. *
  13934. */
  13935. 'use strict';
  13936. /* global Symbol */
  13937. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  13938. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  13939. /**
  13940. * Returns the iterator method function contained on the iterable object.
  13941. *
  13942. * Be sure to invoke the function with the iterable as context:
  13943. *
  13944. * var iteratorFn = getIteratorFn(myIterable);
  13945. * if (iteratorFn) {
  13946. * var iterator = iteratorFn.call(myIterable);
  13947. * ...
  13948. * }
  13949. *
  13950. * @param {?object} maybeIterable
  13951. * @return {?function}
  13952. */
  13953. function getIteratorFn(maybeIterable) {
  13954. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  13955. if (typeof iteratorFn === 'function') {
  13956. return iteratorFn;
  13957. }
  13958. }
  13959. module.exports = getIteratorFn;
  13960. },{}],117:[function(_dereq_,module,exports){
  13961. /**
  13962. * Copyright 2013-present, Facebook, Inc.
  13963. * All rights reserved.
  13964. *
  13965. * This source code is licensed under the BSD-style license found in the
  13966. * LICENSE file in the root directory of this source tree. An additional grant
  13967. * of patent rights can be found in the PATENTS file in the same directory.
  13968. *
  13969. */
  13970. 'use strict';
  13971. /**
  13972. * Given any node return the first leaf node without children.
  13973. *
  13974. * @param {DOMElement|DOMTextNode} node
  13975. * @return {DOMElement|DOMTextNode}
  13976. */
  13977. function getLeafNode(node) {
  13978. while (node && node.firstChild) {
  13979. node = node.firstChild;
  13980. }
  13981. return node;
  13982. }
  13983. /**
  13984. * Get the next sibling within a container. This will walk up the
  13985. * DOM if a node's siblings have been exhausted.
  13986. *
  13987. * @param {DOMElement|DOMTextNode} node
  13988. * @return {?DOMElement|DOMTextNode}
  13989. */
  13990. function getSiblingNode(node) {
  13991. while (node) {
  13992. if (node.nextSibling) {
  13993. return node.nextSibling;
  13994. }
  13995. node = node.parentNode;
  13996. }
  13997. }
  13998. /**
  13999. * Get object describing the nodes which contain characters at offset.
  14000. *
  14001. * @param {DOMElement|DOMTextNode} root
  14002. * @param {number} offset
  14003. * @return {?object}
  14004. */
  14005. function getNodeForCharacterOffset(root, offset) {
  14006. var node = getLeafNode(root);
  14007. var nodeStart = 0;
  14008. var nodeEnd = 0;
  14009. while (node) {
  14010. if (node.nodeType === 3) {
  14011. nodeEnd = nodeStart + node.textContent.length;
  14012. if (nodeStart <= offset && nodeEnd >= offset) {
  14013. return {
  14014. node: node,
  14015. offset: offset - nodeStart
  14016. };
  14017. }
  14018. nodeStart = nodeEnd;
  14019. }
  14020. node = getLeafNode(getSiblingNode(node));
  14021. }
  14022. }
  14023. module.exports = getNodeForCharacterOffset;
  14024. },{}],118:[function(_dereq_,module,exports){
  14025. /**
  14026. * Copyright 2013-present, Facebook, Inc.
  14027. * All rights reserved.
  14028. *
  14029. * This source code is licensed under the BSD-style license found in the
  14030. * LICENSE file in the root directory of this source tree. An additional grant
  14031. * of patent rights can be found in the PATENTS file in the same directory.
  14032. *
  14033. */
  14034. 'use strict';
  14035. var ExecutionEnvironment = _dereq_(138);
  14036. var contentKey = null;
  14037. /**
  14038. * Gets the key used to access text content on a DOM node.
  14039. *
  14040. * @return {?string} Key used to access text content.
  14041. * @internal
  14042. */
  14043. function getTextContentAccessor() {
  14044. if (!contentKey && ExecutionEnvironment.canUseDOM) {
  14045. // Prefer textContent to innerText because many browsers support both but
  14046. // SVG <text> elements don't support innerText even when <div> does.
  14047. contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
  14048. }
  14049. return contentKey;
  14050. }
  14051. module.exports = getTextContentAccessor;
  14052. },{"138":138}],119:[function(_dereq_,module,exports){
  14053. /**
  14054. * Copyright 2013-present, Facebook, Inc.
  14055. * All rights reserved.
  14056. *
  14057. * This source code is licensed under the BSD-style license found in the
  14058. * LICENSE file in the root directory of this source tree. An additional grant
  14059. * of patent rights can be found in the PATENTS file in the same directory.
  14060. *
  14061. */
  14062. 'use strict';
  14063. var ExecutionEnvironment = _dereq_(138);
  14064. /**
  14065. * Generate a mapping of standard vendor prefixes using the defined style property and event name.
  14066. *
  14067. * @param {string} styleProp
  14068. * @param {string} eventName
  14069. * @returns {object}
  14070. */
  14071. function makePrefixMap(styleProp, eventName) {
  14072. var prefixes = {};
  14073. prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
  14074. prefixes['Webkit' + styleProp] = 'webkit' + eventName;
  14075. prefixes['Moz' + styleProp] = 'moz' + eventName;
  14076. prefixes['ms' + styleProp] = 'MS' + eventName;
  14077. prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
  14078. return prefixes;
  14079. }
  14080. /**
  14081. * A list of event names to a configurable list of vendor prefixes.
  14082. */
  14083. var vendorPrefixes = {
  14084. animationend: makePrefixMap('Animation', 'AnimationEnd'),
  14085. animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
  14086. animationstart: makePrefixMap('Animation', 'AnimationStart'),
  14087. transitionend: makePrefixMap('Transition', 'TransitionEnd')
  14088. };
  14089. /**
  14090. * Event names that have already been detected and prefixed (if applicable).
  14091. */
  14092. var prefixedEventNames = {};
  14093. /**
  14094. * Element to check for prefixes on.
  14095. */
  14096. var style = {};
  14097. /**
  14098. * Bootstrap if a DOM exists.
  14099. */
  14100. if (ExecutionEnvironment.canUseDOM) {
  14101. style = document.createElement('div').style;
  14102. // On some platforms, in particular some releases of Android 4.x,
  14103. // the un-prefixed "animation" and "transition" properties are defined on the
  14104. // style object but the events that fire will still be prefixed, so we need
  14105. // to check if the un-prefixed events are usable, and if not remove them from the map.
  14106. if (!('AnimationEvent' in window)) {
  14107. delete vendorPrefixes.animationend.animation;
  14108. delete vendorPrefixes.animationiteration.animation;
  14109. delete vendorPrefixes.animationstart.animation;
  14110. }
  14111. // Same as above
  14112. if (!('TransitionEvent' in window)) {
  14113. delete vendorPrefixes.transitionend.transition;
  14114. }
  14115. }
  14116. /**
  14117. * Attempts to determine the correct vendor prefixed event name.
  14118. *
  14119. * @param {string} eventName
  14120. * @returns {string}
  14121. */
  14122. function getVendorPrefixedEventName(eventName) {
  14123. if (prefixedEventNames[eventName]) {
  14124. return prefixedEventNames[eventName];
  14125. } else if (!vendorPrefixes[eventName]) {
  14126. return eventName;
  14127. }
  14128. var prefixMap = vendorPrefixes[eventName];
  14129. for (var styleProp in prefixMap) {
  14130. if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
  14131. return prefixedEventNames[eventName] = prefixMap[styleProp];
  14132. }
  14133. }
  14134. return '';
  14135. }
  14136. module.exports = getVendorPrefixedEventName;
  14137. },{"138":138}],120:[function(_dereq_,module,exports){
  14138. /**
  14139. * Copyright 2013-present, Facebook, Inc.
  14140. * All rights reserved.
  14141. *
  14142. * This source code is licensed under the BSD-style license found in the
  14143. * LICENSE file in the root directory of this source tree. An additional grant
  14144. * of patent rights can be found in the PATENTS file in the same directory.
  14145. *
  14146. */
  14147. 'use strict';
  14148. var ReactDOMComponentTree = _dereq_(34);
  14149. function isCheckable(elem) {
  14150. var type = elem.type;
  14151. var nodeName = elem.nodeName;
  14152. return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');
  14153. }
  14154. function getTracker(inst) {
  14155. return inst._wrapperState.valueTracker;
  14156. }
  14157. function attachTracker(inst, tracker) {
  14158. inst._wrapperState.valueTracker = tracker;
  14159. }
  14160. function detachTracker(inst) {
  14161. delete inst._wrapperState.valueTracker;
  14162. }
  14163. function getValueFromNode(node) {
  14164. var value;
  14165. if (node) {
  14166. value = isCheckable(node) ? '' + node.checked : node.value;
  14167. }
  14168. return value;
  14169. }
  14170. var inputValueTracking = {
  14171. // exposed for testing
  14172. _getTrackerFromNode: function (node) {
  14173. return getTracker(ReactDOMComponentTree.getInstanceFromNode(node));
  14174. },
  14175. track: function (inst) {
  14176. if (getTracker(inst)) {
  14177. return;
  14178. }
  14179. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  14180. var valueField = isCheckable(node) ? 'checked' : 'value';
  14181. var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField);
  14182. var currentValue = '' + node[valueField];
  14183. // if someone has already defined a value or Safari, then bail
  14184. // and don't track value will cause over reporting of changes,
  14185. // but it's better then a hard failure
  14186. // (needed for certain tests that spyOn input values and Safari)
  14187. if (node.hasOwnProperty(valueField) || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') {
  14188. return;
  14189. }
  14190. Object.defineProperty(node, valueField, {
  14191. enumerable: descriptor.enumerable,
  14192. configurable: true,
  14193. get: function () {
  14194. return descriptor.get.call(this);
  14195. },
  14196. set: function (value) {
  14197. currentValue = '' + value;
  14198. descriptor.set.call(this, value);
  14199. }
  14200. });
  14201. attachTracker(inst, {
  14202. getValue: function () {
  14203. return currentValue;
  14204. },
  14205. setValue: function (value) {
  14206. currentValue = '' + value;
  14207. },
  14208. stopTracking: function () {
  14209. detachTracker(inst);
  14210. delete node[valueField];
  14211. }
  14212. });
  14213. },
  14214. updateValueIfChanged: function (inst) {
  14215. if (!inst) {
  14216. return false;
  14217. }
  14218. var tracker = getTracker(inst);
  14219. if (!tracker) {
  14220. inputValueTracking.track(inst);
  14221. return true;
  14222. }
  14223. var lastValue = tracker.getValue();
  14224. var nextValue = getValueFromNode(ReactDOMComponentTree.getNodeFromInstance(inst));
  14225. if (nextValue !== lastValue) {
  14226. tracker.setValue(nextValue);
  14227. return true;
  14228. }
  14229. return false;
  14230. },
  14231. stopTracking: function (inst) {
  14232. var tracker = getTracker(inst);
  14233. if (tracker) {
  14234. tracker.stopTracking();
  14235. }
  14236. }
  14237. };
  14238. module.exports = inputValueTracking;
  14239. },{"34":34}],121:[function(_dereq_,module,exports){
  14240. /**
  14241. * Copyright 2013-present, Facebook, Inc.
  14242. * All rights reserved.
  14243. *
  14244. * This source code is licensed under the BSD-style license found in the
  14245. * LICENSE file in the root directory of this source tree. An additional grant
  14246. * of patent rights can be found in the PATENTS file in the same directory.
  14247. *
  14248. */
  14249. 'use strict';
  14250. var _prodInvariant = _dereq_(126),
  14251. _assign = _dereq_(160);
  14252. var ReactCompositeComponent = _dereq_(30);
  14253. var ReactEmptyComponent = _dereq_(54);
  14254. var ReactHostComponent = _dereq_(59);
  14255. var getNextDebugID = _dereq_(136);
  14256. var invariant = _dereq_(152);
  14257. var warning = _dereq_(159);
  14258. // To avoid a cyclic dependency, we create the final class in this module
  14259. var ReactCompositeComponentWrapper = function (element) {
  14260. this.construct(element);
  14261. };
  14262. function getDeclarationErrorAddendum(owner) {
  14263. if (owner) {
  14264. var name = owner.getName();
  14265. if (name) {
  14266. return ' Check the render method of `' + name + '`.';
  14267. }
  14268. }
  14269. return '';
  14270. }
  14271. /**
  14272. * Check if the type reference is a known internal type. I.e. not a user
  14273. * provided composite type.
  14274. *
  14275. * @param {function} type
  14276. * @return {boolean} Returns true if this is a valid internal type.
  14277. */
  14278. function isInternalComponentType(type) {
  14279. return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
  14280. }
  14281. /**
  14282. * Given a ReactNode, create an instance that will actually be mounted.
  14283. *
  14284. * @param {ReactNode} node
  14285. * @param {boolean} shouldHaveDebugID
  14286. * @return {object} A new instance of the element's constructor.
  14287. * @protected
  14288. */
  14289. function instantiateReactComponent(node, shouldHaveDebugID) {
  14290. var instance;
  14291. if (node === null || node === false) {
  14292. instance = ReactEmptyComponent.create(instantiateReactComponent);
  14293. } else if (typeof node === 'object') {
  14294. var element = node;
  14295. var type = element.type;
  14296. if (typeof type !== 'function' && typeof type !== 'string') {
  14297. var info = '';
  14298. if ("development" !== 'production') {
  14299. if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
  14300. info += ' You likely forgot to export your component from the file ' + "it's defined in.";
  14301. }
  14302. }
  14303. info += getDeclarationErrorAddendum(element._owner);
  14304. !false ? "development" !== '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', type == null ? type : typeof type, info) : _prodInvariant('130', type == null ? type : typeof type, info) : void 0;
  14305. }
  14306. // Special case string values
  14307. if (typeof element.type === 'string') {
  14308. instance = ReactHostComponent.createInternalComponent(element);
  14309. } else if (isInternalComponentType(element.type)) {
  14310. // This is temporarily available for custom components that are not string
  14311. // representations. I.e. ART. Once those are updated to use the string
  14312. // representation, we can drop this code path.
  14313. instance = new element.type(element);
  14314. // We renamed this. Allow the old name for compat. :(
  14315. if (!instance.getHostNode) {
  14316. instance.getHostNode = instance.getNativeNode;
  14317. }
  14318. } else {
  14319. instance = new ReactCompositeComponentWrapper(element);
  14320. }
  14321. } else if (typeof node === 'string' || typeof node === 'number') {
  14322. instance = ReactHostComponent.createInstanceForText(node);
  14323. } else {
  14324. !false ? "development" !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : _prodInvariant('131', typeof node) : void 0;
  14325. }
  14326. if ("development" !== 'production') {
  14327. "development" !== 'production' ? warning(typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.getHostNode === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : void 0;
  14328. }
  14329. // These two fields are used by the DOM and ART diffing algorithms
  14330. // respectively. Instead of using expandos on components, we should be
  14331. // storing the state needed by the diffing algorithms elsewhere.
  14332. instance._mountIndex = 0;
  14333. instance._mountImage = null;
  14334. if ("development" !== 'production') {
  14335. instance._debugID = shouldHaveDebugID ? getNextDebugID() : 0;
  14336. }
  14337. // Internal instances should fully constructed at this point, so they should
  14338. // not get any new fields added to them at this point.
  14339. if ("development" !== 'production') {
  14340. if (Object.preventExtensions) {
  14341. Object.preventExtensions(instance);
  14342. }
  14343. }
  14344. return instance;
  14345. }
  14346. _assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent, {
  14347. _instantiateReactComponent: instantiateReactComponent
  14348. });
  14349. module.exports = instantiateReactComponent;
  14350. },{"126":126,"136":136,"152":152,"159":159,"160":160,"30":30,"54":54,"59":59}],122:[function(_dereq_,module,exports){
  14351. /**
  14352. * Copyright 2013-present, Facebook, Inc.
  14353. * All rights reserved.
  14354. *
  14355. * This source code is licensed under the BSD-style license found in the
  14356. * LICENSE file in the root directory of this source tree. An additional grant
  14357. * of patent rights can be found in the PATENTS file in the same directory.
  14358. *
  14359. */
  14360. 'use strict';
  14361. var ExecutionEnvironment = _dereq_(138);
  14362. var useHasFeature;
  14363. if (ExecutionEnvironment.canUseDOM) {
  14364. useHasFeature = document.implementation && document.implementation.hasFeature &&
  14365. // always returns true in newer browsers as per the standard.
  14366. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
  14367. document.implementation.hasFeature('', '') !== true;
  14368. }
  14369. /**
  14370. * Checks if an event is supported in the current execution environment.
  14371. *
  14372. * NOTE: This will not work correctly for non-generic events such as `change`,
  14373. * `reset`, `load`, `error`, and `select`.
  14374. *
  14375. * Borrows from Modernizr.
  14376. *
  14377. * @param {string} eventNameSuffix Event name, e.g. "click".
  14378. * @param {?boolean} capture Check if the capture phase is supported.
  14379. * @return {boolean} True if the event is supported.
  14380. * @internal
  14381. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  14382. */
  14383. function isEventSupported(eventNameSuffix, capture) {
  14384. if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
  14385. return false;
  14386. }
  14387. var eventName = 'on' + eventNameSuffix;
  14388. var isSupported = eventName in document;
  14389. if (!isSupported) {
  14390. var element = document.createElement('div');
  14391. element.setAttribute(eventName, 'return;');
  14392. isSupported = typeof element[eventName] === 'function';
  14393. }
  14394. if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
  14395. // This is the only way to test support for the `wheel` event in IE9+.
  14396. isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  14397. }
  14398. return isSupported;
  14399. }
  14400. module.exports = isEventSupported;
  14401. },{"138":138}],123:[function(_dereq_,module,exports){
  14402. /**
  14403. * Copyright 2013-present, Facebook, Inc.
  14404. * All rights reserved.
  14405. *
  14406. * This source code is licensed under the BSD-style license found in the
  14407. * LICENSE file in the root directory of this source tree. An additional grant
  14408. * of patent rights can be found in the PATENTS file in the same directory.
  14409. *
  14410. *
  14411. */
  14412. 'use strict';
  14413. /**
  14414. * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
  14415. */
  14416. var supportedInputTypes = {
  14417. color: true,
  14418. date: true,
  14419. datetime: true,
  14420. 'datetime-local': true,
  14421. email: true,
  14422. month: true,
  14423. number: true,
  14424. password: true,
  14425. range: true,
  14426. search: true,
  14427. tel: true,
  14428. text: true,
  14429. time: true,
  14430. url: true,
  14431. week: true
  14432. };
  14433. function isTextInputElement(elem) {
  14434. var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
  14435. if (nodeName === 'input') {
  14436. return !!supportedInputTypes[elem.type];
  14437. }
  14438. if (nodeName === 'textarea') {
  14439. return true;
  14440. }
  14441. return false;
  14442. }
  14443. module.exports = isTextInputElement;
  14444. },{}],124:[function(_dereq_,module,exports){
  14445. /**
  14446. * Copyright 2014-2015, Facebook, Inc.
  14447. * All rights reserved.
  14448. *
  14449. * This source code is licensed under the BSD-style license found in the
  14450. * LICENSE file in the root directory of this source tree. An additional grant
  14451. * of patent rights can be found in the PATENTS file in the same directory.
  14452. *
  14453. */
  14454. 'use strict';
  14455. /**
  14456. * Forked from fbjs/warning:
  14457. * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
  14458. *
  14459. * Only change is we use console.warn instead of console.error,
  14460. * and do nothing when 'console' is not supported.
  14461. * This really simplifies the code.
  14462. * ---
  14463. * Similar to invariant but only logs a warning if the condition is not met.
  14464. * This can be used to log issues in development environments in critical
  14465. * paths. Removing the logging code for production environments will keep the
  14466. * same logic and follow the same code paths.
  14467. */
  14468. var lowPriorityWarning = function () {};
  14469. if ("development" !== 'production') {
  14470. var printWarning = function (format) {
  14471. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  14472. args[_key - 1] = arguments[_key];
  14473. }
  14474. var argIndex = 0;
  14475. var message = 'Warning: ' + format.replace(/%s/g, function () {
  14476. return args[argIndex++];
  14477. });
  14478. if (typeof console !== 'undefined') {
  14479. console.warn(message);
  14480. }
  14481. try {
  14482. // --- Welcome to debugging React ---
  14483. // This error was thrown as a convenience so that you can use this stack
  14484. // to find the callsite that caused this warning to fire.
  14485. throw new Error(message);
  14486. } catch (x) {}
  14487. };
  14488. lowPriorityWarning = function (condition, format) {
  14489. if (format === undefined) {
  14490. throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
  14491. }
  14492. if (!condition) {
  14493. for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
  14494. args[_key2 - 2] = arguments[_key2];
  14495. }
  14496. printWarning.apply(undefined, [format].concat(args));
  14497. }
  14498. };
  14499. }
  14500. module.exports = lowPriorityWarning;
  14501. },{}],125:[function(_dereq_,module,exports){
  14502. /**
  14503. * Copyright 2013-present, Facebook, Inc.
  14504. * All rights reserved.
  14505. *
  14506. * This source code is licensed under the BSD-style license found in the
  14507. * LICENSE file in the root directory of this source tree. An additional grant
  14508. * of patent rights can be found in the PATENTS file in the same directory.
  14509. *
  14510. */
  14511. 'use strict';
  14512. var escapeTextContentForBrowser = _dereq_(107);
  14513. /**
  14514. * Escapes attribute value to prevent scripting attacks.
  14515. *
  14516. * @param {*} value Value to escape.
  14517. * @return {string} An escaped string.
  14518. */
  14519. function quoteAttributeValueForBrowser(value) {
  14520. return '"' + escapeTextContentForBrowser(value) + '"';
  14521. }
  14522. module.exports = quoteAttributeValueForBrowser;
  14523. },{"107":107}],126:[function(_dereq_,module,exports){
  14524. /**
  14525. * Copyright (c) 2013-present, Facebook, Inc.
  14526. * All rights reserved.
  14527. *
  14528. * This source code is licensed under the BSD-style license found in the
  14529. * LICENSE file in the root directory of this source tree. An additional grant
  14530. * of patent rights can be found in the PATENTS file in the same directory.
  14531. *
  14532. *
  14533. */
  14534. 'use strict';
  14535. /**
  14536. * WARNING: DO NOT manually require this module.
  14537. * This is a replacement for `invariant(...)` used by the error code system
  14538. * and will _only_ be required by the corresponding babel pass.
  14539. * It always throws.
  14540. */
  14541. function reactProdInvariant(code) {
  14542. var argCount = arguments.length - 1;
  14543. var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;
  14544. for (var argIdx = 0; argIdx < argCount; argIdx++) {
  14545. message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
  14546. }
  14547. message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';
  14548. var error = new Error(message);
  14549. error.name = 'Invariant Violation';
  14550. error.framesToPop = 1; // we don't care about reactProdInvariant's own frame
  14551. throw error;
  14552. }
  14553. module.exports = reactProdInvariant;
  14554. },{}],127:[function(_dereq_,module,exports){
  14555. /**
  14556. * Copyright 2013-present, Facebook, Inc.
  14557. * All rights reserved.
  14558. *
  14559. * This source code is licensed under the BSD-style license found in the
  14560. * LICENSE file in the root directory of this source tree. An additional grant
  14561. * of patent rights can be found in the PATENTS file in the same directory.
  14562. *
  14563. */
  14564. 'use strict';
  14565. var ReactMount = _dereq_(67);
  14566. module.exports = ReactMount.renderSubtreeIntoContainer;
  14567. },{"67":67}],128:[function(_dereq_,module,exports){
  14568. /**
  14569. * Copyright 2013-present, Facebook, Inc.
  14570. * All rights reserved.
  14571. *
  14572. * This source code is licensed under the BSD-style license found in the
  14573. * LICENSE file in the root directory of this source tree. An additional grant
  14574. * of patent rights can be found in the PATENTS file in the same directory.
  14575. *
  14576. */
  14577. 'use strict';
  14578. var ExecutionEnvironment = _dereq_(138);
  14579. var DOMNamespaces = _dereq_(10);
  14580. var WHITESPACE_TEST = /^[ \r\n\t\f]/;
  14581. var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
  14582. var createMicrosoftUnsafeLocalFunction = _dereq_(105);
  14583. // SVG temp container for IE lacking innerHTML
  14584. var reusableSVGContainer;
  14585. /**
  14586. * Set the innerHTML property of a node, ensuring that whitespace is preserved
  14587. * even in IE8.
  14588. *
  14589. * @param {DOMElement} node
  14590. * @param {string} html
  14591. * @internal
  14592. */
  14593. var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
  14594. // IE does not have innerHTML for SVG nodes, so instead we inject the
  14595. // new markup in a temp node and then move the child nodes across into
  14596. // the target node
  14597. if (node.namespaceURI === DOMNamespaces.svg && !('innerHTML' in node)) {
  14598. reusableSVGContainer = reusableSVGContainer || document.createElement('div');
  14599. reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>';
  14600. var svgNode = reusableSVGContainer.firstChild;
  14601. while (svgNode.firstChild) {
  14602. node.appendChild(svgNode.firstChild);
  14603. }
  14604. } else {
  14605. node.innerHTML = html;
  14606. }
  14607. });
  14608. if (ExecutionEnvironment.canUseDOM) {
  14609. // IE8: When updating a just created node with innerHTML only leading
  14610. // whitespace is removed. When updating an existing node with innerHTML
  14611. // whitespace in root TextNodes is also collapsed.
  14612. // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
  14613. // Feature detection; only IE8 is known to behave improperly like this.
  14614. var testElement = document.createElement('div');
  14615. testElement.innerHTML = ' ';
  14616. if (testElement.innerHTML === '') {
  14617. setInnerHTML = function (node, html) {
  14618. // Magic theory: IE8 supposedly differentiates between added and updated
  14619. // nodes when processing innerHTML, innerHTML on updated nodes suffers
  14620. // from worse whitespace behavior. Re-adding a node like this triggers
  14621. // the initial and more favorable whitespace behavior.
  14622. // TODO: What to do on a detached node?
  14623. if (node.parentNode) {
  14624. node.parentNode.replaceChild(node, node);
  14625. }
  14626. // We also implement a workaround for non-visible tags disappearing into
  14627. // thin air on IE8, this only happens if there is no visible text
  14628. // in-front of the non-visible tags. Piggyback on the whitespace fix
  14629. // and simply check if any non-visible tags appear in the source.
  14630. if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
  14631. // Recover leading whitespace by temporarily prepending any character.
  14632. // \uFEFF has the potential advantage of being zero-width/invisible.
  14633. // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
  14634. // in hopes that this is preserved even if "\uFEFF" is transformed to
  14635. // the actual Unicode character (by Babel, for example).
  14636. // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
  14637. node.innerHTML = String.fromCharCode(0xfeff) + html;
  14638. // deleteData leaves an empty `TextNode` which offsets the index of all
  14639. // children. Definitely want to avoid this.
  14640. var textNode = node.firstChild;
  14641. if (textNode.data.length === 1) {
  14642. node.removeChild(textNode);
  14643. } else {
  14644. textNode.deleteData(0, 1);
  14645. }
  14646. } else {
  14647. node.innerHTML = html;
  14648. }
  14649. };
  14650. }
  14651. testElement = null;
  14652. }
  14653. module.exports = setInnerHTML;
  14654. },{"10":10,"105":105,"138":138}],129:[function(_dereq_,module,exports){
  14655. /**
  14656. * Copyright 2013-present, Facebook, Inc.
  14657. * All rights reserved.
  14658. *
  14659. * This source code is licensed under the BSD-style license found in the
  14660. * LICENSE file in the root directory of this source tree. An additional grant
  14661. * of patent rights can be found in the PATENTS file in the same directory.
  14662. *
  14663. */
  14664. 'use strict';
  14665. var ExecutionEnvironment = _dereq_(138);
  14666. var escapeTextContentForBrowser = _dereq_(107);
  14667. var setInnerHTML = _dereq_(128);
  14668. /**
  14669. * Set the textContent property of a node, ensuring that whitespace is preserved
  14670. * even in IE8. innerText is a poor substitute for textContent and, among many
  14671. * issues, inserts <br> instead of the literal newline chars. innerHTML behaves
  14672. * as it should.
  14673. *
  14674. * @param {DOMElement} node
  14675. * @param {string} text
  14676. * @internal
  14677. */
  14678. var setTextContent = function (node, text) {
  14679. if (text) {
  14680. var firstChild = node.firstChild;
  14681. if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) {
  14682. firstChild.nodeValue = text;
  14683. return;
  14684. }
  14685. }
  14686. node.textContent = text;
  14687. };
  14688. if (ExecutionEnvironment.canUseDOM) {
  14689. if (!('textContent' in document.documentElement)) {
  14690. setTextContent = function (node, text) {
  14691. if (node.nodeType === 3) {
  14692. node.nodeValue = text;
  14693. return;
  14694. }
  14695. setInnerHTML(node, escapeTextContentForBrowser(text));
  14696. };
  14697. }
  14698. }
  14699. module.exports = setTextContent;
  14700. },{"107":107,"128":128,"138":138}],130:[function(_dereq_,module,exports){
  14701. /**
  14702. * Copyright 2013-present, Facebook, Inc.
  14703. * All rights reserved.
  14704. *
  14705. * This source code is licensed under the BSD-style license found in the
  14706. * LICENSE file in the root directory of this source tree. An additional grant
  14707. * of patent rights can be found in the PATENTS file in the same directory.
  14708. *
  14709. */
  14710. 'use strict';
  14711. /**
  14712. * Given a `prevElement` and `nextElement`, determines if the existing
  14713. * instance should be updated as opposed to being destroyed or replaced by a new
  14714. * instance. Both arguments are elements. This ensures that this logic can
  14715. * operate on stateless trees without any backing instance.
  14716. *
  14717. * @param {?object} prevElement
  14718. * @param {?object} nextElement
  14719. * @return {boolean} True if the existing instance should be updated.
  14720. * @protected
  14721. */
  14722. function shouldUpdateReactComponent(prevElement, nextElement) {
  14723. var prevEmpty = prevElement === null || prevElement === false;
  14724. var nextEmpty = nextElement === null || nextElement === false;
  14725. if (prevEmpty || nextEmpty) {
  14726. return prevEmpty === nextEmpty;
  14727. }
  14728. var prevType = typeof prevElement;
  14729. var nextType = typeof nextElement;
  14730. if (prevType === 'string' || prevType === 'number') {
  14731. return nextType === 'string' || nextType === 'number';
  14732. } else {
  14733. return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
  14734. }
  14735. }
  14736. module.exports = shouldUpdateReactComponent;
  14737. },{}],131:[function(_dereq_,module,exports){
  14738. /**
  14739. * Copyright 2013-present, Facebook, Inc.
  14740. * All rights reserved.
  14741. *
  14742. * This source code is licensed under the BSD-style license found in the
  14743. * LICENSE file in the root directory of this source tree. An additional grant
  14744. * of patent rights can be found in the PATENTS file in the same directory.
  14745. *
  14746. */
  14747. 'use strict';
  14748. var _prodInvariant = _dereq_(126);
  14749. var ReactCurrentOwner = _dereq_(134);
  14750. var REACT_ELEMENT_TYPE = _dereq_(53);
  14751. var getIteratorFn = _dereq_(116);
  14752. var invariant = _dereq_(152);
  14753. var KeyEscapeUtils = _dereq_(23);
  14754. var warning = _dereq_(159);
  14755. var SEPARATOR = '.';
  14756. var SUBSEPARATOR = ':';
  14757. /**
  14758. * This is inlined from ReactElement since this file is shared between
  14759. * isomorphic and renderers. We could extract this to a
  14760. *
  14761. */
  14762. /**
  14763. * TODO: Test that a single child and an array with one item have the same key
  14764. * pattern.
  14765. */
  14766. var didWarnAboutMaps = false;
  14767. /**
  14768. * Generate a key string that identifies a component within a set.
  14769. *
  14770. * @param {*} component A component that could contain a manual key.
  14771. * @param {number} index Index that is used if a manual key is not provided.
  14772. * @return {string}
  14773. */
  14774. function getComponentKey(component, index) {
  14775. // Do some typechecking here since we call this blindly. We want to ensure
  14776. // that we don't block potential future ES APIs.
  14777. if (component && typeof component === 'object' && component.key != null) {
  14778. // Explicit key
  14779. return KeyEscapeUtils.escape(component.key);
  14780. }
  14781. // Implicit key determined by the index in the set
  14782. return index.toString(36);
  14783. }
  14784. /**
  14785. * @param {?*} children Children tree container.
  14786. * @param {!string} nameSoFar Name of the key path so far.
  14787. * @param {!function} callback Callback to invoke with each child found.
  14788. * @param {?*} traverseContext Used to pass information throughout the traversal
  14789. * process.
  14790. * @return {!number} The number of children in this subtree.
  14791. */
  14792. function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
  14793. var type = typeof children;
  14794. if (type === 'undefined' || type === 'boolean') {
  14795. // All of the above are perceived as null.
  14796. children = null;
  14797. }
  14798. if (children === null || type === 'string' || type === 'number' ||
  14799. // The following is inlined from ReactElement. This means we can optimize
  14800. // some checks. React Fiber also inlines this logic for similar purposes.
  14801. type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
  14802. callback(traverseContext, children,
  14803. // If it's the only child, treat the name as if it was wrapped in an array
  14804. // so that it's consistent if the number of children grows.
  14805. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
  14806. return 1;
  14807. }
  14808. var child;
  14809. var nextName;
  14810. var subtreeCount = 0; // Count of children found in the current subtree.
  14811. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
  14812. if (Array.isArray(children)) {
  14813. for (var i = 0; i < children.length; i++) {
  14814. child = children[i];
  14815. nextName = nextNamePrefix + getComponentKey(child, i);
  14816. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  14817. }
  14818. } else {
  14819. var iteratorFn = getIteratorFn(children);
  14820. if (iteratorFn) {
  14821. var iterator = iteratorFn.call(children);
  14822. var step;
  14823. if (iteratorFn !== children.entries) {
  14824. var ii = 0;
  14825. while (!(step = iterator.next()).done) {
  14826. child = step.value;
  14827. nextName = nextNamePrefix + getComponentKey(child, ii++);
  14828. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  14829. }
  14830. } else {
  14831. if ("development" !== 'production') {
  14832. var mapsAsChildrenAddendum = '';
  14833. if (ReactCurrentOwner.current) {
  14834. var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
  14835. if (mapsAsChildrenOwnerName) {
  14836. mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
  14837. }
  14838. }
  14839. "development" !== '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.%s', mapsAsChildrenAddendum) : void 0;
  14840. didWarnAboutMaps = true;
  14841. }
  14842. // Iterator will provide entry [k,v] tuples rather than values.
  14843. while (!(step = iterator.next()).done) {
  14844. var entry = step.value;
  14845. if (entry) {
  14846. child = entry[1];
  14847. nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
  14848. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  14849. }
  14850. }
  14851. }
  14852. } else if (type === 'object') {
  14853. var addendum = '';
  14854. if ("development" !== 'production') {
  14855. 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.';
  14856. if (children._isReactElement) {
  14857. 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.';
  14858. }
  14859. if (ReactCurrentOwner.current) {
  14860. var name = ReactCurrentOwner.current.getName();
  14861. if (name) {
  14862. addendum += ' Check the render method of `' + name + '`.';
  14863. }
  14864. }
  14865. }
  14866. var childrenString = String(children);
  14867. !false ? "development" !== '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) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0;
  14868. }
  14869. }
  14870. return subtreeCount;
  14871. }
  14872. /**
  14873. * Traverses children that are typically specified as `props.children`, but
  14874. * might also be specified through attributes:
  14875. *
  14876. * - `traverseAllChildren(this.props.children, ...)`
  14877. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  14878. *
  14879. * The `traverseContext` is an optional argument that is passed through the
  14880. * entire traversal. It can be used to store accumulations or anything else that
  14881. * the callback might find relevant.
  14882. *
  14883. * @param {?*} children Children tree object.
  14884. * @param {!function} callback To invoke upon traversing each child.
  14885. * @param {?*} traverseContext Context for traversal.
  14886. * @return {!number} The number of children in this subtree.
  14887. */
  14888. function traverseAllChildren(children, callback, traverseContext) {
  14889. if (children == null) {
  14890. return 0;
  14891. }
  14892. return traverseAllChildrenImpl(children, '', callback, traverseContext);
  14893. }
  14894. module.exports = traverseAllChildren;
  14895. },{"116":116,"126":126,"134":134,"152":152,"159":159,"23":23,"53":53}],132:[function(_dereq_,module,exports){
  14896. /**
  14897. * Copyright 2015-present, Facebook, Inc.
  14898. * All rights reserved.
  14899. *
  14900. * This source code is licensed under the BSD-style license found in the
  14901. * LICENSE file in the root directory of this source tree. An additional grant
  14902. * of patent rights can be found in the PATENTS file in the same directory.
  14903. *
  14904. */
  14905. 'use strict';
  14906. var _assign = _dereq_(160);
  14907. var emptyFunction = _dereq_(144);
  14908. var warning = _dereq_(159);
  14909. var validateDOMNesting = emptyFunction;
  14910. if ("development" !== 'production') {
  14911. // This validation code was written based on the HTML5 parsing spec:
  14912. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
  14913. //
  14914. // Note: this does not catch all invalid nesting, nor does it try to (as it's
  14915. // not clear what practical benefit doing so provides); instead, we warn only
  14916. // for cases where the parser will give a parse tree differing from what React
  14917. // intended. For example, <b><div></div></b> is invalid but we don't warn
  14918. // because it still parses correctly; we do warn for other cases like nested
  14919. // <p> tags where the beginning of the second element implicitly closes the
  14920. // first, causing a confusing mess.
  14921. // https://html.spec.whatwg.org/multipage/syntax.html#special
  14922. 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'];
  14923. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
  14924. var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
  14925. // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
  14926. // TODO: Distinguish by namespace here -- for <title>, including it here
  14927. // errs on the side of fewer warnings
  14928. 'foreignObject', 'desc', 'title'];
  14929. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
  14930. var buttonScopeTags = inScopeTags.concat(['button']);
  14931. // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
  14932. var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
  14933. var emptyAncestorInfo = {
  14934. current: null,
  14935. formTag: null,
  14936. aTagInScope: null,
  14937. buttonTagInScope: null,
  14938. nobrTagInScope: null,
  14939. pTagInButtonScope: null,
  14940. listItemTagAutoclosing: null,
  14941. dlItemTagAutoclosing: null
  14942. };
  14943. var updatedAncestorInfo = function (oldInfo, tag, instance) {
  14944. var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
  14945. var info = { tag: tag, instance: instance };
  14946. if (inScopeTags.indexOf(tag) !== -1) {
  14947. ancestorInfo.aTagInScope = null;
  14948. ancestorInfo.buttonTagInScope = null;
  14949. ancestorInfo.nobrTagInScope = null;
  14950. }
  14951. if (buttonScopeTags.indexOf(tag) !== -1) {
  14952. ancestorInfo.pTagInButtonScope = null;
  14953. }
  14954. // See rules for 'li', 'dd', 'dt' start tags in
  14955. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
  14956. if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
  14957. ancestorInfo.listItemTagAutoclosing = null;
  14958. ancestorInfo.dlItemTagAutoclosing = null;
  14959. }
  14960. ancestorInfo.current = info;
  14961. if (tag === 'form') {
  14962. ancestorInfo.formTag = info;
  14963. }
  14964. if (tag === 'a') {
  14965. ancestorInfo.aTagInScope = info;
  14966. }
  14967. if (tag === 'button') {
  14968. ancestorInfo.buttonTagInScope = info;
  14969. }
  14970. if (tag === 'nobr') {
  14971. ancestorInfo.nobrTagInScope = info;
  14972. }
  14973. if (tag === 'p') {
  14974. ancestorInfo.pTagInButtonScope = info;
  14975. }
  14976. if (tag === 'li') {
  14977. ancestorInfo.listItemTagAutoclosing = info;
  14978. }
  14979. if (tag === 'dd' || tag === 'dt') {
  14980. ancestorInfo.dlItemTagAutoclosing = info;
  14981. }
  14982. return ancestorInfo;
  14983. };
  14984. /**
  14985. * Returns whether
  14986. */
  14987. var isTagValidWithParent = function (tag, parentTag) {
  14988. // First, let's check if we're in an unusual parsing mode...
  14989. switch (parentTag) {
  14990. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
  14991. case 'select':
  14992. return tag === 'option' || tag === 'optgroup' || tag === '#text';
  14993. case 'optgroup':
  14994. return tag === 'option' || tag === '#text';
  14995. // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
  14996. // but
  14997. case 'option':
  14998. return tag === '#text';
  14999. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
  15000. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
  15001. // No special behavior since these rules fall back to "in body" mode for
  15002. // all except special table nodes which cause bad parsing behavior anyway.
  15003. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
  15004. case 'tr':
  15005. return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
  15006. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
  15007. case 'tbody':
  15008. case 'thead':
  15009. case 'tfoot':
  15010. return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
  15011. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
  15012. case 'colgroup':
  15013. return tag === 'col' || tag === 'template';
  15014. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
  15015. case 'table':
  15016. return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
  15017. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
  15018. case 'head':
  15019. return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
  15020. // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
  15021. case 'html':
  15022. return tag === 'head' || tag === 'body';
  15023. case '#document':
  15024. return tag === 'html';
  15025. }
  15026. // Probably in the "in body" parsing mode, so we outlaw only tag combos
  15027. // where the parsing rules cause implicit opens or closes to be added.
  15028. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
  15029. switch (tag) {
  15030. case 'h1':
  15031. case 'h2':
  15032. case 'h3':
  15033. case 'h4':
  15034. case 'h5':
  15035. case 'h6':
  15036. return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
  15037. case 'rp':
  15038. case 'rt':
  15039. return impliedEndTags.indexOf(parentTag) === -1;
  15040. case 'body':
  15041. case 'caption':
  15042. case 'col':
  15043. case 'colgroup':
  15044. case 'frame':
  15045. case 'head':
  15046. case 'html':
  15047. case 'tbody':
  15048. case 'td':
  15049. case 'tfoot':
  15050. case 'th':
  15051. case 'thead':
  15052. case 'tr':
  15053. // These tags are only valid with a few parents that have special child
  15054. // parsing rules -- if we're down here, then none of those matched and
  15055. // so we allow it only if we don't know what the parent is, as all other
  15056. // cases are invalid.
  15057. return parentTag == null;
  15058. }
  15059. return true;
  15060. };
  15061. /**
  15062. * Returns whether
  15063. */
  15064. var findInvalidAncestorForTag = function (tag, ancestorInfo) {
  15065. switch (tag) {
  15066. case 'address':
  15067. case 'article':
  15068. case 'aside':
  15069. case 'blockquote':
  15070. case 'center':
  15071. case 'details':
  15072. case 'dialog':
  15073. case 'dir':
  15074. case 'div':
  15075. case 'dl':
  15076. case 'fieldset':
  15077. case 'figcaption':
  15078. case 'figure':
  15079. case 'footer':
  15080. case 'header':
  15081. case 'hgroup':
  15082. case 'main':
  15083. case 'menu':
  15084. case 'nav':
  15085. case 'ol':
  15086. case 'p':
  15087. case 'section':
  15088. case 'summary':
  15089. case 'ul':
  15090. case 'pre':
  15091. case 'listing':
  15092. case 'table':
  15093. case 'hr':
  15094. case 'xmp':
  15095. case 'h1':
  15096. case 'h2':
  15097. case 'h3':
  15098. case 'h4':
  15099. case 'h5':
  15100. case 'h6':
  15101. return ancestorInfo.pTagInButtonScope;
  15102. case 'form':
  15103. return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
  15104. case 'li':
  15105. return ancestorInfo.listItemTagAutoclosing;
  15106. case 'dd':
  15107. case 'dt':
  15108. return ancestorInfo.dlItemTagAutoclosing;
  15109. case 'button':
  15110. return ancestorInfo.buttonTagInScope;
  15111. case 'a':
  15112. // Spec says something about storing a list of markers, but it sounds
  15113. // equivalent to this check.
  15114. return ancestorInfo.aTagInScope;
  15115. case 'nobr':
  15116. return ancestorInfo.nobrTagInScope;
  15117. }
  15118. return null;
  15119. };
  15120. /**
  15121. * Given a ReactCompositeComponent instance, return a list of its recursive
  15122. * owners, starting at the root and ending with the instance itself.
  15123. */
  15124. var findOwnerStack = function (instance) {
  15125. if (!instance) {
  15126. return [];
  15127. }
  15128. var stack = [];
  15129. do {
  15130. stack.push(instance);
  15131. } while (instance = instance._currentElement._owner);
  15132. stack.reverse();
  15133. return stack;
  15134. };
  15135. var didWarn = {};
  15136. validateDOMNesting = function (childTag, childText, childInstance, ancestorInfo) {
  15137. ancestorInfo = ancestorInfo || emptyAncestorInfo;
  15138. var parentInfo = ancestorInfo.current;
  15139. var parentTag = parentInfo && parentInfo.tag;
  15140. if (childText != null) {
  15141. "development" !== 'production' ? warning(childTag == null, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0;
  15142. childTag = '#text';
  15143. }
  15144. var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
  15145. var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
  15146. var problematic = invalidParent || invalidAncestor;
  15147. if (problematic) {
  15148. var ancestorTag = problematic.tag;
  15149. var ancestorInstance = problematic.instance;
  15150. var childOwner = childInstance && childInstance._currentElement._owner;
  15151. var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
  15152. var childOwners = findOwnerStack(childOwner);
  15153. var ancestorOwners = findOwnerStack(ancestorOwner);
  15154. var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
  15155. var i;
  15156. var deepestCommon = -1;
  15157. for (i = 0; i < minStackLen; i++) {
  15158. if (childOwners[i] === ancestorOwners[i]) {
  15159. deepestCommon = i;
  15160. } else {
  15161. break;
  15162. }
  15163. }
  15164. var UNKNOWN = '(unknown)';
  15165. var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
  15166. return inst.getName() || UNKNOWN;
  15167. });
  15168. var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
  15169. return inst.getName() || UNKNOWN;
  15170. });
  15171. var ownerInfo = [].concat(
  15172. // If the parent and child instances have a common owner ancestor, start
  15173. // with that -- otherwise we just start with the parent's owners.
  15174. deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
  15175. // If we're warning about an invalid (non-parent) ancestry, add '...'
  15176. invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
  15177. var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
  15178. if (didWarn[warnKey]) {
  15179. return;
  15180. }
  15181. didWarn[warnKey] = true;
  15182. var tagDisplayName = childTag;
  15183. var whitespaceInfo = '';
  15184. if (childTag === '#text') {
  15185. if (/\S/.test(childText)) {
  15186. tagDisplayName = 'Text nodes';
  15187. } else {
  15188. tagDisplayName = 'Whitespace text nodes';
  15189. whitespaceInfo = " Make sure you don't have any extra whitespace between tags on " + 'each line of your source code.';
  15190. }
  15191. } else {
  15192. tagDisplayName = '<' + childTag + '>';
  15193. }
  15194. if (invalidParent) {
  15195. var info = '';
  15196. if (ancestorTag === 'table' && childTag === 'tr') {
  15197. info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
  15198. }
  15199. "development" !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s ' + 'See %s.%s', tagDisplayName, ancestorTag, whitespaceInfo, ownerInfo, info) : void 0;
  15200. } else {
  15201. "development" !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0;
  15202. }
  15203. }
  15204. };
  15205. validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
  15206. // For testing
  15207. validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
  15208. ancestorInfo = ancestorInfo || emptyAncestorInfo;
  15209. var parentInfo = ancestorInfo.current;
  15210. var parentTag = parentInfo && parentInfo.tag;
  15211. return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
  15212. };
  15213. }
  15214. module.exports = validateDOMNesting;
  15215. },{"144":144,"159":159,"160":160}],133:[function(_dereq_,module,exports){
  15216. /**
  15217. * Copyright 2013-present, Facebook, Inc.
  15218. * All rights reserved.
  15219. *
  15220. * This source code is licensed under the BSD-style license found in the
  15221. * LICENSE file in the root directory of this source tree. An additional grant
  15222. * of patent rights can be found in the PATENTS file in the same directory.
  15223. *
  15224. */
  15225. /* globals React */
  15226. 'use strict';
  15227. var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
  15228. module.exports = ReactInternals.ReactComponentTreeHook;
  15229. },{}],134:[function(_dereq_,module,exports){
  15230. /**
  15231. * Copyright 2013-present, Facebook, Inc.
  15232. * All rights reserved.
  15233. *
  15234. * This source code is licensed under the BSD-style license found in the
  15235. * LICENSE file in the root directory of this source tree. An additional grant
  15236. * of patent rights can be found in the PATENTS file in the same directory.
  15237. *
  15238. */
  15239. /* globals React */
  15240. 'use strict';
  15241. var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
  15242. module.exports = ReactInternals.ReactCurrentOwner;
  15243. },{}],135:[function(_dereq_,module,exports){
  15244. /**
  15245. * Copyright 2013-present, Facebook, Inc.
  15246. * All rights reserved.
  15247. *
  15248. * This source code is licensed under the BSD-style license found in the
  15249. * LICENSE file in the root directory of this source tree. An additional grant
  15250. * of patent rights can be found in the PATENTS file in the same directory.
  15251. *
  15252. */
  15253. /* globals React */
  15254. 'use strict';
  15255. module.exports = React;
  15256. },{}],136:[function(_dereq_,module,exports){
  15257. /**
  15258. * Copyright 2013-present, Facebook, Inc.
  15259. * All rights reserved.
  15260. *
  15261. * This source code is licensed under the BSD-style license found in the
  15262. * LICENSE file in the root directory of this source tree. An additional grant
  15263. * of patent rights can be found in the PATENTS file in the same directory.
  15264. *
  15265. */
  15266. /* globals React */
  15267. 'use strict';
  15268. var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
  15269. module.exports = ReactInternals.getNextDebugID;
  15270. },{}],137:[function(_dereq_,module,exports){
  15271. 'use strict';
  15272. /**
  15273. * Copyright (c) 2013-present, Facebook, Inc.
  15274. *
  15275. * Licensed under the Apache License, Version 2.0 (the "License");
  15276. * you may not use this file except in compliance with the License.
  15277. * You may obtain a copy of the License at
  15278. *
  15279. * http://www.apache.org/licenses/LICENSE-2.0
  15280. *
  15281. * Unless required by applicable law or agreed to in writing, software
  15282. * distributed under the License is distributed on an "AS IS" BASIS,
  15283. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15284. * See the License for the specific language governing permissions and
  15285. * limitations under the License.
  15286. *
  15287. * @typechecks
  15288. */
  15289. var emptyFunction = _dereq_(144);
  15290. /**
  15291. * Upstream version of event listener. Does not take into account specific
  15292. * nature of platform.
  15293. */
  15294. var EventListener = {
  15295. /**
  15296. * Listen to DOM events during the bubble phase.
  15297. *
  15298. * @param {DOMEventTarget} target DOM element to register listener on.
  15299. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  15300. * @param {function} callback Callback function.
  15301. * @return {object} Object with a `remove` method.
  15302. */
  15303. listen: function listen(target, eventType, callback) {
  15304. if (target.addEventListener) {
  15305. target.addEventListener(eventType, callback, false);
  15306. return {
  15307. remove: function remove() {
  15308. target.removeEventListener(eventType, callback, false);
  15309. }
  15310. };
  15311. } else if (target.attachEvent) {
  15312. target.attachEvent('on' + eventType, callback);
  15313. return {
  15314. remove: function remove() {
  15315. target.detachEvent('on' + eventType, callback);
  15316. }
  15317. };
  15318. }
  15319. },
  15320. /**
  15321. * Listen to DOM events during the capture phase.
  15322. *
  15323. * @param {DOMEventTarget} target DOM element to register listener on.
  15324. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  15325. * @param {function} callback Callback function.
  15326. * @return {object} Object with a `remove` method.
  15327. */
  15328. capture: function capture(target, eventType, callback) {
  15329. if (target.addEventListener) {
  15330. target.addEventListener(eventType, callback, true);
  15331. return {
  15332. remove: function remove() {
  15333. target.removeEventListener(eventType, callback, true);
  15334. }
  15335. };
  15336. } else {
  15337. if ("development" !== 'production') {
  15338. 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.');
  15339. }
  15340. return {
  15341. remove: emptyFunction
  15342. };
  15343. }
  15344. },
  15345. registerDefault: function registerDefault() {}
  15346. };
  15347. module.exports = EventListener;
  15348. },{"144":144}],138:[function(_dereq_,module,exports){
  15349. /**
  15350. * Copyright (c) 2013-present, Facebook, Inc.
  15351. * All rights reserved.
  15352. *
  15353. * This source code is licensed under the BSD-style license found in the
  15354. * LICENSE file in the root directory of this source tree. An additional grant
  15355. * of patent rights can be found in the PATENTS file in the same directory.
  15356. *
  15357. */
  15358. 'use strict';
  15359. var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
  15360. /**
  15361. * Simple, lightweight module assisting with the detection and context of
  15362. * Worker. Helps avoid circular dependencies and allows code to reason about
  15363. * whether or not they are in a Worker, even if they never include the main
  15364. * `ReactWorker` dependency.
  15365. */
  15366. var ExecutionEnvironment = {
  15367. canUseDOM: canUseDOM,
  15368. canUseWorkers: typeof Worker !== 'undefined',
  15369. canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
  15370. canUseViewport: canUseDOM && !!window.screen,
  15371. isInWorker: !canUseDOM // For now, this is true - might change in the future.
  15372. };
  15373. module.exports = ExecutionEnvironment;
  15374. },{}],139:[function(_dereq_,module,exports){
  15375. "use strict";
  15376. /**
  15377. * Copyright (c) 2013-present, Facebook, Inc.
  15378. * All rights reserved.
  15379. *
  15380. * This source code is licensed under the BSD-style license found in the
  15381. * LICENSE file in the root directory of this source tree. An additional grant
  15382. * of patent rights can be found in the PATENTS file in the same directory.
  15383. *
  15384. * @typechecks
  15385. */
  15386. var _hyphenPattern = /-(.)/g;
  15387. /**
  15388. * Camelcases a hyphenated string, for example:
  15389. *
  15390. * > camelize('background-color')
  15391. * < "backgroundColor"
  15392. *
  15393. * @param {string} string
  15394. * @return {string}
  15395. */
  15396. function camelize(string) {
  15397. return string.replace(_hyphenPattern, function (_, character) {
  15398. return character.toUpperCase();
  15399. });
  15400. }
  15401. module.exports = camelize;
  15402. },{}],140:[function(_dereq_,module,exports){
  15403. /**
  15404. * Copyright (c) 2013-present, Facebook, Inc.
  15405. * All rights reserved.
  15406. *
  15407. * This source code is licensed under the BSD-style license found in the
  15408. * LICENSE file in the root directory of this source tree. An additional grant
  15409. * of patent rights can be found in the PATENTS file in the same directory.
  15410. *
  15411. * @typechecks
  15412. */
  15413. 'use strict';
  15414. var camelize = _dereq_(139);
  15415. var msPattern = /^-ms-/;
  15416. /**
  15417. * Camelcases a hyphenated CSS property name, for example:
  15418. *
  15419. * > camelizeStyleName('background-color')
  15420. * < "backgroundColor"
  15421. * > camelizeStyleName('-moz-transition')
  15422. * < "MozTransition"
  15423. * > camelizeStyleName('-ms-transition')
  15424. * < "msTransition"
  15425. *
  15426. * As Andi Smith suggests
  15427. * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
  15428. * is converted to lowercase `ms`.
  15429. *
  15430. * @param {string} string
  15431. * @return {string}
  15432. */
  15433. function camelizeStyleName(string) {
  15434. return camelize(string.replace(msPattern, 'ms-'));
  15435. }
  15436. module.exports = camelizeStyleName;
  15437. },{"139":139}],141:[function(_dereq_,module,exports){
  15438. 'use strict';
  15439. /**
  15440. * Copyright (c) 2013-present, Facebook, Inc.
  15441. * All rights reserved.
  15442. *
  15443. * This source code is licensed under the BSD-style license found in the
  15444. * LICENSE file in the root directory of this source tree. An additional grant
  15445. * of patent rights can be found in the PATENTS file in the same directory.
  15446. *
  15447. *
  15448. */
  15449. var isTextNode = _dereq_(154);
  15450. /*eslint-disable no-bitwise */
  15451. /**
  15452. * Checks if a given DOM node contains or is another DOM node.
  15453. */
  15454. function containsNode(outerNode, innerNode) {
  15455. if (!outerNode || !innerNode) {
  15456. return false;
  15457. } else if (outerNode === innerNode) {
  15458. return true;
  15459. } else if (isTextNode(outerNode)) {
  15460. return false;
  15461. } else if (isTextNode(innerNode)) {
  15462. return containsNode(outerNode, innerNode.parentNode);
  15463. } else if ('contains' in outerNode) {
  15464. return outerNode.contains(innerNode);
  15465. } else if (outerNode.compareDocumentPosition) {
  15466. return !!(outerNode.compareDocumentPosition(innerNode) & 16);
  15467. } else {
  15468. return false;
  15469. }
  15470. }
  15471. module.exports = containsNode;
  15472. },{"154":154}],142:[function(_dereq_,module,exports){
  15473. 'use strict';
  15474. /**
  15475. * Copyright (c) 2013-present, Facebook, Inc.
  15476. * All rights reserved.
  15477. *
  15478. * This source code is licensed under the BSD-style license found in the
  15479. * LICENSE file in the root directory of this source tree. An additional grant
  15480. * of patent rights can be found in the PATENTS file in the same directory.
  15481. *
  15482. * @typechecks
  15483. */
  15484. var invariant = _dereq_(152);
  15485. /**
  15486. * Convert array-like objects to arrays.
  15487. *
  15488. * This API assumes the caller knows the contents of the data type. For less
  15489. * well defined inputs use createArrayFromMixed.
  15490. *
  15491. * @param {object|function|filelist} obj
  15492. * @return {array}
  15493. */
  15494. function toArray(obj) {
  15495. var length = obj.length;
  15496. // Some browsers builtin objects can report typeof 'function' (e.g. NodeList
  15497. // in old versions of Safari).
  15498. !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? "development" !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0;
  15499. !(typeof length === 'number') ? "development" !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0;
  15500. !(length === 0 || length - 1 in obj) ? "development" !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0;
  15501. !(typeof obj.callee !== 'function') ? "development" !== 'production' ? invariant(false, 'toArray: Object can\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0;
  15502. // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
  15503. // without method will throw during the slice call and skip straight to the
  15504. // fallback.
  15505. if (obj.hasOwnProperty) {
  15506. try {
  15507. return Array.prototype.slice.call(obj);
  15508. } catch (e) {
  15509. // IE < 9 does not support Array#slice on collections objects
  15510. }
  15511. }
  15512. // Fall back to copying key by key. This assumes all keys have a value,
  15513. // so will not preserve sparsely populated inputs.
  15514. var ret = Array(length);
  15515. for (var ii = 0; ii < length; ii++) {
  15516. ret[ii] = obj[ii];
  15517. }
  15518. return ret;
  15519. }
  15520. /**
  15521. * Perform a heuristic test to determine if an object is "array-like".
  15522. *
  15523. * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
  15524. * Joshu replied: "Mu."
  15525. *
  15526. * This function determines if its argument has "array nature": it returns
  15527. * true if the argument is an actual array, an `arguments' object, or an
  15528. * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
  15529. *
  15530. * It will return false for other array-like objects like Filelist.
  15531. *
  15532. * @param {*} obj
  15533. * @return {boolean}
  15534. */
  15535. function hasArrayNature(obj) {
  15536. return (
  15537. // not null/false
  15538. !!obj && (
  15539. // arrays are objects, NodeLists are functions in Safari
  15540. typeof obj == 'object' || typeof obj == 'function') &&
  15541. // quacks like an array
  15542. 'length' in obj &&
  15543. // not window
  15544. !('setInterval' in obj) &&
  15545. // no DOM node should be considered an array-like
  15546. // a 'select' element has 'length' and 'item' properties on IE8
  15547. typeof obj.nodeType != 'number' && (
  15548. // a real array
  15549. Array.isArray(obj) ||
  15550. // arguments
  15551. 'callee' in obj ||
  15552. // HTMLCollection/NodeList
  15553. 'item' in obj)
  15554. );
  15555. }
  15556. /**
  15557. * Ensure that the argument is an array by wrapping it in an array if it is not.
  15558. * Creates a copy of the argument if it is already an array.
  15559. *
  15560. * This is mostly useful idiomatically:
  15561. *
  15562. * var createArrayFromMixed = require('createArrayFromMixed');
  15563. *
  15564. * function takesOneOrMoreThings(things) {
  15565. * things = createArrayFromMixed(things);
  15566. * ...
  15567. * }
  15568. *
  15569. * This allows you to treat `things' as an array, but accept scalars in the API.
  15570. *
  15571. * If you need to convert an array-like object, like `arguments`, into an array
  15572. * use toArray instead.
  15573. *
  15574. * @param {*} obj
  15575. * @return {array}
  15576. */
  15577. function createArrayFromMixed(obj) {
  15578. if (!hasArrayNature(obj)) {
  15579. return [obj];
  15580. } else if (Array.isArray(obj)) {
  15581. return obj.slice();
  15582. } else {
  15583. return toArray(obj);
  15584. }
  15585. }
  15586. module.exports = createArrayFromMixed;
  15587. },{"152":152}],143:[function(_dereq_,module,exports){
  15588. 'use strict';
  15589. /**
  15590. * Copyright (c) 2013-present, Facebook, Inc.
  15591. * All rights reserved.
  15592. *
  15593. * This source code is licensed under the BSD-style license found in the
  15594. * LICENSE file in the root directory of this source tree. An additional grant
  15595. * of patent rights can be found in the PATENTS file in the same directory.
  15596. *
  15597. * @typechecks
  15598. */
  15599. /*eslint-disable fb-www/unsafe-html*/
  15600. var ExecutionEnvironment = _dereq_(138);
  15601. var createArrayFromMixed = _dereq_(142);
  15602. var getMarkupWrap = _dereq_(148);
  15603. var invariant = _dereq_(152);
  15604. /**
  15605. * Dummy container used to render all markup.
  15606. */
  15607. var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  15608. /**
  15609. * Pattern used by `getNodeName`.
  15610. */
  15611. var nodeNamePattern = /^\s*<(\w+)/;
  15612. /**
  15613. * Extracts the `nodeName` of the first element in a string of markup.
  15614. *
  15615. * @param {string} markup String of markup.
  15616. * @return {?string} Node name of the supplied markup.
  15617. */
  15618. function getNodeName(markup) {
  15619. var nodeNameMatch = markup.match(nodeNamePattern);
  15620. return nodeNameMatch && nodeNameMatch[1].toLowerCase();
  15621. }
  15622. /**
  15623. * Creates an array containing the nodes rendered from the supplied markup. The
  15624. * optionally supplied `handleScript` function will be invoked once for each
  15625. * <script> element that is rendered. If no `handleScript` function is supplied,
  15626. * an exception is thrown if any <script> elements are rendered.
  15627. *
  15628. * @param {string} markup A string of valid HTML markup.
  15629. * @param {?function} handleScript Invoked once for each rendered <script>.
  15630. * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
  15631. */
  15632. function createNodesFromMarkup(markup, handleScript) {
  15633. var node = dummyNode;
  15634. !!!dummyNode ? "development" !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0;
  15635. var nodeName = getNodeName(markup);
  15636. var wrap = nodeName && getMarkupWrap(nodeName);
  15637. if (wrap) {
  15638. node.innerHTML = wrap[1] + markup + wrap[2];
  15639. var wrapDepth = wrap[0];
  15640. while (wrapDepth--) {
  15641. node = node.lastChild;
  15642. }
  15643. } else {
  15644. node.innerHTML = markup;
  15645. }
  15646. var scripts = node.getElementsByTagName('script');
  15647. if (scripts.length) {
  15648. !handleScript ? "development" !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0;
  15649. createArrayFromMixed(scripts).forEach(handleScript);
  15650. }
  15651. var nodes = Array.from(node.childNodes);
  15652. while (node.lastChild) {
  15653. node.removeChild(node.lastChild);
  15654. }
  15655. return nodes;
  15656. }
  15657. module.exports = createNodesFromMarkup;
  15658. },{"138":138,"142":142,"148":148,"152":152}],144:[function(_dereq_,module,exports){
  15659. "use strict";
  15660. /**
  15661. * Copyright (c) 2013-present, Facebook, Inc.
  15662. * All rights reserved.
  15663. *
  15664. * This source code is licensed under the BSD-style license found in the
  15665. * LICENSE file in the root directory of this source tree. An additional grant
  15666. * of patent rights can be found in the PATENTS file in the same directory.
  15667. *
  15668. *
  15669. */
  15670. function makeEmptyFunction(arg) {
  15671. return function () {
  15672. return arg;
  15673. };
  15674. }
  15675. /**
  15676. * This function accepts and discards inputs; it has no side effects. This is
  15677. * primarily useful idiomatically for overridable function endpoints which
  15678. * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
  15679. */
  15680. var emptyFunction = function emptyFunction() {};
  15681. emptyFunction.thatReturns = makeEmptyFunction;
  15682. emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
  15683. emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
  15684. emptyFunction.thatReturnsNull = makeEmptyFunction(null);
  15685. emptyFunction.thatReturnsThis = function () {
  15686. return this;
  15687. };
  15688. emptyFunction.thatReturnsArgument = function (arg) {
  15689. return arg;
  15690. };
  15691. module.exports = emptyFunction;
  15692. },{}],145:[function(_dereq_,module,exports){
  15693. /**
  15694. * Copyright (c) 2013-present, Facebook, Inc.
  15695. * All rights reserved.
  15696. *
  15697. * This source code is licensed under the BSD-style license found in the
  15698. * LICENSE file in the root directory of this source tree. An additional grant
  15699. * of patent rights can be found in the PATENTS file in the same directory.
  15700. *
  15701. */
  15702. 'use strict';
  15703. var emptyObject = {};
  15704. if ("development" !== 'production') {
  15705. Object.freeze(emptyObject);
  15706. }
  15707. module.exports = emptyObject;
  15708. },{}],146:[function(_dereq_,module,exports){
  15709. /**
  15710. * Copyright (c) 2013-present, Facebook, Inc.
  15711. * All rights reserved.
  15712. *
  15713. * This source code is licensed under the BSD-style license found in the
  15714. * LICENSE file in the root directory of this source tree. An additional grant
  15715. * of patent rights can be found in the PATENTS file in the same directory.
  15716. *
  15717. */
  15718. 'use strict';
  15719. /**
  15720. * @param {DOMElement} node input/textarea to focus
  15721. */
  15722. function focusNode(node) {
  15723. // IE8 can throw "Can't move focus to the control because it is invisible,
  15724. // not enabled, or of a type that does not accept the focus." for all kinds of
  15725. // reasons that are too expensive and fragile to test.
  15726. try {
  15727. node.focus();
  15728. } catch (e) {}
  15729. }
  15730. module.exports = focusNode;
  15731. },{}],147:[function(_dereq_,module,exports){
  15732. 'use strict';
  15733. /**
  15734. * Copyright (c) 2013-present, Facebook, Inc.
  15735. * All rights reserved.
  15736. *
  15737. * This source code is licensed under the BSD-style license found in the
  15738. * LICENSE file in the root directory of this source tree. An additional grant
  15739. * of patent rights can be found in the PATENTS file in the same directory.
  15740. *
  15741. * @typechecks
  15742. */
  15743. /* eslint-disable fb-www/typeof-undefined */
  15744. /**
  15745. * Same as document.activeElement but wraps in a try-catch block. In IE it is
  15746. * not safe to call document.activeElement if there is nothing focused.
  15747. *
  15748. * The activeElement will be null only if the document or document body is not
  15749. * yet defined.
  15750. *
  15751. * @param {?DOMDocument} doc Defaults to current document.
  15752. * @return {?DOMElement}
  15753. */
  15754. function getActiveElement(doc) /*?DOMElement*/{
  15755. doc = doc || (typeof document !== 'undefined' ? document : undefined);
  15756. if (typeof doc === 'undefined') {
  15757. return null;
  15758. }
  15759. try {
  15760. return doc.activeElement || doc.body;
  15761. } catch (e) {
  15762. return doc.body;
  15763. }
  15764. }
  15765. module.exports = getActiveElement;
  15766. },{}],148:[function(_dereq_,module,exports){
  15767. 'use strict';
  15768. /**
  15769. * Copyright (c) 2013-present, Facebook, Inc.
  15770. * All rights reserved.
  15771. *
  15772. * This source code is licensed under the BSD-style license found in the
  15773. * LICENSE file in the root directory of this source tree. An additional grant
  15774. * of patent rights can be found in the PATENTS file in the same directory.
  15775. *
  15776. */
  15777. /*eslint-disable fb-www/unsafe-html */
  15778. var ExecutionEnvironment = _dereq_(138);
  15779. var invariant = _dereq_(152);
  15780. /**
  15781. * Dummy container used to detect which wraps are necessary.
  15782. */
  15783. var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  15784. /**
  15785. * Some browsers cannot use `innerHTML` to render certain elements standalone,
  15786. * so we wrap them, render the wrapped nodes, then extract the desired node.
  15787. *
  15788. * In IE8, certain elements cannot render alone, so wrap all elements ('*').
  15789. */
  15790. var shouldWrap = {};
  15791. var selectWrap = [1, '<select multiple="true">', '</select>'];
  15792. var tableWrap = [1, '<table>', '</table>'];
  15793. var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
  15794. var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
  15795. var markupWrap = {
  15796. '*': [1, '?<div>', '</div>'],
  15797. 'area': [1, '<map>', '</map>'],
  15798. 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
  15799. 'legend': [1, '<fieldset>', '</fieldset>'],
  15800. 'param': [1, '<object>', '</object>'],
  15801. 'tr': [2, '<table><tbody>', '</tbody></table>'],
  15802. 'optgroup': selectWrap,
  15803. 'option': selectWrap,
  15804. 'caption': tableWrap,
  15805. 'colgroup': tableWrap,
  15806. 'tbody': tableWrap,
  15807. 'tfoot': tableWrap,
  15808. 'thead': tableWrap,
  15809. 'td': trWrap,
  15810. 'th': trWrap
  15811. };
  15812. // Initialize the SVG elements since we know they'll always need to be wrapped
  15813. // consistently. If they are created inside a <div> they will be initialized in
  15814. // the wrong namespace (and will not display).
  15815. var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
  15816. svgElements.forEach(function (nodeName) {
  15817. markupWrap[nodeName] = svgWrap;
  15818. shouldWrap[nodeName] = true;
  15819. });
  15820. /**
  15821. * Gets the markup wrap configuration for the supplied `nodeName`.
  15822. *
  15823. * NOTE: This lazily detects which wraps are necessary for the current browser.
  15824. *
  15825. * @param {string} nodeName Lowercase `nodeName`.
  15826. * @return {?array} Markup wrap configuration, if applicable.
  15827. */
  15828. function getMarkupWrap(nodeName) {
  15829. !!!dummyNode ? "development" !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0;
  15830. if (!markupWrap.hasOwnProperty(nodeName)) {
  15831. nodeName = '*';
  15832. }
  15833. if (!shouldWrap.hasOwnProperty(nodeName)) {
  15834. if (nodeName === '*') {
  15835. dummyNode.innerHTML = '<link />';
  15836. } else {
  15837. dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
  15838. }
  15839. shouldWrap[nodeName] = !dummyNode.firstChild;
  15840. }
  15841. return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
  15842. }
  15843. module.exports = getMarkupWrap;
  15844. },{"138":138,"152":152}],149:[function(_dereq_,module,exports){
  15845. /**
  15846. * Copyright (c) 2013-present, Facebook, Inc.
  15847. * All rights reserved.
  15848. *
  15849. * This source code is licensed under the BSD-style license found in the
  15850. * LICENSE file in the root directory of this source tree. An additional grant
  15851. * of patent rights can be found in the PATENTS file in the same directory.
  15852. *
  15853. * @typechecks
  15854. */
  15855. 'use strict';
  15856. /**
  15857. * Gets the scroll position of the supplied element or window.
  15858. *
  15859. * The return values are unbounded, unlike `getScrollPosition`. This means they
  15860. * may be negative or exceed the element boundaries (which is possible using
  15861. * inertial scrolling).
  15862. *
  15863. * @param {DOMWindow|DOMElement} scrollable
  15864. * @return {object} Map with `x` and `y` keys.
  15865. */
  15866. function getUnboundedScrollPosition(scrollable) {
  15867. if (scrollable.Window && scrollable instanceof scrollable.Window) {
  15868. return {
  15869. x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft,
  15870. y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop
  15871. };
  15872. }
  15873. return {
  15874. x: scrollable.scrollLeft,
  15875. y: scrollable.scrollTop
  15876. };
  15877. }
  15878. module.exports = getUnboundedScrollPosition;
  15879. },{}],150:[function(_dereq_,module,exports){
  15880. 'use strict';
  15881. /**
  15882. * Copyright (c) 2013-present, Facebook, Inc.
  15883. * All rights reserved.
  15884. *
  15885. * This source code is licensed under the BSD-style license found in the
  15886. * LICENSE file in the root directory of this source tree. An additional grant
  15887. * of patent rights can be found in the PATENTS file in the same directory.
  15888. *
  15889. * @typechecks
  15890. */
  15891. var _uppercasePattern = /([A-Z])/g;
  15892. /**
  15893. * Hyphenates a camelcased string, for example:
  15894. *
  15895. * > hyphenate('backgroundColor')
  15896. * < "background-color"
  15897. *
  15898. * For CSS style names, use `hyphenateStyleName` instead which works properly
  15899. * with all vendor prefixes, including `ms`.
  15900. *
  15901. * @param {string} string
  15902. * @return {string}
  15903. */
  15904. function hyphenate(string) {
  15905. return string.replace(_uppercasePattern, '-$1').toLowerCase();
  15906. }
  15907. module.exports = hyphenate;
  15908. },{}],151:[function(_dereq_,module,exports){
  15909. /**
  15910. * Copyright (c) 2013-present, Facebook, Inc.
  15911. * All rights reserved.
  15912. *
  15913. * This source code is licensed under the BSD-style license found in the
  15914. * LICENSE file in the root directory of this source tree. An additional grant
  15915. * of patent rights can be found in the PATENTS file in the same directory.
  15916. *
  15917. * @typechecks
  15918. */
  15919. 'use strict';
  15920. var hyphenate = _dereq_(150);
  15921. var msPattern = /^ms-/;
  15922. /**
  15923. * Hyphenates a camelcased CSS property name, for example:
  15924. *
  15925. * > hyphenateStyleName('backgroundColor')
  15926. * < "background-color"
  15927. * > hyphenateStyleName('MozTransition')
  15928. * < "-moz-transition"
  15929. * > hyphenateStyleName('msTransition')
  15930. * < "-ms-transition"
  15931. *
  15932. * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
  15933. * is converted to `-ms-`.
  15934. *
  15935. * @param {string} string
  15936. * @return {string}
  15937. */
  15938. function hyphenateStyleName(string) {
  15939. return hyphenate(string).replace(msPattern, '-ms-');
  15940. }
  15941. module.exports = hyphenateStyleName;
  15942. },{"150":150}],152:[function(_dereq_,module,exports){
  15943. /**
  15944. * Copyright (c) 2013-present, Facebook, Inc.
  15945. * All rights reserved.
  15946. *
  15947. * This source code is licensed under the BSD-style license found in the
  15948. * LICENSE file in the root directory of this source tree. An additional grant
  15949. * of patent rights can be found in the PATENTS file in the same directory.
  15950. *
  15951. */
  15952. 'use strict';
  15953. /**
  15954. * Use invariant() to assert state which your program assumes to be true.
  15955. *
  15956. * Provide sprintf-style format (only %s is supported) and arguments
  15957. * to provide information about what broke and what you were
  15958. * expecting.
  15959. *
  15960. * The invariant message will be stripped in production, but the invariant
  15961. * will remain to ensure logic does not differ in production.
  15962. */
  15963. var validateFormat = function validateFormat(format) {};
  15964. if ("development" !== 'production') {
  15965. validateFormat = function validateFormat(format) {
  15966. if (format === undefined) {
  15967. throw new Error('invariant requires an error message argument');
  15968. }
  15969. };
  15970. }
  15971. function invariant(condition, format, a, b, c, d, e, f) {
  15972. validateFormat(format);
  15973. if (!condition) {
  15974. var error;
  15975. if (format === undefined) {
  15976. error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
  15977. } else {
  15978. var args = [a, b, c, d, e, f];
  15979. var argIndex = 0;
  15980. error = new Error(format.replace(/%s/g, function () {
  15981. return args[argIndex++];
  15982. }));
  15983. error.name = 'Invariant Violation';
  15984. }
  15985. error.framesToPop = 1; // we don't care about invariant's own frame
  15986. throw error;
  15987. }
  15988. }
  15989. module.exports = invariant;
  15990. },{}],153:[function(_dereq_,module,exports){
  15991. 'use strict';
  15992. /**
  15993. * Copyright (c) 2013-present, Facebook, Inc.
  15994. * All rights reserved.
  15995. *
  15996. * This source code is licensed under the BSD-style license found in the
  15997. * LICENSE file in the root directory of this source tree. An additional grant
  15998. * of patent rights can be found in the PATENTS file in the same directory.
  15999. *
  16000. * @typechecks
  16001. */
  16002. /**
  16003. * @param {*} object The object to check.
  16004. * @return {boolean} Whether or not the object is a DOM node.
  16005. */
  16006. function isNode(object) {
  16007. var doc = object ? object.ownerDocument || object : document;
  16008. var defaultView = doc.defaultView || window;
  16009. return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
  16010. }
  16011. module.exports = isNode;
  16012. },{}],154:[function(_dereq_,module,exports){
  16013. 'use strict';
  16014. /**
  16015. * Copyright (c) 2013-present, Facebook, Inc.
  16016. * All rights reserved.
  16017. *
  16018. * This source code is licensed under the BSD-style license found in the
  16019. * LICENSE file in the root directory of this source tree. An additional grant
  16020. * of patent rights can be found in the PATENTS file in the same directory.
  16021. *
  16022. * @typechecks
  16023. */
  16024. var isNode = _dereq_(153);
  16025. /**
  16026. * @param {*} object The object to check.
  16027. * @return {boolean} Whether or not the object is a DOM text node.
  16028. */
  16029. function isTextNode(object) {
  16030. return isNode(object) && object.nodeType == 3;
  16031. }
  16032. module.exports = isTextNode;
  16033. },{"153":153}],155:[function(_dereq_,module,exports){
  16034. /**
  16035. * Copyright (c) 2013-present, Facebook, Inc.
  16036. * All rights reserved.
  16037. *
  16038. * This source code is licensed under the BSD-style license found in the
  16039. * LICENSE file in the root directory of this source tree. An additional grant
  16040. * of patent rights can be found in the PATENTS file in the same directory.
  16041. *
  16042. *
  16043. * @typechecks static-only
  16044. */
  16045. 'use strict';
  16046. /**
  16047. * Memoizes the return value of a function that accepts one string argument.
  16048. */
  16049. function memoizeStringOnly(callback) {
  16050. var cache = {};
  16051. return function (string) {
  16052. if (!cache.hasOwnProperty(string)) {
  16053. cache[string] = callback.call(this, string);
  16054. }
  16055. return cache[string];
  16056. };
  16057. }
  16058. module.exports = memoizeStringOnly;
  16059. },{}],156:[function(_dereq_,module,exports){
  16060. /**
  16061. * Copyright (c) 2013-present, Facebook, Inc.
  16062. * All rights reserved.
  16063. *
  16064. * This source code is licensed under the BSD-style license found in the
  16065. * LICENSE file in the root directory of this source tree. An additional grant
  16066. * of patent rights can be found in the PATENTS file in the same directory.
  16067. *
  16068. * @typechecks
  16069. */
  16070. 'use strict';
  16071. var ExecutionEnvironment = _dereq_(138);
  16072. var performance;
  16073. if (ExecutionEnvironment.canUseDOM) {
  16074. performance = window.performance || window.msPerformance || window.webkitPerformance;
  16075. }
  16076. module.exports = performance || {};
  16077. },{"138":138}],157:[function(_dereq_,module,exports){
  16078. 'use strict';
  16079. /**
  16080. * Copyright (c) 2013-present, Facebook, Inc.
  16081. * All rights reserved.
  16082. *
  16083. * This source code is licensed under the BSD-style license found in the
  16084. * LICENSE file in the root directory of this source tree. An additional grant
  16085. * of patent rights can be found in the PATENTS file in the same directory.
  16086. *
  16087. * @typechecks
  16088. */
  16089. var performance = _dereq_(156);
  16090. var performanceNow;
  16091. /**
  16092. * Detect if we can use `window.performance.now()` and gracefully fallback to
  16093. * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
  16094. * because of Facebook's testing infrastructure.
  16095. */
  16096. if (performance.now) {
  16097. performanceNow = function performanceNow() {
  16098. return performance.now();
  16099. };
  16100. } else {
  16101. performanceNow = function performanceNow() {
  16102. return Date.now();
  16103. };
  16104. }
  16105. module.exports = performanceNow;
  16106. },{"156":156}],158:[function(_dereq_,module,exports){
  16107. /**
  16108. * Copyright (c) 2013-present, Facebook, Inc.
  16109. * All rights reserved.
  16110. *
  16111. * This source code is licensed under the BSD-style license found in the
  16112. * LICENSE file in the root directory of this source tree. An additional grant
  16113. * of patent rights can be found in the PATENTS file in the same directory.
  16114. *
  16115. * @typechecks
  16116. *
  16117. */
  16118. /*eslint-disable no-self-compare */
  16119. 'use strict';
  16120. var hasOwnProperty = Object.prototype.hasOwnProperty;
  16121. /**
  16122. * inlined Object.is polyfill to avoid requiring consumers ship their own
  16123. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  16124. */
  16125. function is(x, y) {
  16126. // SameValue algorithm
  16127. if (x === y) {
  16128. // Steps 1-5, 7-10
  16129. // Steps 6.b-6.e: +0 != -0
  16130. // Added the nonzero y check to make Flow happy, but it is redundant
  16131. return x !== 0 || y !== 0 || 1 / x === 1 / y;
  16132. } else {
  16133. // Step 6.a: NaN == NaN
  16134. return x !== x && y !== y;
  16135. }
  16136. }
  16137. /**
  16138. * Performs equality by iterating through keys on an object and returning false
  16139. * when any key has values which are not strictly equal between the arguments.
  16140. * Returns true when the values of all keys are strictly equal.
  16141. */
  16142. function shallowEqual(objA, objB) {
  16143. if (is(objA, objB)) {
  16144. return true;
  16145. }
  16146. if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
  16147. return false;
  16148. }
  16149. var keysA = Object.keys(objA);
  16150. var keysB = Object.keys(objB);
  16151. if (keysA.length !== keysB.length) {
  16152. return false;
  16153. }
  16154. // Test for A's keys different from B.
  16155. for (var i = 0; i < keysA.length; i++) {
  16156. if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
  16157. return false;
  16158. }
  16159. }
  16160. return true;
  16161. }
  16162. module.exports = shallowEqual;
  16163. },{}],159:[function(_dereq_,module,exports){
  16164. /**
  16165. * Copyright 2014-2015, Facebook, Inc.
  16166. * All rights reserved.
  16167. *
  16168. * This source code is licensed under the BSD-style license found in the
  16169. * LICENSE file in the root directory of this source tree. An additional grant
  16170. * of patent rights can be found in the PATENTS file in the same directory.
  16171. *
  16172. */
  16173. 'use strict';
  16174. var emptyFunction = _dereq_(144);
  16175. /**
  16176. * Similar to invariant but only logs a warning if the condition is not met.
  16177. * This can be used to log issues in development environments in critical
  16178. * paths. Removing the logging code for production environments will keep the
  16179. * same logic and follow the same code paths.
  16180. */
  16181. var warning = emptyFunction;
  16182. if ("development" !== 'production') {
  16183. (function () {
  16184. var printWarning = function printWarning(format) {
  16185. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  16186. args[_key - 1] = arguments[_key];
  16187. }
  16188. var argIndex = 0;
  16189. var message = 'Warning: ' + format.replace(/%s/g, function () {
  16190. return args[argIndex++];
  16191. });
  16192. if (typeof console !== 'undefined') {
  16193. console.error(message);
  16194. }
  16195. try {
  16196. // --- Welcome to debugging React ---
  16197. // This error was thrown as a convenience so that you can use this stack
  16198. // to find the callsite that caused this warning to fire.
  16199. throw new Error(message);
  16200. } catch (x) {}
  16201. };
  16202. warning = function warning(condition, format) {
  16203. if (format === undefined) {
  16204. throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
  16205. }
  16206. if (format.indexOf('Failed Composite propType: ') === 0) {
  16207. return; // Ignore CompositeComponent proptype check.
  16208. }
  16209. if (!condition) {
  16210. for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
  16211. args[_key2 - 2] = arguments[_key2];
  16212. }
  16213. printWarning.apply(undefined, [format].concat(args));
  16214. }
  16215. };
  16216. })();
  16217. }
  16218. module.exports = warning;
  16219. },{"144":144}],160:[function(_dereq_,module,exports){
  16220. /*
  16221. object-assign
  16222. (c) Sindre Sorhus
  16223. @license MIT
  16224. */
  16225. 'use strict';
  16226. /* eslint-disable no-unused-vars */
  16227. var getOwnPropertySymbols = Object.getOwnPropertySymbols;
  16228. var hasOwnProperty = Object.prototype.hasOwnProperty;
  16229. var propIsEnumerable = Object.prototype.propertyIsEnumerable;
  16230. function toObject(val) {
  16231. if (val === null || val === undefined) {
  16232. throw new TypeError('Object.assign cannot be called with null or undefined');
  16233. }
  16234. return Object(val);
  16235. }
  16236. function shouldUseNative() {
  16237. try {
  16238. if (!Object.assign) {
  16239. return false;
  16240. }
  16241. // Detect buggy property enumeration order in older V8 versions.
  16242. // https://bugs.chromium.org/p/v8/issues/detail?id=4118
  16243. var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
  16244. test1[5] = 'de';
  16245. if (Object.getOwnPropertyNames(test1)[0] === '5') {
  16246. return false;
  16247. }
  16248. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  16249. var test2 = {};
  16250. for (var i = 0; i < 10; i++) {
  16251. test2['_' + String.fromCharCode(i)] = i;
  16252. }
  16253. var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
  16254. return test2[n];
  16255. });
  16256. if (order2.join('') !== '0123456789') {
  16257. return false;
  16258. }
  16259. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  16260. var test3 = {};
  16261. 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
  16262. test3[letter] = letter;
  16263. });
  16264. if (Object.keys(Object.assign({}, test3)).join('') !==
  16265. 'abcdefghijklmnopqrst') {
  16266. return false;
  16267. }
  16268. return true;
  16269. } catch (err) {
  16270. // We don't expect any of the above to throw, but better to be safe.
  16271. return false;
  16272. }
  16273. }
  16274. module.exports = shouldUseNative() ? Object.assign : function (target, source) {
  16275. var from;
  16276. var to = toObject(target);
  16277. var symbols;
  16278. for (var s = 1; s < arguments.length; s++) {
  16279. from = Object(arguments[s]);
  16280. for (var key in from) {
  16281. if (hasOwnProperty.call(from, key)) {
  16282. to[key] = from[key];
  16283. }
  16284. }
  16285. if (getOwnPropertySymbols) {
  16286. symbols = getOwnPropertySymbols(from);
  16287. for (var i = 0; i < symbols.length; i++) {
  16288. if (propIsEnumerable.call(from, symbols[i])) {
  16289. to[symbols[i]] = from[symbols[i]];
  16290. }
  16291. }
  16292. }
  16293. }
  16294. return to;
  16295. };
  16296. },{}],161:[function(_dereq_,module,exports){
  16297. /**
  16298. * Copyright 2013-present, Facebook, Inc.
  16299. * All rights reserved.
  16300. *
  16301. * This source code is licensed under the BSD-style license found in the
  16302. * LICENSE file in the root directory of this source tree. An additional grant
  16303. * of patent rights can be found in the PATENTS file in the same directory.
  16304. */
  16305. 'use strict';
  16306. if ("development" !== 'production') {
  16307. var invariant = _dereq_(152);
  16308. var warning = _dereq_(159);
  16309. var ReactPropTypesSecret = _dereq_(164);
  16310. var loggedTypeFailures = {};
  16311. }
  16312. /**
  16313. * Assert that the values match with the type specs.
  16314. * Error messages are memorized and will only be shown once.
  16315. *
  16316. * @param {object} typeSpecs Map of name to a ReactPropType
  16317. * @param {object} values Runtime values that need to be type-checked
  16318. * @param {string} location e.g. "prop", "context", "child context"
  16319. * @param {string} componentName Name of the component for error messages.
  16320. * @param {?Function} getStack Returns the component stack.
  16321. * @private
  16322. */
  16323. function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
  16324. if ("development" !== 'production') {
  16325. for (var typeSpecName in typeSpecs) {
  16326. if (typeSpecs.hasOwnProperty(typeSpecName)) {
  16327. var error;
  16328. // Prop type validation may throw. In case they do, we don't want to
  16329. // fail the render phase where it didn't fail before. So we log it.
  16330. // After these have been cleaned up, we'll let them throw.
  16331. try {
  16332. // This is intentionally an invariant that gets caught. It's the same
  16333. // behavior as without this statement except with a better message.
  16334. invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', location, typeSpecName);
  16335. error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
  16336. } catch (ex) {
  16337. error = ex;
  16338. }
  16339. 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', location, typeSpecName, typeof error);
  16340. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  16341. // Only monitor this failure once because there tends to be a lot of the
  16342. // same error.
  16343. loggedTypeFailures[error.message] = true;
  16344. var stack = getStack ? getStack() : '';
  16345. warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
  16346. }
  16347. }
  16348. }
  16349. }
  16350. }
  16351. module.exports = checkPropTypes;
  16352. },{"152":152,"159":159,"164":164}],162:[function(_dereq_,module,exports){
  16353. /**
  16354. * Copyright 2013-present, Facebook, Inc.
  16355. * All rights reserved.
  16356. *
  16357. * This source code is licensed under the BSD-style license found in the
  16358. * LICENSE file in the root directory of this source tree. An additional grant
  16359. * of patent rights can be found in the PATENTS file in the same directory.
  16360. */
  16361. 'use strict';
  16362. // React 15.5 references this module, and assumes PropTypes are still callable in production.
  16363. // Therefore we re-export development-only version with all the PropTypes checks here.
  16364. // However if one is migrating to the `prop-types` npm library, they will go through the
  16365. // `index.js` entry point, and it will branch depending on the environment.
  16366. var factory = _dereq_(163);
  16367. module.exports = function(isValidElement) {
  16368. // It is still allowed in 15.5.
  16369. var throwOnDirectAccess = false;
  16370. return factory(isValidElement, throwOnDirectAccess);
  16371. };
  16372. },{"163":163}],163:[function(_dereq_,module,exports){
  16373. /**
  16374. * Copyright 2013-present, Facebook, Inc.
  16375. * All rights reserved.
  16376. *
  16377. * This source code is licensed under the BSD-style license found in the
  16378. * LICENSE file in the root directory of this source tree. An additional grant
  16379. * of patent rights can be found in the PATENTS file in the same directory.
  16380. */
  16381. 'use strict';
  16382. var emptyFunction = _dereq_(144);
  16383. var invariant = _dereq_(152);
  16384. var warning = _dereq_(159);
  16385. var ReactPropTypesSecret = _dereq_(164);
  16386. var checkPropTypes = _dereq_(161);
  16387. module.exports = function(isValidElement, throwOnDirectAccess) {
  16388. /* global Symbol */
  16389. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  16390. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  16391. /**
  16392. * Returns the iterator method function contained on the iterable object.
  16393. *
  16394. * Be sure to invoke the function with the iterable as context:
  16395. *
  16396. * var iteratorFn = getIteratorFn(myIterable);
  16397. * if (iteratorFn) {
  16398. * var iterator = iteratorFn.call(myIterable);
  16399. * ...
  16400. * }
  16401. *
  16402. * @param {?object} maybeIterable
  16403. * @return {?function}
  16404. */
  16405. function getIteratorFn(maybeIterable) {
  16406. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  16407. if (typeof iteratorFn === 'function') {
  16408. return iteratorFn;
  16409. }
  16410. }
  16411. /**
  16412. * Collection of methods that allow declaration and validation of props that are
  16413. * supplied to React components. Example usage:
  16414. *
  16415. * var Props = require('ReactPropTypes');
  16416. * var MyArticle = React.createClass({
  16417. * propTypes: {
  16418. * // An optional string prop named "description".
  16419. * description: Props.string,
  16420. *
  16421. * // A required enum prop named "category".
  16422. * category: Props.oneOf(['News','Photos']).isRequired,
  16423. *
  16424. * // A prop named "dialog" that requires an instance of Dialog.
  16425. * dialog: Props.instanceOf(Dialog).isRequired
  16426. * },
  16427. * render: function() { ... }
  16428. * });
  16429. *
  16430. * A more formal specification of how these methods are used:
  16431. *
  16432. * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
  16433. * decl := ReactPropTypes.{type}(.isRequired)?
  16434. *
  16435. * Each and every declaration produces a function with the same signature. This
  16436. * allows the creation of custom validation functions. For example:
  16437. *
  16438. * var MyLink = React.createClass({
  16439. * propTypes: {
  16440. * // An optional string or URI prop named "href".
  16441. * href: function(props, propName, componentName) {
  16442. * var propValue = props[propName];
  16443. * if (propValue != null && typeof propValue !== 'string' &&
  16444. * !(propValue instanceof URI)) {
  16445. * return new Error(
  16446. * 'Expected a string or an URI for ' + propName + ' in ' +
  16447. * componentName
  16448. * );
  16449. * }
  16450. * }
  16451. * },
  16452. * render: function() {...}
  16453. * });
  16454. *
  16455. * @internal
  16456. */
  16457. var ANONYMOUS = '<<anonymous>>';
  16458. // Important!
  16459. // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
  16460. var ReactPropTypes = {
  16461. array: createPrimitiveTypeChecker('array'),
  16462. bool: createPrimitiveTypeChecker('boolean'),
  16463. func: createPrimitiveTypeChecker('function'),
  16464. number: createPrimitiveTypeChecker('number'),
  16465. object: createPrimitiveTypeChecker('object'),
  16466. string: createPrimitiveTypeChecker('string'),
  16467. symbol: createPrimitiveTypeChecker('symbol'),
  16468. any: createAnyTypeChecker(),
  16469. arrayOf: createArrayOfTypeChecker,
  16470. element: createElementTypeChecker(),
  16471. instanceOf: createInstanceTypeChecker,
  16472. node: createNodeChecker(),
  16473. objectOf: createObjectOfTypeChecker,
  16474. oneOf: createEnumTypeChecker,
  16475. oneOfType: createUnionTypeChecker,
  16476. shape: createShapeTypeChecker
  16477. };
  16478. /**
  16479. * inlined Object.is polyfill to avoid requiring consumers ship their own
  16480. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  16481. */
  16482. /*eslint-disable no-self-compare*/
  16483. function is(x, y) {
  16484. // SameValue algorithm
  16485. if (x === y) {
  16486. // Steps 1-5, 7-10
  16487. // Steps 6.b-6.e: +0 != -0
  16488. return x !== 0 || 1 / x === 1 / y;
  16489. } else {
  16490. // Step 6.a: NaN == NaN
  16491. return x !== x && y !== y;
  16492. }
  16493. }
  16494. /*eslint-enable no-self-compare*/
  16495. /**
  16496. * We use an Error-like object for backward compatibility as people may call
  16497. * PropTypes directly and inspect their output. However, we don't use real
  16498. * Errors anymore. We don't inspect their stack anyway, and creating them
  16499. * is prohibitively expensive if they are created too often, such as what
  16500. * happens in oneOfType() for any type before the one that matched.
  16501. */
  16502. function PropTypeError(message) {
  16503. this.message = message;
  16504. this.stack = '';
  16505. }
  16506. // Make `instanceof Error` still work for returned errors.
  16507. PropTypeError.prototype = Error.prototype;
  16508. function createChainableTypeChecker(validate) {
  16509. if ("development" !== 'production') {
  16510. var manualPropTypeCallCache = {};
  16511. var manualPropTypeWarningCount = 0;
  16512. }
  16513. function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
  16514. componentName = componentName || ANONYMOUS;
  16515. propFullName = propFullName || propName;
  16516. if (secret !== ReactPropTypesSecret) {
  16517. if (throwOnDirectAccess) {
  16518. // New behavior only for users of `prop-types` package
  16519. invariant(
  16520. false,
  16521. 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
  16522. 'Use `PropTypes.checkPropTypes()` to call them. ' +
  16523. 'Read more at http://fb.me/use-check-prop-types'
  16524. );
  16525. } else if ("development" !== 'production' && typeof console !== 'undefined') {
  16526. // Old behavior for people using React.PropTypes
  16527. var cacheKey = componentName + ':' + propName;
  16528. if (
  16529. !manualPropTypeCallCache[cacheKey] &&
  16530. // Avoid spamming the console because they are often not actionable except for lib authors
  16531. manualPropTypeWarningCount < 3
  16532. ) {
  16533. warning(
  16534. false,
  16535. 'You are manually calling a React.PropTypes validation ' +
  16536. 'function for the `%s` prop on `%s`. This is deprecated ' +
  16537. 'and will throw in the standalone `prop-types` package. ' +
  16538. 'You may be seeing this warning due to a third-party PropTypes ' +
  16539. 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
  16540. propFullName,
  16541. componentName
  16542. );
  16543. manualPropTypeCallCache[cacheKey] = true;
  16544. manualPropTypeWarningCount++;
  16545. }
  16546. }
  16547. }
  16548. if (props[propName] == null) {
  16549. if (isRequired) {
  16550. if (props[propName] === null) {
  16551. return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
  16552. }
  16553. return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
  16554. }
  16555. return null;
  16556. } else {
  16557. return validate(props, propName, componentName, location, propFullName);
  16558. }
  16559. }
  16560. var chainedCheckType = checkType.bind(null, false);
  16561. chainedCheckType.isRequired = checkType.bind(null, true);
  16562. return chainedCheckType;
  16563. }
  16564. function createPrimitiveTypeChecker(expectedType) {
  16565. function validate(props, propName, componentName, location, propFullName, secret) {
  16566. var propValue = props[propName];
  16567. var propType = getPropType(propValue);
  16568. if (propType !== expectedType) {
  16569. // `propValue` being instance of, say, date/regexp, pass the 'object'
  16570. // check, but we can offer a more precise error message here rather than
  16571. // 'of type `object`'.
  16572. var preciseType = getPreciseType(propValue);
  16573. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
  16574. }
  16575. return null;
  16576. }
  16577. return createChainableTypeChecker(validate);
  16578. }
  16579. function createAnyTypeChecker() {
  16580. return createChainableTypeChecker(emptyFunction.thatReturnsNull);
  16581. }
  16582. function createArrayOfTypeChecker(typeChecker) {
  16583. function validate(props, propName, componentName, location, propFullName) {
  16584. if (typeof typeChecker !== 'function') {
  16585. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
  16586. }
  16587. var propValue = props[propName];
  16588. if (!Array.isArray(propValue)) {
  16589. var propType = getPropType(propValue);
  16590. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
  16591. }
  16592. for (var i = 0; i < propValue.length; i++) {
  16593. var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
  16594. if (error instanceof Error) {
  16595. return error;
  16596. }
  16597. }
  16598. return null;
  16599. }
  16600. return createChainableTypeChecker(validate);
  16601. }
  16602. function createElementTypeChecker() {
  16603. function validate(props, propName, componentName, location, propFullName) {
  16604. var propValue = props[propName];
  16605. if (!isValidElement(propValue)) {
  16606. var propType = getPropType(propValue);
  16607. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
  16608. }
  16609. return null;
  16610. }
  16611. return createChainableTypeChecker(validate);
  16612. }
  16613. function createInstanceTypeChecker(expectedClass) {
  16614. function validate(props, propName, componentName, location, propFullName) {
  16615. if (!(props[propName] instanceof expectedClass)) {
  16616. var expectedClassName = expectedClass.name || ANONYMOUS;
  16617. var actualClassName = getClassName(props[propName]);
  16618. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
  16619. }
  16620. return null;
  16621. }
  16622. return createChainableTypeChecker(validate);
  16623. }
  16624. function createEnumTypeChecker(expectedValues) {
  16625. if (!Array.isArray(expectedValues)) {
  16626. "development" !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
  16627. return emptyFunction.thatReturnsNull;
  16628. }
  16629. function validate(props, propName, componentName, location, propFullName) {
  16630. var propValue = props[propName];
  16631. for (var i = 0; i < expectedValues.length; i++) {
  16632. if (is(propValue, expectedValues[i])) {
  16633. return null;
  16634. }
  16635. }
  16636. var valuesString = JSON.stringify(expectedValues);
  16637. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
  16638. }
  16639. return createChainableTypeChecker(validate);
  16640. }
  16641. function createObjectOfTypeChecker(typeChecker) {
  16642. function validate(props, propName, componentName, location, propFullName) {
  16643. if (typeof typeChecker !== 'function') {
  16644. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
  16645. }
  16646. var propValue = props[propName];
  16647. var propType = getPropType(propValue);
  16648. if (propType !== 'object') {
  16649. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
  16650. }
  16651. for (var key in propValue) {
  16652. if (propValue.hasOwnProperty(key)) {
  16653. var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  16654. if (error instanceof Error) {
  16655. return error;
  16656. }
  16657. }
  16658. }
  16659. return null;
  16660. }
  16661. return createChainableTypeChecker(validate);
  16662. }
  16663. function createUnionTypeChecker(arrayOfTypeCheckers) {
  16664. if (!Array.isArray(arrayOfTypeCheckers)) {
  16665. "development" !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
  16666. return emptyFunction.thatReturnsNull;
  16667. }
  16668. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  16669. var checker = arrayOfTypeCheckers[i];
  16670. if (typeof checker !== 'function') {
  16671. warning(
  16672. false,
  16673. 'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' +
  16674. 'received %s at index %s.',
  16675. getPostfixForTypeWarning(checker),
  16676. i
  16677. );
  16678. return emptyFunction.thatReturnsNull;
  16679. }
  16680. }
  16681. function validate(props, propName, componentName, location, propFullName) {
  16682. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  16683. var checker = arrayOfTypeCheckers[i];
  16684. if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
  16685. return null;
  16686. }
  16687. }
  16688. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
  16689. }
  16690. return createChainableTypeChecker(validate);
  16691. }
  16692. function createNodeChecker() {
  16693. function validate(props, propName, componentName, location, propFullName) {
  16694. if (!isNode(props[propName])) {
  16695. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
  16696. }
  16697. return null;
  16698. }
  16699. return createChainableTypeChecker(validate);
  16700. }
  16701. function createShapeTypeChecker(shapeTypes) {
  16702. function validate(props, propName, componentName, location, propFullName) {
  16703. var propValue = props[propName];
  16704. var propType = getPropType(propValue);
  16705. if (propType !== 'object') {
  16706. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
  16707. }
  16708. for (var key in shapeTypes) {
  16709. var checker = shapeTypes[key];
  16710. if (!checker) {
  16711. continue;
  16712. }
  16713. var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  16714. if (error) {
  16715. return error;
  16716. }
  16717. }
  16718. return null;
  16719. }
  16720. return createChainableTypeChecker(validate);
  16721. }
  16722. function isNode(propValue) {
  16723. switch (typeof propValue) {
  16724. case 'number':
  16725. case 'string':
  16726. case 'undefined':
  16727. return true;
  16728. case 'boolean':
  16729. return !propValue;
  16730. case 'object':
  16731. if (Array.isArray(propValue)) {
  16732. return propValue.every(isNode);
  16733. }
  16734. if (propValue === null || isValidElement(propValue)) {
  16735. return true;
  16736. }
  16737. var iteratorFn = getIteratorFn(propValue);
  16738. if (iteratorFn) {
  16739. var iterator = iteratorFn.call(propValue);
  16740. var step;
  16741. if (iteratorFn !== propValue.entries) {
  16742. while (!(step = iterator.next()).done) {
  16743. if (!isNode(step.value)) {
  16744. return false;
  16745. }
  16746. }
  16747. } else {
  16748. // Iterator will provide entry [k,v] tuples rather than values.
  16749. while (!(step = iterator.next()).done) {
  16750. var entry = step.value;
  16751. if (entry) {
  16752. if (!isNode(entry[1])) {
  16753. return false;
  16754. }
  16755. }
  16756. }
  16757. }
  16758. } else {
  16759. return false;
  16760. }
  16761. return true;
  16762. default:
  16763. return false;
  16764. }
  16765. }
  16766. function isSymbol(propType, propValue) {
  16767. // Native Symbol.
  16768. if (propType === 'symbol') {
  16769. return true;
  16770. }
  16771. // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
  16772. if (propValue['@@toStringTag'] === 'Symbol') {
  16773. return true;
  16774. }
  16775. // Fallback for non-spec compliant Symbols which are polyfilled.
  16776. if (typeof Symbol === 'function' && propValue instanceof Symbol) {
  16777. return true;
  16778. }
  16779. return false;
  16780. }
  16781. // Equivalent of `typeof` but with special handling for array and regexp.
  16782. function getPropType(propValue) {
  16783. var propType = typeof propValue;
  16784. if (Array.isArray(propValue)) {
  16785. return 'array';
  16786. }
  16787. if (propValue instanceof RegExp) {
  16788. // Old webkits (at least until Android 4.0) return 'function' rather than
  16789. // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
  16790. // passes PropTypes.object.
  16791. return 'object';
  16792. }
  16793. if (isSymbol(propType, propValue)) {
  16794. return 'symbol';
  16795. }
  16796. return propType;
  16797. }
  16798. // This handles more types than `getPropType`. Only used for error messages.
  16799. // See `createPrimitiveTypeChecker`.
  16800. function getPreciseType(propValue) {
  16801. if (typeof propValue === 'undefined' || propValue === null) {
  16802. return '' + propValue;
  16803. }
  16804. var propType = getPropType(propValue);
  16805. if (propType === 'object') {
  16806. if (propValue instanceof Date) {
  16807. return 'date';
  16808. } else if (propValue instanceof RegExp) {
  16809. return 'regexp';
  16810. }
  16811. }
  16812. return propType;
  16813. }
  16814. // Returns a string that is postfixed to a warning about an invalid type.
  16815. // For example, "undefined" or "of type array"
  16816. function getPostfixForTypeWarning(value) {
  16817. var type = getPreciseType(value);
  16818. switch (type) {
  16819. case 'array':
  16820. case 'object':
  16821. return 'an ' + type;
  16822. case 'boolean':
  16823. case 'date':
  16824. case 'regexp':
  16825. return 'a ' + type;
  16826. default:
  16827. return type;
  16828. }
  16829. }
  16830. // Returns class name of the object, if any.
  16831. function getClassName(propValue) {
  16832. if (!propValue.constructor || !propValue.constructor.name) {
  16833. return ANONYMOUS;
  16834. }
  16835. return propValue.constructor.name;
  16836. }
  16837. ReactPropTypes.checkPropTypes = checkPropTypes;
  16838. ReactPropTypes.PropTypes = ReactPropTypes;
  16839. return ReactPropTypes;
  16840. };
  16841. },{"144":144,"152":152,"159":159,"161":161,"164":164}],164:[function(_dereq_,module,exports){
  16842. /**
  16843. * Copyright 2013-present, Facebook, Inc.
  16844. * All rights reserved.
  16845. *
  16846. * This source code is licensed under the BSD-style license found in the
  16847. * LICENSE file in the root directory of this source tree. An additional grant
  16848. * of patent rights can be found in the PATENTS file in the same directory.
  16849. */
  16850. 'use strict';
  16851. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  16852. module.exports = ReactPropTypesSecret;
  16853. },{}]},{},[48])(48)
  16854. });
  16855. });