react.js 133 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987
  1. /**
  2. * React v15.5.4
  3. */
  4. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
  5. /**
  6. * Copyright 2013-present, Facebook, Inc.
  7. * All rights reserved.
  8. *
  9. * This source code is licensed under the BSD-style license found in the
  10. * LICENSE file in the root directory of this source tree. An additional grant
  11. * of patent rights can be found in the PATENTS file in the same directory.
  12. *
  13. *
  14. */
  15. 'use strict';
  16. /**
  17. * Escape and wrap key so it is safe to use as a reactid
  18. *
  19. * @param {string} key to be escaped.
  20. * @return {string} the escaped key.
  21. */
  22. function escape(key) {
  23. var escapeRegex = /[=:]/g;
  24. var escaperLookup = {
  25. '=': '=0',
  26. ':': '=2'
  27. };
  28. var escapedString = ('' + key).replace(escapeRegex, function (match) {
  29. return escaperLookup[match];
  30. });
  31. return '$' + escapedString;
  32. }
  33. /**
  34. * Unescape and unwrap key for human-readable display
  35. *
  36. * @param {string} key to unescape.
  37. * @return {string} the unescaped key.
  38. */
  39. function unescape(key) {
  40. var unescapeRegex = /(=0|=2)/g;
  41. var unescaperLookup = {
  42. '=0': '=',
  43. '=2': ':'
  44. };
  45. var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
  46. return ('' + keySubstring).replace(unescapeRegex, function (match) {
  47. return unescaperLookup[match];
  48. });
  49. }
  50. var KeyEscapeUtils = {
  51. escape: escape,
  52. unescape: unescape
  53. };
  54. module.exports = KeyEscapeUtils;
  55. },{}],2:[function(_dereq_,module,exports){
  56. /**
  57. * Copyright 2013-present, Facebook, Inc.
  58. * All rights reserved.
  59. *
  60. * This source code is licensed under the BSD-style license found in the
  61. * LICENSE file in the root directory of this source tree. An additional grant
  62. * of patent rights can be found in the PATENTS file in the same directory.
  63. *
  64. *
  65. */
  66. 'use strict';
  67. var _prodInvariant = _dereq_(25);
  68. var invariant = _dereq_(29);
  69. /**
  70. * Static poolers. Several custom versions for each potential number of
  71. * arguments. A completely generic pooler is easy to implement, but would
  72. * require accessing the `arguments` object. In each of these, `this` refers to
  73. * the Class itself, not an instance. If any others are needed, simply add them
  74. * here, or in their own files.
  75. */
  76. var oneArgumentPooler = function (copyFieldsFrom) {
  77. var Klass = this;
  78. if (Klass.instancePool.length) {
  79. var instance = Klass.instancePool.pop();
  80. Klass.call(instance, copyFieldsFrom);
  81. return instance;
  82. } else {
  83. return new Klass(copyFieldsFrom);
  84. }
  85. };
  86. var twoArgumentPooler = function (a1, a2) {
  87. var Klass = this;
  88. if (Klass.instancePool.length) {
  89. var instance = Klass.instancePool.pop();
  90. Klass.call(instance, a1, a2);
  91. return instance;
  92. } else {
  93. return new Klass(a1, a2);
  94. }
  95. };
  96. var threeArgumentPooler = function (a1, a2, a3) {
  97. var Klass = this;
  98. if (Klass.instancePool.length) {
  99. var instance = Klass.instancePool.pop();
  100. Klass.call(instance, a1, a2, a3);
  101. return instance;
  102. } else {
  103. return new Klass(a1, a2, a3);
  104. }
  105. };
  106. var fourArgumentPooler = function (a1, a2, a3, a4) {
  107. var Klass = this;
  108. if (Klass.instancePool.length) {
  109. var instance = Klass.instancePool.pop();
  110. Klass.call(instance, a1, a2, a3, a4);
  111. return instance;
  112. } else {
  113. return new Klass(a1, a2, a3, a4);
  114. }
  115. };
  116. var standardReleaser = function (instance) {
  117. var Klass = this;
  118. !(instance instanceof Klass) ? "development" !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
  119. instance.destructor();
  120. if (Klass.instancePool.length < Klass.poolSize) {
  121. Klass.instancePool.push(instance);
  122. }
  123. };
  124. var DEFAULT_POOL_SIZE = 10;
  125. var DEFAULT_POOLER = oneArgumentPooler;
  126. /**
  127. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  128. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  129. * you give this may have a `poolSize` property, and will look for a
  130. * prototypical `destructor` on instances.
  131. *
  132. * @param {Function} CopyConstructor Constructor that can be used to reset.
  133. * @param {Function} pooler Customizable pooler.
  134. */
  135. var addPoolingTo = function (CopyConstructor, pooler) {
  136. // Casting as any so that flow ignores the actual implementation and trusts
  137. // it to match the type we declared
  138. var NewKlass = CopyConstructor;
  139. NewKlass.instancePool = [];
  140. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  141. if (!NewKlass.poolSize) {
  142. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  143. }
  144. NewKlass.release = standardReleaser;
  145. return NewKlass;
  146. };
  147. var PooledClass = {
  148. addPoolingTo: addPoolingTo,
  149. oneArgumentPooler: oneArgumentPooler,
  150. twoArgumentPooler: twoArgumentPooler,
  151. threeArgumentPooler: threeArgumentPooler,
  152. fourArgumentPooler: fourArgumentPooler
  153. };
  154. module.exports = PooledClass;
  155. },{"25":25,"29":29}],3:[function(_dereq_,module,exports){
  156. /**
  157. * Copyright 2013-present, Facebook, Inc.
  158. * All rights reserved.
  159. *
  160. * This source code is licensed under the BSD-style license found in the
  161. * LICENSE file in the root directory of this source tree. An additional grant
  162. * of patent rights can be found in the PATENTS file in the same directory.
  163. *
  164. */
  165. 'use strict';
  166. var _assign = _dereq_(31);
  167. var ReactChildren = _dereq_(4);
  168. var ReactComponent = _dereq_(6);
  169. var ReactPureComponent = _dereq_(17);
  170. var ReactClass = _dereq_(5);
  171. var ReactDOMFactories = _dereq_(9);
  172. var ReactElement = _dereq_(10);
  173. var ReactPropTypes = _dereq_(15);
  174. var ReactVersion = _dereq_(19);
  175. var onlyChild = _dereq_(24);
  176. var warning = _dereq_(30);
  177. var createElement = ReactElement.createElement;
  178. var createFactory = ReactElement.createFactory;
  179. var cloneElement = ReactElement.cloneElement;
  180. if ("development" !== 'production') {
  181. var canDefineProperty = _dereq_(20);
  182. var ReactElementValidator = _dereq_(12);
  183. var didWarnPropTypesDeprecated = false;
  184. createElement = ReactElementValidator.createElement;
  185. createFactory = ReactElementValidator.createFactory;
  186. cloneElement = ReactElementValidator.cloneElement;
  187. }
  188. var __spread = _assign;
  189. if ("development" !== 'production') {
  190. var warned = false;
  191. __spread = function () {
  192. "development" !== 'production' ? warning(warned, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.') : void 0;
  193. warned = true;
  194. return _assign.apply(null, arguments);
  195. };
  196. }
  197. var React = {
  198. // Modern
  199. Children: {
  200. map: ReactChildren.map,
  201. forEach: ReactChildren.forEach,
  202. count: ReactChildren.count,
  203. toArray: ReactChildren.toArray,
  204. only: onlyChild
  205. },
  206. Component: ReactComponent,
  207. PureComponent: ReactPureComponent,
  208. createElement: createElement,
  209. cloneElement: cloneElement,
  210. isValidElement: ReactElement.isValidElement,
  211. // Classic
  212. PropTypes: ReactPropTypes,
  213. createClass: ReactClass.createClass,
  214. createFactory: createFactory,
  215. createMixin: function (mixin) {
  216. // Currently a noop. Will be used to validate and trace mixins.
  217. return mixin;
  218. },
  219. // This looks DOM specific but these are actually isomorphic helpers
  220. // since they are just generating DOM strings.
  221. DOM: ReactDOMFactories,
  222. version: ReactVersion,
  223. // Deprecated hook for JSX spread, don't use this for anything.
  224. __spread: __spread
  225. };
  226. // TODO: Fix tests so that this deprecation warning doesn't cause failures.
  227. if ("development" !== 'production') {
  228. if (canDefineProperty) {
  229. Object.defineProperty(React, 'PropTypes', {
  230. get: function () {
  231. "development" !== 'production' ? warning(didWarnPropTypesDeprecated, 'Accessing PropTypes via the main React package is deprecated. Use ' + 'the prop-types package from npm instead.') : void 0;
  232. didWarnPropTypesDeprecated = true;
  233. return ReactPropTypes;
  234. }
  235. });
  236. }
  237. }
  238. module.exports = React;
  239. },{"10":10,"12":12,"15":15,"17":17,"19":19,"20":20,"24":24,"30":30,"31":31,"4":4,"5":5,"6":6,"9":9}],4:[function(_dereq_,module,exports){
  240. /**
  241. * Copyright 2013-present, Facebook, Inc.
  242. * All rights reserved.
  243. *
  244. * This source code is licensed under the BSD-style license found in the
  245. * LICENSE file in the root directory of this source tree. An additional grant
  246. * of patent rights can be found in the PATENTS file in the same directory.
  247. *
  248. */
  249. 'use strict';
  250. var PooledClass = _dereq_(2);
  251. var ReactElement = _dereq_(10);
  252. var emptyFunction = _dereq_(27);
  253. var traverseAllChildren = _dereq_(26);
  254. var twoArgumentPooler = PooledClass.twoArgumentPooler;
  255. var fourArgumentPooler = PooledClass.fourArgumentPooler;
  256. var userProvidedKeyEscapeRegex = /\/+/g;
  257. function escapeUserProvidedKey(text) {
  258. return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
  259. }
  260. /**
  261. * PooledClass representing the bookkeeping associated with performing a child
  262. * traversal. Allows avoiding binding callbacks.
  263. *
  264. * @constructor ForEachBookKeeping
  265. * @param {!function} forEachFunction Function to perform traversal with.
  266. * @param {?*} forEachContext Context to perform context with.
  267. */
  268. function ForEachBookKeeping(forEachFunction, forEachContext) {
  269. this.func = forEachFunction;
  270. this.context = forEachContext;
  271. this.count = 0;
  272. }
  273. ForEachBookKeeping.prototype.destructor = function () {
  274. this.func = null;
  275. this.context = null;
  276. this.count = 0;
  277. };
  278. PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
  279. function forEachSingleChild(bookKeeping, child, name) {
  280. var func = bookKeeping.func,
  281. context = bookKeeping.context;
  282. func.call(context, child, bookKeeping.count++);
  283. }
  284. /**
  285. * Iterates through children that are typically specified as `props.children`.
  286. *
  287. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach
  288. *
  289. * The provided forEachFunc(child, index) will be called for each
  290. * leaf child.
  291. *
  292. * @param {?*} children Children tree container.
  293. * @param {function(*, int)} forEachFunc
  294. * @param {*} forEachContext Context for forEachContext.
  295. */
  296. function forEachChildren(children, forEachFunc, forEachContext) {
  297. if (children == null) {
  298. return children;
  299. }
  300. var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
  301. traverseAllChildren(children, forEachSingleChild, traverseContext);
  302. ForEachBookKeeping.release(traverseContext);
  303. }
  304. /**
  305. * PooledClass representing the bookkeeping associated with performing a child
  306. * mapping. Allows avoiding binding callbacks.
  307. *
  308. * @constructor MapBookKeeping
  309. * @param {!*} mapResult Object containing the ordered map of results.
  310. * @param {!function} mapFunction Function to perform mapping with.
  311. * @param {?*} mapContext Context to perform mapping with.
  312. */
  313. function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
  314. this.result = mapResult;
  315. this.keyPrefix = keyPrefix;
  316. this.func = mapFunction;
  317. this.context = mapContext;
  318. this.count = 0;
  319. }
  320. MapBookKeeping.prototype.destructor = function () {
  321. this.result = null;
  322. this.keyPrefix = null;
  323. this.func = null;
  324. this.context = null;
  325. this.count = 0;
  326. };
  327. PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
  328. function mapSingleChildIntoContext(bookKeeping, child, childKey) {
  329. var result = bookKeeping.result,
  330. keyPrefix = bookKeeping.keyPrefix,
  331. func = bookKeeping.func,
  332. context = bookKeeping.context;
  333. var mappedChild = func.call(context, child, bookKeeping.count++);
  334. if (Array.isArray(mappedChild)) {
  335. mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
  336. } else if (mappedChild != null) {
  337. if (ReactElement.isValidElement(mappedChild)) {
  338. mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
  339. // Keep both the (mapped) and old keys if they differ, just as
  340. // traverseAllChildren used to do for objects as children
  341. keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
  342. }
  343. result.push(mappedChild);
  344. }
  345. }
  346. function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
  347. var escapedPrefix = '';
  348. if (prefix != null) {
  349. escapedPrefix = escapeUserProvidedKey(prefix) + '/';
  350. }
  351. var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
  352. traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
  353. MapBookKeeping.release(traverseContext);
  354. }
  355. /**
  356. * Maps children that are typically specified as `props.children`.
  357. *
  358. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.map
  359. *
  360. * The provided mapFunction(child, key, index) will be called for each
  361. * leaf child.
  362. *
  363. * @param {?*} children Children tree container.
  364. * @param {function(*, int)} func The map function.
  365. * @param {*} context Context for mapFunction.
  366. * @return {object} Object containing the ordered map of results.
  367. */
  368. function mapChildren(children, func, context) {
  369. if (children == null) {
  370. return children;
  371. }
  372. var result = [];
  373. mapIntoWithKeyPrefixInternal(children, result, null, func, context);
  374. return result;
  375. }
  376. function forEachSingleChildDummy(traverseContext, child, name) {
  377. return null;
  378. }
  379. /**
  380. * Count the number of children that are typically specified as
  381. * `props.children`.
  382. *
  383. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.count
  384. *
  385. * @param {?*} children Children tree container.
  386. * @return {number} The number of children.
  387. */
  388. function countChildren(children, context) {
  389. return traverseAllChildren(children, forEachSingleChildDummy, null);
  390. }
  391. /**
  392. * Flatten a children object (typically specified as `props.children`) and
  393. * return an array with appropriately re-keyed children.
  394. *
  395. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray
  396. */
  397. function toArray(children) {
  398. var result = [];
  399. mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
  400. return result;
  401. }
  402. var ReactChildren = {
  403. forEach: forEachChildren,
  404. map: mapChildren,
  405. mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
  406. count: countChildren,
  407. toArray: toArray
  408. };
  409. module.exports = ReactChildren;
  410. },{"10":10,"2":2,"26":26,"27":27}],5:[function(_dereq_,module,exports){
  411. /**
  412. * Copyright 2013-present, Facebook, Inc.
  413. * All rights reserved.
  414. *
  415. * This source code is licensed under the BSD-style license found in the
  416. * LICENSE file in the root directory of this source tree. An additional grant
  417. * of patent rights can be found in the PATENTS file in the same directory.
  418. *
  419. */
  420. 'use strict';
  421. var _prodInvariant = _dereq_(25),
  422. _assign = _dereq_(31);
  423. var ReactComponent = _dereq_(6);
  424. var ReactElement = _dereq_(10);
  425. var ReactPropTypeLocationNames = _dereq_(14);
  426. var ReactNoopUpdateQueue = _dereq_(13);
  427. var emptyObject = _dereq_(28);
  428. var invariant = _dereq_(29);
  429. var warning = _dereq_(30);
  430. var MIXINS_KEY = 'mixins';
  431. // Helper function to allow the creation of anonymous functions which do not
  432. // have .name set to the name of the variable being assigned to.
  433. function identity(fn) {
  434. return fn;
  435. }
  436. /**
  437. * Policies that describe methods in `ReactClassInterface`.
  438. */
  439. var injectedMixins = [];
  440. /**
  441. * Composite components are higher-level components that compose other composite
  442. * or host components.
  443. *
  444. * To create a new type of `ReactClass`, pass a specification of
  445. * your new class to `React.createClass`. The only requirement of your class
  446. * specification is that you implement a `render` method.
  447. *
  448. * var MyComponent = React.createClass({
  449. * render: function() {
  450. * return <div>Hello World</div>;
  451. * }
  452. * });
  453. *
  454. * The class specification supports a specific protocol of methods that have
  455. * special meaning (e.g. `render`). See `ReactClassInterface` for
  456. * more the comprehensive protocol. Any other properties and methods in the
  457. * class specification will be available on the prototype.
  458. *
  459. * @interface ReactClassInterface
  460. * @internal
  461. */
  462. var ReactClassInterface = {
  463. /**
  464. * An array of Mixin objects to include when defining your component.
  465. *
  466. * @type {array}
  467. * @optional
  468. */
  469. mixins: 'DEFINE_MANY',
  470. /**
  471. * An object containing properties and methods that should be defined on
  472. * the component's constructor instead of its prototype (static methods).
  473. *
  474. * @type {object}
  475. * @optional
  476. */
  477. statics: 'DEFINE_MANY',
  478. /**
  479. * Definition of prop types for this component.
  480. *
  481. * @type {object}
  482. * @optional
  483. */
  484. propTypes: 'DEFINE_MANY',
  485. /**
  486. * Definition of context types for this component.
  487. *
  488. * @type {object}
  489. * @optional
  490. */
  491. contextTypes: 'DEFINE_MANY',
  492. /**
  493. * Definition of context types this component sets for its children.
  494. *
  495. * @type {object}
  496. * @optional
  497. */
  498. childContextTypes: 'DEFINE_MANY',
  499. // ==== Definition methods ====
  500. /**
  501. * Invoked when the component is mounted. Values in the mapping will be set on
  502. * `this.props` if that prop is not specified (i.e. using an `in` check).
  503. *
  504. * This method is invoked before `getInitialState` and therefore cannot rely
  505. * on `this.state` or use `this.setState`.
  506. *
  507. * @return {object}
  508. * @optional
  509. */
  510. getDefaultProps: 'DEFINE_MANY_MERGED',
  511. /**
  512. * Invoked once before the component is mounted. The return value will be used
  513. * as the initial value of `this.state`.
  514. *
  515. * getInitialState: function() {
  516. * return {
  517. * isOn: false,
  518. * fooBaz: new BazFoo()
  519. * }
  520. * }
  521. *
  522. * @return {object}
  523. * @optional
  524. */
  525. getInitialState: 'DEFINE_MANY_MERGED',
  526. /**
  527. * @return {object}
  528. * @optional
  529. */
  530. getChildContext: 'DEFINE_MANY_MERGED',
  531. /**
  532. * Uses props from `this.props` and state from `this.state` to render the
  533. * structure of the component.
  534. *
  535. * No guarantees are made about when or how often this method is invoked, so
  536. * it must not have side effects.
  537. *
  538. * render: function() {
  539. * var name = this.props.name;
  540. * return <div>Hello, {name}!</div>;
  541. * }
  542. *
  543. * @return {ReactComponent}
  544. * @required
  545. */
  546. render: 'DEFINE_ONCE',
  547. // ==== Delegate methods ====
  548. /**
  549. * Invoked when the component is initially created and about to be mounted.
  550. * This may have side effects, but any external subscriptions or data created
  551. * by this method must be cleaned up in `componentWillUnmount`.
  552. *
  553. * @optional
  554. */
  555. componentWillMount: 'DEFINE_MANY',
  556. /**
  557. * Invoked when the component has been mounted and has a DOM representation.
  558. * However, there is no guarantee that the DOM node is in the document.
  559. *
  560. * Use this as an opportunity to operate on the DOM when the component has
  561. * been mounted (initialized and rendered) for the first time.
  562. *
  563. * @param {DOMElement} rootNode DOM element representing the component.
  564. * @optional
  565. */
  566. componentDidMount: 'DEFINE_MANY',
  567. /**
  568. * Invoked before the component receives new props.
  569. *
  570. * Use this as an opportunity to react to a prop transition by updating the
  571. * state using `this.setState`. Current props are accessed via `this.props`.
  572. *
  573. * componentWillReceiveProps: function(nextProps, nextContext) {
  574. * this.setState({
  575. * likesIncreasing: nextProps.likeCount > this.props.likeCount
  576. * });
  577. * }
  578. *
  579. * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
  580. * transition may cause a state change, but the opposite is not true. If you
  581. * need it, you are probably looking for `componentWillUpdate`.
  582. *
  583. * @param {object} nextProps
  584. * @optional
  585. */
  586. componentWillReceiveProps: 'DEFINE_MANY',
  587. /**
  588. * Invoked while deciding if the component should be updated as a result of
  589. * receiving new props, state and/or context.
  590. *
  591. * Use this as an opportunity to `return false` when you're certain that the
  592. * transition to the new props/state/context will not require a component
  593. * update.
  594. *
  595. * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
  596. * return !equal(nextProps, this.props) ||
  597. * !equal(nextState, this.state) ||
  598. * !equal(nextContext, this.context);
  599. * }
  600. *
  601. * @param {object} nextProps
  602. * @param {?object} nextState
  603. * @param {?object} nextContext
  604. * @return {boolean} True if the component should update.
  605. * @optional
  606. */
  607. shouldComponentUpdate: 'DEFINE_ONCE',
  608. /**
  609. * Invoked when the component is about to update due to a transition from
  610. * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
  611. * and `nextContext`.
  612. *
  613. * Use this as an opportunity to perform preparation before an update occurs.
  614. *
  615. * NOTE: You **cannot** use `this.setState()` in this method.
  616. *
  617. * @param {object} nextProps
  618. * @param {?object} nextState
  619. * @param {?object} nextContext
  620. * @param {ReactReconcileTransaction} transaction
  621. * @optional
  622. */
  623. componentWillUpdate: 'DEFINE_MANY',
  624. /**
  625. * Invoked when the component's DOM representation has been updated.
  626. *
  627. * Use this as an opportunity to operate on the DOM when the component has
  628. * been updated.
  629. *
  630. * @param {object} prevProps
  631. * @param {?object} prevState
  632. * @param {?object} prevContext
  633. * @param {DOMElement} rootNode DOM element representing the component.
  634. * @optional
  635. */
  636. componentDidUpdate: 'DEFINE_MANY',
  637. /**
  638. * Invoked when the component is about to be removed from its parent and have
  639. * its DOM representation destroyed.
  640. *
  641. * Use this as an opportunity to deallocate any external resources.
  642. *
  643. * NOTE: There is no `componentDidUnmount` since your component will have been
  644. * destroyed by that point.
  645. *
  646. * @optional
  647. */
  648. componentWillUnmount: 'DEFINE_MANY',
  649. // ==== Advanced methods ====
  650. /**
  651. * Updates the component's currently mounted DOM representation.
  652. *
  653. * By default, this implements React's rendering and reconciliation algorithm.
  654. * Sophisticated clients may wish to override this.
  655. *
  656. * @param {ReactReconcileTransaction} transaction
  657. * @internal
  658. * @overridable
  659. */
  660. updateComponent: 'OVERRIDE_BASE'
  661. };
  662. /**
  663. * Mapping from class specification keys to special processing functions.
  664. *
  665. * Although these are declared like instance properties in the specification
  666. * when defining classes using `React.createClass`, they are actually static
  667. * and are accessible on the constructor instead of the prototype. Despite
  668. * being static, they must be defined outside of the "statics" key under
  669. * which all other static methods are defined.
  670. */
  671. var RESERVED_SPEC_KEYS = {
  672. displayName: function (Constructor, displayName) {
  673. Constructor.displayName = displayName;
  674. },
  675. mixins: function (Constructor, mixins) {
  676. if (mixins) {
  677. for (var i = 0; i < mixins.length; i++) {
  678. mixSpecIntoComponent(Constructor, mixins[i]);
  679. }
  680. }
  681. },
  682. childContextTypes: function (Constructor, childContextTypes) {
  683. if ("development" !== 'production') {
  684. validateTypeDef(Constructor, childContextTypes, 'childContext');
  685. }
  686. Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes);
  687. },
  688. contextTypes: function (Constructor, contextTypes) {
  689. if ("development" !== 'production') {
  690. validateTypeDef(Constructor, contextTypes, 'context');
  691. }
  692. Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes);
  693. },
  694. /**
  695. * Special case getDefaultProps which should move into statics but requires
  696. * automatic merging.
  697. */
  698. getDefaultProps: function (Constructor, getDefaultProps) {
  699. if (Constructor.getDefaultProps) {
  700. Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
  701. } else {
  702. Constructor.getDefaultProps = getDefaultProps;
  703. }
  704. },
  705. propTypes: function (Constructor, propTypes) {
  706. if ("development" !== 'production') {
  707. validateTypeDef(Constructor, propTypes, 'prop');
  708. }
  709. Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
  710. },
  711. statics: function (Constructor, statics) {
  712. mixStaticSpecIntoComponent(Constructor, statics);
  713. },
  714. autobind: function () {} };
  715. function validateTypeDef(Constructor, typeDef, location) {
  716. for (var propName in typeDef) {
  717. if (typeDef.hasOwnProperty(propName)) {
  718. // use a warning instead of an invariant so components
  719. // don't show up in prod but only in __DEV__
  720. "development" !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0;
  721. }
  722. }
  723. }
  724. function validateMethodOverride(isAlreadyDefined, name) {
  725. var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
  726. // Disallow overriding of base class methods unless explicitly allowed.
  727. if (ReactClassMixin.hasOwnProperty(name)) {
  728. !(specPolicy === 'OVERRIDE_BASE') ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.', name) : _prodInvariant('73', name) : void 0;
  729. }
  730. // Disallow defining methods more than once unless explicitly allowed.
  731. if (isAlreadyDefined) {
  732. !(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED') ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('74', name) : void 0;
  733. }
  734. }
  735. /**
  736. * Mixin helper which handles policy validation and reserved
  737. * specification keys when building React classes.
  738. */
  739. function mixSpecIntoComponent(Constructor, spec) {
  740. if (!spec) {
  741. if ("development" !== 'production') {
  742. var typeofSpec = typeof spec;
  743. var isMixinValid = typeofSpec === 'object' && spec !== null;
  744. "development" !== 'production' ? warning(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0;
  745. }
  746. return;
  747. }
  748. !(typeof spec !== 'function') ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component class or function as a mixin. Instead, just use a regular object.') : _prodInvariant('75') : void 0;
  749. !!ReactElement.isValidElement(spec) ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component as a mixin. Instead, just use a regular object.') : _prodInvariant('76') : void 0;
  750. var proto = Constructor.prototype;
  751. var autoBindPairs = proto.__reactAutoBindPairs;
  752. // By handling mixins before any other properties, we ensure the same
  753. // chaining order is applied to methods with DEFINE_MANY policy, whether
  754. // mixins are listed before or after these methods in the spec.
  755. if (spec.hasOwnProperty(MIXINS_KEY)) {
  756. RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
  757. }
  758. for (var name in spec) {
  759. if (!spec.hasOwnProperty(name)) {
  760. continue;
  761. }
  762. if (name === MIXINS_KEY) {
  763. // We have already handled mixins in a special case above.
  764. continue;
  765. }
  766. var property = spec[name];
  767. var isAlreadyDefined = proto.hasOwnProperty(name);
  768. validateMethodOverride(isAlreadyDefined, name);
  769. if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
  770. RESERVED_SPEC_KEYS[name](Constructor, property);
  771. } else {
  772. // Setup methods on prototype:
  773. // The following member methods should not be automatically bound:
  774. // 1. Expected ReactClass methods (in the "interface").
  775. // 2. Overridden methods (that were mixed in).
  776. var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
  777. var isFunction = typeof property === 'function';
  778. var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
  779. if (shouldAutoBind) {
  780. autoBindPairs.push(name, property);
  781. proto[name] = property;
  782. } else {
  783. if (isAlreadyDefined) {
  784. var specPolicy = ReactClassInterface[name];
  785. // These cases should already be caught by validateMethodOverride.
  786. !(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY')) ? "development" !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.', specPolicy, name) : _prodInvariant('77', specPolicy, name) : void 0;
  787. // For methods which are defined more than once, call the existing
  788. // methods before calling the new property, merging if appropriate.
  789. if (specPolicy === 'DEFINE_MANY_MERGED') {
  790. proto[name] = createMergedResultFunction(proto[name], property);
  791. } else if (specPolicy === 'DEFINE_MANY') {
  792. proto[name] = createChainedFunction(proto[name], property);
  793. }
  794. } else {
  795. proto[name] = property;
  796. if ("development" !== 'production') {
  797. // Add verbose displayName to the function, which helps when looking
  798. // at profiling tools.
  799. if (typeof property === 'function' && spec.displayName) {
  800. proto[name].displayName = spec.displayName + '_' + name;
  801. }
  802. }
  803. }
  804. }
  805. }
  806. }
  807. }
  808. function mixStaticSpecIntoComponent(Constructor, statics) {
  809. if (!statics) {
  810. return;
  811. }
  812. for (var name in statics) {
  813. var property = statics[name];
  814. if (!statics.hasOwnProperty(name)) {
  815. continue;
  816. }
  817. var isReserved = name in RESERVED_SPEC_KEYS;
  818. !!isReserved ? "development" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.', name) : _prodInvariant('78', name) : void 0;
  819. var isInherited = name in Constructor;
  820. !!isInherited ? "development" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('79', name) : void 0;
  821. Constructor[name] = property;
  822. }
  823. }
  824. /**
  825. * Merge two objects, but throw if both contain the same key.
  826. *
  827. * @param {object} one The first object, which is mutated.
  828. * @param {object} two The second object
  829. * @return {object} one after it has been mutated to contain everything in two.
  830. */
  831. function mergeIntoWithNoDuplicateKeys(one, two) {
  832. !(one && two && typeof one === 'object' && typeof two === 'object') ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0;
  833. for (var key in two) {
  834. if (two.hasOwnProperty(key)) {
  835. !(one[key] === undefined) ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.', key) : _prodInvariant('81', key) : void 0;
  836. one[key] = two[key];
  837. }
  838. }
  839. return one;
  840. }
  841. /**
  842. * Creates a function that invokes two functions and merges their return values.
  843. *
  844. * @param {function} one Function to invoke first.
  845. * @param {function} two Function to invoke second.
  846. * @return {function} Function that invokes the two argument functions.
  847. * @private
  848. */
  849. function createMergedResultFunction(one, two) {
  850. return function mergedResult() {
  851. var a = one.apply(this, arguments);
  852. var b = two.apply(this, arguments);
  853. if (a == null) {
  854. return b;
  855. } else if (b == null) {
  856. return a;
  857. }
  858. var c = {};
  859. mergeIntoWithNoDuplicateKeys(c, a);
  860. mergeIntoWithNoDuplicateKeys(c, b);
  861. return c;
  862. };
  863. }
  864. /**
  865. * Creates a function that invokes two functions and ignores their return vales.
  866. *
  867. * @param {function} one Function to invoke first.
  868. * @param {function} two Function to invoke second.
  869. * @return {function} Function that invokes the two argument functions.
  870. * @private
  871. */
  872. function createChainedFunction(one, two) {
  873. return function chainedFunction() {
  874. one.apply(this, arguments);
  875. two.apply(this, arguments);
  876. };
  877. }
  878. /**
  879. * Binds a method to the component.
  880. *
  881. * @param {object} component Component whose method is going to be bound.
  882. * @param {function} method Method to be bound.
  883. * @return {function} The bound method.
  884. */
  885. function bindAutoBindMethod(component, method) {
  886. var boundMethod = method.bind(component);
  887. if ("development" !== 'production') {
  888. boundMethod.__reactBoundContext = component;
  889. boundMethod.__reactBoundMethod = method;
  890. boundMethod.__reactBoundArguments = null;
  891. var componentName = component.constructor.displayName;
  892. var _bind = boundMethod.bind;
  893. boundMethod.bind = function (newThis) {
  894. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  895. args[_key - 1] = arguments[_key];
  896. }
  897. // User is trying to bind() an autobound method; we effectively will
  898. // ignore the value of "this" that the user is trying to use, so
  899. // let's warn.
  900. if (newThis !== component && newThis !== null) {
  901. "development" !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0;
  902. } else if (!args.length) {
  903. "development" !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0;
  904. return boundMethod;
  905. }
  906. var reboundMethod = _bind.apply(boundMethod, arguments);
  907. reboundMethod.__reactBoundContext = component;
  908. reboundMethod.__reactBoundMethod = method;
  909. reboundMethod.__reactBoundArguments = args;
  910. return reboundMethod;
  911. };
  912. }
  913. return boundMethod;
  914. }
  915. /**
  916. * Binds all auto-bound methods in a component.
  917. *
  918. * @param {object} component Component whose method is going to be bound.
  919. */
  920. function bindAutoBindMethods(component) {
  921. var pairs = component.__reactAutoBindPairs;
  922. for (var i = 0; i < pairs.length; i += 2) {
  923. var autoBindKey = pairs[i];
  924. var method = pairs[i + 1];
  925. component[autoBindKey] = bindAutoBindMethod(component, method);
  926. }
  927. }
  928. /**
  929. * Add more to the ReactClass base class. These are all legacy features and
  930. * therefore not already part of the modern ReactComponent.
  931. */
  932. var ReactClassMixin = {
  933. /**
  934. * TODO: This will be deprecated because state should always keep a consistent
  935. * type signature and the only use case for this, is to avoid that.
  936. */
  937. replaceState: function (newState, callback) {
  938. this.updater.enqueueReplaceState(this, newState);
  939. if (callback) {
  940. this.updater.enqueueCallback(this, callback, 'replaceState');
  941. }
  942. },
  943. /**
  944. * Checks whether or not this composite component is mounted.
  945. * @return {boolean} True if mounted, false otherwise.
  946. * @protected
  947. * @final
  948. */
  949. isMounted: function () {
  950. return this.updater.isMounted(this);
  951. }
  952. };
  953. var ReactClassComponent = function () {};
  954. _assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
  955. var didWarnDeprecated = false;
  956. /**
  957. * Module for creating composite components.
  958. *
  959. * @class ReactClass
  960. */
  961. var ReactClass = {
  962. /**
  963. * Creates a composite component class given a class specification.
  964. * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
  965. *
  966. * @param {object} spec Class specification (which must define `render`).
  967. * @return {function} Component constructor function.
  968. * @public
  969. */
  970. createClass: function (spec) {
  971. if ("development" !== 'production') {
  972. "development" !== 'production' ? warning(didWarnDeprecated, '%s: React.createClass is deprecated and will be removed in version 16. ' + 'Use plain JavaScript classes instead. If you\'re not yet ready to ' + 'migrate, create-react-class is available on npm as a ' + 'drop-in replacement.', spec && spec.displayName || 'A Component') : void 0;
  973. didWarnDeprecated = true;
  974. }
  975. // To keep our warnings more understandable, we'll use a little hack here to
  976. // ensure that Constructor.name !== 'Constructor'. This makes sure we don't
  977. // unnecessarily identify a class without displayName as 'Constructor'.
  978. var Constructor = identity(function (props, context, updater) {
  979. // This constructor gets overridden by mocks. The argument is used
  980. // by mocks to assert on what gets mounted.
  981. if ("development" !== 'production') {
  982. "development" !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0;
  983. }
  984. // Wire up auto-binding
  985. if (this.__reactAutoBindPairs.length) {
  986. bindAutoBindMethods(this);
  987. }
  988. this.props = props;
  989. this.context = context;
  990. this.refs = emptyObject;
  991. this.updater = updater || ReactNoopUpdateQueue;
  992. this.state = null;
  993. // ReactClasses doesn't have constructors. Instead, they use the
  994. // getInitialState and componentWillMount methods for initialization.
  995. var initialState = this.getInitialState ? this.getInitialState() : null;
  996. if ("development" !== 'production') {
  997. // We allow auto-mocks to proceed as if they're returning null.
  998. if (initialState === undefined && this.getInitialState._isMockFunction) {
  999. // This is probably bad practice. Consider warning here and
  1000. // deprecating this convenience.
  1001. initialState = null;
  1002. }
  1003. }
  1004. !(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0;
  1005. this.state = initialState;
  1006. });
  1007. Constructor.prototype = new ReactClassComponent();
  1008. Constructor.prototype.constructor = Constructor;
  1009. Constructor.prototype.__reactAutoBindPairs = [];
  1010. injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
  1011. mixSpecIntoComponent(Constructor, spec);
  1012. // Initialize the defaultProps property after all mixins have been merged.
  1013. if (Constructor.getDefaultProps) {
  1014. Constructor.defaultProps = Constructor.getDefaultProps();
  1015. }
  1016. if ("development" !== 'production') {
  1017. // This is a tag to indicate that the use of these method names is ok,
  1018. // since it's used with createClass. If it's not, then it's likely a
  1019. // mistake so we'll warn you to use the static property, property
  1020. // initializer or constructor respectively.
  1021. if (Constructor.getDefaultProps) {
  1022. Constructor.getDefaultProps.isReactClassApproved = {};
  1023. }
  1024. if (Constructor.prototype.getInitialState) {
  1025. Constructor.prototype.getInitialState.isReactClassApproved = {};
  1026. }
  1027. }
  1028. !Constructor.prototype.render ? "development" !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0;
  1029. if ("development" !== 'production') {
  1030. "development" !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0;
  1031. "development" !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0;
  1032. }
  1033. // Reduce time spent doing lookups by setting these on the prototype.
  1034. for (var methodName in ReactClassInterface) {
  1035. if (!Constructor.prototype[methodName]) {
  1036. Constructor.prototype[methodName] = null;
  1037. }
  1038. }
  1039. return Constructor;
  1040. },
  1041. injection: {
  1042. injectMixin: function (mixin) {
  1043. injectedMixins.push(mixin);
  1044. }
  1045. }
  1046. };
  1047. module.exports = ReactClass;
  1048. },{"10":10,"13":13,"14":14,"25":25,"28":28,"29":29,"30":30,"31":31,"6":6}],6:[function(_dereq_,module,exports){
  1049. /**
  1050. * Copyright 2013-present, Facebook, Inc.
  1051. * All rights reserved.
  1052. *
  1053. * This source code is licensed under the BSD-style license found in the
  1054. * LICENSE file in the root directory of this source tree. An additional grant
  1055. * of patent rights can be found in the PATENTS file in the same directory.
  1056. *
  1057. */
  1058. 'use strict';
  1059. var _prodInvariant = _dereq_(25);
  1060. var ReactNoopUpdateQueue = _dereq_(13);
  1061. var canDefineProperty = _dereq_(20);
  1062. var emptyObject = _dereq_(28);
  1063. var invariant = _dereq_(29);
  1064. var warning = _dereq_(30);
  1065. /**
  1066. * Base class helpers for the updating state of a component.
  1067. */
  1068. function ReactComponent(props, context, updater) {
  1069. this.props = props;
  1070. this.context = context;
  1071. this.refs = emptyObject;
  1072. // We initialize the default updater but the real one gets injected by the
  1073. // renderer.
  1074. this.updater = updater || ReactNoopUpdateQueue;
  1075. }
  1076. ReactComponent.prototype.isReactComponent = {};
  1077. /**
  1078. * Sets a subset of the state. Always use this to mutate
  1079. * state. You should treat `this.state` as immutable.
  1080. *
  1081. * There is no guarantee that `this.state` will be immediately updated, so
  1082. * accessing `this.state` after calling this method may return the old value.
  1083. *
  1084. * There is no guarantee that calls to `setState` will run synchronously,
  1085. * as they may eventually be batched together. You can provide an optional
  1086. * callback that will be executed when the call to setState is actually
  1087. * completed.
  1088. *
  1089. * When a function is provided to setState, it will be called at some point in
  1090. * the future (not synchronously). It will be called with the up to date
  1091. * component arguments (state, props, context). These values can be different
  1092. * from this.* because your function may be called after receiveProps but before
  1093. * shouldComponentUpdate, and this new state, props, and context will not yet be
  1094. * assigned to this.
  1095. *
  1096. * @param {object|function} partialState Next partial state or function to
  1097. * produce next partial state to be merged with current state.
  1098. * @param {?function} callback Called after state is updated.
  1099. * @final
  1100. * @protected
  1101. */
  1102. ReactComponent.prototype.setState = function (partialState, callback) {
  1103. !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? "development" !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0;
  1104. this.updater.enqueueSetState(this, partialState);
  1105. if (callback) {
  1106. this.updater.enqueueCallback(this, callback, 'setState');
  1107. }
  1108. };
  1109. /**
  1110. * Forces an update. This should only be invoked when it is known with
  1111. * certainty that we are **not** in a DOM transaction.
  1112. *
  1113. * You may want to call this when you know that some deeper aspect of the
  1114. * component's state has changed but `setState` was not called.
  1115. *
  1116. * This will not invoke `shouldComponentUpdate`, but it will invoke
  1117. * `componentWillUpdate` and `componentDidUpdate`.
  1118. *
  1119. * @param {?function} callback Called after update is complete.
  1120. * @final
  1121. * @protected
  1122. */
  1123. ReactComponent.prototype.forceUpdate = function (callback) {
  1124. this.updater.enqueueForceUpdate(this);
  1125. if (callback) {
  1126. this.updater.enqueueCallback(this, callback, 'forceUpdate');
  1127. }
  1128. };
  1129. /**
  1130. * Deprecated APIs. These APIs used to exist on classic React classes but since
  1131. * we would like to deprecate them, we're not going to move them over to this
  1132. * modern base class. Instead, we define a getter that warns if it's accessed.
  1133. */
  1134. if ("development" !== 'production') {
  1135. var deprecatedAPIs = {
  1136. isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
  1137. replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
  1138. };
  1139. var defineDeprecationWarning = function (methodName, info) {
  1140. if (canDefineProperty) {
  1141. Object.defineProperty(ReactComponent.prototype, methodName, {
  1142. get: function () {
  1143. "development" !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0;
  1144. return undefined;
  1145. }
  1146. });
  1147. }
  1148. };
  1149. for (var fnName in deprecatedAPIs) {
  1150. if (deprecatedAPIs.hasOwnProperty(fnName)) {
  1151. defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
  1152. }
  1153. }
  1154. }
  1155. module.exports = ReactComponent;
  1156. },{"13":13,"20":20,"25":25,"28":28,"29":29,"30":30}],7:[function(_dereq_,module,exports){
  1157. /**
  1158. * Copyright 2016-present, Facebook, Inc.
  1159. * All rights reserved.
  1160. *
  1161. * This source code is licensed under the BSD-style license found in the
  1162. * LICENSE file in the root directory of this source tree. An additional grant
  1163. * of patent rights can be found in the PATENTS file in the same directory.
  1164. *
  1165. *
  1166. */
  1167. 'use strict';
  1168. var _prodInvariant = _dereq_(25);
  1169. var ReactCurrentOwner = _dereq_(8);
  1170. var invariant = _dereq_(29);
  1171. var warning = _dereq_(30);
  1172. function isNative(fn) {
  1173. // Based on isNative() from Lodash
  1174. var funcToString = Function.prototype.toString;
  1175. var hasOwnProperty = Object.prototype.hasOwnProperty;
  1176. var reIsNative = RegExp('^' + funcToString
  1177. // Take an example native function source for comparison
  1178. .call(hasOwnProperty)
  1179. // Strip regex characters so we can use it for regex
  1180. .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
  1181. // Remove hasOwnProperty from the template to make it generic
  1182. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
  1183. try {
  1184. var source = funcToString.call(fn);
  1185. return reIsNative.test(source);
  1186. } catch (err) {
  1187. return false;
  1188. }
  1189. }
  1190. var canUseCollections =
  1191. // Array.from
  1192. typeof Array.from === 'function' &&
  1193. // Map
  1194. typeof Map === 'function' && isNative(Map) &&
  1195. // Map.prototype.keys
  1196. Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
  1197. // Set
  1198. typeof Set === 'function' && isNative(Set) &&
  1199. // Set.prototype.keys
  1200. Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
  1201. var setItem;
  1202. var getItem;
  1203. var removeItem;
  1204. var getItemIDs;
  1205. var addRoot;
  1206. var removeRoot;
  1207. var getRootIDs;
  1208. if (canUseCollections) {
  1209. var itemMap = new Map();
  1210. var rootIDSet = new Set();
  1211. setItem = function (id, item) {
  1212. itemMap.set(id, item);
  1213. };
  1214. getItem = function (id) {
  1215. return itemMap.get(id);
  1216. };
  1217. removeItem = function (id) {
  1218. itemMap['delete'](id);
  1219. };
  1220. getItemIDs = function () {
  1221. return Array.from(itemMap.keys());
  1222. };
  1223. addRoot = function (id) {
  1224. rootIDSet.add(id);
  1225. };
  1226. removeRoot = function (id) {
  1227. rootIDSet['delete'](id);
  1228. };
  1229. getRootIDs = function () {
  1230. return Array.from(rootIDSet.keys());
  1231. };
  1232. } else {
  1233. var itemByKey = {};
  1234. var rootByKey = {};
  1235. // Use non-numeric keys to prevent V8 performance issues:
  1236. // https://github.com/facebook/react/pull/7232
  1237. var getKeyFromID = function (id) {
  1238. return '.' + id;
  1239. };
  1240. var getIDFromKey = function (key) {
  1241. return parseInt(key.substr(1), 10);
  1242. };
  1243. setItem = function (id, item) {
  1244. var key = getKeyFromID(id);
  1245. itemByKey[key] = item;
  1246. };
  1247. getItem = function (id) {
  1248. var key = getKeyFromID(id);
  1249. return itemByKey[key];
  1250. };
  1251. removeItem = function (id) {
  1252. var key = getKeyFromID(id);
  1253. delete itemByKey[key];
  1254. };
  1255. getItemIDs = function () {
  1256. return Object.keys(itemByKey).map(getIDFromKey);
  1257. };
  1258. addRoot = function (id) {
  1259. var key = getKeyFromID(id);
  1260. rootByKey[key] = true;
  1261. };
  1262. removeRoot = function (id) {
  1263. var key = getKeyFromID(id);
  1264. delete rootByKey[key];
  1265. };
  1266. getRootIDs = function () {
  1267. return Object.keys(rootByKey).map(getIDFromKey);
  1268. };
  1269. }
  1270. var unmountedIDs = [];
  1271. function purgeDeep(id) {
  1272. var item = getItem(id);
  1273. if (item) {
  1274. var childIDs = item.childIDs;
  1275. removeItem(id);
  1276. childIDs.forEach(purgeDeep);
  1277. }
  1278. }
  1279. function describeComponentFrame(name, source, ownerName) {
  1280. return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
  1281. }
  1282. function getDisplayName(element) {
  1283. if (element == null) {
  1284. return '#empty';
  1285. } else if (typeof element === 'string' || typeof element === 'number') {
  1286. return '#text';
  1287. } else if (typeof element.type === 'string') {
  1288. return element.type;
  1289. } else {
  1290. return element.type.displayName || element.type.name || 'Unknown';
  1291. }
  1292. }
  1293. function describeID(id) {
  1294. var name = ReactComponentTreeHook.getDisplayName(id);
  1295. var element = ReactComponentTreeHook.getElement(id);
  1296. var ownerID = ReactComponentTreeHook.getOwnerID(id);
  1297. var ownerName;
  1298. if (ownerID) {
  1299. ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
  1300. }
  1301. "development" !== 'production' ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0;
  1302. return describeComponentFrame(name, element && element._source, ownerName);
  1303. }
  1304. var ReactComponentTreeHook = {
  1305. onSetChildren: function (id, nextChildIDs) {
  1306. var item = getItem(id);
  1307. !item ? "development" !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
  1308. item.childIDs = nextChildIDs;
  1309. for (var i = 0; i < nextChildIDs.length; i++) {
  1310. var nextChildID = nextChildIDs[i];
  1311. var nextChild = getItem(nextChildID);
  1312. !nextChild ? "development" !== 'production' ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0;
  1313. !(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? "development" !== 'production' ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : _prodInvariant('141') : void 0;
  1314. !nextChild.isMounted ? "development" !== 'production' ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0;
  1315. if (nextChild.parentID == null) {
  1316. nextChild.parentID = id;
  1317. // TODO: This shouldn't be necessary but mounting a new root during in
  1318. // componentWillMount currently causes not-yet-mounted components to
  1319. // be purged from our tree data so their parent id is missing.
  1320. }
  1321. !(nextChild.parentID === id) ? "development" !== 'production' ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : _prodInvariant('142', nextChildID, nextChild.parentID, id) : void 0;
  1322. }
  1323. },
  1324. onBeforeMountComponent: function (id, element, parentID) {
  1325. var item = {
  1326. element: element,
  1327. parentID: parentID,
  1328. text: null,
  1329. childIDs: [],
  1330. isMounted: false,
  1331. updateCount: 0
  1332. };
  1333. setItem(id, item);
  1334. },
  1335. onBeforeUpdateComponent: function (id, element) {
  1336. var item = getItem(id);
  1337. if (!item || !item.isMounted) {
  1338. // We may end up here as a result of setState() in componentWillUnmount().
  1339. // In this case, ignore the element.
  1340. return;
  1341. }
  1342. item.element = element;
  1343. },
  1344. onMountComponent: function (id) {
  1345. var item = getItem(id);
  1346. !item ? "development" !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
  1347. item.isMounted = true;
  1348. var isRoot = item.parentID === 0;
  1349. if (isRoot) {
  1350. addRoot(id);
  1351. }
  1352. },
  1353. onUpdateComponent: function (id) {
  1354. var item = getItem(id);
  1355. if (!item || !item.isMounted) {
  1356. // We may end up here as a result of setState() in componentWillUnmount().
  1357. // In this case, ignore the element.
  1358. return;
  1359. }
  1360. item.updateCount++;
  1361. },
  1362. onUnmountComponent: function (id) {
  1363. var item = getItem(id);
  1364. if (item) {
  1365. // We need to check if it exists.
  1366. // `item` might not exist if it is inside an error boundary, and a sibling
  1367. // error boundary child threw while mounting. Then this instance never
  1368. // got a chance to mount, but it still gets an unmounting event during
  1369. // the error boundary cleanup.
  1370. item.isMounted = false;
  1371. var isRoot = item.parentID === 0;
  1372. if (isRoot) {
  1373. removeRoot(id);
  1374. }
  1375. }
  1376. unmountedIDs.push(id);
  1377. },
  1378. purgeUnmountedComponents: function () {
  1379. if (ReactComponentTreeHook._preventPurging) {
  1380. // Should only be used for testing.
  1381. return;
  1382. }
  1383. for (var i = 0; i < unmountedIDs.length; i++) {
  1384. var id = unmountedIDs[i];
  1385. purgeDeep(id);
  1386. }
  1387. unmountedIDs.length = 0;
  1388. },
  1389. isMounted: function (id) {
  1390. var item = getItem(id);
  1391. return item ? item.isMounted : false;
  1392. },
  1393. getCurrentStackAddendum: function (topElement) {
  1394. var info = '';
  1395. if (topElement) {
  1396. var name = getDisplayName(topElement);
  1397. var owner = topElement._owner;
  1398. info += describeComponentFrame(name, topElement._source, owner && owner.getName());
  1399. }
  1400. var currentOwner = ReactCurrentOwner.current;
  1401. var id = currentOwner && currentOwner._debugID;
  1402. info += ReactComponentTreeHook.getStackAddendumByID(id);
  1403. return info;
  1404. },
  1405. getStackAddendumByID: function (id) {
  1406. var info = '';
  1407. while (id) {
  1408. info += describeID(id);
  1409. id = ReactComponentTreeHook.getParentID(id);
  1410. }
  1411. return info;
  1412. },
  1413. getChildIDs: function (id) {
  1414. var item = getItem(id);
  1415. return item ? item.childIDs : [];
  1416. },
  1417. getDisplayName: function (id) {
  1418. var element = ReactComponentTreeHook.getElement(id);
  1419. if (!element) {
  1420. return null;
  1421. }
  1422. return getDisplayName(element);
  1423. },
  1424. getElement: function (id) {
  1425. var item = getItem(id);
  1426. return item ? item.element : null;
  1427. },
  1428. getOwnerID: function (id) {
  1429. var element = ReactComponentTreeHook.getElement(id);
  1430. if (!element || !element._owner) {
  1431. return null;
  1432. }
  1433. return element._owner._debugID;
  1434. },
  1435. getParentID: function (id) {
  1436. var item = getItem(id);
  1437. return item ? item.parentID : null;
  1438. },
  1439. getSource: function (id) {
  1440. var item = getItem(id);
  1441. var element = item ? item.element : null;
  1442. var source = element != null ? element._source : null;
  1443. return source;
  1444. },
  1445. getText: function (id) {
  1446. var element = ReactComponentTreeHook.getElement(id);
  1447. if (typeof element === 'string') {
  1448. return element;
  1449. } else if (typeof element === 'number') {
  1450. return '' + element;
  1451. } else {
  1452. return null;
  1453. }
  1454. },
  1455. getUpdateCount: function (id) {
  1456. var item = getItem(id);
  1457. return item ? item.updateCount : 0;
  1458. },
  1459. getRootIDs: getRootIDs,
  1460. getRegisteredIDs: getItemIDs
  1461. };
  1462. module.exports = ReactComponentTreeHook;
  1463. },{"25":25,"29":29,"30":30,"8":8}],8:[function(_dereq_,module,exports){
  1464. /**
  1465. * Copyright 2013-present, Facebook, Inc.
  1466. * All rights reserved.
  1467. *
  1468. * This source code is licensed under the BSD-style license found in the
  1469. * LICENSE file in the root directory of this source tree. An additional grant
  1470. * of patent rights can be found in the PATENTS file in the same directory.
  1471. *
  1472. *
  1473. */
  1474. 'use strict';
  1475. /**
  1476. * Keeps track of the current owner.
  1477. *
  1478. * The current owner is the component who should own any components that are
  1479. * currently being constructed.
  1480. */
  1481. var ReactCurrentOwner = {
  1482. /**
  1483. * @internal
  1484. * @type {ReactComponent}
  1485. */
  1486. current: null
  1487. };
  1488. module.exports = ReactCurrentOwner;
  1489. },{}],9:[function(_dereq_,module,exports){
  1490. /**
  1491. * Copyright 2013-present, Facebook, Inc.
  1492. * All rights reserved.
  1493. *
  1494. * This source code is licensed under the BSD-style license found in the
  1495. * LICENSE file in the root directory of this source tree. An additional grant
  1496. * of patent rights can be found in the PATENTS file in the same directory.
  1497. *
  1498. */
  1499. 'use strict';
  1500. var ReactElement = _dereq_(10);
  1501. /**
  1502. * Create a factory that creates HTML tag elements.
  1503. *
  1504. * @private
  1505. */
  1506. var createDOMFactory = ReactElement.createFactory;
  1507. if ("development" !== 'production') {
  1508. var ReactElementValidator = _dereq_(12);
  1509. createDOMFactory = ReactElementValidator.createFactory;
  1510. }
  1511. /**
  1512. * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
  1513. * This is also accessible via `React.DOM`.
  1514. *
  1515. * @public
  1516. */
  1517. var ReactDOMFactories = {
  1518. a: createDOMFactory('a'),
  1519. abbr: createDOMFactory('abbr'),
  1520. address: createDOMFactory('address'),
  1521. area: createDOMFactory('area'),
  1522. article: createDOMFactory('article'),
  1523. aside: createDOMFactory('aside'),
  1524. audio: createDOMFactory('audio'),
  1525. b: createDOMFactory('b'),
  1526. base: createDOMFactory('base'),
  1527. bdi: createDOMFactory('bdi'),
  1528. bdo: createDOMFactory('bdo'),
  1529. big: createDOMFactory('big'),
  1530. blockquote: createDOMFactory('blockquote'),
  1531. body: createDOMFactory('body'),
  1532. br: createDOMFactory('br'),
  1533. button: createDOMFactory('button'),
  1534. canvas: createDOMFactory('canvas'),
  1535. caption: createDOMFactory('caption'),
  1536. cite: createDOMFactory('cite'),
  1537. code: createDOMFactory('code'),
  1538. col: createDOMFactory('col'),
  1539. colgroup: createDOMFactory('colgroup'),
  1540. data: createDOMFactory('data'),
  1541. datalist: createDOMFactory('datalist'),
  1542. dd: createDOMFactory('dd'),
  1543. del: createDOMFactory('del'),
  1544. details: createDOMFactory('details'),
  1545. dfn: createDOMFactory('dfn'),
  1546. dialog: createDOMFactory('dialog'),
  1547. div: createDOMFactory('div'),
  1548. dl: createDOMFactory('dl'),
  1549. dt: createDOMFactory('dt'),
  1550. em: createDOMFactory('em'),
  1551. embed: createDOMFactory('embed'),
  1552. fieldset: createDOMFactory('fieldset'),
  1553. figcaption: createDOMFactory('figcaption'),
  1554. figure: createDOMFactory('figure'),
  1555. footer: createDOMFactory('footer'),
  1556. form: createDOMFactory('form'),
  1557. h1: createDOMFactory('h1'),
  1558. h2: createDOMFactory('h2'),
  1559. h3: createDOMFactory('h3'),
  1560. h4: createDOMFactory('h4'),
  1561. h5: createDOMFactory('h5'),
  1562. h6: createDOMFactory('h6'),
  1563. head: createDOMFactory('head'),
  1564. header: createDOMFactory('header'),
  1565. hgroup: createDOMFactory('hgroup'),
  1566. hr: createDOMFactory('hr'),
  1567. html: createDOMFactory('html'),
  1568. i: createDOMFactory('i'),
  1569. iframe: createDOMFactory('iframe'),
  1570. img: createDOMFactory('img'),
  1571. input: createDOMFactory('input'),
  1572. ins: createDOMFactory('ins'),
  1573. kbd: createDOMFactory('kbd'),
  1574. keygen: createDOMFactory('keygen'),
  1575. label: createDOMFactory('label'),
  1576. legend: createDOMFactory('legend'),
  1577. li: createDOMFactory('li'),
  1578. link: createDOMFactory('link'),
  1579. main: createDOMFactory('main'),
  1580. map: createDOMFactory('map'),
  1581. mark: createDOMFactory('mark'),
  1582. menu: createDOMFactory('menu'),
  1583. menuitem: createDOMFactory('menuitem'),
  1584. meta: createDOMFactory('meta'),
  1585. meter: createDOMFactory('meter'),
  1586. nav: createDOMFactory('nav'),
  1587. noscript: createDOMFactory('noscript'),
  1588. object: createDOMFactory('object'),
  1589. ol: createDOMFactory('ol'),
  1590. optgroup: createDOMFactory('optgroup'),
  1591. option: createDOMFactory('option'),
  1592. output: createDOMFactory('output'),
  1593. p: createDOMFactory('p'),
  1594. param: createDOMFactory('param'),
  1595. picture: createDOMFactory('picture'),
  1596. pre: createDOMFactory('pre'),
  1597. progress: createDOMFactory('progress'),
  1598. q: createDOMFactory('q'),
  1599. rp: createDOMFactory('rp'),
  1600. rt: createDOMFactory('rt'),
  1601. ruby: createDOMFactory('ruby'),
  1602. s: createDOMFactory('s'),
  1603. samp: createDOMFactory('samp'),
  1604. script: createDOMFactory('script'),
  1605. section: createDOMFactory('section'),
  1606. select: createDOMFactory('select'),
  1607. small: createDOMFactory('small'),
  1608. source: createDOMFactory('source'),
  1609. span: createDOMFactory('span'),
  1610. strong: createDOMFactory('strong'),
  1611. style: createDOMFactory('style'),
  1612. sub: createDOMFactory('sub'),
  1613. summary: createDOMFactory('summary'),
  1614. sup: createDOMFactory('sup'),
  1615. table: createDOMFactory('table'),
  1616. tbody: createDOMFactory('tbody'),
  1617. td: createDOMFactory('td'),
  1618. textarea: createDOMFactory('textarea'),
  1619. tfoot: createDOMFactory('tfoot'),
  1620. th: createDOMFactory('th'),
  1621. thead: createDOMFactory('thead'),
  1622. time: createDOMFactory('time'),
  1623. title: createDOMFactory('title'),
  1624. tr: createDOMFactory('tr'),
  1625. track: createDOMFactory('track'),
  1626. u: createDOMFactory('u'),
  1627. ul: createDOMFactory('ul'),
  1628. 'var': createDOMFactory('var'),
  1629. video: createDOMFactory('video'),
  1630. wbr: createDOMFactory('wbr'),
  1631. // SVG
  1632. circle: createDOMFactory('circle'),
  1633. clipPath: createDOMFactory('clipPath'),
  1634. defs: createDOMFactory('defs'),
  1635. ellipse: createDOMFactory('ellipse'),
  1636. g: createDOMFactory('g'),
  1637. image: createDOMFactory('image'),
  1638. line: createDOMFactory('line'),
  1639. linearGradient: createDOMFactory('linearGradient'),
  1640. mask: createDOMFactory('mask'),
  1641. path: createDOMFactory('path'),
  1642. pattern: createDOMFactory('pattern'),
  1643. polygon: createDOMFactory('polygon'),
  1644. polyline: createDOMFactory('polyline'),
  1645. radialGradient: createDOMFactory('radialGradient'),
  1646. rect: createDOMFactory('rect'),
  1647. stop: createDOMFactory('stop'),
  1648. svg: createDOMFactory('svg'),
  1649. text: createDOMFactory('text'),
  1650. tspan: createDOMFactory('tspan')
  1651. };
  1652. module.exports = ReactDOMFactories;
  1653. },{"10":10,"12":12}],10:[function(_dereq_,module,exports){
  1654. /**
  1655. * Copyright 2014-present, Facebook, Inc.
  1656. * All rights reserved.
  1657. *
  1658. * This source code is licensed under the BSD-style license found in the
  1659. * LICENSE file in the root directory of this source tree. An additional grant
  1660. * of patent rights can be found in the PATENTS file in the same directory.
  1661. *
  1662. */
  1663. 'use strict';
  1664. var _assign = _dereq_(31);
  1665. var ReactCurrentOwner = _dereq_(8);
  1666. var warning = _dereq_(30);
  1667. var canDefineProperty = _dereq_(20);
  1668. var hasOwnProperty = Object.prototype.hasOwnProperty;
  1669. var REACT_ELEMENT_TYPE = _dereq_(11);
  1670. var RESERVED_PROPS = {
  1671. key: true,
  1672. ref: true,
  1673. __self: true,
  1674. __source: true
  1675. };
  1676. var specialPropKeyWarningShown, specialPropRefWarningShown;
  1677. function hasValidRef(config) {
  1678. if ("development" !== 'production') {
  1679. if (hasOwnProperty.call(config, 'ref')) {
  1680. var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
  1681. if (getter && getter.isReactWarning) {
  1682. return false;
  1683. }
  1684. }
  1685. }
  1686. return config.ref !== undefined;
  1687. }
  1688. function hasValidKey(config) {
  1689. if ("development" !== 'production') {
  1690. if (hasOwnProperty.call(config, 'key')) {
  1691. var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
  1692. if (getter && getter.isReactWarning) {
  1693. return false;
  1694. }
  1695. }
  1696. }
  1697. return config.key !== undefined;
  1698. }
  1699. function defineKeyPropWarningGetter(props, displayName) {
  1700. var warnAboutAccessingKey = function () {
  1701. if (!specialPropKeyWarningShown) {
  1702. specialPropKeyWarningShown = true;
  1703. "development" !== 'production' ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0;
  1704. }
  1705. };
  1706. warnAboutAccessingKey.isReactWarning = true;
  1707. Object.defineProperty(props, 'key', {
  1708. get: warnAboutAccessingKey,
  1709. configurable: true
  1710. });
  1711. }
  1712. function defineRefPropWarningGetter(props, displayName) {
  1713. var warnAboutAccessingRef = function () {
  1714. if (!specialPropRefWarningShown) {
  1715. specialPropRefWarningShown = true;
  1716. "development" !== 'production' ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0;
  1717. }
  1718. };
  1719. warnAboutAccessingRef.isReactWarning = true;
  1720. Object.defineProperty(props, 'ref', {
  1721. get: warnAboutAccessingRef,
  1722. configurable: true
  1723. });
  1724. }
  1725. /**
  1726. * Factory method to create a new React element. This no longer adheres to
  1727. * the class pattern, so do not use new to call it. Also, no instanceof check
  1728. * will work. Instead test $$typeof field against Symbol.for('react.element') to check
  1729. * if something is a React Element.
  1730. *
  1731. * @param {*} type
  1732. * @param {*} key
  1733. * @param {string|object} ref
  1734. * @param {*} self A *temporary* helper to detect places where `this` is
  1735. * different from the `owner` when React.createElement is called, so that we
  1736. * can warn. We want to get rid of owner and replace string `ref`s with arrow
  1737. * functions, and as long as `this` and owner are the same, there will be no
  1738. * change in behavior.
  1739. * @param {*} source An annotation object (added by a transpiler or otherwise)
  1740. * indicating filename, line number, and/or other information.
  1741. * @param {*} owner
  1742. * @param {*} props
  1743. * @internal
  1744. */
  1745. var ReactElement = function (type, key, ref, self, source, owner, props) {
  1746. var element = {
  1747. // This tag allow us to uniquely identify this as a React Element
  1748. $$typeof: REACT_ELEMENT_TYPE,
  1749. // Built-in properties that belong on the element
  1750. type: type,
  1751. key: key,
  1752. ref: ref,
  1753. props: props,
  1754. // Record the component responsible for creating this element.
  1755. _owner: owner
  1756. };
  1757. if ("development" !== 'production') {
  1758. // The validation flag is currently mutative. We put it on
  1759. // an external backing store so that we can freeze the whole object.
  1760. // This can be replaced with a WeakMap once they are implemented in
  1761. // commonly used development environments.
  1762. element._store = {};
  1763. // To make comparing ReactElements easier for testing purposes, we make
  1764. // the validation flag non-enumerable (where possible, which should
  1765. // include every environment we run tests in), so the test framework
  1766. // ignores it.
  1767. if (canDefineProperty) {
  1768. Object.defineProperty(element._store, 'validated', {
  1769. configurable: false,
  1770. enumerable: false,
  1771. writable: true,
  1772. value: false
  1773. });
  1774. // self and source are DEV only properties.
  1775. Object.defineProperty(element, '_self', {
  1776. configurable: false,
  1777. enumerable: false,
  1778. writable: false,
  1779. value: self
  1780. });
  1781. // Two elements created in two different places should be considered
  1782. // equal for testing purposes and therefore we hide it from enumeration.
  1783. Object.defineProperty(element, '_source', {
  1784. configurable: false,
  1785. enumerable: false,
  1786. writable: false,
  1787. value: source
  1788. });
  1789. } else {
  1790. element._store.validated = false;
  1791. element._self = self;
  1792. element._source = source;
  1793. }
  1794. if (Object.freeze) {
  1795. Object.freeze(element.props);
  1796. Object.freeze(element);
  1797. }
  1798. }
  1799. return element;
  1800. };
  1801. /**
  1802. * Create and return a new ReactElement of the given type.
  1803. * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement
  1804. */
  1805. ReactElement.createElement = function (type, config, children) {
  1806. var propName;
  1807. // Reserved names are extracted
  1808. var props = {};
  1809. var key = null;
  1810. var ref = null;
  1811. var self = null;
  1812. var source = null;
  1813. if (config != null) {
  1814. if (hasValidRef(config)) {
  1815. ref = config.ref;
  1816. }
  1817. if (hasValidKey(config)) {
  1818. key = '' + config.key;
  1819. }
  1820. self = config.__self === undefined ? null : config.__self;
  1821. source = config.__source === undefined ? null : config.__source;
  1822. // Remaining properties are added to a new props object
  1823. for (propName in config) {
  1824. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  1825. props[propName] = config[propName];
  1826. }
  1827. }
  1828. }
  1829. // Children can be more than one argument, and those are transferred onto
  1830. // the newly allocated props object.
  1831. var childrenLength = arguments.length - 2;
  1832. if (childrenLength === 1) {
  1833. props.children = children;
  1834. } else if (childrenLength > 1) {
  1835. var childArray = Array(childrenLength);
  1836. for (var i = 0; i < childrenLength; i++) {
  1837. childArray[i] = arguments[i + 2];
  1838. }
  1839. if ("development" !== 'production') {
  1840. if (Object.freeze) {
  1841. Object.freeze(childArray);
  1842. }
  1843. }
  1844. props.children = childArray;
  1845. }
  1846. // Resolve default props
  1847. if (type && type.defaultProps) {
  1848. var defaultProps = type.defaultProps;
  1849. for (propName in defaultProps) {
  1850. if (props[propName] === undefined) {
  1851. props[propName] = defaultProps[propName];
  1852. }
  1853. }
  1854. }
  1855. if ("development" !== 'production') {
  1856. if (key || ref) {
  1857. if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
  1858. var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
  1859. if (key) {
  1860. defineKeyPropWarningGetter(props, displayName);
  1861. }
  1862. if (ref) {
  1863. defineRefPropWarningGetter(props, displayName);
  1864. }
  1865. }
  1866. }
  1867. }
  1868. return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
  1869. };
  1870. /**
  1871. * Return a function that produces ReactElements of a given type.
  1872. * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory
  1873. */
  1874. ReactElement.createFactory = function (type) {
  1875. var factory = ReactElement.createElement.bind(null, type);
  1876. // Expose the type on the factory and the prototype so that it can be
  1877. // easily accessed on elements. E.g. `<Foo />.type === Foo`.
  1878. // This should not be named `constructor` since this may not be the function
  1879. // that created the element, and it may not even be a constructor.
  1880. // Legacy hook TODO: Warn if this is accessed
  1881. factory.type = type;
  1882. return factory;
  1883. };
  1884. ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
  1885. var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
  1886. return newElement;
  1887. };
  1888. /**
  1889. * Clone and return a new ReactElement using element as the starting point.
  1890. * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement
  1891. */
  1892. ReactElement.cloneElement = function (element, config, children) {
  1893. var propName;
  1894. // Original props are copied
  1895. var props = _assign({}, element.props);
  1896. // Reserved names are extracted
  1897. var key = element.key;
  1898. var ref = element.ref;
  1899. // Self is preserved since the owner is preserved.
  1900. var self = element._self;
  1901. // Source is preserved since cloneElement is unlikely to be targeted by a
  1902. // transpiler, and the original source is probably a better indicator of the
  1903. // true owner.
  1904. var source = element._source;
  1905. // Owner will be preserved, unless ref is overridden
  1906. var owner = element._owner;
  1907. if (config != null) {
  1908. if (hasValidRef(config)) {
  1909. // Silently steal the ref from the parent.
  1910. ref = config.ref;
  1911. owner = ReactCurrentOwner.current;
  1912. }
  1913. if (hasValidKey(config)) {
  1914. key = '' + config.key;
  1915. }
  1916. // Remaining properties override existing props
  1917. var defaultProps;
  1918. if (element.type && element.type.defaultProps) {
  1919. defaultProps = element.type.defaultProps;
  1920. }
  1921. for (propName in config) {
  1922. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  1923. if (config[propName] === undefined && defaultProps !== undefined) {
  1924. // Resolve default props
  1925. props[propName] = defaultProps[propName];
  1926. } else {
  1927. props[propName] = config[propName];
  1928. }
  1929. }
  1930. }
  1931. }
  1932. // Children can be more than one argument, and those are transferred onto
  1933. // the newly allocated props object.
  1934. var childrenLength = arguments.length - 2;
  1935. if (childrenLength === 1) {
  1936. props.children = children;
  1937. } else if (childrenLength > 1) {
  1938. var childArray = Array(childrenLength);
  1939. for (var i = 0; i < childrenLength; i++) {
  1940. childArray[i] = arguments[i + 2];
  1941. }
  1942. props.children = childArray;
  1943. }
  1944. return ReactElement(element.type, key, ref, self, source, owner, props);
  1945. };
  1946. /**
  1947. * Verifies the object is a ReactElement.
  1948. * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement
  1949. * @param {?object} object
  1950. * @return {boolean} True if `object` is a valid component.
  1951. * @final
  1952. */
  1953. ReactElement.isValidElement = function (object) {
  1954. return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  1955. };
  1956. module.exports = ReactElement;
  1957. },{"11":11,"20":20,"30":30,"31":31,"8":8}],11:[function(_dereq_,module,exports){
  1958. /**
  1959. * Copyright 2014-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. */
  1968. 'use strict';
  1969. // The Symbol used to tag the ReactElement type. If there is no native Symbol
  1970. // nor polyfill, then a plain number is used for performance.
  1971. var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
  1972. module.exports = REACT_ELEMENT_TYPE;
  1973. },{}],12:[function(_dereq_,module,exports){
  1974. /**
  1975. * Copyright 2014-present, Facebook, Inc.
  1976. * All rights reserved.
  1977. *
  1978. * This source code is licensed under the BSD-style license found in the
  1979. * LICENSE file in the root directory of this source tree. An additional grant
  1980. * of patent rights can be found in the PATENTS file in the same directory.
  1981. *
  1982. */
  1983. /**
  1984. * ReactElementValidator provides a wrapper around a element factory
  1985. * which validates the props passed to the element. This is intended to be
  1986. * used only in DEV and could be replaced by a static type checker for languages
  1987. * that support it.
  1988. */
  1989. 'use strict';
  1990. var ReactCurrentOwner = _dereq_(8);
  1991. var ReactComponentTreeHook = _dereq_(7);
  1992. var ReactElement = _dereq_(10);
  1993. var checkReactTypeSpec = _dereq_(21);
  1994. var canDefineProperty = _dereq_(20);
  1995. var getIteratorFn = _dereq_(22);
  1996. var warning = _dereq_(30);
  1997. function getDeclarationErrorAddendum() {
  1998. if (ReactCurrentOwner.current) {
  1999. var name = ReactCurrentOwner.current.getName();
  2000. if (name) {
  2001. return ' Check the render method of `' + name + '`.';
  2002. }
  2003. }
  2004. return '';
  2005. }
  2006. function getSourceInfoErrorAddendum(elementProps) {
  2007. if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
  2008. var source = elementProps.__source;
  2009. var fileName = source.fileName.replace(/^.*[\\\/]/, '');
  2010. var lineNumber = source.lineNumber;
  2011. return ' Check your code at ' + fileName + ':' + lineNumber + '.';
  2012. }
  2013. return '';
  2014. }
  2015. /**
  2016. * Warn if there's no key explicitly set on dynamic arrays of children or
  2017. * object keys are not valid. This allows us to keep track of children between
  2018. * updates.
  2019. */
  2020. var ownerHasKeyUseWarning = {};
  2021. function getCurrentComponentErrorInfo(parentType) {
  2022. var info = getDeclarationErrorAddendum();
  2023. if (!info) {
  2024. var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
  2025. if (parentName) {
  2026. info = ' Check the top-level render call using <' + parentName + '>.';
  2027. }
  2028. }
  2029. return info;
  2030. }
  2031. /**
  2032. * Warn if the element doesn't have an explicit key assigned to it.
  2033. * This element is in an array. The array could grow and shrink or be
  2034. * reordered. All children that haven't already been validated are required to
  2035. * have a "key" property assigned to it. Error statuses are cached so a warning
  2036. * will only be shown once.
  2037. *
  2038. * @internal
  2039. * @param {ReactElement} element Element that requires a key.
  2040. * @param {*} parentType element's parent's type.
  2041. */
  2042. function validateExplicitKey(element, parentType) {
  2043. if (!element._store || element._store.validated || element.key != null) {
  2044. return;
  2045. }
  2046. element._store.validated = true;
  2047. var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {});
  2048. var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
  2049. if (memoizer[currentComponentErrorInfo]) {
  2050. return;
  2051. }
  2052. memoizer[currentComponentErrorInfo] = true;
  2053. // Usually the current owner is the offender, but if it accepts children as a
  2054. // property, it may be the creator of the child that's responsible for
  2055. // assigning it a key.
  2056. var childOwner = '';
  2057. if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
  2058. // Give the component that originally created this child.
  2059. childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
  2060. }
  2061. "development" !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, ReactComponentTreeHook.getCurrentStackAddendum(element)) : void 0;
  2062. }
  2063. /**
  2064. * Ensure that every element either is passed in a static location, in an
  2065. * array with an explicit keys property defined, or in an object literal
  2066. * with valid key property.
  2067. *
  2068. * @internal
  2069. * @param {ReactNode} node Statically passed child of any type.
  2070. * @param {*} parentType node's parent's type.
  2071. */
  2072. function validateChildKeys(node, parentType) {
  2073. if (typeof node !== 'object') {
  2074. return;
  2075. }
  2076. if (Array.isArray(node)) {
  2077. for (var i = 0; i < node.length; i++) {
  2078. var child = node[i];
  2079. if (ReactElement.isValidElement(child)) {
  2080. validateExplicitKey(child, parentType);
  2081. }
  2082. }
  2083. } else if (ReactElement.isValidElement(node)) {
  2084. // This element was passed in a valid location.
  2085. if (node._store) {
  2086. node._store.validated = true;
  2087. }
  2088. } else if (node) {
  2089. var iteratorFn = getIteratorFn(node);
  2090. // Entry iterators provide implicit keys.
  2091. if (iteratorFn) {
  2092. if (iteratorFn !== node.entries) {
  2093. var iterator = iteratorFn.call(node);
  2094. var step;
  2095. while (!(step = iterator.next()).done) {
  2096. if (ReactElement.isValidElement(step.value)) {
  2097. validateExplicitKey(step.value, parentType);
  2098. }
  2099. }
  2100. }
  2101. }
  2102. }
  2103. }
  2104. /**
  2105. * Given an element, validate that its props follow the propTypes definition,
  2106. * provided by the type.
  2107. *
  2108. * @param {ReactElement} element
  2109. */
  2110. function validatePropTypes(element) {
  2111. var componentClass = element.type;
  2112. if (typeof componentClass !== 'function') {
  2113. return;
  2114. }
  2115. var name = componentClass.displayName || componentClass.name;
  2116. if (componentClass.propTypes) {
  2117. checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, element, null);
  2118. }
  2119. if (typeof componentClass.getDefaultProps === 'function') {
  2120. "development" !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
  2121. }
  2122. }
  2123. var ReactElementValidator = {
  2124. createElement: function (type, props, children) {
  2125. var validType = typeof type === 'string' || typeof type === 'function';
  2126. // We warn in this case but don't throw. We expect the element creation to
  2127. // succeed and there will likely be errors in render.
  2128. if (!validType) {
  2129. if (typeof type !== 'function' && typeof type !== 'string') {
  2130. var info = '';
  2131. if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
  2132. info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
  2133. }
  2134. var sourceInfo = getSourceInfoErrorAddendum(props);
  2135. if (sourceInfo) {
  2136. info += sourceInfo;
  2137. } else {
  2138. info += getDeclarationErrorAddendum();
  2139. }
  2140. info += ReactComponentTreeHook.getCurrentStackAddendum();
  2141. "development" !== 'production' ? warning(false, 'React.createElement: 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) : void 0;
  2142. }
  2143. }
  2144. var element = ReactElement.createElement.apply(this, arguments);
  2145. // The result can be nullish if a mock or a custom function is used.
  2146. // TODO: Drop this when these are no longer allowed as the type argument.
  2147. if (element == null) {
  2148. return element;
  2149. }
  2150. // Skip key warning if the type isn't valid since our key validation logic
  2151. // doesn't expect a non-string/function type and can throw confusing errors.
  2152. // We don't want exception behavior to differ between dev and prod.
  2153. // (Rendering will throw with a helpful message and as soon as the type is
  2154. // fixed, the key warnings will appear.)
  2155. if (validType) {
  2156. for (var i = 2; i < arguments.length; i++) {
  2157. validateChildKeys(arguments[i], type);
  2158. }
  2159. }
  2160. validatePropTypes(element);
  2161. return element;
  2162. },
  2163. createFactory: function (type) {
  2164. var validatedFactory = ReactElementValidator.createElement.bind(null, type);
  2165. // Legacy hook TODO: Warn if this is accessed
  2166. validatedFactory.type = type;
  2167. if ("development" !== 'production') {
  2168. if (canDefineProperty) {
  2169. Object.defineProperty(validatedFactory, 'type', {
  2170. enumerable: false,
  2171. get: function () {
  2172. "development" !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0;
  2173. Object.defineProperty(this, 'type', {
  2174. value: type
  2175. });
  2176. return type;
  2177. }
  2178. });
  2179. }
  2180. }
  2181. return validatedFactory;
  2182. },
  2183. cloneElement: function (element, props, children) {
  2184. var newElement = ReactElement.cloneElement.apply(this, arguments);
  2185. for (var i = 2; i < arguments.length; i++) {
  2186. validateChildKeys(arguments[i], newElement.type);
  2187. }
  2188. validatePropTypes(newElement);
  2189. return newElement;
  2190. }
  2191. };
  2192. module.exports = ReactElementValidator;
  2193. },{"10":10,"20":20,"21":21,"22":22,"30":30,"7":7,"8":8}],13:[function(_dereq_,module,exports){
  2194. /**
  2195. * Copyright 2015-present, Facebook, Inc.
  2196. * All rights reserved.
  2197. *
  2198. * This source code is licensed under the BSD-style license found in the
  2199. * LICENSE file in the root directory of this source tree. An additional grant
  2200. * of patent rights can be found in the PATENTS file in the same directory.
  2201. *
  2202. */
  2203. 'use strict';
  2204. var warning = _dereq_(30);
  2205. function warnNoop(publicInstance, callerName) {
  2206. if ("development" !== 'production') {
  2207. var constructor = publicInstance.constructor;
  2208. "development" !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
  2209. }
  2210. }
  2211. /**
  2212. * This is the abstract API for an update queue.
  2213. */
  2214. var ReactNoopUpdateQueue = {
  2215. /**
  2216. * Checks whether or not this composite component is mounted.
  2217. * @param {ReactClass} publicInstance The instance we want to test.
  2218. * @return {boolean} True if mounted, false otherwise.
  2219. * @protected
  2220. * @final
  2221. */
  2222. isMounted: function (publicInstance) {
  2223. return false;
  2224. },
  2225. /**
  2226. * Enqueue a callback that will be executed after all the pending updates
  2227. * have processed.
  2228. *
  2229. * @param {ReactClass} publicInstance The instance to use as `this` context.
  2230. * @param {?function} callback Called after state is updated.
  2231. * @internal
  2232. */
  2233. enqueueCallback: function (publicInstance, callback) {},
  2234. /**
  2235. * Forces an update. This should only be invoked when it is known with
  2236. * certainty that we are **not** in a DOM transaction.
  2237. *
  2238. * You may want to call this when you know that some deeper aspect of the
  2239. * component's state has changed but `setState` was not called.
  2240. *
  2241. * This will not invoke `shouldComponentUpdate`, but it will invoke
  2242. * `componentWillUpdate` and `componentDidUpdate`.
  2243. *
  2244. * @param {ReactClass} publicInstance The instance that should rerender.
  2245. * @internal
  2246. */
  2247. enqueueForceUpdate: function (publicInstance) {
  2248. warnNoop(publicInstance, 'forceUpdate');
  2249. },
  2250. /**
  2251. * Replaces all of the state. Always use this or `setState` to mutate state.
  2252. * You should treat `this.state` as immutable.
  2253. *
  2254. * There is no guarantee that `this.state` will be immediately updated, so
  2255. * accessing `this.state` after calling this method may return the old value.
  2256. *
  2257. * @param {ReactClass} publicInstance The instance that should rerender.
  2258. * @param {object} completeState Next state.
  2259. * @internal
  2260. */
  2261. enqueueReplaceState: function (publicInstance, completeState) {
  2262. warnNoop(publicInstance, 'replaceState');
  2263. },
  2264. /**
  2265. * Sets a subset of the state. This only exists because _pendingState is
  2266. * internal. This provides a merging strategy that is not available to deep
  2267. * properties which is confusing. TODO: Expose pendingState or don't use it
  2268. * during the merge.
  2269. *
  2270. * @param {ReactClass} publicInstance The instance that should rerender.
  2271. * @param {object} partialState Next partial state to be merged with state.
  2272. * @internal
  2273. */
  2274. enqueueSetState: function (publicInstance, partialState) {
  2275. warnNoop(publicInstance, 'setState');
  2276. }
  2277. };
  2278. module.exports = ReactNoopUpdateQueue;
  2279. },{"30":30}],14:[function(_dereq_,module,exports){
  2280. /**
  2281. * Copyright 2013-present, Facebook, Inc.
  2282. * All rights reserved.
  2283. *
  2284. * This source code is licensed under the BSD-style license found in the
  2285. * LICENSE file in the root directory of this source tree. An additional grant
  2286. * of patent rights can be found in the PATENTS file in the same directory.
  2287. *
  2288. *
  2289. */
  2290. 'use strict';
  2291. var ReactPropTypeLocationNames = {};
  2292. if ("development" !== 'production') {
  2293. ReactPropTypeLocationNames = {
  2294. prop: 'prop',
  2295. context: 'context',
  2296. childContext: 'child context'
  2297. };
  2298. }
  2299. module.exports = ReactPropTypeLocationNames;
  2300. },{}],15:[function(_dereq_,module,exports){
  2301. /**
  2302. * Copyright 2013-present, Facebook, Inc.
  2303. * All rights reserved.
  2304. *
  2305. * This source code is licensed under the BSD-style license found in the
  2306. * LICENSE file in the root directory of this source tree. An additional grant
  2307. * of patent rights can be found in the PATENTS file in the same directory.
  2308. *
  2309. */
  2310. 'use strict';
  2311. var _require = _dereq_(10),
  2312. isValidElement = _require.isValidElement;
  2313. var factory = _dereq_(33);
  2314. module.exports = factory(isValidElement);
  2315. },{"10":10,"33":33}],16:[function(_dereq_,module,exports){
  2316. /**
  2317. * Copyright 2013-present, Facebook, Inc.
  2318. * All rights reserved.
  2319. *
  2320. * This source code is licensed under the BSD-style license found in the
  2321. * LICENSE file in the root directory of this source tree. An additional grant
  2322. * of patent rights can be found in the PATENTS file in the same directory.
  2323. *
  2324. *
  2325. */
  2326. 'use strict';
  2327. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  2328. module.exports = ReactPropTypesSecret;
  2329. },{}],17:[function(_dereq_,module,exports){
  2330. /**
  2331. * Copyright 2013-present, Facebook, Inc.
  2332. * All rights reserved.
  2333. *
  2334. * This source code is licensed under the BSD-style license found in the
  2335. * LICENSE file in the root directory of this source tree. An additional grant
  2336. * of patent rights can be found in the PATENTS file in the same directory.
  2337. *
  2338. */
  2339. 'use strict';
  2340. var _assign = _dereq_(31);
  2341. var ReactComponent = _dereq_(6);
  2342. var ReactNoopUpdateQueue = _dereq_(13);
  2343. var emptyObject = _dereq_(28);
  2344. /**
  2345. * Base class helpers for the updating state of a component.
  2346. */
  2347. function ReactPureComponent(props, context, updater) {
  2348. // Duplicated from ReactComponent.
  2349. this.props = props;
  2350. this.context = context;
  2351. this.refs = emptyObject;
  2352. // We initialize the default updater but the real one gets injected by the
  2353. // renderer.
  2354. this.updater = updater || ReactNoopUpdateQueue;
  2355. }
  2356. function ComponentDummy() {}
  2357. ComponentDummy.prototype = ReactComponent.prototype;
  2358. ReactPureComponent.prototype = new ComponentDummy();
  2359. ReactPureComponent.prototype.constructor = ReactPureComponent;
  2360. // Avoid an extra prototype jump for these methods.
  2361. _assign(ReactPureComponent.prototype, ReactComponent.prototype);
  2362. ReactPureComponent.prototype.isPureReactComponent = true;
  2363. module.exports = ReactPureComponent;
  2364. },{"13":13,"28":28,"31":31,"6":6}],18:[function(_dereq_,module,exports){
  2365. /**
  2366. * Copyright 2013-present, Facebook, Inc.
  2367. * All rights reserved.
  2368. *
  2369. * This source code is licensed under the BSD-style license found in the
  2370. * LICENSE file in the root directory of this source tree. An additional grant
  2371. * of patent rights can be found in the PATENTS file in the same directory.
  2372. *
  2373. */
  2374. 'use strict';
  2375. var _assign = _dereq_(31);
  2376. var React = _dereq_(3);
  2377. // `version` will be added here by the React module.
  2378. var ReactUMDEntry = _assign(React, {
  2379. __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
  2380. ReactCurrentOwner: _dereq_(8)
  2381. }
  2382. });
  2383. if ("development" !== 'production') {
  2384. _assign(ReactUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
  2385. // ReactComponentTreeHook should not be included in production.
  2386. ReactComponentTreeHook: _dereq_(7),
  2387. getNextDebugID: _dereq_(23)
  2388. });
  2389. }
  2390. module.exports = ReactUMDEntry;
  2391. },{"23":23,"3":3,"31":31,"7":7,"8":8}],19:[function(_dereq_,module,exports){
  2392. /**
  2393. * Copyright 2013-present, Facebook, Inc.
  2394. * All rights reserved.
  2395. *
  2396. * This source code is licensed under the BSD-style license found in the
  2397. * LICENSE file in the root directory of this source tree. An additional grant
  2398. * of patent rights can be found in the PATENTS file in the same directory.
  2399. *
  2400. */
  2401. 'use strict';
  2402. module.exports = '15.5.4';
  2403. },{}],20:[function(_dereq_,module,exports){
  2404. /**
  2405. * Copyright 2013-present, Facebook, Inc.
  2406. * All rights reserved.
  2407. *
  2408. * This source code is licensed under the BSD-style license found in the
  2409. * LICENSE file in the root directory of this source tree. An additional grant
  2410. * of patent rights can be found in the PATENTS file in the same directory.
  2411. *
  2412. *
  2413. */
  2414. 'use strict';
  2415. var canDefineProperty = false;
  2416. if ("development" !== 'production') {
  2417. try {
  2418. // $FlowFixMe https://github.com/facebook/flow/issues/285
  2419. Object.defineProperty({}, 'x', { get: function () {} });
  2420. canDefineProperty = true;
  2421. } catch (x) {
  2422. // IE will fail on defineProperty
  2423. }
  2424. }
  2425. module.exports = canDefineProperty;
  2426. },{}],21:[function(_dereq_,module,exports){
  2427. (function (process){
  2428. /**
  2429. * Copyright 2013-present, Facebook, Inc.
  2430. * All rights reserved.
  2431. *
  2432. * This source code is licensed under the BSD-style license found in the
  2433. * LICENSE file in the root directory of this source tree. An additional grant
  2434. * of patent rights can be found in the PATENTS file in the same directory.
  2435. *
  2436. */
  2437. 'use strict';
  2438. var _prodInvariant = _dereq_(25);
  2439. var ReactPropTypeLocationNames = _dereq_(14);
  2440. var ReactPropTypesSecret = _dereq_(16);
  2441. var invariant = _dereq_(29);
  2442. var warning = _dereq_(30);
  2443. var ReactComponentTreeHook;
  2444. if (typeof process !== 'undefined' && process.env && "development" === 'test') {
  2445. // Temporary hack.
  2446. // Inline requires don't work well with Jest:
  2447. // https://github.com/facebook/react/issues/7240
  2448. // Remove the inline requires when we don't need them anymore:
  2449. // https://github.com/facebook/react/pull/7178
  2450. ReactComponentTreeHook = _dereq_(7);
  2451. }
  2452. var loggedTypeFailures = {};
  2453. /**
  2454. * Assert that the values match with the type specs.
  2455. * Error messages are memorized and will only be shown once.
  2456. *
  2457. * @param {object} typeSpecs Map of name to a ReactPropType
  2458. * @param {object} values Runtime values that need to be type-checked
  2459. * @param {string} location e.g. "prop", "context", "child context"
  2460. * @param {string} componentName Name of the component for error messages.
  2461. * @param {?object} element The React element that is being type-checked
  2462. * @param {?number} debugID The React component instance that is being type-checked
  2463. * @private
  2464. */
  2465. function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) {
  2466. for (var typeSpecName in typeSpecs) {
  2467. if (typeSpecs.hasOwnProperty(typeSpecName)) {
  2468. var error;
  2469. // Prop type validation may throw. In case they do, we don't want to
  2470. // fail the render phase where it didn't fail before. So we log it.
  2471. // After these have been cleaned up, we'll let them throw.
  2472. try {
  2473. // This is intentionally an invariant that gets caught. It's the same
  2474. // behavior as without this statement except with a better message.
  2475. !(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;
  2476. error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
  2477. } catch (ex) {
  2478. error = ex;
  2479. }
  2480. "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;
  2481. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  2482. // Only monitor this failure once because there tends to be a lot of the
  2483. // same error.
  2484. loggedTypeFailures[error.message] = true;
  2485. var componentStackInfo = '';
  2486. if ("development" !== 'production') {
  2487. if (!ReactComponentTreeHook) {
  2488. ReactComponentTreeHook = _dereq_(7);
  2489. }
  2490. if (debugID !== null) {
  2491. componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID);
  2492. } else if (element !== null) {
  2493. componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element);
  2494. }
  2495. }
  2496. "development" !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0;
  2497. }
  2498. }
  2499. }
  2500. }
  2501. module.exports = checkReactTypeSpec;
  2502. }).call(this,undefined)
  2503. },{"14":14,"16":16,"25":25,"29":29,"30":30,"7":7}],22:[function(_dereq_,module,exports){
  2504. /**
  2505. * Copyright 2013-present, Facebook, Inc.
  2506. * All rights reserved.
  2507. *
  2508. * This source code is licensed under the BSD-style license found in the
  2509. * LICENSE file in the root directory of this source tree. An additional grant
  2510. * of patent rights can be found in the PATENTS file in the same directory.
  2511. *
  2512. *
  2513. */
  2514. 'use strict';
  2515. /* global Symbol */
  2516. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  2517. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  2518. /**
  2519. * Returns the iterator method function contained on the iterable object.
  2520. *
  2521. * Be sure to invoke the function with the iterable as context:
  2522. *
  2523. * var iteratorFn = getIteratorFn(myIterable);
  2524. * if (iteratorFn) {
  2525. * var iterator = iteratorFn.call(myIterable);
  2526. * ...
  2527. * }
  2528. *
  2529. * @param {?object} maybeIterable
  2530. * @return {?function}
  2531. */
  2532. function getIteratorFn(maybeIterable) {
  2533. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  2534. if (typeof iteratorFn === 'function') {
  2535. return iteratorFn;
  2536. }
  2537. }
  2538. module.exports = getIteratorFn;
  2539. },{}],23:[function(_dereq_,module,exports){
  2540. /**
  2541. * Copyright 2013-present, Facebook, Inc.
  2542. * All rights reserved.
  2543. *
  2544. * This source code is licensed under the BSD-style license found in the
  2545. * LICENSE file in the root directory of this source tree. An additional grant
  2546. * of patent rights can be found in the PATENTS file in the same directory.
  2547. *
  2548. *
  2549. */
  2550. 'use strict';
  2551. var nextDebugID = 1;
  2552. function getNextDebugID() {
  2553. return nextDebugID++;
  2554. }
  2555. module.exports = getNextDebugID;
  2556. },{}],24:[function(_dereq_,module,exports){
  2557. /**
  2558. * Copyright 2013-present, Facebook, Inc.
  2559. * All rights reserved.
  2560. *
  2561. * This source code is licensed under the BSD-style license found in the
  2562. * LICENSE file in the root directory of this source tree. An additional grant
  2563. * of patent rights can be found in the PATENTS file in the same directory.
  2564. *
  2565. */
  2566. 'use strict';
  2567. var _prodInvariant = _dereq_(25);
  2568. var ReactElement = _dereq_(10);
  2569. var invariant = _dereq_(29);
  2570. /**
  2571. * Returns the first child in a collection of children and verifies that there
  2572. * is only one child in the collection.
  2573. *
  2574. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.only
  2575. *
  2576. * The current implementation of this function assumes that a single child gets
  2577. * passed without a wrapper, but the purpose of this helper function is to
  2578. * abstract away the particular structure of children.
  2579. *
  2580. * @param {?object} children Child collection structure.
  2581. * @return {ReactElement} The first and only `ReactElement` contained in the
  2582. * structure.
  2583. */
  2584. function onlyChild(children) {
  2585. !ReactElement.isValidElement(children) ? "development" !== 'production' ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0;
  2586. return children;
  2587. }
  2588. module.exports = onlyChild;
  2589. },{"10":10,"25":25,"29":29}],25:[function(_dereq_,module,exports){
  2590. /**
  2591. * Copyright (c) 2013-present, Facebook, Inc.
  2592. * All rights reserved.
  2593. *
  2594. * This source code is licensed under the BSD-style license found in the
  2595. * LICENSE file in the root directory of this source tree. An additional grant
  2596. * of patent rights can be found in the PATENTS file in the same directory.
  2597. *
  2598. *
  2599. */
  2600. 'use strict';
  2601. /**
  2602. * WARNING: DO NOT manually require this module.
  2603. * This is a replacement for `invariant(...)` used by the error code system
  2604. * and will _only_ be required by the corresponding babel pass.
  2605. * It always throws.
  2606. */
  2607. function reactProdInvariant(code) {
  2608. var argCount = arguments.length - 1;
  2609. var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;
  2610. for (var argIdx = 0; argIdx < argCount; argIdx++) {
  2611. message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
  2612. }
  2613. message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';
  2614. var error = new Error(message);
  2615. error.name = 'Invariant Violation';
  2616. error.framesToPop = 1; // we don't care about reactProdInvariant's own frame
  2617. throw error;
  2618. }
  2619. module.exports = reactProdInvariant;
  2620. },{}],26:[function(_dereq_,module,exports){
  2621. /**
  2622. * Copyright 2013-present, Facebook, Inc.
  2623. * All rights reserved.
  2624. *
  2625. * This source code is licensed under the BSD-style license found in the
  2626. * LICENSE file in the root directory of this source tree. An additional grant
  2627. * of patent rights can be found in the PATENTS file in the same directory.
  2628. *
  2629. */
  2630. 'use strict';
  2631. var _prodInvariant = _dereq_(25);
  2632. var ReactCurrentOwner = _dereq_(8);
  2633. var REACT_ELEMENT_TYPE = _dereq_(11);
  2634. var getIteratorFn = _dereq_(22);
  2635. var invariant = _dereq_(29);
  2636. var KeyEscapeUtils = _dereq_(1);
  2637. var warning = _dereq_(30);
  2638. var SEPARATOR = '.';
  2639. var SUBSEPARATOR = ':';
  2640. /**
  2641. * This is inlined from ReactElement since this file is shared between
  2642. * isomorphic and renderers. We could extract this to a
  2643. *
  2644. */
  2645. /**
  2646. * TODO: Test that a single child and an array with one item have the same key
  2647. * pattern.
  2648. */
  2649. var didWarnAboutMaps = false;
  2650. /**
  2651. * Generate a key string that identifies a component within a set.
  2652. *
  2653. * @param {*} component A component that could contain a manual key.
  2654. * @param {number} index Index that is used if a manual key is not provided.
  2655. * @return {string}
  2656. */
  2657. function getComponentKey(component, index) {
  2658. // Do some typechecking here since we call this blindly. We want to ensure
  2659. // that we don't block potential future ES APIs.
  2660. if (component && typeof component === 'object' && component.key != null) {
  2661. // Explicit key
  2662. return KeyEscapeUtils.escape(component.key);
  2663. }
  2664. // Implicit key determined by the index in the set
  2665. return index.toString(36);
  2666. }
  2667. /**
  2668. * @param {?*} children Children tree container.
  2669. * @param {!string} nameSoFar Name of the key path so far.
  2670. * @param {!function} callback Callback to invoke with each child found.
  2671. * @param {?*} traverseContext Used to pass information throughout the traversal
  2672. * process.
  2673. * @return {!number} The number of children in this subtree.
  2674. */
  2675. function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
  2676. var type = typeof children;
  2677. if (type === 'undefined' || type === 'boolean') {
  2678. // All of the above are perceived as null.
  2679. children = null;
  2680. }
  2681. if (children === null || type === 'string' || type === 'number' ||
  2682. // The following is inlined from ReactElement. This means we can optimize
  2683. // some checks. React Fiber also inlines this logic for similar purposes.
  2684. type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
  2685. callback(traverseContext, children,
  2686. // If it's the only child, treat the name as if it was wrapped in an array
  2687. // so that it's consistent if the number of children grows.
  2688. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
  2689. return 1;
  2690. }
  2691. var child;
  2692. var nextName;
  2693. var subtreeCount = 0; // Count of children found in the current subtree.
  2694. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
  2695. if (Array.isArray(children)) {
  2696. for (var i = 0; i < children.length; i++) {
  2697. child = children[i];
  2698. nextName = nextNamePrefix + getComponentKey(child, i);
  2699. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  2700. }
  2701. } else {
  2702. var iteratorFn = getIteratorFn(children);
  2703. if (iteratorFn) {
  2704. var iterator = iteratorFn.call(children);
  2705. var step;
  2706. if (iteratorFn !== children.entries) {
  2707. var ii = 0;
  2708. while (!(step = iterator.next()).done) {
  2709. child = step.value;
  2710. nextName = nextNamePrefix + getComponentKey(child, ii++);
  2711. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  2712. }
  2713. } else {
  2714. if ("development" !== 'production') {
  2715. var mapsAsChildrenAddendum = '';
  2716. if (ReactCurrentOwner.current) {
  2717. var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
  2718. if (mapsAsChildrenOwnerName) {
  2719. mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
  2720. }
  2721. }
  2722. "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;
  2723. didWarnAboutMaps = true;
  2724. }
  2725. // Iterator will provide entry [k,v] tuples rather than values.
  2726. while (!(step = iterator.next()).done) {
  2727. var entry = step.value;
  2728. if (entry) {
  2729. child = entry[1];
  2730. nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
  2731. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  2732. }
  2733. }
  2734. }
  2735. } else if (type === 'object') {
  2736. var addendum = '';
  2737. if ("development" !== 'production') {
  2738. 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.';
  2739. if (children._isReactElement) {
  2740. 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.';
  2741. }
  2742. if (ReactCurrentOwner.current) {
  2743. var name = ReactCurrentOwner.current.getName();
  2744. if (name) {
  2745. addendum += ' Check the render method of `' + name + '`.';
  2746. }
  2747. }
  2748. }
  2749. var childrenString = String(children);
  2750. !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;
  2751. }
  2752. }
  2753. return subtreeCount;
  2754. }
  2755. /**
  2756. * Traverses children that are typically specified as `props.children`, but
  2757. * might also be specified through attributes:
  2758. *
  2759. * - `traverseAllChildren(this.props.children, ...)`
  2760. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  2761. *
  2762. * The `traverseContext` is an optional argument that is passed through the
  2763. * entire traversal. It can be used to store accumulations or anything else that
  2764. * the callback might find relevant.
  2765. *
  2766. * @param {?*} children Children tree object.
  2767. * @param {!function} callback To invoke upon traversing each child.
  2768. * @param {?*} traverseContext Context for traversal.
  2769. * @return {!number} The number of children in this subtree.
  2770. */
  2771. function traverseAllChildren(children, callback, traverseContext) {
  2772. if (children == null) {
  2773. return 0;
  2774. }
  2775. return traverseAllChildrenImpl(children, '', callback, traverseContext);
  2776. }
  2777. module.exports = traverseAllChildren;
  2778. },{"1":1,"11":11,"22":22,"25":25,"29":29,"30":30,"8":8}],27:[function(_dereq_,module,exports){
  2779. "use strict";
  2780. /**
  2781. * Copyright (c) 2013-present, Facebook, Inc.
  2782. * All rights reserved.
  2783. *
  2784. * This source code is licensed under the BSD-style license found in the
  2785. * LICENSE file in the root directory of this source tree. An additional grant
  2786. * of patent rights can be found in the PATENTS file in the same directory.
  2787. *
  2788. *
  2789. */
  2790. function makeEmptyFunction(arg) {
  2791. return function () {
  2792. return arg;
  2793. };
  2794. }
  2795. /**
  2796. * This function accepts and discards inputs; it has no side effects. This is
  2797. * primarily useful idiomatically for overridable function endpoints which
  2798. * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
  2799. */
  2800. var emptyFunction = function emptyFunction() {};
  2801. emptyFunction.thatReturns = makeEmptyFunction;
  2802. emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
  2803. emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
  2804. emptyFunction.thatReturnsNull = makeEmptyFunction(null);
  2805. emptyFunction.thatReturnsThis = function () {
  2806. return this;
  2807. };
  2808. emptyFunction.thatReturnsArgument = function (arg) {
  2809. return arg;
  2810. };
  2811. module.exports = emptyFunction;
  2812. },{}],28:[function(_dereq_,module,exports){
  2813. /**
  2814. * Copyright (c) 2013-present, Facebook, Inc.
  2815. * All rights reserved.
  2816. *
  2817. * This source code is licensed under the BSD-style license found in the
  2818. * LICENSE file in the root directory of this source tree. An additional grant
  2819. * of patent rights can be found in the PATENTS file in the same directory.
  2820. *
  2821. */
  2822. 'use strict';
  2823. var emptyObject = {};
  2824. if ("development" !== 'production') {
  2825. Object.freeze(emptyObject);
  2826. }
  2827. module.exports = emptyObject;
  2828. },{}],29:[function(_dereq_,module,exports){
  2829. /**
  2830. * Copyright (c) 2013-present, Facebook, Inc.
  2831. * All rights reserved.
  2832. *
  2833. * This source code is licensed under the BSD-style license found in the
  2834. * LICENSE file in the root directory of this source tree. An additional grant
  2835. * of patent rights can be found in the PATENTS file in the same directory.
  2836. *
  2837. */
  2838. 'use strict';
  2839. /**
  2840. * Use invariant() to assert state which your program assumes to be true.
  2841. *
  2842. * Provide sprintf-style format (only %s is supported) and arguments
  2843. * to provide information about what broke and what you were
  2844. * expecting.
  2845. *
  2846. * The invariant message will be stripped in production, but the invariant
  2847. * will remain to ensure logic does not differ in production.
  2848. */
  2849. var validateFormat = function validateFormat(format) {};
  2850. if ("development" !== 'production') {
  2851. validateFormat = function validateFormat(format) {
  2852. if (format === undefined) {
  2853. throw new Error('invariant requires an error message argument');
  2854. }
  2855. };
  2856. }
  2857. function invariant(condition, format, a, b, c, d, e, f) {
  2858. validateFormat(format);
  2859. if (!condition) {
  2860. var error;
  2861. if (format === undefined) {
  2862. error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
  2863. } else {
  2864. var args = [a, b, c, d, e, f];
  2865. var argIndex = 0;
  2866. error = new Error(format.replace(/%s/g, function () {
  2867. return args[argIndex++];
  2868. }));
  2869. error.name = 'Invariant Violation';
  2870. }
  2871. error.framesToPop = 1; // we don't care about invariant's own frame
  2872. throw error;
  2873. }
  2874. }
  2875. module.exports = invariant;
  2876. },{}],30:[function(_dereq_,module,exports){
  2877. /**
  2878. * Copyright 2014-2015, Facebook, Inc.
  2879. * All rights reserved.
  2880. *
  2881. * This source code is licensed under the BSD-style license found in the
  2882. * LICENSE file in the root directory of this source tree. An additional grant
  2883. * of patent rights can be found in the PATENTS file in the same directory.
  2884. *
  2885. */
  2886. 'use strict';
  2887. var emptyFunction = _dereq_(27);
  2888. /**
  2889. * Similar to invariant but only logs a warning if the condition is not met.
  2890. * This can be used to log issues in development environments in critical
  2891. * paths. Removing the logging code for production environments will keep the
  2892. * same logic and follow the same code paths.
  2893. */
  2894. var warning = emptyFunction;
  2895. if ("development" !== 'production') {
  2896. (function () {
  2897. var printWarning = function printWarning(format) {
  2898. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  2899. args[_key - 1] = arguments[_key];
  2900. }
  2901. var argIndex = 0;
  2902. var message = 'Warning: ' + format.replace(/%s/g, function () {
  2903. return args[argIndex++];
  2904. });
  2905. if (typeof console !== 'undefined') {
  2906. console.error(message);
  2907. }
  2908. try {
  2909. // --- Welcome to debugging React ---
  2910. // This error was thrown as a convenience so that you can use this stack
  2911. // to find the callsite that caused this warning to fire.
  2912. throw new Error(message);
  2913. } catch (x) {}
  2914. };
  2915. warning = function warning(condition, format) {
  2916. if (format === undefined) {
  2917. throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
  2918. }
  2919. if (format.indexOf('Failed Composite propType: ') === 0) {
  2920. return; // Ignore CompositeComponent proptype check.
  2921. }
  2922. if (!condition) {
  2923. for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
  2924. args[_key2 - 2] = arguments[_key2];
  2925. }
  2926. printWarning.apply(undefined, [format].concat(args));
  2927. }
  2928. };
  2929. })();
  2930. }
  2931. module.exports = warning;
  2932. },{"27":27}],31:[function(_dereq_,module,exports){
  2933. /*
  2934. object-assign
  2935. (c) Sindre Sorhus
  2936. @license MIT
  2937. */
  2938. 'use strict';
  2939. /* eslint-disable no-unused-vars */
  2940. var getOwnPropertySymbols = Object.getOwnPropertySymbols;
  2941. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2942. var propIsEnumerable = Object.prototype.propertyIsEnumerable;
  2943. function toObject(val) {
  2944. if (val === null || val === undefined) {
  2945. throw new TypeError('Object.assign cannot be called with null or undefined');
  2946. }
  2947. return Object(val);
  2948. }
  2949. function shouldUseNative() {
  2950. try {
  2951. if (!Object.assign) {
  2952. return false;
  2953. }
  2954. // Detect buggy property enumeration order in older V8 versions.
  2955. // https://bugs.chromium.org/p/v8/issues/detail?id=4118
  2956. var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
  2957. test1[5] = 'de';
  2958. if (Object.getOwnPropertyNames(test1)[0] === '5') {
  2959. return false;
  2960. }
  2961. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  2962. var test2 = {};
  2963. for (var i = 0; i < 10; i++) {
  2964. test2['_' + String.fromCharCode(i)] = i;
  2965. }
  2966. var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
  2967. return test2[n];
  2968. });
  2969. if (order2.join('') !== '0123456789') {
  2970. return false;
  2971. }
  2972. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  2973. var test3 = {};
  2974. 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
  2975. test3[letter] = letter;
  2976. });
  2977. if (Object.keys(Object.assign({}, test3)).join('') !==
  2978. 'abcdefghijklmnopqrst') {
  2979. return false;
  2980. }
  2981. return true;
  2982. } catch (err) {
  2983. // We don't expect any of the above to throw, but better to be safe.
  2984. return false;
  2985. }
  2986. }
  2987. module.exports = shouldUseNative() ? Object.assign : function (target, source) {
  2988. var from;
  2989. var to = toObject(target);
  2990. var symbols;
  2991. for (var s = 1; s < arguments.length; s++) {
  2992. from = Object(arguments[s]);
  2993. for (var key in from) {
  2994. if (hasOwnProperty.call(from, key)) {
  2995. to[key] = from[key];
  2996. }
  2997. }
  2998. if (getOwnPropertySymbols) {
  2999. symbols = getOwnPropertySymbols(from);
  3000. for (var i = 0; i < symbols.length; i++) {
  3001. if (propIsEnumerable.call(from, symbols[i])) {
  3002. to[symbols[i]] = from[symbols[i]];
  3003. }
  3004. }
  3005. }
  3006. }
  3007. return to;
  3008. };
  3009. },{}],32:[function(_dereq_,module,exports){
  3010. /**
  3011. * Copyright 2013-present, Facebook, Inc.
  3012. * All rights reserved.
  3013. *
  3014. * This source code is licensed under the BSD-style license found in the
  3015. * LICENSE file in the root directory of this source tree. An additional grant
  3016. * of patent rights can be found in the PATENTS file in the same directory.
  3017. */
  3018. 'use strict';
  3019. if ("development" !== 'production') {
  3020. var invariant = _dereq_(29);
  3021. var warning = _dereq_(30);
  3022. var ReactPropTypesSecret = _dereq_(35);
  3023. var loggedTypeFailures = {};
  3024. }
  3025. /**
  3026. * Assert that the values match with the type specs.
  3027. * Error messages are memorized and will only be shown once.
  3028. *
  3029. * @param {object} typeSpecs Map of name to a ReactPropType
  3030. * @param {object} values Runtime values that need to be type-checked
  3031. * @param {string} location e.g. "prop", "context", "child context"
  3032. * @param {string} componentName Name of the component for error messages.
  3033. * @param {?Function} getStack Returns the component stack.
  3034. * @private
  3035. */
  3036. function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
  3037. if ("development" !== 'production') {
  3038. for (var typeSpecName in typeSpecs) {
  3039. if (typeSpecs.hasOwnProperty(typeSpecName)) {
  3040. var error;
  3041. // Prop type validation may throw. In case they do, we don't want to
  3042. // fail the render phase where it didn't fail before. So we log it.
  3043. // After these have been cleaned up, we'll let them throw.
  3044. try {
  3045. // This is intentionally an invariant that gets caught. It's the same
  3046. // behavior as without this statement except with a better message.
  3047. 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);
  3048. error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
  3049. } catch (ex) {
  3050. error = ex;
  3051. }
  3052. 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);
  3053. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  3054. // Only monitor this failure once because there tends to be a lot of the
  3055. // same error.
  3056. loggedTypeFailures[error.message] = true;
  3057. var stack = getStack ? getStack() : '';
  3058. warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
  3059. }
  3060. }
  3061. }
  3062. }
  3063. }
  3064. module.exports = checkPropTypes;
  3065. },{"29":29,"30":30,"35":35}],33:[function(_dereq_,module,exports){
  3066. /**
  3067. * Copyright 2013-present, Facebook, Inc.
  3068. * All rights reserved.
  3069. *
  3070. * This source code is licensed under the BSD-style license found in the
  3071. * LICENSE file in the root directory of this source tree. An additional grant
  3072. * of patent rights can be found in the PATENTS file in the same directory.
  3073. */
  3074. 'use strict';
  3075. // React 15.5 references this module, and assumes PropTypes are still callable in production.
  3076. // Therefore we re-export development-only version with all the PropTypes checks here.
  3077. // However if one is migrating to the `prop-types` npm library, they will go through the
  3078. // `index.js` entry point, and it will branch depending on the environment.
  3079. var factory = _dereq_(34);
  3080. module.exports = function(isValidElement) {
  3081. // It is still allowed in 15.5.
  3082. var throwOnDirectAccess = false;
  3083. return factory(isValidElement, throwOnDirectAccess);
  3084. };
  3085. },{"34":34}],34:[function(_dereq_,module,exports){
  3086. /**
  3087. * Copyright 2013-present, Facebook, Inc.
  3088. * All rights reserved.
  3089. *
  3090. * This source code is licensed under the BSD-style license found in the
  3091. * LICENSE file in the root directory of this source tree. An additional grant
  3092. * of patent rights can be found in the PATENTS file in the same directory.
  3093. */
  3094. 'use strict';
  3095. var emptyFunction = _dereq_(27);
  3096. var invariant = _dereq_(29);
  3097. var warning = _dereq_(30);
  3098. var ReactPropTypesSecret = _dereq_(35);
  3099. var checkPropTypes = _dereq_(32);
  3100. module.exports = function(isValidElement, throwOnDirectAccess) {
  3101. /* global Symbol */
  3102. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  3103. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  3104. /**
  3105. * Returns the iterator method function contained on the iterable object.
  3106. *
  3107. * Be sure to invoke the function with the iterable as context:
  3108. *
  3109. * var iteratorFn = getIteratorFn(myIterable);
  3110. * if (iteratorFn) {
  3111. * var iterator = iteratorFn.call(myIterable);
  3112. * ...
  3113. * }
  3114. *
  3115. * @param {?object} maybeIterable
  3116. * @return {?function}
  3117. */
  3118. function getIteratorFn(maybeIterable) {
  3119. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  3120. if (typeof iteratorFn === 'function') {
  3121. return iteratorFn;
  3122. }
  3123. }
  3124. /**
  3125. * Collection of methods that allow declaration and validation of props that are
  3126. * supplied to React components. Example usage:
  3127. *
  3128. * var Props = require('ReactPropTypes');
  3129. * var MyArticle = React.createClass({
  3130. * propTypes: {
  3131. * // An optional string prop named "description".
  3132. * description: Props.string,
  3133. *
  3134. * // A required enum prop named "category".
  3135. * category: Props.oneOf(['News','Photos']).isRequired,
  3136. *
  3137. * // A prop named "dialog" that requires an instance of Dialog.
  3138. * dialog: Props.instanceOf(Dialog).isRequired
  3139. * },
  3140. * render: function() { ... }
  3141. * });
  3142. *
  3143. * A more formal specification of how these methods are used:
  3144. *
  3145. * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
  3146. * decl := ReactPropTypes.{type}(.isRequired)?
  3147. *
  3148. * Each and every declaration produces a function with the same signature. This
  3149. * allows the creation of custom validation functions. For example:
  3150. *
  3151. * var MyLink = React.createClass({
  3152. * propTypes: {
  3153. * // An optional string or URI prop named "href".
  3154. * href: function(props, propName, componentName) {
  3155. * var propValue = props[propName];
  3156. * if (propValue != null && typeof propValue !== 'string' &&
  3157. * !(propValue instanceof URI)) {
  3158. * return new Error(
  3159. * 'Expected a string or an URI for ' + propName + ' in ' +
  3160. * componentName
  3161. * );
  3162. * }
  3163. * }
  3164. * },
  3165. * render: function() {...}
  3166. * });
  3167. *
  3168. * @internal
  3169. */
  3170. var ANONYMOUS = '<<anonymous>>';
  3171. // Important!
  3172. // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
  3173. var ReactPropTypes = {
  3174. array: createPrimitiveTypeChecker('array'),
  3175. bool: createPrimitiveTypeChecker('boolean'),
  3176. func: createPrimitiveTypeChecker('function'),
  3177. number: createPrimitiveTypeChecker('number'),
  3178. object: createPrimitiveTypeChecker('object'),
  3179. string: createPrimitiveTypeChecker('string'),
  3180. symbol: createPrimitiveTypeChecker('symbol'),
  3181. any: createAnyTypeChecker(),
  3182. arrayOf: createArrayOfTypeChecker,
  3183. element: createElementTypeChecker(),
  3184. instanceOf: createInstanceTypeChecker,
  3185. node: createNodeChecker(),
  3186. objectOf: createObjectOfTypeChecker,
  3187. oneOf: createEnumTypeChecker,
  3188. oneOfType: createUnionTypeChecker,
  3189. shape: createShapeTypeChecker
  3190. };
  3191. /**
  3192. * inlined Object.is polyfill to avoid requiring consumers ship their own
  3193. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  3194. */
  3195. /*eslint-disable no-self-compare*/
  3196. function is(x, y) {
  3197. // SameValue algorithm
  3198. if (x === y) {
  3199. // Steps 1-5, 7-10
  3200. // Steps 6.b-6.e: +0 != -0
  3201. return x !== 0 || 1 / x === 1 / y;
  3202. } else {
  3203. // Step 6.a: NaN == NaN
  3204. return x !== x && y !== y;
  3205. }
  3206. }
  3207. /*eslint-enable no-self-compare*/
  3208. /**
  3209. * We use an Error-like object for backward compatibility as people may call
  3210. * PropTypes directly and inspect their output. However, we don't use real
  3211. * Errors anymore. We don't inspect their stack anyway, and creating them
  3212. * is prohibitively expensive if they are created too often, such as what
  3213. * happens in oneOfType() for any type before the one that matched.
  3214. */
  3215. function PropTypeError(message) {
  3216. this.message = message;
  3217. this.stack = '';
  3218. }
  3219. // Make `instanceof Error` still work for returned errors.
  3220. PropTypeError.prototype = Error.prototype;
  3221. function createChainableTypeChecker(validate) {
  3222. if ("development" !== 'production') {
  3223. var manualPropTypeCallCache = {};
  3224. }
  3225. function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
  3226. componentName = componentName || ANONYMOUS;
  3227. propFullName = propFullName || propName;
  3228. if (secret !== ReactPropTypesSecret) {
  3229. if (throwOnDirectAccess) {
  3230. // New behavior only for users of `prop-types` package
  3231. invariant(
  3232. false,
  3233. 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
  3234. 'Use `PropTypes.checkPropTypes()` to call them. ' +
  3235. 'Read more at http://fb.me/use-check-prop-types'
  3236. );
  3237. } else if ("development" !== 'production' && typeof console !== 'undefined') {
  3238. // Old behavior for people using React.PropTypes
  3239. var cacheKey = componentName + ':' + propName;
  3240. if (!manualPropTypeCallCache[cacheKey]) {
  3241. warning(
  3242. false,
  3243. 'You are manually calling a React.PropTypes validation ' +
  3244. 'function for the `%s` prop on `%s`. This is deprecated ' +
  3245. 'and will throw in the standalone `prop-types` package. ' +
  3246. 'You may be seeing this warning due to a third-party PropTypes ' +
  3247. 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
  3248. propFullName,
  3249. componentName
  3250. );
  3251. manualPropTypeCallCache[cacheKey] = true;
  3252. }
  3253. }
  3254. }
  3255. if (props[propName] == null) {
  3256. if (isRequired) {
  3257. if (props[propName] === null) {
  3258. return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
  3259. }
  3260. return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
  3261. }
  3262. return null;
  3263. } else {
  3264. return validate(props, propName, componentName, location, propFullName);
  3265. }
  3266. }
  3267. var chainedCheckType = checkType.bind(null, false);
  3268. chainedCheckType.isRequired = checkType.bind(null, true);
  3269. return chainedCheckType;
  3270. }
  3271. function createPrimitiveTypeChecker(expectedType) {
  3272. function validate(props, propName, componentName, location, propFullName, secret) {
  3273. var propValue = props[propName];
  3274. var propType = getPropType(propValue);
  3275. if (propType !== expectedType) {
  3276. // `propValue` being instance of, say, date/regexp, pass the 'object'
  3277. // check, but we can offer a more precise error message here rather than
  3278. // 'of type `object`'.
  3279. var preciseType = getPreciseType(propValue);
  3280. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
  3281. }
  3282. return null;
  3283. }
  3284. return createChainableTypeChecker(validate);
  3285. }
  3286. function createAnyTypeChecker() {
  3287. return createChainableTypeChecker(emptyFunction.thatReturnsNull);
  3288. }
  3289. function createArrayOfTypeChecker(typeChecker) {
  3290. function validate(props, propName, componentName, location, propFullName) {
  3291. if (typeof typeChecker !== 'function') {
  3292. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
  3293. }
  3294. var propValue = props[propName];
  3295. if (!Array.isArray(propValue)) {
  3296. var propType = getPropType(propValue);
  3297. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
  3298. }
  3299. for (var i = 0; i < propValue.length; i++) {
  3300. var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
  3301. if (error instanceof Error) {
  3302. return error;
  3303. }
  3304. }
  3305. return null;
  3306. }
  3307. return createChainableTypeChecker(validate);
  3308. }
  3309. function createElementTypeChecker() {
  3310. function validate(props, propName, componentName, location, propFullName) {
  3311. var propValue = props[propName];
  3312. if (!isValidElement(propValue)) {
  3313. var propType = getPropType(propValue);
  3314. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
  3315. }
  3316. return null;
  3317. }
  3318. return createChainableTypeChecker(validate);
  3319. }
  3320. function createInstanceTypeChecker(expectedClass) {
  3321. function validate(props, propName, componentName, location, propFullName) {
  3322. if (!(props[propName] instanceof expectedClass)) {
  3323. var expectedClassName = expectedClass.name || ANONYMOUS;
  3324. var actualClassName = getClassName(props[propName]);
  3325. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
  3326. }
  3327. return null;
  3328. }
  3329. return createChainableTypeChecker(validate);
  3330. }
  3331. function createEnumTypeChecker(expectedValues) {
  3332. if (!Array.isArray(expectedValues)) {
  3333. "development" !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
  3334. return emptyFunction.thatReturnsNull;
  3335. }
  3336. function validate(props, propName, componentName, location, propFullName) {
  3337. var propValue = props[propName];
  3338. for (var i = 0; i < expectedValues.length; i++) {
  3339. if (is(propValue, expectedValues[i])) {
  3340. return null;
  3341. }
  3342. }
  3343. var valuesString = JSON.stringify(expectedValues);
  3344. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
  3345. }
  3346. return createChainableTypeChecker(validate);
  3347. }
  3348. function createObjectOfTypeChecker(typeChecker) {
  3349. function validate(props, propName, componentName, location, propFullName) {
  3350. if (typeof typeChecker !== 'function') {
  3351. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
  3352. }
  3353. var propValue = props[propName];
  3354. var propType = getPropType(propValue);
  3355. if (propType !== 'object') {
  3356. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
  3357. }
  3358. for (var key in propValue) {
  3359. if (propValue.hasOwnProperty(key)) {
  3360. var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  3361. if (error instanceof Error) {
  3362. return error;
  3363. }
  3364. }
  3365. }
  3366. return null;
  3367. }
  3368. return createChainableTypeChecker(validate);
  3369. }
  3370. function createUnionTypeChecker(arrayOfTypeCheckers) {
  3371. if (!Array.isArray(arrayOfTypeCheckers)) {
  3372. "development" !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
  3373. return emptyFunction.thatReturnsNull;
  3374. }
  3375. function validate(props, propName, componentName, location, propFullName) {
  3376. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  3377. var checker = arrayOfTypeCheckers[i];
  3378. if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
  3379. return null;
  3380. }
  3381. }
  3382. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
  3383. }
  3384. return createChainableTypeChecker(validate);
  3385. }
  3386. function createNodeChecker() {
  3387. function validate(props, propName, componentName, location, propFullName) {
  3388. if (!isNode(props[propName])) {
  3389. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
  3390. }
  3391. return null;
  3392. }
  3393. return createChainableTypeChecker(validate);
  3394. }
  3395. function createShapeTypeChecker(shapeTypes) {
  3396. function validate(props, propName, componentName, location, propFullName) {
  3397. var propValue = props[propName];
  3398. var propType = getPropType(propValue);
  3399. if (propType !== 'object') {
  3400. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
  3401. }
  3402. for (var key in shapeTypes) {
  3403. var checker = shapeTypes[key];
  3404. if (!checker) {
  3405. continue;
  3406. }
  3407. var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  3408. if (error) {
  3409. return error;
  3410. }
  3411. }
  3412. return null;
  3413. }
  3414. return createChainableTypeChecker(validate);
  3415. }
  3416. function isNode(propValue) {
  3417. switch (typeof propValue) {
  3418. case 'number':
  3419. case 'string':
  3420. case 'undefined':
  3421. return true;
  3422. case 'boolean':
  3423. return !propValue;
  3424. case 'object':
  3425. if (Array.isArray(propValue)) {
  3426. return propValue.every(isNode);
  3427. }
  3428. if (propValue === null || isValidElement(propValue)) {
  3429. return true;
  3430. }
  3431. var iteratorFn = getIteratorFn(propValue);
  3432. if (iteratorFn) {
  3433. var iterator = iteratorFn.call(propValue);
  3434. var step;
  3435. if (iteratorFn !== propValue.entries) {
  3436. while (!(step = iterator.next()).done) {
  3437. if (!isNode(step.value)) {
  3438. return false;
  3439. }
  3440. }
  3441. } else {
  3442. // Iterator will provide entry [k,v] tuples rather than values.
  3443. while (!(step = iterator.next()).done) {
  3444. var entry = step.value;
  3445. if (entry) {
  3446. if (!isNode(entry[1])) {
  3447. return false;
  3448. }
  3449. }
  3450. }
  3451. }
  3452. } else {
  3453. return false;
  3454. }
  3455. return true;
  3456. default:
  3457. return false;
  3458. }
  3459. }
  3460. function isSymbol(propType, propValue) {
  3461. // Native Symbol.
  3462. if (propType === 'symbol') {
  3463. return true;
  3464. }
  3465. // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
  3466. if (propValue['@@toStringTag'] === 'Symbol') {
  3467. return true;
  3468. }
  3469. // Fallback for non-spec compliant Symbols which are polyfilled.
  3470. if (typeof Symbol === 'function' && propValue instanceof Symbol) {
  3471. return true;
  3472. }
  3473. return false;
  3474. }
  3475. // Equivalent of `typeof` but with special handling for array and regexp.
  3476. function getPropType(propValue) {
  3477. var propType = typeof propValue;
  3478. if (Array.isArray(propValue)) {
  3479. return 'array';
  3480. }
  3481. if (propValue instanceof RegExp) {
  3482. // Old webkits (at least until Android 4.0) return 'function' rather than
  3483. // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
  3484. // passes PropTypes.object.
  3485. return 'object';
  3486. }
  3487. if (isSymbol(propType, propValue)) {
  3488. return 'symbol';
  3489. }
  3490. return propType;
  3491. }
  3492. // This handles more types than `getPropType`. Only used for error messages.
  3493. // See `createPrimitiveTypeChecker`.
  3494. function getPreciseType(propValue) {
  3495. var propType = getPropType(propValue);
  3496. if (propType === 'object') {
  3497. if (propValue instanceof Date) {
  3498. return 'date';
  3499. } else if (propValue instanceof RegExp) {
  3500. return 'regexp';
  3501. }
  3502. }
  3503. return propType;
  3504. }
  3505. // Returns class name of the object, if any.
  3506. function getClassName(propValue) {
  3507. if (!propValue.constructor || !propValue.constructor.name) {
  3508. return ANONYMOUS;
  3509. }
  3510. return propValue.constructor.name;
  3511. }
  3512. ReactPropTypes.checkPropTypes = checkPropTypes;
  3513. ReactPropTypes.PropTypes = ReactPropTypes;
  3514. return ReactPropTypes;
  3515. };
  3516. },{"27":27,"29":29,"30":30,"32":32,"35":35}],35:[function(_dereq_,module,exports){
  3517. /**
  3518. * Copyright 2013-present, Facebook, Inc.
  3519. * All rights reserved.
  3520. *
  3521. * This source code is licensed under the BSD-style license found in the
  3522. * LICENSE file in the root directory of this source tree. An additional grant
  3523. * of patent rights can be found in the PATENTS file in the same directory.
  3524. */
  3525. 'use strict';
  3526. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  3527. module.exports = ReactPropTypesSecret;
  3528. },{}]},{},[18])(18)
  3529. });