lib_react_dom_15.4.1.js (606099B)
1 /** 2 * ReactDOM v15.4.1 3 */ 4 5 ;(function(f) { 6 // CommonJS 7 if (typeof exports === "object" && typeof module !== "undefined") { 8 module.exports = f(require('react')); 9 10 // RequireJS 11 } else if (typeof define === "function" && define.amd) { 12 define(['react'], f); 13 14 // <script> 15 } else { 16 var g; 17 if (typeof window !== "undefined") { 18 g = window; 19 } else if (typeof global !== "undefined") { 20 g = global; 21 } else if (typeof self !== "undefined") { 22 g = self; 23 } else { 24 // works providing we're not in "use strict"; 25 // needed for Java 8 Nashorn 26 // see https://github.com/facebook/react/issues/3037 27 g = this; 28 } 29 g.ReactDOM = f(g.React); 30 } 31 })(function(React) { 32 return (function(f){return f()})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw (f.code="MODULE_NOT_FOUND", f)}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ 33 /** 34 * Copyright 2013-present, Facebook, Inc. 35 * All rights reserved. 36 * 37 * This source code is licensed under the BSD-style license found in the 38 * LICENSE file in the root directory of this source tree. An additional grant 39 * of patent rights can be found in the PATENTS file in the same directory. 40 * 41 */ 42 43 'use strict'; 44 45 var ARIADOMPropertyConfig = { 46 Properties: { 47 // Global States and Properties 48 'aria-current': 0, // state 49 'aria-details': 0, 50 'aria-disabled': 0, // state 51 'aria-hidden': 0, // state 52 'aria-invalid': 0, // state 53 'aria-keyshortcuts': 0, 54 'aria-label': 0, 55 'aria-roledescription': 0, 56 // Widget Attributes 57 'aria-autocomplete': 0, 58 'aria-checked': 0, 59 'aria-expanded': 0, 60 'aria-haspopup': 0, 61 'aria-level': 0, 62 'aria-modal': 0, 63 'aria-multiline': 0, 64 'aria-multiselectable': 0, 65 'aria-orientation': 0, 66 'aria-placeholder': 0, 67 'aria-pressed': 0, 68 'aria-readonly': 0, 69 'aria-required': 0, 70 'aria-selected': 0, 71 'aria-sort': 0, 72 'aria-valuemax': 0, 73 'aria-valuemin': 0, 74 'aria-valuenow': 0, 75 'aria-valuetext': 0, 76 // Live Region Attributes 77 'aria-atomic': 0, 78 'aria-busy': 0, 79 'aria-live': 0, 80 'aria-relevant': 0, 81 // Drag-and-Drop Attributes 82 'aria-dropeffect': 0, 83 'aria-grabbed': 0, 84 // Relationship Attributes 85 'aria-activedescendant': 0, 86 'aria-colcount': 0, 87 'aria-colindex': 0, 88 'aria-colspan': 0, 89 'aria-controls': 0, 90 'aria-describedby': 0, 91 'aria-errormessage': 0, 92 'aria-flowto': 0, 93 'aria-labelledby': 0, 94 'aria-owns': 0, 95 'aria-posinset': 0, 96 'aria-rowcount': 0, 97 'aria-rowindex': 0, 98 'aria-rowspan': 0, 99 'aria-setsize': 0 100 }, 101 DOMAttributeNames: {}, 102 DOMPropertyNames: {} 103 }; 104 105 module.exports = ARIADOMPropertyConfig; 106 },{}],2:[function(_dereq_,module,exports){ 107 /** 108 * Copyright 2013-present, Facebook, Inc. 109 * All rights reserved. 110 * 111 * This source code is licensed under the BSD-style license found in the 112 * LICENSE file in the root directory of this source tree. An additional grant 113 * of patent rights can be found in the PATENTS file in the same directory. 114 * 115 */ 116 117 'use strict'; 118 119 var ReactDOMComponentTree = _dereq_(34); 120 121 var focusNode = _dereq_(144); 122 123 var AutoFocusUtils = { 124 focusDOMComponent: function () { 125 focusNode(ReactDOMComponentTree.getNodeFromInstance(this)); 126 } 127 }; 128 129 module.exports = AutoFocusUtils; 130 },{"144":144,"34":34}],3:[function(_dereq_,module,exports){ 131 /** 132 * Copyright 2013-present Facebook, Inc. 133 * All rights reserved. 134 * 135 * This source code is licensed under the BSD-style license found in the 136 * LICENSE file in the root directory of this source tree. An additional grant 137 * of patent rights can be found in the PATENTS file in the same directory. 138 * 139 */ 140 141 'use strict'; 142 143 var EventPropagators = _dereq_(20); 144 var ExecutionEnvironment = _dereq_(136); 145 var FallbackCompositionState = _dereq_(21); 146 var SyntheticCompositionEvent = _dereq_(89); 147 var SyntheticInputEvent = _dereq_(93); 148 149 var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space 150 var START_KEYCODE = 229; 151 152 var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window; 153 154 var documentMode = null; 155 if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) { 156 documentMode = document.documentMode; 157 } 158 159 // Webkit offers a very useful `textInput` event that can be used to 160 // directly represent `beforeInput`. The IE `textinput` event is not as 161 // useful, so we don't use it. 162 var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto(); 163 164 // In IE9+, we have access to composition events, but the data supplied 165 // by the native compositionend event may be incorrect. Japanese ideographic 166 // spaces, for instance (\u3000) are not recorded correctly. 167 var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); 168 169 /** 170 * Opera <= 12 includes TextEvent in window, but does not fire 171 * text input events. Rely on keypress instead. 172 */ 173 function isPresto() { 174 var opera = window.opera; 175 return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12; 176 } 177 178 var SPACEBAR_CODE = 32; 179 var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); 180 181 // Events and their corresponding property names. 182 var eventTypes = { 183 beforeInput: { 184 phasedRegistrationNames: { 185 bubbled: 'onBeforeInput', 186 captured: 'onBeforeInputCapture' 187 }, 188 dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste'] 189 }, 190 compositionEnd: { 191 phasedRegistrationNames: { 192 bubbled: 'onCompositionEnd', 193 captured: 'onCompositionEndCapture' 194 }, 195 dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] 196 }, 197 compositionStart: { 198 phasedRegistrationNames: { 199 bubbled: 'onCompositionStart', 200 captured: 'onCompositionStartCapture' 201 }, 202 dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] 203 }, 204 compositionUpdate: { 205 phasedRegistrationNames: { 206 bubbled: 'onCompositionUpdate', 207 captured: 'onCompositionUpdateCapture' 208 }, 209 dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] 210 } 211 }; 212 213 // Track whether we've ever handled a keypress on the space key. 214 var hasSpaceKeypress = false; 215 216 /** 217 * Return whether a native keypress event is assumed to be a command. 218 * This is required because Firefox fires `keypress` events for key commands 219 * (cut, copy, select-all, etc.) even though no character is inserted. 220 */ 221 function isKeypressCommand(nativeEvent) { 222 return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && 223 // ctrlKey && altKey is equivalent to AltGr, and is not a command. 224 !(nativeEvent.ctrlKey && nativeEvent.altKey); 225 } 226 227 /** 228 * Translate native top level events into event types. 229 * 230 * @param {string} topLevelType 231 * @return {object} 232 */ 233 function getCompositionEventType(topLevelType) { 234 switch (topLevelType) { 235 case 'topCompositionStart': 236 return eventTypes.compositionStart; 237 case 'topCompositionEnd': 238 return eventTypes.compositionEnd; 239 case 'topCompositionUpdate': 240 return eventTypes.compositionUpdate; 241 } 242 } 243 244 /** 245 * Does our fallback best-guess model think this event signifies that 246 * composition has begun? 247 * 248 * @param {string} topLevelType 249 * @param {object} nativeEvent 250 * @return {boolean} 251 */ 252 function isFallbackCompositionStart(topLevelType, nativeEvent) { 253 return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE; 254 } 255 256 /** 257 * Does our fallback mode think that this event is the end of composition? 258 * 259 * @param {string} topLevelType 260 * @param {object} nativeEvent 261 * @return {boolean} 262 */ 263 function isFallbackCompositionEnd(topLevelType, nativeEvent) { 264 switch (topLevelType) { 265 case 'topKeyUp': 266 // Command keys insert or clear IME input. 267 return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; 268 case 'topKeyDown': 269 // Expect IME keyCode on each keydown. If we get any other 270 // code we must have exited earlier. 271 return nativeEvent.keyCode !== START_KEYCODE; 272 case 'topKeyPress': 273 case 'topMouseDown': 274 case 'topBlur': 275 // Events are not possible without cancelling IME. 276 return true; 277 default: 278 return false; 279 } 280 } 281 282 /** 283 * Google Input Tools provides composition data via a CustomEvent, 284 * with the `data` property populated in the `detail` object. If this 285 * is available on the event object, use it. If not, this is a plain 286 * composition event and we have nothing special to extract. 287 * 288 * @param {object} nativeEvent 289 * @return {?string} 290 */ 291 function getDataFromCustomEvent(nativeEvent) { 292 var detail = nativeEvent.detail; 293 if (typeof detail === 'object' && 'data' in detail) { 294 return detail.data; 295 } 296 return null; 297 } 298 299 // Track the current IME composition fallback object, if any. 300 var currentComposition = null; 301 302 /** 303 * @return {?object} A SyntheticCompositionEvent. 304 */ 305 function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { 306 var eventType; 307 var fallbackData; 308 309 if (canUseCompositionEvent) { 310 eventType = getCompositionEventType(topLevelType); 311 } else if (!currentComposition) { 312 if (isFallbackCompositionStart(topLevelType, nativeEvent)) { 313 eventType = eventTypes.compositionStart; 314 } 315 } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { 316 eventType = eventTypes.compositionEnd; 317 } 318 319 if (!eventType) { 320 return null; 321 } 322 323 if (useFallbackCompositionData) { 324 // The current composition is stored statically and must not be 325 // overwritten while composition continues. 326 if (!currentComposition && eventType === eventTypes.compositionStart) { 327 currentComposition = FallbackCompositionState.getPooled(nativeEventTarget); 328 } else if (eventType === eventTypes.compositionEnd) { 329 if (currentComposition) { 330 fallbackData = currentComposition.getData(); 331 } 332 } 333 } 334 335 var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget); 336 337 if (fallbackData) { 338 // Inject data generated from fallback path into the synthetic event. 339 // This matches the property of native CompositionEventInterface. 340 event.data = fallbackData; 341 } else { 342 var customData = getDataFromCustomEvent(nativeEvent); 343 if (customData !== null) { 344 event.data = customData; 345 } 346 } 347 348 EventPropagators.accumulateTwoPhaseDispatches(event); 349 return event; 350 } 351 352 /** 353 * @param {string} topLevelType Record from `EventConstants`. 354 * @param {object} nativeEvent Native browser event. 355 * @return {?string} The string corresponding to this `beforeInput` event. 356 */ 357 function getNativeBeforeInputChars(topLevelType, nativeEvent) { 358 switch (topLevelType) { 359 case 'topCompositionEnd': 360 return getDataFromCustomEvent(nativeEvent); 361 case 'topKeyPress': 362 /** 363 * If native `textInput` events are available, our goal is to make 364 * use of them. However, there is a special case: the spacebar key. 365 * In Webkit, preventing default on a spacebar `textInput` event 366 * cancels character insertion, but it *also* causes the browser 367 * to fall back to its default spacebar behavior of scrolling the 368 * page. 369 * 370 * Tracking at: 371 * https://code.google.com/p/chromium/issues/detail?id=355103 372 * 373 * To avoid this issue, use the keypress event as if no `textInput` 374 * event is available. 375 */ 376 var which = nativeEvent.which; 377 if (which !== SPACEBAR_CODE) { 378 return null; 379 } 380 381 hasSpaceKeypress = true; 382 return SPACEBAR_CHAR; 383 384 case 'topTextInput': 385 // Record the characters to be added to the DOM. 386 var chars = nativeEvent.data; 387 388 // If it's a spacebar character, assume that we have already handled 389 // it at the keypress level and bail immediately. Android Chrome 390 // doesn't give us keycodes, so we need to blacklist it. 391 if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { 392 return null; 393 } 394 395 return chars; 396 397 default: 398 // For other native event types, do nothing. 399 return null; 400 } 401 } 402 403 /** 404 * For browsers that do not provide the `textInput` event, extract the 405 * appropriate string to use for SyntheticInputEvent. 406 * 407 * @param {string} topLevelType Record from `EventConstants`. 408 * @param {object} nativeEvent Native browser event. 409 * @return {?string} The fallback string for this `beforeInput` event. 410 */ 411 function getFallbackBeforeInputChars(topLevelType, nativeEvent) { 412 // If we are currently composing (IME) and using a fallback to do so, 413 // try to extract the composed characters from the fallback object. 414 // If composition event is available, we extract a string only at 415 // compositionevent, otherwise extract it at fallback events. 416 if (currentComposition) { 417 if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) { 418 var chars = currentComposition.getData(); 419 FallbackCompositionState.release(currentComposition); 420 currentComposition = null; 421 return chars; 422 } 423 return null; 424 } 425 426 switch (topLevelType) { 427 case 'topPaste': 428 // If a paste event occurs after a keypress, throw out the input 429 // chars. Paste events should not lead to BeforeInput events. 430 return null; 431 case 'topKeyPress': 432 /** 433 * As of v27, Firefox may fire keypress events even when no character 434 * will be inserted. A few possibilities: 435 * 436 * - `which` is `0`. Arrow keys, Esc key, etc. 437 * 438 * - `which` is the pressed key code, but no char is available. 439 * Ex: 'AltGr + d` in Polish. There is no modified character for 440 * this key combination and no character is inserted into the 441 * document, but FF fires the keypress for char code `100` anyway. 442 * No `input` event will occur. 443 * 444 * - `which` is the pressed key code, but a command combination is 445 * being used. Ex: `Cmd+C`. No character is inserted, and no 446 * `input` event will occur. 447 */ 448 if (nativeEvent.which && !isKeypressCommand(nativeEvent)) { 449 return String.fromCharCode(nativeEvent.which); 450 } 451 return null; 452 case 'topCompositionEnd': 453 return useFallbackCompositionData ? null : nativeEvent.data; 454 default: 455 return null; 456 } 457 } 458 459 /** 460 * Extract a SyntheticInputEvent for `beforeInput`, based on either native 461 * `textInput` or fallback behavior. 462 * 463 * @return {?object} A SyntheticInputEvent. 464 */ 465 function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { 466 var chars; 467 468 if (canUseTextInputEvent) { 469 chars = getNativeBeforeInputChars(topLevelType, nativeEvent); 470 } else { 471 chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); 472 } 473 474 // If no characters are being inserted, no BeforeInput event should 475 // be fired. 476 if (!chars) { 477 return null; 478 } 479 480 var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget); 481 482 event.data = chars; 483 EventPropagators.accumulateTwoPhaseDispatches(event); 484 return event; 485 } 486 487 /** 488 * Create an `onBeforeInput` event to match 489 * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. 490 * 491 * This event plugin is based on the native `textInput` event 492 * available in Chrome, Safari, Opera, and IE. This event fires after 493 * `onKeyPress` and `onCompositionEnd`, but before `onInput`. 494 * 495 * `beforeInput` is spec'd but not implemented in any browsers, and 496 * the `input` event does not provide any useful information about what has 497 * actually been added, contrary to the spec. Thus, `textInput` is the best 498 * available event to identify the characters that have actually been inserted 499 * into the target node. 500 * 501 * This plugin is also responsible for emitting `composition` events, thus 502 * allowing us to share composition fallback code for both `beforeInput` and 503 * `composition` event types. 504 */ 505 var BeforeInputEventPlugin = { 506 507 eventTypes: eventTypes, 508 509 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { 510 return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)]; 511 } 512 }; 513 514 module.exports = BeforeInputEventPlugin; 515 },{"136":136,"20":20,"21":21,"89":89,"93":93}],4:[function(_dereq_,module,exports){ 516 /** 517 * Copyright 2013-present, Facebook, Inc. 518 * All rights reserved. 519 * 520 * This source code is licensed under the BSD-style license found in the 521 * LICENSE file in the root directory of this source tree. An additional grant 522 * of patent rights can be found in the PATENTS file in the same directory. 523 * 524 */ 525 526 'use strict'; 527 528 /** 529 * CSS properties which accept numbers but are not in units of "px". 530 */ 531 532 var isUnitlessNumber = { 533 animationIterationCount: true, 534 borderImageOutset: true, 535 borderImageSlice: true, 536 borderImageWidth: true, 537 boxFlex: true, 538 boxFlexGroup: true, 539 boxOrdinalGroup: true, 540 columnCount: true, 541 flex: true, 542 flexGrow: true, 543 flexPositive: true, 544 flexShrink: true, 545 flexNegative: true, 546 flexOrder: true, 547 gridRow: true, 548 gridColumn: true, 549 fontWeight: true, 550 lineClamp: true, 551 lineHeight: true, 552 opacity: true, 553 order: true, 554 orphans: true, 555 tabSize: true, 556 widows: true, 557 zIndex: true, 558 zoom: true, 559 560 // SVG-related properties 561 fillOpacity: true, 562 floodOpacity: true, 563 stopOpacity: true, 564 strokeDasharray: true, 565 strokeDashoffset: true, 566 strokeMiterlimit: true, 567 strokeOpacity: true, 568 strokeWidth: true 569 }; 570 571 /** 572 * @param {string} prefix vendor-specific prefix, eg: Webkit 573 * @param {string} key style name, eg: transitionDuration 574 * @return {string} style name prefixed with `prefix`, properly camelCased, eg: 575 * WebkitTransitionDuration 576 */ 577 function prefixKey(prefix, key) { 578 return prefix + key.charAt(0).toUpperCase() + key.substring(1); 579 } 580 581 /** 582 * Support style names that may come passed in prefixed by adding permutations 583 * of vendor prefixes. 584 */ 585 var prefixes = ['Webkit', 'ms', 'Moz', 'O']; 586 587 // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an 588 // infinite loop, because it iterates over the newly added props too. 589 Object.keys(isUnitlessNumber).forEach(function (prop) { 590 prefixes.forEach(function (prefix) { 591 isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop]; 592 }); 593 }); 594 595 /** 596 * Most style properties can be unset by doing .style[prop] = '' but IE8 597 * doesn't like doing that with shorthand properties so for the properties that 598 * IE8 breaks on, which are listed here, we instead unset each of the 599 * individual properties. See http://bugs.jquery.com/ticket/12385. 600 * The 4-value 'clock' properties like margin, padding, border-width seem to 601 * behave without any problems. Curiously, list-style works too without any 602 * special prodding. 603 */ 604 var shorthandPropertyExpansions = { 605 background: { 606 backgroundAttachment: true, 607 backgroundColor: true, 608 backgroundImage: true, 609 backgroundPositionX: true, 610 backgroundPositionY: true, 611 backgroundRepeat: true 612 }, 613 backgroundPosition: { 614 backgroundPositionX: true, 615 backgroundPositionY: true 616 }, 617 border: { 618 borderWidth: true, 619 borderStyle: true, 620 borderColor: true 621 }, 622 borderBottom: { 623 borderBottomWidth: true, 624 borderBottomStyle: true, 625 borderBottomColor: true 626 }, 627 borderLeft: { 628 borderLeftWidth: true, 629 borderLeftStyle: true, 630 borderLeftColor: true 631 }, 632 borderRight: { 633 borderRightWidth: true, 634 borderRightStyle: true, 635 borderRightColor: true 636 }, 637 borderTop: { 638 borderTopWidth: true, 639 borderTopStyle: true, 640 borderTopColor: true 641 }, 642 font: { 643 fontStyle: true, 644 fontVariant: true, 645 fontWeight: true, 646 fontSize: true, 647 lineHeight: true, 648 fontFamily: true 649 }, 650 outline: { 651 outlineWidth: true, 652 outlineStyle: true, 653 outlineColor: true 654 } 655 }; 656 657 var CSSProperty = { 658 isUnitlessNumber: isUnitlessNumber, 659 shorthandPropertyExpansions: shorthandPropertyExpansions 660 }; 661 662 module.exports = CSSProperty; 663 },{}],5:[function(_dereq_,module,exports){ 664 /** 665 * Copyright 2013-present, Facebook, Inc. 666 * All rights reserved. 667 * 668 * This source code is licensed under the BSD-style license found in the 669 * LICENSE file in the root directory of this source tree. An additional grant 670 * of patent rights can be found in the PATENTS file in the same directory. 671 * 672 */ 673 674 'use strict'; 675 676 var CSSProperty = _dereq_(4); 677 var ExecutionEnvironment = _dereq_(136); 678 var ReactInstrumentation = _dereq_(64); 679 680 var camelizeStyleName = _dereq_(138); 681 var dangerousStyleValue = _dereq_(106); 682 var hyphenateStyleName = _dereq_(149); 683 var memoizeStringOnly = _dereq_(153); 684 var warning = _dereq_(157); 685 686 var processStyleName = memoizeStringOnly(function (styleName) { 687 return hyphenateStyleName(styleName); 688 }); 689 690 var hasShorthandPropertyBug = false; 691 var styleFloatAccessor = 'cssFloat'; 692 if (ExecutionEnvironment.canUseDOM) { 693 var tempStyle = document.createElement('div').style; 694 try { 695 // IE8 throws "Invalid argument." if resetting shorthand style properties. 696 tempStyle.font = ''; 697 } catch (e) { 698 hasShorthandPropertyBug = true; 699 } 700 // IE8 only supports accessing cssFloat (standard) as styleFloat 701 if (document.documentElement.style.cssFloat === undefined) { 702 styleFloatAccessor = 'styleFloat'; 703 } 704 } 705 706 if ("development" !== 'production') { 707 // 'msTransform' is correct, but the other prefixes should be capitalized 708 var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/; 709 710 // style values shouldn't contain a semicolon 711 var badStyleValueWithSemicolonPattern = /;\s*$/; 712 713 var warnedStyleNames = {}; 714 var warnedStyleValues = {}; 715 var warnedForNaNValue = false; 716 717 var warnHyphenatedStyleName = function (name, owner) { 718 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { 719 return; 720 } 721 722 warnedStyleNames[name] = true; 723 "development" !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0; 724 }; 725 726 var warnBadVendoredStyleName = function (name, owner) { 727 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { 728 return; 729 } 730 731 warnedStyleNames[name] = true; 732 "development" !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), checkRenderMessage(owner)) : void 0; 733 }; 734 735 var warnStyleValueWithSemicolon = function (name, value, owner) { 736 if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) { 737 return; 738 } 739 740 warnedStyleValues[value] = true; 741 "development" !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon.%s ' + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, '')) : void 0; 742 }; 743 744 var warnStyleValueIsNaN = function (name, value, owner) { 745 if (warnedForNaNValue) { 746 return; 747 } 748 749 warnedForNaNValue = true; 750 "development" !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0; 751 }; 752 753 var checkRenderMessage = function (owner) { 754 if (owner) { 755 var name = owner.getName(); 756 if (name) { 757 return ' Check the render method of `' + name + '`.'; 758 } 759 } 760 return ''; 761 }; 762 763 /** 764 * @param {string} name 765 * @param {*} value 766 * @param {ReactDOMComponent} component 767 */ 768 var warnValidStyle = function (name, value, component) { 769 var owner; 770 if (component) { 771 owner = component._currentElement._owner; 772 } 773 if (name.indexOf('-') > -1) { 774 warnHyphenatedStyleName(name, owner); 775 } else if (badVendoredStyleNamePattern.test(name)) { 776 warnBadVendoredStyleName(name, owner); 777 } else if (badStyleValueWithSemicolonPattern.test(value)) { 778 warnStyleValueWithSemicolon(name, value, owner); 779 } 780 781 if (typeof value === 'number' && isNaN(value)) { 782 warnStyleValueIsNaN(name, value, owner); 783 } 784 }; 785 } 786 787 /** 788 * Operations for dealing with CSS properties. 789 */ 790 var CSSPropertyOperations = { 791 792 /** 793 * Serializes a mapping of style properties for use as inline styles: 794 * 795 * > createMarkupForStyles({width: '200px', height: 0}) 796 * "width:200px;height:0;" 797 * 798 * Undefined values are ignored so that declarative programming is easier. 799 * The result should be HTML-escaped before insertion into the DOM. 800 * 801 * @param {object} styles 802 * @param {ReactDOMComponent} component 803 * @return {?string} 804 */ 805 createMarkupForStyles: function (styles, component) { 806 var serialized = ''; 807 for (var styleName in styles) { 808 if (!styles.hasOwnProperty(styleName)) { 809 continue; 810 } 811 var styleValue = styles[styleName]; 812 if ("development" !== 'production') { 813 warnValidStyle(styleName, styleValue, component); 814 } 815 if (styleValue != null) { 816 serialized += processStyleName(styleName) + ':'; 817 serialized += dangerousStyleValue(styleName, styleValue, component) + ';'; 818 } 819 } 820 return serialized || null; 821 }, 822 823 /** 824 * Sets the value for multiple styles on a node. If a value is specified as 825 * '' (empty string), the corresponding style property will be unset. 826 * 827 * @param {DOMElement} node 828 * @param {object} styles 829 * @param {ReactDOMComponent} component 830 */ 831 setValueForStyles: function (node, styles, component) { 832 if ("development" !== 'production') { 833 ReactInstrumentation.debugTool.onHostOperation({ 834 instanceID: component._debugID, 835 type: 'update styles', 836 payload: styles 837 }); 838 } 839 840 var style = node.style; 841 for (var styleName in styles) { 842 if (!styles.hasOwnProperty(styleName)) { 843 continue; 844 } 845 if ("development" !== 'production') { 846 warnValidStyle(styleName, styles[styleName], component); 847 } 848 var styleValue = dangerousStyleValue(styleName, styles[styleName], component); 849 if (styleName === 'float' || styleName === 'cssFloat') { 850 styleName = styleFloatAccessor; 851 } 852 if (styleValue) { 853 style[styleName] = styleValue; 854 } else { 855 var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName]; 856 if (expansion) { 857 // Shorthand property that IE8 won't like unsetting, so unset each 858 // component to placate it 859 for (var individualStyleName in expansion) { 860 style[individualStyleName] = ''; 861 } 862 } else { 863 style[styleName] = ''; 864 } 865 } 866 } 867 } 868 869 }; 870 871 module.exports = CSSPropertyOperations; 872 },{"106":106,"136":136,"138":138,"149":149,"153":153,"157":157,"4":4,"64":64}],6:[function(_dereq_,module,exports){ 873 /** 874 * Copyright 2013-present, Facebook, Inc. 875 * All rights reserved. 876 * 877 * This source code is licensed under the BSD-style license found in the 878 * LICENSE file in the root directory of this source tree. An additional grant 879 * of patent rights can be found in the PATENTS file in the same directory. 880 * 881 * 882 */ 883 884 'use strict'; 885 886 var _prodInvariant = _dereq_(125); 887 888 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 889 890 var PooledClass = _dereq_(25); 891 892 var invariant = _dereq_(150); 893 894 /** 895 * A specialized pseudo-event module to help keep track of components waiting to 896 * be notified when their DOM representations are available for use. 897 * 898 * This implements `PooledClass`, so you should never need to instantiate this. 899 * Instead, use `CallbackQueue.getPooled()`. 900 * 901 * @class ReactMountReady 902 * @implements PooledClass 903 * @internal 904 */ 905 906 var CallbackQueue = function () { 907 function CallbackQueue(arg) { 908 _classCallCheck(this, CallbackQueue); 909 910 this._callbacks = null; 911 this._contexts = null; 912 this._arg = arg; 913 } 914 915 /** 916 * Enqueues a callback to be invoked when `notifyAll` is invoked. 917 * 918 * @param {function} callback Invoked when `notifyAll` is invoked. 919 * @param {?object} context Context to call `callback` with. 920 * @internal 921 */ 922 923 924 CallbackQueue.prototype.enqueue = function enqueue(callback, context) { 925 this._callbacks = this._callbacks || []; 926 this._callbacks.push(callback); 927 this._contexts = this._contexts || []; 928 this._contexts.push(context); 929 }; 930 931 /** 932 * Invokes all enqueued callbacks and clears the queue. This is invoked after 933 * the DOM representation of a component has been created or updated. 934 * 935 * @internal 936 */ 937 938 939 CallbackQueue.prototype.notifyAll = function notifyAll() { 940 var callbacks = this._callbacks; 941 var contexts = this._contexts; 942 var arg = this._arg; 943 if (callbacks && contexts) { 944 !(callbacks.length === contexts.length) ? "development" !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : _prodInvariant('24') : void 0; 945 this._callbacks = null; 946 this._contexts = null; 947 for (var i = 0; i < callbacks.length; i++) { 948 callbacks[i].call(contexts[i], arg); 949 } 950 callbacks.length = 0; 951 contexts.length = 0; 952 } 953 }; 954 955 CallbackQueue.prototype.checkpoint = function checkpoint() { 956 return this._callbacks ? this._callbacks.length : 0; 957 }; 958 959 CallbackQueue.prototype.rollback = function rollback(len) { 960 if (this._callbacks && this._contexts) { 961 this._callbacks.length = len; 962 this._contexts.length = len; 963 } 964 }; 965 966 /** 967 * Resets the internal queue. 968 * 969 * @internal 970 */ 971 972 973 CallbackQueue.prototype.reset = function reset() { 974 this._callbacks = null; 975 this._contexts = null; 976 }; 977 978 /** 979 * `PooledClass` looks for this. 980 */ 981 982 983 CallbackQueue.prototype.destructor = function destructor() { 984 this.reset(); 985 }; 986 987 return CallbackQueue; 988 }(); 989 990 module.exports = PooledClass.addPoolingTo(CallbackQueue); 991 },{"125":125,"150":150,"25":25}],7:[function(_dereq_,module,exports){ 992 /** 993 * Copyright 2013-present, Facebook, Inc. 994 * All rights reserved. 995 * 996 * This source code is licensed under the BSD-style license found in the 997 * LICENSE file in the root directory of this source tree. An additional grant 998 * of patent rights can be found in the PATENTS file in the same directory. 999 * 1000 */ 1001 1002 'use strict'; 1003 1004 var EventPluginHub = _dereq_(17); 1005 var EventPropagators = _dereq_(20); 1006 var ExecutionEnvironment = _dereq_(136); 1007 var ReactDOMComponentTree = _dereq_(34); 1008 var ReactUpdates = _dereq_(82); 1009 var SyntheticEvent = _dereq_(91); 1010 1011 var getEventTarget = _dereq_(114); 1012 var isEventSupported = _dereq_(122); 1013 var isTextInputElement = _dereq_(123); 1014 1015 var eventTypes = { 1016 change: { 1017 phasedRegistrationNames: { 1018 bubbled: 'onChange', 1019 captured: 'onChangeCapture' 1020 }, 1021 dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange'] 1022 } 1023 }; 1024 1025 /** 1026 * For IE shims 1027 */ 1028 var activeElement = null; 1029 var activeElementInst = null; 1030 var activeElementValue = null; 1031 var activeElementValueProp = null; 1032 1033 /** 1034 * SECTION: handle `change` event 1035 */ 1036 function shouldUseChangeEvent(elem) { 1037 var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); 1038 return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; 1039 } 1040 1041 var doesChangeEventBubble = false; 1042 if (ExecutionEnvironment.canUseDOM) { 1043 // See `handleChange` comment below 1044 doesChangeEventBubble = isEventSupported('change') && (!document.documentMode || document.documentMode > 8); 1045 } 1046 1047 function manualDispatchChangeEvent(nativeEvent) { 1048 var event = SyntheticEvent.getPooled(eventTypes.change, activeElementInst, nativeEvent, getEventTarget(nativeEvent)); 1049 EventPropagators.accumulateTwoPhaseDispatches(event); 1050 1051 // If change and propertychange bubbled, we'd just bind to it like all the 1052 // other events and have it go through ReactBrowserEventEmitter. Since it 1053 // doesn't, we manually listen for the events and so we have to enqueue and 1054 // process the abstract event manually. 1055 // 1056 // Batching is necessary here in order to ensure that all event handlers run 1057 // before the next rerender (including event handlers attached to ancestor 1058 // elements instead of directly on the input). Without this, controlled 1059 // components don't work properly in conjunction with event bubbling because 1060 // the component is rerendered and the value reverted before all the event 1061 // handlers can run. See https://github.com/facebook/react/issues/708. 1062 ReactUpdates.batchedUpdates(runEventInBatch, event); 1063 } 1064 1065 function runEventInBatch(event) { 1066 EventPluginHub.enqueueEvents(event); 1067 EventPluginHub.processEventQueue(false); 1068 } 1069 1070 function startWatchingForChangeEventIE8(target, targetInst) { 1071 activeElement = target; 1072 activeElementInst = targetInst; 1073 activeElement.attachEvent('onchange', manualDispatchChangeEvent); 1074 } 1075 1076 function stopWatchingForChangeEventIE8() { 1077 if (!activeElement) { 1078 return; 1079 } 1080 activeElement.detachEvent('onchange', manualDispatchChangeEvent); 1081 activeElement = null; 1082 activeElementInst = null; 1083 } 1084 1085 function getTargetInstForChangeEvent(topLevelType, targetInst) { 1086 if (topLevelType === 'topChange') { 1087 return targetInst; 1088 } 1089 } 1090 function handleEventsForChangeEventIE8(topLevelType, target, targetInst) { 1091 if (topLevelType === 'topFocus') { 1092 // stopWatching() should be a noop here but we call it just in case we 1093 // missed a blur event somehow. 1094 stopWatchingForChangeEventIE8(); 1095 startWatchingForChangeEventIE8(target, targetInst); 1096 } else if (topLevelType === 'topBlur') { 1097 stopWatchingForChangeEventIE8(); 1098 } 1099 } 1100 1101 /** 1102 * SECTION: handle `input` event 1103 */ 1104 var isInputEventSupported = false; 1105 if (ExecutionEnvironment.canUseDOM) { 1106 // IE9 claims to support the input event but fails to trigger it when 1107 // deleting text, so we ignore its input events. 1108 // IE10+ fire input events to often, such when a placeholder 1109 // changes or when an input with a placeholder is focused. 1110 isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 11); 1111 } 1112 1113 /** 1114 * (For IE <=11) Replacement getter/setter for the `value` property that gets 1115 * set on the active element. 1116 */ 1117 var newValueProp = { 1118 get: function () { 1119 return activeElementValueProp.get.call(this); 1120 }, 1121 set: function (val) { 1122 // Cast to a string so we can do equality checks. 1123 activeElementValue = '' + val; 1124 activeElementValueProp.set.call(this, val); 1125 } 1126 }; 1127 1128 /** 1129 * (For IE <=11) Starts tracking propertychange events on the passed-in element 1130 * and override the value property so that we can distinguish user events from 1131 * value changes in JS. 1132 */ 1133 function startWatchingForValueChange(target, targetInst) { 1134 activeElement = target; 1135 activeElementInst = targetInst; 1136 activeElementValue = target.value; 1137 activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value'); 1138 1139 // Not guarded in a canDefineProperty check: IE8 supports defineProperty only 1140 // on DOM elements 1141 Object.defineProperty(activeElement, 'value', newValueProp); 1142 if (activeElement.attachEvent) { 1143 activeElement.attachEvent('onpropertychange', handlePropertyChange); 1144 } else { 1145 activeElement.addEventListener('propertychange', handlePropertyChange, false); 1146 } 1147 } 1148 1149 /** 1150 * (For IE <=11) Removes the event listeners from the currently-tracked element, 1151 * if any exists. 1152 */ 1153 function stopWatchingForValueChange() { 1154 if (!activeElement) { 1155 return; 1156 } 1157 1158 // delete restores the original property definition 1159 delete activeElement.value; 1160 1161 if (activeElement.detachEvent) { 1162 activeElement.detachEvent('onpropertychange', handlePropertyChange); 1163 } else { 1164 activeElement.removeEventListener('propertychange', handlePropertyChange, false); 1165 } 1166 1167 activeElement = null; 1168 activeElementInst = null; 1169 activeElementValue = null; 1170 activeElementValueProp = null; 1171 } 1172 1173 /** 1174 * (For IE <=11) Handles a propertychange event, sending a `change` event if 1175 * the value of the active element has changed. 1176 */ 1177 function handlePropertyChange(nativeEvent) { 1178 if (nativeEvent.propertyName !== 'value') { 1179 return; 1180 } 1181 var value = nativeEvent.srcElement.value; 1182 if (value === activeElementValue) { 1183 return; 1184 } 1185 activeElementValue = value; 1186 1187 manualDispatchChangeEvent(nativeEvent); 1188 } 1189 1190 /** 1191 * If a `change` event should be fired, returns the target's ID. 1192 */ 1193 function getTargetInstForInputEvent(topLevelType, targetInst) { 1194 if (topLevelType === 'topInput') { 1195 // In modern browsers (i.e., not IE8 or IE9), the input event is exactly 1196 // what we want so fall through here and trigger an abstract event 1197 return targetInst; 1198 } 1199 } 1200 1201 function handleEventsForInputEventIE(topLevelType, target, targetInst) { 1202 if (topLevelType === 'topFocus') { 1203 // In IE8, we can capture almost all .value changes by adding a 1204 // propertychange handler and looking for events with propertyName 1205 // equal to 'value' 1206 // In IE9-11, propertychange fires for most input events but is buggy and 1207 // doesn't fire when text is deleted, but conveniently, selectionchange 1208 // appears to fire in all of the remaining cases so we catch those and 1209 // forward the event if the value has changed 1210 // In either case, we don't want to call the event handler if the value 1211 // is changed from JS so we redefine a setter for `.value` that updates 1212 // our activeElementValue variable, allowing us to ignore those changes 1213 // 1214 // stopWatching() should be a noop here but we call it just in case we 1215 // missed a blur event somehow. 1216 stopWatchingForValueChange(); 1217 startWatchingForValueChange(target, targetInst); 1218 } else if (topLevelType === 'topBlur') { 1219 stopWatchingForValueChange(); 1220 } 1221 } 1222 1223 // For IE8 and IE9. 1224 function getTargetInstForInputEventIE(topLevelType, targetInst) { 1225 if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') { 1226 // On the selectionchange event, the target is just document which isn't 1227 // helpful for us so just check activeElement instead. 1228 // 1229 // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire 1230 // propertychange on the first input event after setting `value` from a 1231 // script and fires only keydown, keypress, keyup. Catching keyup usually 1232 // gets it and catching keydown lets us fire an event for the first 1233 // keystroke if user does a key repeat (it'll be a little delayed: right 1234 // before the second keystroke). Other input methods (e.g., paste) seem to 1235 // fire selectionchange normally. 1236 if (activeElement && activeElement.value !== activeElementValue) { 1237 activeElementValue = activeElement.value; 1238 return activeElementInst; 1239 } 1240 } 1241 } 1242 1243 /** 1244 * SECTION: handle `click` event 1245 */ 1246 function shouldUseClickEvent(elem) { 1247 // Use the `click` event to detect changes to checkbox and radio inputs. 1248 // This approach works across all browsers, whereas `change` does not fire 1249 // until `blur` in IE8. 1250 return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio'); 1251 } 1252 1253 function getTargetInstForClickEvent(topLevelType, targetInst) { 1254 if (topLevelType === 'topClick') { 1255 return targetInst; 1256 } 1257 } 1258 1259 /** 1260 * This plugin creates an `onChange` event that normalizes change events 1261 * across form elements. This event fires at a time when it's possible to 1262 * change the element's value without seeing a flicker. 1263 * 1264 * Supported elements are: 1265 * - input (see `isTextInputElement`) 1266 * - textarea 1267 * - select 1268 */ 1269 var ChangeEventPlugin = { 1270 1271 eventTypes: eventTypes, 1272 1273 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { 1274 var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window; 1275 1276 var getTargetInstFunc, handleEventFunc; 1277 if (shouldUseChangeEvent(targetNode)) { 1278 if (doesChangeEventBubble) { 1279 getTargetInstFunc = getTargetInstForChangeEvent; 1280 } else { 1281 handleEventFunc = handleEventsForChangeEventIE8; 1282 } 1283 } else if (isTextInputElement(targetNode)) { 1284 if (isInputEventSupported) { 1285 getTargetInstFunc = getTargetInstForInputEvent; 1286 } else { 1287 getTargetInstFunc = getTargetInstForInputEventIE; 1288 handleEventFunc = handleEventsForInputEventIE; 1289 } 1290 } else if (shouldUseClickEvent(targetNode)) { 1291 getTargetInstFunc = getTargetInstForClickEvent; 1292 } 1293 1294 if (getTargetInstFunc) { 1295 var inst = getTargetInstFunc(topLevelType, targetInst); 1296 if (inst) { 1297 var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, nativeEventTarget); 1298 event.type = 'change'; 1299 EventPropagators.accumulateTwoPhaseDispatches(event); 1300 return event; 1301 } 1302 } 1303 1304 if (handleEventFunc) { 1305 handleEventFunc(topLevelType, targetNode, targetInst); 1306 } 1307 } 1308 1309 }; 1310 1311 module.exports = ChangeEventPlugin; 1312 },{"114":114,"122":122,"123":123,"136":136,"17":17,"20":20,"34":34,"82":82,"91":91}],8:[function(_dereq_,module,exports){ 1313 /** 1314 * Copyright 2013-present, Facebook, Inc. 1315 * All rights reserved. 1316 * 1317 * This source code is licensed under the BSD-style license found in the 1318 * LICENSE file in the root directory of this source tree. An additional grant 1319 * of patent rights can be found in the PATENTS file in the same directory. 1320 * 1321 */ 1322 1323 'use strict'; 1324 1325 var DOMLazyTree = _dereq_(9); 1326 var Danger = _dereq_(13); 1327 var ReactDOMComponentTree = _dereq_(34); 1328 var ReactInstrumentation = _dereq_(64); 1329 1330 var createMicrosoftUnsafeLocalFunction = _dereq_(105); 1331 var setInnerHTML = _dereq_(127); 1332 var setTextContent = _dereq_(128); 1333 1334 function getNodeAfter(parentNode, node) { 1335 // Special case for text components, which return [open, close] comments 1336 // from getHostNode. 1337 if (Array.isArray(node)) { 1338 node = node[1]; 1339 } 1340 return node ? node.nextSibling : parentNode.firstChild; 1341 } 1342 1343 /** 1344 * Inserts `childNode` as a child of `parentNode` at the `index`. 1345 * 1346 * @param {DOMElement} parentNode Parent node in which to insert. 1347 * @param {DOMElement} childNode Child node to insert. 1348 * @param {number} index Index at which to insert the child. 1349 * @internal 1350 */ 1351 var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) { 1352 // We rely exclusively on `insertBefore(node, null)` instead of also using 1353 // `appendChild(node)`. (Using `undefined` is not allowed by all browsers so 1354 // we are careful to use `null`.) 1355 parentNode.insertBefore(childNode, referenceNode); 1356 }); 1357 1358 function insertLazyTreeChildAt(parentNode, childTree, referenceNode) { 1359 DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode); 1360 } 1361 1362 function moveChild(parentNode, childNode, referenceNode) { 1363 if (Array.isArray(childNode)) { 1364 moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode); 1365 } else { 1366 insertChildAt(parentNode, childNode, referenceNode); 1367 } 1368 } 1369 1370 function removeChild(parentNode, childNode) { 1371 if (Array.isArray(childNode)) { 1372 var closingComment = childNode[1]; 1373 childNode = childNode[0]; 1374 removeDelimitedText(parentNode, childNode, closingComment); 1375 parentNode.removeChild(closingComment); 1376 } 1377 parentNode.removeChild(childNode); 1378 } 1379 1380 function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) { 1381 var node = openingComment; 1382 while (true) { 1383 var nextNode = node.nextSibling; 1384 insertChildAt(parentNode, node, referenceNode); 1385 if (node === closingComment) { 1386 break; 1387 } 1388 node = nextNode; 1389 } 1390 } 1391 1392 function removeDelimitedText(parentNode, startNode, closingComment) { 1393 while (true) { 1394 var node = startNode.nextSibling; 1395 if (node === closingComment) { 1396 // The closing comment is removed by ReactMultiChild. 1397 break; 1398 } else { 1399 parentNode.removeChild(node); 1400 } 1401 } 1402 } 1403 1404 function replaceDelimitedText(openingComment, closingComment, stringText) { 1405 var parentNode = openingComment.parentNode; 1406 var nodeAfterComment = openingComment.nextSibling; 1407 if (nodeAfterComment === closingComment) { 1408 // There are no text nodes between the opening and closing comments; insert 1409 // a new one if stringText isn't empty. 1410 if (stringText) { 1411 insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment); 1412 } 1413 } else { 1414 if (stringText) { 1415 // Set the text content of the first node after the opening comment, and 1416 // remove all following nodes up until the closing comment. 1417 setTextContent(nodeAfterComment, stringText); 1418 removeDelimitedText(parentNode, nodeAfterComment, closingComment); 1419 } else { 1420 removeDelimitedText(parentNode, openingComment, closingComment); 1421 } 1422 } 1423 1424 if ("development" !== 'production') { 1425 ReactInstrumentation.debugTool.onHostOperation({ 1426 instanceID: ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID, 1427 type: 'replace text', 1428 payload: stringText 1429 }); 1430 } 1431 } 1432 1433 var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup; 1434 if ("development" !== 'production') { 1435 dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) { 1436 Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup); 1437 if (prevInstance._debugID !== 0) { 1438 ReactInstrumentation.debugTool.onHostOperation({ 1439 instanceID: prevInstance._debugID, 1440 type: 'replace with', 1441 payload: markup.toString() 1442 }); 1443 } else { 1444 var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node); 1445 if (nextInstance._debugID !== 0) { 1446 ReactInstrumentation.debugTool.onHostOperation({ 1447 instanceID: nextInstance._debugID, 1448 type: 'mount', 1449 payload: markup.toString() 1450 }); 1451 } 1452 } 1453 }; 1454 } 1455 1456 /** 1457 * Operations for updating with DOM children. 1458 */ 1459 var DOMChildrenOperations = { 1460 1461 dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup, 1462 1463 replaceDelimitedText: replaceDelimitedText, 1464 1465 /** 1466 * Updates a component's children by processing a series of updates. The 1467 * update configurations are each expected to have a `parentNode` property. 1468 * 1469 * @param {array<object>} updates List of update configurations. 1470 * @internal 1471 */ 1472 processUpdates: function (parentNode, updates) { 1473 if ("development" !== 'production') { 1474 var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID; 1475 } 1476 1477 for (var k = 0; k < updates.length; k++) { 1478 var update = updates[k]; 1479 switch (update.type) { 1480 case 'INSERT_MARKUP': 1481 insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode)); 1482 if ("development" !== 'production') { 1483 ReactInstrumentation.debugTool.onHostOperation({ 1484 instanceID: parentNodeDebugID, 1485 type: 'insert child', 1486 payload: { toIndex: update.toIndex, content: update.content.toString() } 1487 }); 1488 } 1489 break; 1490 case 'MOVE_EXISTING': 1491 moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode)); 1492 if ("development" !== 'production') { 1493 ReactInstrumentation.debugTool.onHostOperation({ 1494 instanceID: parentNodeDebugID, 1495 type: 'move child', 1496 payload: { fromIndex: update.fromIndex, toIndex: update.toIndex } 1497 }); 1498 } 1499 break; 1500 case 'SET_MARKUP': 1501 setInnerHTML(parentNode, update.content); 1502 if ("development" !== 'production') { 1503 ReactInstrumentation.debugTool.onHostOperation({ 1504 instanceID: parentNodeDebugID, 1505 type: 'replace children', 1506 payload: update.content.toString() 1507 }); 1508 } 1509 break; 1510 case 'TEXT_CONTENT': 1511 setTextContent(parentNode, update.content); 1512 if ("development" !== 'production') { 1513 ReactInstrumentation.debugTool.onHostOperation({ 1514 instanceID: parentNodeDebugID, 1515 type: 'replace text', 1516 payload: update.content.toString() 1517 }); 1518 } 1519 break; 1520 case 'REMOVE_NODE': 1521 removeChild(parentNode, update.fromNode); 1522 if ("development" !== 'production') { 1523 ReactInstrumentation.debugTool.onHostOperation({ 1524 instanceID: parentNodeDebugID, 1525 type: 'remove child', 1526 payload: { fromIndex: update.fromIndex } 1527 }); 1528 } 1529 break; 1530 } 1531 } 1532 } 1533 1534 }; 1535 1536 module.exports = DOMChildrenOperations; 1537 },{"105":105,"127":127,"128":128,"13":13,"34":34,"64":64,"9":9}],9:[function(_dereq_,module,exports){ 1538 /** 1539 * Copyright 2015-present, Facebook, Inc. 1540 * All rights reserved. 1541 * 1542 * This source code is licensed under the BSD-style license found in the 1543 * LICENSE file in the root directory of this source tree. An additional grant 1544 * of patent rights can be found in the PATENTS file in the same directory. 1545 * 1546 */ 1547 1548 'use strict'; 1549 1550 var DOMNamespaces = _dereq_(10); 1551 var setInnerHTML = _dereq_(127); 1552 1553 var createMicrosoftUnsafeLocalFunction = _dereq_(105); 1554 var setTextContent = _dereq_(128); 1555 1556 var ELEMENT_NODE_TYPE = 1; 1557 var DOCUMENT_FRAGMENT_NODE_TYPE = 11; 1558 1559 /** 1560 * In IE (8-11) and Edge, appending nodes with no children is dramatically 1561 * faster than appending a full subtree, so we essentially queue up the 1562 * .appendChild calls here and apply them so each node is added to its parent 1563 * before any children are added. 1564 * 1565 * In other browsers, doing so is slower or neutral compared to the other order 1566 * (in Firefox, twice as slow) so we only do this inversion in IE. 1567 * 1568 * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode. 1569 */ 1570 var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent); 1571 1572 function insertTreeChildren(tree) { 1573 if (!enableLazy) { 1574 return; 1575 } 1576 var node = tree.node; 1577 var children = tree.children; 1578 if (children.length) { 1579 for (var i = 0; i < children.length; i++) { 1580 insertTreeBefore(node, children[i], null); 1581 } 1582 } else if (tree.html != null) { 1583 setInnerHTML(node, tree.html); 1584 } else if (tree.text != null) { 1585 setTextContent(node, tree.text); 1586 } 1587 } 1588 1589 var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) { 1590 // DocumentFragments aren't actually part of the DOM after insertion so 1591 // appending children won't update the DOM. We need to ensure the fragment 1592 // is properly populated first, breaking out of our lazy approach for just 1593 // this level. Also, some <object> plugins (like Flash Player) will read 1594 // <param> nodes immediately upon insertion into the DOM, so <object> 1595 // must also be populated prior to insertion into the DOM. 1596 if (tree.node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE || tree.node.nodeType === ELEMENT_NODE_TYPE && tree.node.nodeName.toLowerCase() === 'object' && (tree.node.namespaceURI == null || tree.node.namespaceURI === DOMNamespaces.html)) { 1597 insertTreeChildren(tree); 1598 parentNode.insertBefore(tree.node, referenceNode); 1599 } else { 1600 parentNode.insertBefore(tree.node, referenceNode); 1601 insertTreeChildren(tree); 1602 } 1603 }); 1604 1605 function replaceChildWithTree(oldNode, newTree) { 1606 oldNode.parentNode.replaceChild(newTree.node, oldNode); 1607 insertTreeChildren(newTree); 1608 } 1609 1610 function queueChild(parentTree, childTree) { 1611 if (enableLazy) { 1612 parentTree.children.push(childTree); 1613 } else { 1614 parentTree.node.appendChild(childTree.node); 1615 } 1616 } 1617 1618 function queueHTML(tree, html) { 1619 if (enableLazy) { 1620 tree.html = html; 1621 } else { 1622 setInnerHTML(tree.node, html); 1623 } 1624 } 1625 1626 function queueText(tree, text) { 1627 if (enableLazy) { 1628 tree.text = text; 1629 } else { 1630 setTextContent(tree.node, text); 1631 } 1632 } 1633 1634 function toString() { 1635 return this.node.nodeName; 1636 } 1637 1638 function DOMLazyTree(node) { 1639 return { 1640 node: node, 1641 children: [], 1642 html: null, 1643 text: null, 1644 toString: toString 1645 }; 1646 } 1647 1648 DOMLazyTree.insertTreeBefore = insertTreeBefore; 1649 DOMLazyTree.replaceChildWithTree = replaceChildWithTree; 1650 DOMLazyTree.queueChild = queueChild; 1651 DOMLazyTree.queueHTML = queueHTML; 1652 DOMLazyTree.queueText = queueText; 1653 1654 module.exports = DOMLazyTree; 1655 },{"10":10,"105":105,"127":127,"128":128}],10:[function(_dereq_,module,exports){ 1656 /** 1657 * Copyright 2013-present, Facebook, Inc. 1658 * All rights reserved. 1659 * 1660 * This source code is licensed under the BSD-style license found in the 1661 * LICENSE file in the root directory of this source tree. An additional grant 1662 * of patent rights can be found in the PATENTS file in the same directory. 1663 * 1664 */ 1665 1666 'use strict'; 1667 1668 var DOMNamespaces = { 1669 html: 'http://www.w3.org/1999/xhtml', 1670 mathml: 'http://www.w3.org/1998/Math/MathML', 1671 svg: 'http://www.w3.org/2000/svg' 1672 }; 1673 1674 module.exports = DOMNamespaces; 1675 },{}],11:[function(_dereq_,module,exports){ 1676 /** 1677 * Copyright 2013-present, Facebook, Inc. 1678 * All rights reserved. 1679 * 1680 * This source code is licensed under the BSD-style license found in the 1681 * LICENSE file in the root directory of this source tree. An additional grant 1682 * of patent rights can be found in the PATENTS file in the same directory. 1683 * 1684 */ 1685 1686 'use strict'; 1687 1688 var _prodInvariant = _dereq_(125); 1689 1690 var invariant = _dereq_(150); 1691 1692 function checkMask(value, bitmask) { 1693 return (value & bitmask) === bitmask; 1694 } 1695 1696 var DOMPropertyInjection = { 1697 /** 1698 * Mapping from normalized, camelcased property names to a configuration that 1699 * specifies how the associated DOM property should be accessed or rendered. 1700 */ 1701 MUST_USE_PROPERTY: 0x1, 1702 HAS_BOOLEAN_VALUE: 0x4, 1703 HAS_NUMERIC_VALUE: 0x8, 1704 HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8, 1705 HAS_OVERLOADED_BOOLEAN_VALUE: 0x20, 1706 1707 /** 1708 * Inject some specialized knowledge about the DOM. This takes a config object 1709 * with the following properties: 1710 * 1711 * isCustomAttribute: function that given an attribute name will return true 1712 * if it can be inserted into the DOM verbatim. Useful for data-* or aria-* 1713 * attributes where it's impossible to enumerate all of the possible 1714 * attribute names, 1715 * 1716 * Properties: object mapping DOM property name to one of the 1717 * DOMPropertyInjection constants or null. If your attribute isn't in here, 1718 * it won't get written to the DOM. 1719 * 1720 * DOMAttributeNames: object mapping React attribute name to the DOM 1721 * attribute name. Attribute names not specified use the **lowercase** 1722 * normalized name. 1723 * 1724 * DOMAttributeNamespaces: object mapping React attribute name to the DOM 1725 * attribute namespace URL. (Attribute names not specified use no namespace.) 1726 * 1727 * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties. 1728 * Property names not specified use the normalized name. 1729 * 1730 * DOMMutationMethods: Properties that require special mutation methods. If 1731 * `value` is undefined, the mutation method should unset the property. 1732 * 1733 * @param {object} domPropertyConfig the config as described above. 1734 */ 1735 injectDOMPropertyConfig: function (domPropertyConfig) { 1736 var Injection = DOMPropertyInjection; 1737 var Properties = domPropertyConfig.Properties || {}; 1738 var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {}; 1739 var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; 1740 var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {}; 1741 var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {}; 1742 1743 if (domPropertyConfig.isCustomAttribute) { 1744 DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute); 1745 } 1746 1747 for (var propName in Properties) { 1748 !!DOMProperty.properties.hasOwnProperty(propName) ? "development" !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property \'%s\' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.', propName) : _prodInvariant('48', propName) : void 0; 1749 1750 var lowerCased = propName.toLowerCase(); 1751 var propConfig = Properties[propName]; 1752 1753 var propertyInfo = { 1754 attributeName: lowerCased, 1755 attributeNamespace: null, 1756 propertyName: propName, 1757 mutationMethod: null, 1758 1759 mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY), 1760 hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE), 1761 hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE), 1762 hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE), 1763 hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE) 1764 }; 1765 !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : _prodInvariant('50', propName) : void 0; 1766 1767 if ("development" !== 'production') { 1768 DOMProperty.getPossibleStandardName[lowerCased] = propName; 1769 } 1770 1771 if (DOMAttributeNames.hasOwnProperty(propName)) { 1772 var attributeName = DOMAttributeNames[propName]; 1773 propertyInfo.attributeName = attributeName; 1774 if ("development" !== 'production') { 1775 DOMProperty.getPossibleStandardName[attributeName] = propName; 1776 } 1777 } 1778 1779 if (DOMAttributeNamespaces.hasOwnProperty(propName)) { 1780 propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName]; 1781 } 1782 1783 if (DOMPropertyNames.hasOwnProperty(propName)) { 1784 propertyInfo.propertyName = DOMPropertyNames[propName]; 1785 } 1786 1787 if (DOMMutationMethods.hasOwnProperty(propName)) { 1788 propertyInfo.mutationMethod = DOMMutationMethods[propName]; 1789 } 1790 1791 DOMProperty.properties[propName] = propertyInfo; 1792 } 1793 } 1794 }; 1795 1796 /* eslint-disable max-len */ 1797 var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD'; 1798 /* eslint-enable max-len */ 1799 1800 /** 1801 * DOMProperty exports lookup objects that can be used like functions: 1802 * 1803 * > DOMProperty.isValid['id'] 1804 * true 1805 * > DOMProperty.isValid['foobar'] 1806 * undefined 1807 * 1808 * Although this may be confusing, it performs better in general. 1809 * 1810 * @see http://jsperf.com/key-exists 1811 * @see http://jsperf.com/key-missing 1812 */ 1813 var DOMProperty = { 1814 1815 ID_ATTRIBUTE_NAME: 'data-reactid', 1816 ROOT_ATTRIBUTE_NAME: 'data-reactroot', 1817 1818 ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR, 1819 ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040', 1820 1821 /** 1822 * Map from property "standard name" to an object with info about how to set 1823 * the property in the DOM. Each object contains: 1824 * 1825 * attributeName: 1826 * Used when rendering markup or with `*Attribute()`. 1827 * attributeNamespace 1828 * propertyName: 1829 * Used on DOM node instances. (This includes properties that mutate due to 1830 * external factors.) 1831 * mutationMethod: 1832 * If non-null, used instead of the property or `setAttribute()` after 1833 * initial render. 1834 * mustUseProperty: 1835 * Whether the property must be accessed and mutated as an object property. 1836 * hasBooleanValue: 1837 * Whether the property should be removed when set to a falsey value. 1838 * hasNumericValue: 1839 * Whether the property must be numeric or parse as a numeric and should be 1840 * removed when set to a falsey value. 1841 * hasPositiveNumericValue: 1842 * Whether the property must be positive numeric or parse as a positive 1843 * numeric and should be removed when set to a falsey value. 1844 * hasOverloadedBooleanValue: 1845 * Whether the property can be used as a flag as well as with a value. 1846 * Removed when strictly equal to false; present without a value when 1847 * strictly equal to true; present with a value otherwise. 1848 */ 1849 properties: {}, 1850 1851 /** 1852 * Mapping from lowercase property names to the properly cased version, used 1853 * to warn in the case of missing properties. Available only in __DEV__. 1854 * 1855 * autofocus is predefined, because adding it to the property whitelist 1856 * causes unintended side effects. 1857 * 1858 * @type {Object} 1859 */ 1860 getPossibleStandardName: "development" !== 'production' ? { autofocus: 'autoFocus' } : null, 1861 1862 /** 1863 * All of the isCustomAttribute() functions that have been injected. 1864 */ 1865 _isCustomAttributeFunctions: [], 1866 1867 /** 1868 * Checks whether a property name is a custom attribute. 1869 * @method 1870 */ 1871 isCustomAttribute: function (attributeName) { 1872 for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) { 1873 var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i]; 1874 if (isCustomAttributeFn(attributeName)) { 1875 return true; 1876 } 1877 } 1878 return false; 1879 }, 1880 1881 injection: DOMPropertyInjection 1882 }; 1883 1884 module.exports = DOMProperty; 1885 },{"125":125,"150":150}],12:[function(_dereq_,module,exports){ 1886 /** 1887 * Copyright 2013-present, Facebook, Inc. 1888 * All rights reserved. 1889 * 1890 * This source code is licensed under the BSD-style license found in the 1891 * LICENSE file in the root directory of this source tree. An additional grant 1892 * of patent rights can be found in the PATENTS file in the same directory. 1893 * 1894 */ 1895 1896 'use strict'; 1897 1898 var DOMProperty = _dereq_(11); 1899 var ReactDOMComponentTree = _dereq_(34); 1900 var ReactInstrumentation = _dereq_(64); 1901 1902 var quoteAttributeValueForBrowser = _dereq_(124); 1903 var warning = _dereq_(157); 1904 1905 var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$'); 1906 var illegalAttributeNameCache = {}; 1907 var validatedAttributeNameCache = {}; 1908 1909 function isAttributeNameSafe(attributeName) { 1910 if (validatedAttributeNameCache.hasOwnProperty(attributeName)) { 1911 return true; 1912 } 1913 if (illegalAttributeNameCache.hasOwnProperty(attributeName)) { 1914 return false; 1915 } 1916 if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { 1917 validatedAttributeNameCache[attributeName] = true; 1918 return true; 1919 } 1920 illegalAttributeNameCache[attributeName] = true; 1921 "development" !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0; 1922 return false; 1923 } 1924 1925 function shouldIgnoreValue(propertyInfo, value) { 1926 return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false; 1927 } 1928 1929 /** 1930 * Operations for dealing with DOM properties. 1931 */ 1932 var DOMPropertyOperations = { 1933 1934 /** 1935 * Creates markup for the ID property. 1936 * 1937 * @param {string} id Unescaped ID. 1938 * @return {string} Markup string. 1939 */ 1940 createMarkupForID: function (id) { 1941 return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id); 1942 }, 1943 1944 setAttributeForID: function (node, id) { 1945 node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id); 1946 }, 1947 1948 createMarkupForRoot: function () { 1949 return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""'; 1950 }, 1951 1952 setAttributeForRoot: function (node) { 1953 node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, ''); 1954 }, 1955 1956 /** 1957 * Creates markup for a property. 1958 * 1959 * @param {string} name 1960 * @param {*} value 1961 * @return {?string} Markup string, or null if the property was invalid. 1962 */ 1963 createMarkupForProperty: function (name, value) { 1964 var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; 1965 if (propertyInfo) { 1966 if (shouldIgnoreValue(propertyInfo, value)) { 1967 return ''; 1968 } 1969 var attributeName = propertyInfo.attributeName; 1970 if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { 1971 return attributeName + '=""'; 1972 } 1973 return attributeName + '=' + quoteAttributeValueForBrowser(value); 1974 } else if (DOMProperty.isCustomAttribute(name)) { 1975 if (value == null) { 1976 return ''; 1977 } 1978 return name + '=' + quoteAttributeValueForBrowser(value); 1979 } 1980 return null; 1981 }, 1982 1983 /** 1984 * Creates markup for a custom property. 1985 * 1986 * @param {string} name 1987 * @param {*} value 1988 * @return {string} Markup string, or empty string if the property was invalid. 1989 */ 1990 createMarkupForCustomAttribute: function (name, value) { 1991 if (!isAttributeNameSafe(name) || value == null) { 1992 return ''; 1993 } 1994 return name + '=' + quoteAttributeValueForBrowser(value); 1995 }, 1996 1997 /** 1998 * Sets the value for a property on a node. 1999 * 2000 * @param {DOMElement} node 2001 * @param {string} name 2002 * @param {*} value 2003 */ 2004 setValueForProperty: function (node, name, value) { 2005 var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; 2006 if (propertyInfo) { 2007 var mutationMethod = propertyInfo.mutationMethod; 2008 if (mutationMethod) { 2009 mutationMethod(node, value); 2010 } else if (shouldIgnoreValue(propertyInfo, value)) { 2011 this.deleteValueForProperty(node, name); 2012 return; 2013 } else if (propertyInfo.mustUseProperty) { 2014 // Contrary to `setAttribute`, object properties are properly 2015 // `toString`ed by IE8/9. 2016 node[propertyInfo.propertyName] = value; 2017 } else { 2018 var attributeName = propertyInfo.attributeName; 2019 var namespace = propertyInfo.attributeNamespace; 2020 // `setAttribute` with objects becomes only `[object]` in IE8/9, 2021 // ('' + value) makes it output the correct toString()-value. 2022 if (namespace) { 2023 node.setAttributeNS(namespace, attributeName, '' + value); 2024 } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { 2025 node.setAttribute(attributeName, ''); 2026 } else { 2027 node.setAttribute(attributeName, '' + value); 2028 } 2029 } 2030 } else if (DOMProperty.isCustomAttribute(name)) { 2031 DOMPropertyOperations.setValueForAttribute(node, name, value); 2032 return; 2033 } 2034 2035 if ("development" !== 'production') { 2036 var payload = {}; 2037 payload[name] = value; 2038 ReactInstrumentation.debugTool.onHostOperation({ 2039 instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, 2040 type: 'update attribute', 2041 payload: payload 2042 }); 2043 } 2044 }, 2045 2046 setValueForAttribute: function (node, name, value) { 2047 if (!isAttributeNameSafe(name)) { 2048 return; 2049 } 2050 if (value == null) { 2051 node.removeAttribute(name); 2052 } else { 2053 node.setAttribute(name, '' + value); 2054 } 2055 2056 if ("development" !== 'production') { 2057 var payload = {}; 2058 payload[name] = value; 2059 ReactInstrumentation.debugTool.onHostOperation({ 2060 instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, 2061 type: 'update attribute', 2062 payload: payload 2063 }); 2064 } 2065 }, 2066 2067 /** 2068 * Deletes an attributes from a node. 2069 * 2070 * @param {DOMElement} node 2071 * @param {string} name 2072 */ 2073 deleteValueForAttribute: function (node, name) { 2074 node.removeAttribute(name); 2075 if ("development" !== 'production') { 2076 ReactInstrumentation.debugTool.onHostOperation({ 2077 instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, 2078 type: 'remove attribute', 2079 payload: name 2080 }); 2081 } 2082 }, 2083 2084 /** 2085 * Deletes the value for a property on a node. 2086 * 2087 * @param {DOMElement} node 2088 * @param {string} name 2089 */ 2090 deleteValueForProperty: function (node, name) { 2091 var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; 2092 if (propertyInfo) { 2093 var mutationMethod = propertyInfo.mutationMethod; 2094 if (mutationMethod) { 2095 mutationMethod(node, undefined); 2096 } else if (propertyInfo.mustUseProperty) { 2097 var propName = propertyInfo.propertyName; 2098 if (propertyInfo.hasBooleanValue) { 2099 node[propName] = false; 2100 } else { 2101 node[propName] = ''; 2102 } 2103 } else { 2104 node.removeAttribute(propertyInfo.attributeName); 2105 } 2106 } else if (DOMProperty.isCustomAttribute(name)) { 2107 node.removeAttribute(name); 2108 } 2109 2110 if ("development" !== 'production') { 2111 ReactInstrumentation.debugTool.onHostOperation({ 2112 instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, 2113 type: 'remove attribute', 2114 payload: name 2115 }); 2116 } 2117 } 2118 2119 }; 2120 2121 module.exports = DOMPropertyOperations; 2122 },{"11":11,"124":124,"157":157,"34":34,"64":64}],13:[function(_dereq_,module,exports){ 2123 /** 2124 * Copyright 2013-present, Facebook, Inc. 2125 * All rights reserved. 2126 * 2127 * This source code is licensed under the BSD-style license found in the 2128 * LICENSE file in the root directory of this source tree. An additional grant 2129 * of patent rights can be found in the PATENTS file in the same directory. 2130 * 2131 */ 2132 2133 'use strict'; 2134 2135 var _prodInvariant = _dereq_(125); 2136 2137 var DOMLazyTree = _dereq_(9); 2138 var ExecutionEnvironment = _dereq_(136); 2139 2140 var createNodesFromMarkup = _dereq_(141); 2141 var emptyFunction = _dereq_(142); 2142 var invariant = _dereq_(150); 2143 2144 var Danger = { 2145 2146 /** 2147 * Replaces a node with a string of markup at its current position within its 2148 * parent. The markup must render into a single root node. 2149 * 2150 * @param {DOMElement} oldChild Child node to replace. 2151 * @param {string} markup Markup to render in place of the child node. 2152 * @internal 2153 */ 2154 dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) { 2155 !ExecutionEnvironment.canUseDOM ? "development" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('56') : void 0; 2156 !markup ? "development" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : _prodInvariant('57') : void 0; 2157 !(oldChild.nodeName !== 'HTML') ? "development" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the <html> node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See ReactDOMServer.renderToString().') : _prodInvariant('58') : void 0; 2158 2159 if (typeof markup === 'string') { 2160 var newChild = createNodesFromMarkup(markup, emptyFunction)[0]; 2161 oldChild.parentNode.replaceChild(newChild, oldChild); 2162 } else { 2163 DOMLazyTree.replaceChildWithTree(oldChild, markup); 2164 } 2165 } 2166 2167 }; 2168 2169 module.exports = Danger; 2170 },{"125":125,"136":136,"141":141,"142":142,"150":150,"9":9}],14:[function(_dereq_,module,exports){ 2171 /** 2172 * Copyright 2013-present, Facebook, Inc. 2173 * All rights reserved. 2174 * 2175 * This source code is licensed under the BSD-style license found in the 2176 * LICENSE file in the root directory of this source tree. An additional grant 2177 * of patent rights can be found in the PATENTS file in the same directory. 2178 * 2179 */ 2180 2181 'use strict'; 2182 2183 /** 2184 * Module that is injectable into `EventPluginHub`, that specifies a 2185 * deterministic ordering of `EventPlugin`s. A convenient way to reason about 2186 * plugins, without having to package every one of them. This is better than 2187 * having plugins be ordered in the same order that they are injected because 2188 * that ordering would be influenced by the packaging order. 2189 * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that 2190 * preventing default on events is convenient in `SimpleEventPlugin` handlers. 2191 */ 2192 2193 var DefaultEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin']; 2194 2195 module.exports = DefaultEventPluginOrder; 2196 },{}],15:[function(_dereq_,module,exports){ 2197 /** 2198 * Copyright 2013-present, Facebook, Inc. 2199 * All rights reserved. 2200 * 2201 * This source code is licensed under the BSD-style license found in the 2202 * LICENSE file in the root directory of this source tree. An additional grant 2203 * of patent rights can be found in the PATENTS file in the same directory. 2204 * 2205 */ 2206 2207 'use strict'; 2208 2209 var EventPropagators = _dereq_(20); 2210 var ReactDOMComponentTree = _dereq_(34); 2211 var SyntheticMouseEvent = _dereq_(95); 2212 2213 var eventTypes = { 2214 mouseEnter: { 2215 registrationName: 'onMouseEnter', 2216 dependencies: ['topMouseOut', 'topMouseOver'] 2217 }, 2218 mouseLeave: { 2219 registrationName: 'onMouseLeave', 2220 dependencies: ['topMouseOut', 'topMouseOver'] 2221 } 2222 }; 2223 2224 var EnterLeaveEventPlugin = { 2225 2226 eventTypes: eventTypes, 2227 2228 /** 2229 * For almost every interaction we care about, there will be both a top-level 2230 * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that 2231 * we do not extract duplicate events. However, moving the mouse into the 2232 * browser from outside will not fire a `mouseout` event. In this case, we use 2233 * the `mouseover` top-level event. 2234 */ 2235 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { 2236 if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) { 2237 return null; 2238 } 2239 if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') { 2240 // Must not be a mouse in or mouse out - ignoring. 2241 return null; 2242 } 2243 2244 var win; 2245 if (nativeEventTarget.window === nativeEventTarget) { 2246 // `nativeEventTarget` is probably a window object. 2247 win = nativeEventTarget; 2248 } else { 2249 // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. 2250 var doc = nativeEventTarget.ownerDocument; 2251 if (doc) { 2252 win = doc.defaultView || doc.parentWindow; 2253 } else { 2254 win = window; 2255 } 2256 } 2257 2258 var from; 2259 var to; 2260 if (topLevelType === 'topMouseOut') { 2261 from = targetInst; 2262 var related = nativeEvent.relatedTarget || nativeEvent.toElement; 2263 to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null; 2264 } else { 2265 // Moving to a node from outside the window. 2266 from = null; 2267 to = targetInst; 2268 } 2269 2270 if (from === to) { 2271 // Nothing pertains to our managed components. 2272 return null; 2273 } 2274 2275 var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from); 2276 var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to); 2277 2278 var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget); 2279 leave.type = 'mouseleave'; 2280 leave.target = fromNode; 2281 leave.relatedTarget = toNode; 2282 2283 var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget); 2284 enter.type = 'mouseenter'; 2285 enter.target = toNode; 2286 enter.relatedTarget = fromNode; 2287 2288 EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to); 2289 2290 return [leave, enter]; 2291 } 2292 2293 }; 2294 2295 module.exports = EnterLeaveEventPlugin; 2296 },{"20":20,"34":34,"95":95}],16:[function(_dereq_,module,exports){ 2297 /** 2298 * Copyright 2013-present, Facebook, Inc. 2299 * All rights reserved. 2300 * 2301 * This source code is licensed under the BSD-style license found in the 2302 * LICENSE file in the root directory of this source tree. An additional grant 2303 * of patent rights can be found in the PATENTS file in the same directory. 2304 * 2305 */ 2306 2307 'use strict'; 2308 2309 /** 2310 * Types of raw signals from the browser caught at the top level. 2311 */ 2312 var topLevelTypes = { 2313 topAbort: null, 2314 topAnimationEnd: null, 2315 topAnimationIteration: null, 2316 topAnimationStart: null, 2317 topBlur: null, 2318 topCanPlay: null, 2319 topCanPlayThrough: null, 2320 topChange: null, 2321 topClick: null, 2322 topCompositionEnd: null, 2323 topCompositionStart: null, 2324 topCompositionUpdate: null, 2325 topContextMenu: null, 2326 topCopy: null, 2327 topCut: null, 2328 topDoubleClick: null, 2329 topDrag: null, 2330 topDragEnd: null, 2331 topDragEnter: null, 2332 topDragExit: null, 2333 topDragLeave: null, 2334 topDragOver: null, 2335 topDragStart: null, 2336 topDrop: null, 2337 topDurationChange: null, 2338 topEmptied: null, 2339 topEncrypted: null, 2340 topEnded: null, 2341 topError: null, 2342 topFocus: null, 2343 topInput: null, 2344 topInvalid: null, 2345 topKeyDown: null, 2346 topKeyPress: null, 2347 topKeyUp: null, 2348 topLoad: null, 2349 topLoadedData: null, 2350 topLoadedMetadata: null, 2351 topLoadStart: null, 2352 topMouseDown: null, 2353 topMouseMove: null, 2354 topMouseOut: null, 2355 topMouseOver: null, 2356 topMouseUp: null, 2357 topPaste: null, 2358 topPause: null, 2359 topPlay: null, 2360 topPlaying: null, 2361 topProgress: null, 2362 topRateChange: null, 2363 topReset: null, 2364 topScroll: null, 2365 topSeeked: null, 2366 topSeeking: null, 2367 topSelectionChange: null, 2368 topStalled: null, 2369 topSubmit: null, 2370 topSuspend: null, 2371 topTextInput: null, 2372 topTimeUpdate: null, 2373 topTouchCancel: null, 2374 topTouchEnd: null, 2375 topTouchMove: null, 2376 topTouchStart: null, 2377 topTransitionEnd: null, 2378 topVolumeChange: null, 2379 topWaiting: null, 2380 topWheel: null 2381 }; 2382 2383 var EventConstants = { 2384 topLevelTypes: topLevelTypes 2385 }; 2386 2387 module.exports = EventConstants; 2388 },{}],17:[function(_dereq_,module,exports){ 2389 /** 2390 * Copyright 2013-present, Facebook, Inc. 2391 * All rights reserved. 2392 * 2393 * This source code is licensed under the BSD-style license found in the 2394 * LICENSE file in the root directory of this source tree. An additional grant 2395 * of patent rights can be found in the PATENTS file in the same directory. 2396 * 2397 */ 2398 2399 'use strict'; 2400 2401 var _prodInvariant = _dereq_(125); 2402 2403 var EventPluginRegistry = _dereq_(18); 2404 var EventPluginUtils = _dereq_(19); 2405 var ReactErrorUtils = _dereq_(55); 2406 2407 var accumulateInto = _dereq_(102); 2408 var forEachAccumulated = _dereq_(110); 2409 var invariant = _dereq_(150); 2410 2411 /** 2412 * Internal store for event listeners 2413 */ 2414 var listenerBank = {}; 2415 2416 /** 2417 * Internal queue of events that have accumulated their dispatches and are 2418 * waiting to have their dispatches executed. 2419 */ 2420 var eventQueue = null; 2421 2422 /** 2423 * Dispatches an event and releases it back into the pool, unless persistent. 2424 * 2425 * @param {?object} event Synthetic event to be dispatched. 2426 * @param {boolean} simulated If the event is simulated (changes exn behavior) 2427 * @private 2428 */ 2429 var executeDispatchesAndRelease = function (event, simulated) { 2430 if (event) { 2431 EventPluginUtils.executeDispatchesInOrder(event, simulated); 2432 2433 if (!event.isPersistent()) { 2434 event.constructor.release(event); 2435 } 2436 } 2437 }; 2438 var executeDispatchesAndReleaseSimulated = function (e) { 2439 return executeDispatchesAndRelease(e, true); 2440 }; 2441 var executeDispatchesAndReleaseTopLevel = function (e) { 2442 return executeDispatchesAndRelease(e, false); 2443 }; 2444 2445 var getDictionaryKey = function (inst) { 2446 // Prevents V8 performance issue: 2447 // https://github.com/facebook/react/pull/7232 2448 return '.' + inst._rootNodeID; 2449 }; 2450 2451 function isInteractive(tag) { 2452 return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; 2453 } 2454 2455 function shouldPreventMouseEvent(name, type, props) { 2456 switch (name) { 2457 case 'onClick': 2458 case 'onClickCapture': 2459 case 'onDoubleClick': 2460 case 'onDoubleClickCapture': 2461 case 'onMouseDown': 2462 case 'onMouseDownCapture': 2463 case 'onMouseMove': 2464 case 'onMouseMoveCapture': 2465 case 'onMouseUp': 2466 case 'onMouseUpCapture': 2467 return !!(props.disabled && isInteractive(type)); 2468 default: 2469 return false; 2470 } 2471 } 2472 2473 /** 2474 * This is a unified interface for event plugins to be installed and configured. 2475 * 2476 * Event plugins can implement the following properties: 2477 * 2478 * `extractEvents` {function(string, DOMEventTarget, string, object): *} 2479 * Required. When a top-level event is fired, this method is expected to 2480 * extract synthetic events that will in turn be queued and dispatched. 2481 * 2482 * `eventTypes` {object} 2483 * Optional, plugins that fire events must publish a mapping of registration 2484 * names that are used to register listeners. Values of this mapping must 2485 * be objects that contain `registrationName` or `phasedRegistrationNames`. 2486 * 2487 * `executeDispatch` {function(object, function, string)} 2488 * Optional, allows plugins to override how an event gets dispatched. By 2489 * default, the listener is simply invoked. 2490 * 2491 * Each plugin that is injected into `EventsPluginHub` is immediately operable. 2492 * 2493 * @public 2494 */ 2495 var EventPluginHub = { 2496 2497 /** 2498 * Methods for injecting dependencies. 2499 */ 2500 injection: { 2501 2502 /** 2503 * @param {array} InjectedEventPluginOrder 2504 * @public 2505 */ 2506 injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder, 2507 2508 /** 2509 * @param {object} injectedNamesToPlugins Map from names to plugin modules. 2510 */ 2511 injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName 2512 2513 }, 2514 2515 /** 2516 * Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent. 2517 * 2518 * @param {object} inst The instance, which is the source of events. 2519 * @param {string} registrationName Name of listener (e.g. `onClick`). 2520 * @param {function} listener The callback to store. 2521 */ 2522 putListener: function (inst, registrationName, listener) { 2523 !(typeof listener === 'function') ? "development" !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : _prodInvariant('94', registrationName, typeof listener) : void 0; 2524 2525 var key = getDictionaryKey(inst); 2526 var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {}); 2527 bankForRegistrationName[key] = listener; 2528 2529 var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; 2530 if (PluginModule && PluginModule.didPutListener) { 2531 PluginModule.didPutListener(inst, registrationName, listener); 2532 } 2533 }, 2534 2535 /** 2536 * @param {object} inst The instance, which is the source of events. 2537 * @param {string} registrationName Name of listener (e.g. `onClick`). 2538 * @return {?function} The stored callback. 2539 */ 2540 getListener: function (inst, registrationName) { 2541 // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not 2542 // live here; needs to be moved to a better place soon 2543 var bankForRegistrationName = listenerBank[registrationName]; 2544 if (shouldPreventMouseEvent(registrationName, inst._currentElement.type, inst._currentElement.props)) { 2545 return null; 2546 } 2547 var key = getDictionaryKey(inst); 2548 return bankForRegistrationName && bankForRegistrationName[key]; 2549 }, 2550 2551 /** 2552 * Deletes a listener from the registration bank. 2553 * 2554 * @param {object} inst The instance, which is the source of events. 2555 * @param {string} registrationName Name of listener (e.g. `onClick`). 2556 */ 2557 deleteListener: function (inst, registrationName) { 2558 var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; 2559 if (PluginModule && PluginModule.willDeleteListener) { 2560 PluginModule.willDeleteListener(inst, registrationName); 2561 } 2562 2563 var bankForRegistrationName = listenerBank[registrationName]; 2564 // TODO: This should never be null -- when is it? 2565 if (bankForRegistrationName) { 2566 var key = getDictionaryKey(inst); 2567 delete bankForRegistrationName[key]; 2568 } 2569 }, 2570 2571 /** 2572 * Deletes all listeners for the DOM element with the supplied ID. 2573 * 2574 * @param {object} inst The instance, which is the source of events. 2575 */ 2576 deleteAllListeners: function (inst) { 2577 var key = getDictionaryKey(inst); 2578 for (var registrationName in listenerBank) { 2579 if (!listenerBank.hasOwnProperty(registrationName)) { 2580 continue; 2581 } 2582 2583 if (!listenerBank[registrationName][key]) { 2584 continue; 2585 } 2586 2587 var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; 2588 if (PluginModule && PluginModule.willDeleteListener) { 2589 PluginModule.willDeleteListener(inst, registrationName); 2590 } 2591 2592 delete listenerBank[registrationName][key]; 2593 } 2594 }, 2595 2596 /** 2597 * Allows registered plugins an opportunity to extract events from top-level 2598 * native browser events. 2599 * 2600 * @return {*} An accumulation of synthetic events. 2601 * @internal 2602 */ 2603 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { 2604 var events; 2605 var plugins = EventPluginRegistry.plugins; 2606 for (var i = 0; i < plugins.length; i++) { 2607 // Not every plugin in the ordering may be loaded at runtime. 2608 var possiblePlugin = plugins[i]; 2609 if (possiblePlugin) { 2610 var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); 2611 if (extractedEvents) { 2612 events = accumulateInto(events, extractedEvents); 2613 } 2614 } 2615 } 2616 return events; 2617 }, 2618 2619 /** 2620 * Enqueues a synthetic event that should be dispatched when 2621 * `processEventQueue` is invoked. 2622 * 2623 * @param {*} events An accumulation of synthetic events. 2624 * @internal 2625 */ 2626 enqueueEvents: function (events) { 2627 if (events) { 2628 eventQueue = accumulateInto(eventQueue, events); 2629 } 2630 }, 2631 2632 /** 2633 * Dispatches all synthetic events on the event queue. 2634 * 2635 * @internal 2636 */ 2637 processEventQueue: function (simulated) { 2638 // Set `eventQueue` to null before processing it so that we can tell if more 2639 // events get enqueued while processing. 2640 var processingEventQueue = eventQueue; 2641 eventQueue = null; 2642 if (simulated) { 2643 forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated); 2644 } else { 2645 forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); 2646 } 2647 !!eventQueue ? "development" !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : _prodInvariant('95') : void 0; 2648 // This would be a good time to rethrow if any of the event handlers threw. 2649 ReactErrorUtils.rethrowCaughtError(); 2650 }, 2651 2652 /** 2653 * These are needed for tests only. Do not use! 2654 */ 2655 __purge: function () { 2656 listenerBank = {}; 2657 }, 2658 2659 __getListenerBank: function () { 2660 return listenerBank; 2661 } 2662 2663 }; 2664 2665 module.exports = EventPluginHub; 2666 },{"102":102,"110":110,"125":125,"150":150,"18":18,"19":19,"55":55}],18:[function(_dereq_,module,exports){ 2667 /** 2668 * Copyright 2013-present, Facebook, Inc. 2669 * All rights reserved. 2670 * 2671 * This source code is licensed under the BSD-style license found in the 2672 * LICENSE file in the root directory of this source tree. An additional grant 2673 * of patent rights can be found in the PATENTS file in the same directory. 2674 * 2675 * 2676 */ 2677 2678 'use strict'; 2679 2680 var _prodInvariant = _dereq_(125); 2681 2682 var invariant = _dereq_(150); 2683 2684 /** 2685 * Injectable ordering of event plugins. 2686 */ 2687 var eventPluginOrder = null; 2688 2689 /** 2690 * Injectable mapping from names to event plugin modules. 2691 */ 2692 var namesToPlugins = {}; 2693 2694 /** 2695 * Recomputes the plugin list using the injected plugins and plugin ordering. 2696 * 2697 * @private 2698 */ 2699 function recomputePluginOrdering() { 2700 if (!eventPluginOrder) { 2701 // Wait until an `eventPluginOrder` is injected. 2702 return; 2703 } 2704 for (var pluginName in namesToPlugins) { 2705 var pluginModule = namesToPlugins[pluginName]; 2706 var pluginIndex = eventPluginOrder.indexOf(pluginName); 2707 !(pluginIndex > -1) ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : _prodInvariant('96', pluginName) : void 0; 2708 if (EventPluginRegistry.plugins[pluginIndex]) { 2709 continue; 2710 } 2711 !pluginModule.extractEvents ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : _prodInvariant('97', pluginName) : void 0; 2712 EventPluginRegistry.plugins[pluginIndex] = pluginModule; 2713 var publishedEvents = pluginModule.eventTypes; 2714 for (var eventName in publishedEvents) { 2715 !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : _prodInvariant('98', eventName, pluginName) : void 0; 2716 } 2717 } 2718 } 2719 2720 /** 2721 * Publishes an event so that it can be dispatched by the supplied plugin. 2722 * 2723 * @param {object} dispatchConfig Dispatch configuration for the event. 2724 * @param {object} PluginModule Plugin publishing the event. 2725 * @return {boolean} True if the event was successfully published. 2726 * @private 2727 */ 2728 function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { 2729 !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? "development" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : _prodInvariant('99', eventName) : void 0; 2730 EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig; 2731 2732 var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; 2733 if (phasedRegistrationNames) { 2734 for (var phaseName in phasedRegistrationNames) { 2735 if (phasedRegistrationNames.hasOwnProperty(phaseName)) { 2736 var phasedRegistrationName = phasedRegistrationNames[phaseName]; 2737 publishRegistrationName(phasedRegistrationName, pluginModule, eventName); 2738 } 2739 } 2740 return true; 2741 } else if (dispatchConfig.registrationName) { 2742 publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); 2743 return true; 2744 } 2745 return false; 2746 } 2747 2748 /** 2749 * Publishes a registration name that is used to identify dispatched events and 2750 * can be used with `EventPluginHub.putListener` to register listeners. 2751 * 2752 * @param {string} registrationName Registration name to add. 2753 * @param {object} PluginModule Plugin publishing the event. 2754 * @private 2755 */ 2756 function publishRegistrationName(registrationName, pluginModule, eventName) { 2757 !!EventPluginRegistry.registrationNameModules[registrationName] ? "development" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : _prodInvariant('100', registrationName) : void 0; 2758 EventPluginRegistry.registrationNameModules[registrationName] = pluginModule; 2759 EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies; 2760 2761 if ("development" !== 'production') { 2762 var lowerCasedName = registrationName.toLowerCase(); 2763 EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName; 2764 2765 if (registrationName === 'onDoubleClick') { 2766 EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName; 2767 } 2768 } 2769 } 2770 2771 /** 2772 * Registers plugins so that they can extract and dispatch events. 2773 * 2774 * @see {EventPluginHub} 2775 */ 2776 var EventPluginRegistry = { 2777 2778 /** 2779 * Ordered list of injected plugins. 2780 */ 2781 plugins: [], 2782 2783 /** 2784 * Mapping from event name to dispatch config 2785 */ 2786 eventNameDispatchConfigs: {}, 2787 2788 /** 2789 * Mapping from registration name to plugin module 2790 */ 2791 registrationNameModules: {}, 2792 2793 /** 2794 * Mapping from registration name to event name 2795 */ 2796 registrationNameDependencies: {}, 2797 2798 /** 2799 * Mapping from lowercase registration names to the properly cased version, 2800 * used to warn in the case of missing event handlers. Available 2801 * only in __DEV__. 2802 * @type {Object} 2803 */ 2804 possibleRegistrationNames: "development" !== 'production' ? {} : null, 2805 // Trust the developer to only use possibleRegistrationNames in __DEV__ 2806 2807 /** 2808 * Injects an ordering of plugins (by plugin name). This allows the ordering 2809 * to be decoupled from injection of the actual plugins so that ordering is 2810 * always deterministic regardless of packaging, on-the-fly injection, etc. 2811 * 2812 * @param {array} InjectedEventPluginOrder 2813 * @internal 2814 * @see {EventPluginHub.injection.injectEventPluginOrder} 2815 */ 2816 injectEventPluginOrder: function (injectedEventPluginOrder) { 2817 !!eventPluginOrder ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : _prodInvariant('101') : void 0; 2818 // Clone the ordering so it cannot be dynamically mutated. 2819 eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); 2820 recomputePluginOrdering(); 2821 }, 2822 2823 /** 2824 * Injects plugins to be used by `EventPluginHub`. The plugin names must be 2825 * in the ordering injected by `injectEventPluginOrder`. 2826 * 2827 * Plugins can be injected as part of page initialization or on-the-fly. 2828 * 2829 * @param {object} injectedNamesToPlugins Map from names to plugin modules. 2830 * @internal 2831 * @see {EventPluginHub.injection.injectEventPluginsByName} 2832 */ 2833 injectEventPluginsByName: function (injectedNamesToPlugins) { 2834 var isOrderingDirty = false; 2835 for (var pluginName in injectedNamesToPlugins) { 2836 if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { 2837 continue; 2838 } 2839 var pluginModule = injectedNamesToPlugins[pluginName]; 2840 if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { 2841 !!namesToPlugins[pluginName] ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : _prodInvariant('102', pluginName) : void 0; 2842 namesToPlugins[pluginName] = pluginModule; 2843 isOrderingDirty = true; 2844 } 2845 } 2846 if (isOrderingDirty) { 2847 recomputePluginOrdering(); 2848 } 2849 }, 2850 2851 /** 2852 * Looks up the plugin for the supplied event. 2853 * 2854 * @param {object} event A synthetic event. 2855 * @return {?object} The plugin that created the supplied event. 2856 * @internal 2857 */ 2858 getPluginModuleForEvent: function (event) { 2859 var dispatchConfig = event.dispatchConfig; 2860 if (dispatchConfig.registrationName) { 2861 return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null; 2862 } 2863 if (dispatchConfig.phasedRegistrationNames !== undefined) { 2864 // pulling phasedRegistrationNames out of dispatchConfig helps Flow see 2865 // that it is not undefined. 2866 var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; 2867 2868 for (var phase in phasedRegistrationNames) { 2869 if (!phasedRegistrationNames.hasOwnProperty(phase)) { 2870 continue; 2871 } 2872 var pluginModule = EventPluginRegistry.registrationNameModules[phasedRegistrationNames[phase]]; 2873 if (pluginModule) { 2874 return pluginModule; 2875 } 2876 } 2877 } 2878 return null; 2879 }, 2880 2881 /** 2882 * Exposed for unit testing. 2883 * @private 2884 */ 2885 _resetEventPlugins: function () { 2886 eventPluginOrder = null; 2887 for (var pluginName in namesToPlugins) { 2888 if (namesToPlugins.hasOwnProperty(pluginName)) { 2889 delete namesToPlugins[pluginName]; 2890 } 2891 } 2892 EventPluginRegistry.plugins.length = 0; 2893 2894 var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs; 2895 for (var eventName in eventNameDispatchConfigs) { 2896 if (eventNameDispatchConfigs.hasOwnProperty(eventName)) { 2897 delete eventNameDispatchConfigs[eventName]; 2898 } 2899 } 2900 2901 var registrationNameModules = EventPluginRegistry.registrationNameModules; 2902 for (var registrationName in registrationNameModules) { 2903 if (registrationNameModules.hasOwnProperty(registrationName)) { 2904 delete registrationNameModules[registrationName]; 2905 } 2906 } 2907 2908 if ("development" !== 'production') { 2909 var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames; 2910 for (var lowerCasedName in possibleRegistrationNames) { 2911 if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) { 2912 delete possibleRegistrationNames[lowerCasedName]; 2913 } 2914 } 2915 } 2916 } 2917 2918 }; 2919 2920 module.exports = EventPluginRegistry; 2921 },{"125":125,"150":150}],19:[function(_dereq_,module,exports){ 2922 /** 2923 * Copyright 2013-present, Facebook, Inc. 2924 * All rights reserved. 2925 * 2926 * This source code is licensed under the BSD-style license found in the 2927 * LICENSE file in the root directory of this source tree. An additional grant 2928 * of patent rights can be found in the PATENTS file in the same directory. 2929 * 2930 */ 2931 2932 'use strict'; 2933 2934 var _prodInvariant = _dereq_(125); 2935 2936 var ReactErrorUtils = _dereq_(55); 2937 2938 var invariant = _dereq_(150); 2939 var warning = _dereq_(157); 2940 2941 /** 2942 * Injected dependencies: 2943 */ 2944 2945 /** 2946 * - `ComponentTree`: [required] Module that can convert between React instances 2947 * and actual node references. 2948 */ 2949 var ComponentTree; 2950 var TreeTraversal; 2951 var injection = { 2952 injectComponentTree: function (Injected) { 2953 ComponentTree = Injected; 2954 if ("development" !== 'production') { 2955 "development" !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0; 2956 } 2957 }, 2958 injectTreeTraversal: function (Injected) { 2959 TreeTraversal = Injected; 2960 if ("development" !== 'production') { 2961 "development" !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0; 2962 } 2963 } 2964 }; 2965 2966 function isEndish(topLevelType) { 2967 return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel'; 2968 } 2969 2970 function isMoveish(topLevelType) { 2971 return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove'; 2972 } 2973 function isStartish(topLevelType) { 2974 return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart'; 2975 } 2976 2977 var validateEventDispatches; 2978 if ("development" !== 'production') { 2979 validateEventDispatches = function (event) { 2980 var dispatchListeners = event._dispatchListeners; 2981 var dispatchInstances = event._dispatchInstances; 2982 2983 var listenersIsArr = Array.isArray(dispatchListeners); 2984 var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; 2985 2986 var instancesIsArr = Array.isArray(dispatchInstances); 2987 var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; 2988 2989 "development" !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0; 2990 }; 2991 } 2992 2993 /** 2994 * Dispatch the event to the listener. 2995 * @param {SyntheticEvent} event SyntheticEvent to handle 2996 * @param {boolean} simulated If the event is simulated (changes exn behavior) 2997 * @param {function} listener Application-level callback 2998 * @param {*} inst Internal component instance 2999 */ 3000 function executeDispatch(event, simulated, listener, inst) { 3001 var type = event.type || 'unknown-event'; 3002 event.currentTarget = EventPluginUtils.getNodeFromInstance(inst); 3003 if (simulated) { 3004 ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event); 3005 } else { 3006 ReactErrorUtils.invokeGuardedCallback(type, listener, event); 3007 } 3008 event.currentTarget = null; 3009 } 3010 3011 /** 3012 * Standard/simple iteration through an event's collected dispatches. 3013 */ 3014 function executeDispatchesInOrder(event, simulated) { 3015 var dispatchListeners = event._dispatchListeners; 3016 var dispatchInstances = event._dispatchInstances; 3017 if ("development" !== 'production') { 3018 validateEventDispatches(event); 3019 } 3020 if (Array.isArray(dispatchListeners)) { 3021 for (var i = 0; i < dispatchListeners.length; i++) { 3022 if (event.isPropagationStopped()) { 3023 break; 3024 } 3025 // Listeners and Instances are two parallel arrays that are always in sync. 3026 executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]); 3027 } 3028 } else if (dispatchListeners) { 3029 executeDispatch(event, simulated, dispatchListeners, dispatchInstances); 3030 } 3031 event._dispatchListeners = null; 3032 event._dispatchInstances = null; 3033 } 3034 3035 /** 3036 * Standard/simple iteration through an event's collected dispatches, but stops 3037 * at the first dispatch execution returning true, and returns that id. 3038 * 3039 * @return {?string} id of the first dispatch execution who's listener returns 3040 * true, or null if no listener returned true. 3041 */ 3042 function executeDispatchesInOrderStopAtTrueImpl(event) { 3043 var dispatchListeners = event._dispatchListeners; 3044 var dispatchInstances = event._dispatchInstances; 3045 if ("development" !== 'production') { 3046 validateEventDispatches(event); 3047 } 3048 if (Array.isArray(dispatchListeners)) { 3049 for (var i = 0; i < dispatchListeners.length; i++) { 3050 if (event.isPropagationStopped()) { 3051 break; 3052 } 3053 // Listeners and Instances are two parallel arrays that are always in sync. 3054 if (dispatchListeners[i](event, dispatchInstances[i])) { 3055 return dispatchInstances[i]; 3056 } 3057 } 3058 } else if (dispatchListeners) { 3059 if (dispatchListeners(event, dispatchInstances)) { 3060 return dispatchInstances; 3061 } 3062 } 3063 return null; 3064 } 3065 3066 /** 3067 * @see executeDispatchesInOrderStopAtTrueImpl 3068 */ 3069 function executeDispatchesInOrderStopAtTrue(event) { 3070 var ret = executeDispatchesInOrderStopAtTrueImpl(event); 3071 event._dispatchInstances = null; 3072 event._dispatchListeners = null; 3073 return ret; 3074 } 3075 3076 /** 3077 * Execution of a "direct" dispatch - there must be at most one dispatch 3078 * accumulated on the event or it is considered an error. It doesn't really make 3079 * sense for an event with multiple dispatches (bubbled) to keep track of the 3080 * return values at each dispatch execution, but it does tend to make sense when 3081 * dealing with "direct" dispatches. 3082 * 3083 * @return {*} The return value of executing the single dispatch. 3084 */ 3085 function executeDirectDispatch(event) { 3086 if ("development" !== 'production') { 3087 validateEventDispatches(event); 3088 } 3089 var dispatchListener = event._dispatchListeners; 3090 var dispatchInstance = event._dispatchInstances; 3091 !!Array.isArray(dispatchListener) ? "development" !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0; 3092 event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null; 3093 var res = dispatchListener ? dispatchListener(event) : null; 3094 event.currentTarget = null; 3095 event._dispatchListeners = null; 3096 event._dispatchInstances = null; 3097 return res; 3098 } 3099 3100 /** 3101 * @param {SyntheticEvent} event 3102 * @return {boolean} True iff number of dispatches accumulated is greater than 0. 3103 */ 3104 function hasDispatches(event) { 3105 return !!event._dispatchListeners; 3106 } 3107 3108 /** 3109 * General utilities that are useful in creating custom Event Plugins. 3110 */ 3111 var EventPluginUtils = { 3112 isEndish: isEndish, 3113 isMoveish: isMoveish, 3114 isStartish: isStartish, 3115 3116 executeDirectDispatch: executeDirectDispatch, 3117 executeDispatchesInOrder: executeDispatchesInOrder, 3118 executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue, 3119 hasDispatches: hasDispatches, 3120 3121 getInstanceFromNode: function (node) { 3122 return ComponentTree.getInstanceFromNode(node); 3123 }, 3124 getNodeFromInstance: function (node) { 3125 return ComponentTree.getNodeFromInstance(node); 3126 }, 3127 isAncestor: function (a, b) { 3128 return TreeTraversal.isAncestor(a, b); 3129 }, 3130 getLowestCommonAncestor: function (a, b) { 3131 return TreeTraversal.getLowestCommonAncestor(a, b); 3132 }, 3133 getParentInstance: function (inst) { 3134 return TreeTraversal.getParentInstance(inst); 3135 }, 3136 traverseTwoPhase: function (target, fn, arg) { 3137 return TreeTraversal.traverseTwoPhase(target, fn, arg); 3138 }, 3139 traverseEnterLeave: function (from, to, fn, argFrom, argTo) { 3140 return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo); 3141 }, 3142 3143 injection: injection 3144 }; 3145 3146 module.exports = EventPluginUtils; 3147 },{"125":125,"150":150,"157":157,"55":55}],20:[function(_dereq_,module,exports){ 3148 /** 3149 * Copyright 2013-present, Facebook, Inc. 3150 * All rights reserved. 3151 * 3152 * This source code is licensed under the BSD-style license found in the 3153 * LICENSE file in the root directory of this source tree. An additional grant 3154 * of patent rights can be found in the PATENTS file in the same directory. 3155 * 3156 */ 3157 3158 'use strict'; 3159 3160 var EventPluginHub = _dereq_(17); 3161 var EventPluginUtils = _dereq_(19); 3162 3163 var accumulateInto = _dereq_(102); 3164 var forEachAccumulated = _dereq_(110); 3165 var warning = _dereq_(157); 3166 3167 var getListener = EventPluginHub.getListener; 3168 3169 /** 3170 * Some event types have a notion of different registration names for different 3171 * "phases" of propagation. This finds listeners by a given phase. 3172 */ 3173 function listenerAtPhase(inst, event, propagationPhase) { 3174 var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; 3175 return getListener(inst, registrationName); 3176 } 3177 3178 /** 3179 * Tags a `SyntheticEvent` with dispatched listeners. Creating this function 3180 * here, allows us to not have to bind or create functions for each event. 3181 * Mutating the event's members allows us to not have to create a wrapping 3182 * "dispatch" object that pairs the event with the listener. 3183 */ 3184 function accumulateDirectionalDispatches(inst, phase, event) { 3185 if ("development" !== 'production') { 3186 "development" !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0; 3187 } 3188 var listener = listenerAtPhase(inst, event, phase); 3189 if (listener) { 3190 event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); 3191 event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); 3192 } 3193 } 3194 3195 /** 3196 * Collect dispatches (must be entirely collected before dispatching - see unit 3197 * tests). Lazily allocate the array to conserve memory. We must loop through 3198 * each event and perform the traversal for each one. We cannot perform a 3199 * single traversal for the entire collection of events because each event may 3200 * have a different target. 3201 */ 3202 function accumulateTwoPhaseDispatchesSingle(event) { 3203 if (event && event.dispatchConfig.phasedRegistrationNames) { 3204 EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); 3205 } 3206 } 3207 3208 /** 3209 * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. 3210 */ 3211 function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { 3212 if (event && event.dispatchConfig.phasedRegistrationNames) { 3213 var targetInst = event._targetInst; 3214 var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null; 3215 EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event); 3216 } 3217 } 3218 3219 /** 3220 * Accumulates without regard to direction, does not look for phased 3221 * registration names. Same as `accumulateDirectDispatchesSingle` but without 3222 * requiring that the `dispatchMarker` be the same as the dispatched ID. 3223 */ 3224 function accumulateDispatches(inst, ignoredDirection, event) { 3225 if (event && event.dispatchConfig.registrationName) { 3226 var registrationName = event.dispatchConfig.registrationName; 3227 var listener = getListener(inst, registrationName); 3228 if (listener) { 3229 event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); 3230 event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); 3231 } 3232 } 3233 } 3234 3235 /** 3236 * Accumulates dispatches on an `SyntheticEvent`, but only for the 3237 * `dispatchMarker`. 3238 * @param {SyntheticEvent} event 3239 */ 3240 function accumulateDirectDispatchesSingle(event) { 3241 if (event && event.dispatchConfig.registrationName) { 3242 accumulateDispatches(event._targetInst, null, event); 3243 } 3244 } 3245 3246 function accumulateTwoPhaseDispatches(events) { 3247 forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); 3248 } 3249 3250 function accumulateTwoPhaseDispatchesSkipTarget(events) { 3251 forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); 3252 } 3253 3254 function accumulateEnterLeaveDispatches(leave, enter, from, to) { 3255 EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter); 3256 } 3257 3258 function accumulateDirectDispatches(events) { 3259 forEachAccumulated(events, accumulateDirectDispatchesSingle); 3260 } 3261 3262 /** 3263 * A small set of propagation patterns, each of which will accept a small amount 3264 * of information, and generate a set of "dispatch ready event objects" - which 3265 * are sets of events that have already been annotated with a set of dispatched 3266 * listener functions/ids. The API is designed this way to discourage these 3267 * propagation strategies from actually executing the dispatches, since we 3268 * always want to collect the entire set of dispatches before executing event a 3269 * single one. 3270 * 3271 * @constructor EventPropagators 3272 */ 3273 var EventPropagators = { 3274 accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches, 3275 accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget, 3276 accumulateDirectDispatches: accumulateDirectDispatches, 3277 accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches 3278 }; 3279 3280 module.exports = EventPropagators; 3281 },{"102":102,"110":110,"157":157,"17":17,"19":19}],21:[function(_dereq_,module,exports){ 3282 /** 3283 * Copyright 2013-present, Facebook, Inc. 3284 * All rights reserved. 3285 * 3286 * This source code is licensed under the BSD-style license found in the 3287 * LICENSE file in the root directory of this source tree. An additional grant 3288 * of patent rights can be found in the PATENTS file in the same directory. 3289 * 3290 */ 3291 3292 'use strict'; 3293 3294 var _assign = _dereq_(158); 3295 3296 var PooledClass = _dereq_(25); 3297 3298 var getTextContentAccessor = _dereq_(119); 3299 3300 /** 3301 * This helper class stores information about text content of a target node, 3302 * allowing comparison of content before and after a given event. 3303 * 3304 * Identify the node where selection currently begins, then observe 3305 * both its text content and its current position in the DOM. Since the 3306 * browser may natively replace the target node during composition, we can 3307 * use its position to find its replacement. 3308 * 3309 * @param {DOMEventTarget} root 3310 */ 3311 function FallbackCompositionState(root) { 3312 this._root = root; 3313 this._startText = this.getText(); 3314 this._fallbackText = null; 3315 } 3316 3317 _assign(FallbackCompositionState.prototype, { 3318 destructor: function () { 3319 this._root = null; 3320 this._startText = null; 3321 this._fallbackText = null; 3322 }, 3323 3324 /** 3325 * Get current text of input. 3326 * 3327 * @return {string} 3328 */ 3329 getText: function () { 3330 if ('value' in this._root) { 3331 return this._root.value; 3332 } 3333 return this._root[getTextContentAccessor()]; 3334 }, 3335 3336 /** 3337 * Determine the differing substring between the initially stored 3338 * text content and the current content. 3339 * 3340 * @return {string} 3341 */ 3342 getData: function () { 3343 if (this._fallbackText) { 3344 return this._fallbackText; 3345 } 3346 3347 var start; 3348 var startValue = this._startText; 3349 var startLength = startValue.length; 3350 var end; 3351 var endValue = this.getText(); 3352 var endLength = endValue.length; 3353 3354 for (start = 0; start < startLength; start++) { 3355 if (startValue[start] !== endValue[start]) { 3356 break; 3357 } 3358 } 3359 3360 var minEnd = startLength - start; 3361 for (end = 1; end <= minEnd; end++) { 3362 if (startValue[startLength - end] !== endValue[endLength - end]) { 3363 break; 3364 } 3365 } 3366 3367 var sliceTail = end > 1 ? 1 - end : undefined; 3368 this._fallbackText = endValue.slice(start, sliceTail); 3369 return this._fallbackText; 3370 } 3371 }); 3372 3373 PooledClass.addPoolingTo(FallbackCompositionState); 3374 3375 module.exports = FallbackCompositionState; 3376 },{"119":119,"158":158,"25":25}],22:[function(_dereq_,module,exports){ 3377 /** 3378 * Copyright 2013-present, Facebook, Inc. 3379 * All rights reserved. 3380 * 3381 * This source code is licensed under the BSD-style license found in the 3382 * LICENSE file in the root directory of this source tree. An additional grant 3383 * of patent rights can be found in the PATENTS file in the same directory. 3384 * 3385 */ 3386 3387 'use strict'; 3388 3389 var DOMProperty = _dereq_(11); 3390 3391 var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY; 3392 var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE; 3393 var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE; 3394 var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE; 3395 var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE; 3396 3397 var HTMLDOMPropertyConfig = { 3398 isCustomAttribute: RegExp.prototype.test.bind(new RegExp('^(data|aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$')), 3399 Properties: { 3400 /** 3401 * Standard Properties 3402 */ 3403 accept: 0, 3404 acceptCharset: 0, 3405 accessKey: 0, 3406 action: 0, 3407 allowFullScreen: HAS_BOOLEAN_VALUE, 3408 allowTransparency: 0, 3409 alt: 0, 3410 // specifies target context for links with `preload` type 3411 as: 0, 3412 async: HAS_BOOLEAN_VALUE, 3413 autoComplete: 0, 3414 // autoFocus is polyfilled/normalized by AutoFocusUtils 3415 // autoFocus: HAS_BOOLEAN_VALUE, 3416 autoPlay: HAS_BOOLEAN_VALUE, 3417 capture: HAS_BOOLEAN_VALUE, 3418 cellPadding: 0, 3419 cellSpacing: 0, 3420 charSet: 0, 3421 challenge: 0, 3422 checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, 3423 cite: 0, 3424 classID: 0, 3425 className: 0, 3426 cols: HAS_POSITIVE_NUMERIC_VALUE, 3427 colSpan: 0, 3428 content: 0, 3429 contentEditable: 0, 3430 contextMenu: 0, 3431 controls: HAS_BOOLEAN_VALUE, 3432 coords: 0, 3433 crossOrigin: 0, 3434 data: 0, // For `<object />` acts as `src`. 3435 dateTime: 0, 3436 'default': HAS_BOOLEAN_VALUE, 3437 defer: HAS_BOOLEAN_VALUE, 3438 dir: 0, 3439 disabled: HAS_BOOLEAN_VALUE, 3440 download: HAS_OVERLOADED_BOOLEAN_VALUE, 3441 draggable: 0, 3442 encType: 0, 3443 form: 0, 3444 formAction: 0, 3445 formEncType: 0, 3446 formMethod: 0, 3447 formNoValidate: HAS_BOOLEAN_VALUE, 3448 formTarget: 0, 3449 frameBorder: 0, 3450 headers: 0, 3451 height: 0, 3452 hidden: HAS_BOOLEAN_VALUE, 3453 high: 0, 3454 href: 0, 3455 hrefLang: 0, 3456 htmlFor: 0, 3457 httpEquiv: 0, 3458 icon: 0, 3459 id: 0, 3460 inputMode: 0, 3461 integrity: 0, 3462 is: 0, 3463 keyParams: 0, 3464 keyType: 0, 3465 kind: 0, 3466 label: 0, 3467 lang: 0, 3468 list: 0, 3469 loop: HAS_BOOLEAN_VALUE, 3470 low: 0, 3471 manifest: 0, 3472 marginHeight: 0, 3473 marginWidth: 0, 3474 max: 0, 3475 maxLength: 0, 3476 media: 0, 3477 mediaGroup: 0, 3478 method: 0, 3479 min: 0, 3480 minLength: 0, 3481 // Caution; `option.selected` is not updated if `select.multiple` is 3482 // disabled with `removeAttribute`. 3483 multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, 3484 muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, 3485 name: 0, 3486 nonce: 0, 3487 noValidate: HAS_BOOLEAN_VALUE, 3488 open: HAS_BOOLEAN_VALUE, 3489 optimum: 0, 3490 pattern: 0, 3491 placeholder: 0, 3492 playsInline: HAS_BOOLEAN_VALUE, 3493 poster: 0, 3494 preload: 0, 3495 profile: 0, 3496 radioGroup: 0, 3497 readOnly: HAS_BOOLEAN_VALUE, 3498 referrerPolicy: 0, 3499 rel: 0, 3500 required: HAS_BOOLEAN_VALUE, 3501 reversed: HAS_BOOLEAN_VALUE, 3502 role: 0, 3503 rows: HAS_POSITIVE_NUMERIC_VALUE, 3504 rowSpan: HAS_NUMERIC_VALUE, 3505 sandbox: 0, 3506 scope: 0, 3507 scoped: HAS_BOOLEAN_VALUE, 3508 scrolling: 0, 3509 seamless: HAS_BOOLEAN_VALUE, 3510 selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, 3511 shape: 0, 3512 size: HAS_POSITIVE_NUMERIC_VALUE, 3513 sizes: 0, 3514 span: HAS_POSITIVE_NUMERIC_VALUE, 3515 spellCheck: 0, 3516 src: 0, 3517 srcDoc: 0, 3518 srcLang: 0, 3519 srcSet: 0, 3520 start: HAS_NUMERIC_VALUE, 3521 step: 0, 3522 style: 0, 3523 summary: 0, 3524 tabIndex: 0, 3525 target: 0, 3526 title: 0, 3527 // Setting .type throws on non-<input> tags 3528 type: 0, 3529 useMap: 0, 3530 value: 0, 3531 width: 0, 3532 wmode: 0, 3533 wrap: 0, 3534 3535 /** 3536 * RDFa Properties 3537 */ 3538 about: 0, 3539 datatype: 0, 3540 inlist: 0, 3541 prefix: 0, 3542 // property is also supported for OpenGraph in meta tags. 3543 property: 0, 3544 resource: 0, 3545 'typeof': 0, 3546 vocab: 0, 3547 3548 /** 3549 * Non-standard Properties 3550 */ 3551 // autoCapitalize and autoCorrect are supported in Mobile Safari for 3552 // keyboard hints. 3553 autoCapitalize: 0, 3554 autoCorrect: 0, 3555 // autoSave allows WebKit/Blink to persist values of input fields on page reloads 3556 autoSave: 0, 3557 // color is for Safari mask-icon link 3558 color: 0, 3559 // itemProp, itemScope, itemType are for 3560 // Microdata support. See http://schema.org/docs/gs.html 3561 itemProp: 0, 3562 itemScope: HAS_BOOLEAN_VALUE, 3563 itemType: 0, 3564 // itemID and itemRef are for Microdata support as well but 3565 // only specified in the WHATWG spec document. See 3566 // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api 3567 itemID: 0, 3568 itemRef: 0, 3569 // results show looking glass icon and recent searches on input 3570 // search fields in WebKit/Blink 3571 results: 0, 3572 // IE-only attribute that specifies security restrictions on an iframe 3573 // as an alternative to the sandbox attribute on IE<10 3574 security: 0, 3575 // IE-only attribute that controls focus behavior 3576 unselectable: 0 3577 }, 3578 DOMAttributeNames: { 3579 acceptCharset: 'accept-charset', 3580 className: 'class', 3581 htmlFor: 'for', 3582 httpEquiv: 'http-equiv' 3583 }, 3584 DOMPropertyNames: {} 3585 }; 3586 3587 module.exports = HTMLDOMPropertyConfig; 3588 },{"11":11}],23:[function(_dereq_,module,exports){ 3589 /** 3590 * Copyright 2013-present, Facebook, Inc. 3591 * All rights reserved. 3592 * 3593 * This source code is licensed under the BSD-style license found in the 3594 * LICENSE file in the root directory of this source tree. An additional grant 3595 * of patent rights can be found in the PATENTS file in the same directory. 3596 * 3597 * 3598 */ 3599 3600 'use strict'; 3601 3602 /** 3603 * Escape and wrap key so it is safe to use as a reactid 3604 * 3605 * @param {string} key to be escaped. 3606 * @return {string} the escaped key. 3607 */ 3608 3609 function escape(key) { 3610 var escapeRegex = /[=:]/g; 3611 var escaperLookup = { 3612 '=': '=0', 3613 ':': '=2' 3614 }; 3615 var escapedString = ('' + key).replace(escapeRegex, function (match) { 3616 return escaperLookup[match]; 3617 }); 3618 3619 return '$' + escapedString; 3620 } 3621 3622 /** 3623 * Unescape and unwrap key for human-readable display 3624 * 3625 * @param {string} key to unescape. 3626 * @return {string} the unescaped key. 3627 */ 3628 function unescape(key) { 3629 var unescapeRegex = /(=0|=2)/g; 3630 var unescaperLookup = { 3631 '=0': '=', 3632 '=2': ':' 3633 }; 3634 var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1); 3635 3636 return ('' + keySubstring).replace(unescapeRegex, function (match) { 3637 return unescaperLookup[match]; 3638 }); 3639 } 3640 3641 var KeyEscapeUtils = { 3642 escape: escape, 3643 unescape: unescape 3644 }; 3645 3646 module.exports = KeyEscapeUtils; 3647 },{}],24:[function(_dereq_,module,exports){ 3648 /** 3649 * Copyright 2013-present, Facebook, Inc. 3650 * All rights reserved. 3651 * 3652 * This source code is licensed under the BSD-style license found in the 3653 * LICENSE file in the root directory of this source tree. An additional grant 3654 * of patent rights can be found in the PATENTS file in the same directory. 3655 * 3656 */ 3657 3658 'use strict'; 3659 3660 var _prodInvariant = _dereq_(125); 3661 3662 var React = _dereq_(134); 3663 var ReactPropTypesSecret = _dereq_(73); 3664 3665 var invariant = _dereq_(150); 3666 var warning = _dereq_(157); 3667 3668 var hasReadOnlyValue = { 3669 'button': true, 3670 'checkbox': true, 3671 'image': true, 3672 'hidden': true, 3673 'radio': true, 3674 'reset': true, 3675 'submit': true 3676 }; 3677 3678 function _assertSingleLink(inputProps) { 3679 !(inputProps.checkedLink == null || inputProps.valueLink == null) ? "development" !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use checkedLink, you probably don\'t want to use valueLink and vice versa.') : _prodInvariant('87') : void 0; 3680 } 3681 function _assertValueLink(inputProps) { 3682 _assertSingleLink(inputProps); 3683 !(inputProps.value == null && inputProps.onChange == null) ? "development" !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want to use value or onChange, you probably don\'t want to use valueLink.') : _prodInvariant('88') : void 0; 3684 } 3685 3686 function _assertCheckedLink(inputProps) { 3687 _assertSingleLink(inputProps); 3688 !(inputProps.checked == null && inputProps.onChange == null) ? "development" !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. If you want to use checked or onChange, you probably don\'t want to use checkedLink') : _prodInvariant('89') : void 0; 3689 } 3690 3691 var propTypes = { 3692 value: function (props, propName, componentName) { 3693 if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) { 3694 return null; 3695 } 3696 return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); 3697 }, 3698 checked: function (props, propName, componentName) { 3699 if (!props[propName] || props.onChange || props.readOnly || props.disabled) { 3700 return null; 3701 } 3702 return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); 3703 }, 3704 onChange: React.PropTypes.func 3705 }; 3706 3707 var loggedTypeFailures = {}; 3708 function getDeclarationErrorAddendum(owner) { 3709 if (owner) { 3710 var name = owner.getName(); 3711 if (name) { 3712 return ' Check the render method of `' + name + '`.'; 3713 } 3714 } 3715 return ''; 3716 } 3717 3718 /** 3719 * Provide a linked `value` attribute for controlled forms. You should not use 3720 * this outside of the ReactDOM controlled form components. 3721 */ 3722 var LinkedValueUtils = { 3723 checkPropTypes: function (tagName, props, owner) { 3724 for (var propName in propTypes) { 3725 if (propTypes.hasOwnProperty(propName)) { 3726 var error = propTypes[propName](props, propName, tagName, 'prop', null, ReactPropTypesSecret); 3727 } 3728 if (error instanceof Error && !(error.message in loggedTypeFailures)) { 3729 // Only monitor this failure once because there tends to be a lot of the 3730 // same error. 3731 loggedTypeFailures[error.message] = true; 3732 3733 var addendum = getDeclarationErrorAddendum(owner); 3734 "development" !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0; 3735 } 3736 } 3737 }, 3738 3739 /** 3740 * @param {object} inputProps Props for form component 3741 * @return {*} current value of the input either from value prop or link. 3742 */ 3743 getValue: function (inputProps) { 3744 if (inputProps.valueLink) { 3745 _assertValueLink(inputProps); 3746 return inputProps.valueLink.value; 3747 } 3748 return inputProps.value; 3749 }, 3750 3751 /** 3752 * @param {object} inputProps Props for form component 3753 * @return {*} current checked status of the input either from checked prop 3754 * or link. 3755 */ 3756 getChecked: function (inputProps) { 3757 if (inputProps.checkedLink) { 3758 _assertCheckedLink(inputProps); 3759 return inputProps.checkedLink.value; 3760 } 3761 return inputProps.checked; 3762 }, 3763 3764 /** 3765 * @param {object} inputProps Props for form component 3766 * @param {SyntheticEvent} event change event to handle 3767 */ 3768 executeOnChange: function (inputProps, event) { 3769 if (inputProps.valueLink) { 3770 _assertValueLink(inputProps); 3771 return inputProps.valueLink.requestChange(event.target.value); 3772 } else if (inputProps.checkedLink) { 3773 _assertCheckedLink(inputProps); 3774 return inputProps.checkedLink.requestChange(event.target.checked); 3775 } else if (inputProps.onChange) { 3776 return inputProps.onChange.call(undefined, event); 3777 } 3778 } 3779 }; 3780 3781 module.exports = LinkedValueUtils; 3782 },{"125":125,"134":134,"150":150,"157":157,"73":73}],25:[function(_dereq_,module,exports){ 3783 /** 3784 * Copyright 2013-present, Facebook, Inc. 3785 * All rights reserved. 3786 * 3787 * This source code is licensed under the BSD-style license found in the 3788 * LICENSE file in the root directory of this source tree. An additional grant 3789 * of patent rights can be found in the PATENTS file in the same directory. 3790 * 3791 * 3792 */ 3793 3794 'use strict'; 3795 3796 var _prodInvariant = _dereq_(125); 3797 3798 var invariant = _dereq_(150); 3799 3800 /** 3801 * Static poolers. Several custom versions for each potential number of 3802 * arguments. A completely generic pooler is easy to implement, but would 3803 * require accessing the `arguments` object. In each of these, `this` refers to 3804 * the Class itself, not an instance. If any others are needed, simply add them 3805 * here, or in their own files. 3806 */ 3807 var oneArgumentPooler = function (copyFieldsFrom) { 3808 var Klass = this; 3809 if (Klass.instancePool.length) { 3810 var instance = Klass.instancePool.pop(); 3811 Klass.call(instance, copyFieldsFrom); 3812 return instance; 3813 } else { 3814 return new Klass(copyFieldsFrom); 3815 } 3816 }; 3817 3818 var twoArgumentPooler = function (a1, a2) { 3819 var Klass = this; 3820 if (Klass.instancePool.length) { 3821 var instance = Klass.instancePool.pop(); 3822 Klass.call(instance, a1, a2); 3823 return instance; 3824 } else { 3825 return new Klass(a1, a2); 3826 } 3827 }; 3828 3829 var threeArgumentPooler = function (a1, a2, a3) { 3830 var Klass = this; 3831 if (Klass.instancePool.length) { 3832 var instance = Klass.instancePool.pop(); 3833 Klass.call(instance, a1, a2, a3); 3834 return instance; 3835 } else { 3836 return new Klass(a1, a2, a3); 3837 } 3838 }; 3839 3840 var fourArgumentPooler = function (a1, a2, a3, a4) { 3841 var Klass = this; 3842 if (Klass.instancePool.length) { 3843 var instance = Klass.instancePool.pop(); 3844 Klass.call(instance, a1, a2, a3, a4); 3845 return instance; 3846 } else { 3847 return new Klass(a1, a2, a3, a4); 3848 } 3849 }; 3850 3851 var fiveArgumentPooler = function (a1, a2, a3, a4, a5) { 3852 var Klass = this; 3853 if (Klass.instancePool.length) { 3854 var instance = Klass.instancePool.pop(); 3855 Klass.call(instance, a1, a2, a3, a4, a5); 3856 return instance; 3857 } else { 3858 return new Klass(a1, a2, a3, a4, a5); 3859 } 3860 }; 3861 3862 var standardReleaser = function (instance) { 3863 var Klass = this; 3864 !(instance instanceof Klass) ? "development" !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0; 3865 instance.destructor(); 3866 if (Klass.instancePool.length < Klass.poolSize) { 3867 Klass.instancePool.push(instance); 3868 } 3869 }; 3870 3871 var DEFAULT_POOL_SIZE = 10; 3872 var DEFAULT_POOLER = oneArgumentPooler; 3873 3874 /** 3875 * Augments `CopyConstructor` to be a poolable class, augmenting only the class 3876 * itself (statically) not adding any prototypical fields. Any CopyConstructor 3877 * you give this may have a `poolSize` property, and will look for a 3878 * prototypical `destructor` on instances. 3879 * 3880 * @param {Function} CopyConstructor Constructor that can be used to reset. 3881 * @param {Function} pooler Customizable pooler. 3882 */ 3883 var addPoolingTo = function (CopyConstructor, pooler) { 3884 // Casting as any so that flow ignores the actual implementation and trusts 3885 // it to match the type we declared 3886 var NewKlass = CopyConstructor; 3887 NewKlass.instancePool = []; 3888 NewKlass.getPooled = pooler || DEFAULT_POOLER; 3889 if (!NewKlass.poolSize) { 3890 NewKlass.poolSize = DEFAULT_POOL_SIZE; 3891 } 3892 NewKlass.release = standardReleaser; 3893 return NewKlass; 3894 }; 3895 3896 var PooledClass = { 3897 addPoolingTo: addPoolingTo, 3898 oneArgumentPooler: oneArgumentPooler, 3899 twoArgumentPooler: twoArgumentPooler, 3900 threeArgumentPooler: threeArgumentPooler, 3901 fourArgumentPooler: fourArgumentPooler, 3902 fiveArgumentPooler: fiveArgumentPooler 3903 }; 3904 3905 module.exports = PooledClass; 3906 },{"125":125,"150":150}],26:[function(_dereq_,module,exports){ 3907 /** 3908 * Copyright 2013-present, Facebook, Inc. 3909 * All rights reserved. 3910 * 3911 * This source code is licensed under the BSD-style license found in the 3912 * LICENSE file in the root directory of this source tree. An additional grant 3913 * of patent rights can be found in the PATENTS file in the same directory. 3914 * 3915 */ 3916 3917 'use strict'; 3918 3919 var _assign = _dereq_(158); 3920 3921 var EventPluginRegistry = _dereq_(18); 3922 var ReactEventEmitterMixin = _dereq_(56); 3923 var ViewportMetrics = _dereq_(101); 3924 3925 var getVendorPrefixedEventName = _dereq_(120); 3926 var isEventSupported = _dereq_(122); 3927 3928 /** 3929 * Summary of `ReactBrowserEventEmitter` event handling: 3930 * 3931 * - Top-level delegation is used to trap most native browser events. This 3932 * may only occur in the main thread and is the responsibility of 3933 * ReactEventListener, which is injected and can therefore support pluggable 3934 * event sources. This is the only work that occurs in the main thread. 3935 * 3936 * - We normalize and de-duplicate events to account for browser quirks. This 3937 * may be done in the worker thread. 3938 * 3939 * - Forward these native events (with the associated top-level type used to 3940 * trap it) to `EventPluginHub`, which in turn will ask plugins if they want 3941 * to extract any synthetic events. 3942 * 3943 * - The `EventPluginHub` will then process each event by annotating them with 3944 * "dispatches", a sequence of listeners and IDs that care about that event. 3945 * 3946 * - The `EventPluginHub` then dispatches the events. 3947 * 3948 * Overview of React and the event system: 3949 * 3950 * +------------+ . 3951 * | DOM | . 3952 * +------------+ . 3953 * | . 3954 * v . 3955 * +------------+ . 3956 * | ReactEvent | . 3957 * | Listener | . 3958 * +------------+ . +-----------+ 3959 * | . +--------+|SimpleEvent| 3960 * | . | |Plugin | 3961 * +-----|------+ . v +-----------+ 3962 * | | | . +--------------+ +------------+ 3963 * | +-----------.--->|EventPluginHub| | Event | 3964 * | | . | | +-----------+ | Propagators| 3965 * | ReactEvent | . | | |TapEvent | |------------| 3966 * | Emitter | . | |<---+|Plugin | |other plugin| 3967 * | | . | | +-----------+ | utilities | 3968 * | +-----------.--->| | +------------+ 3969 * | | | . +--------------+ 3970 * +-----|------+ . ^ +-----------+ 3971 * | . | |Enter/Leave| 3972 * + . +-------+|Plugin | 3973 * +-------------+ . +-----------+ 3974 * | application | . 3975 * |-------------| . 3976 * | | . 3977 * | | . 3978 * +-------------+ . 3979 * . 3980 * React Core . General Purpose Event Plugin System 3981 */ 3982 3983 var hasEventPageXY; 3984 var alreadyListeningTo = {}; 3985 var isMonitoringScrollValue = false; 3986 var reactTopListenersCounter = 0; 3987 3988 // For events like 'submit' which don't consistently bubble (which we trap at a 3989 // lower node than `document`), binding at `document` would cause duplicate 3990 // events so we don't include them here 3991 var topEventMapping = { 3992 topAbort: 'abort', 3993 topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend', 3994 topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration', 3995 topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart', 3996 topBlur: 'blur', 3997 topCanPlay: 'canplay', 3998 topCanPlayThrough: 'canplaythrough', 3999 topChange: 'change', 4000 topClick: 'click', 4001 topCompositionEnd: 'compositionend', 4002 topCompositionStart: 'compositionstart', 4003 topCompositionUpdate: 'compositionupdate', 4004 topContextMenu: 'contextmenu', 4005 topCopy: 'copy', 4006 topCut: 'cut', 4007 topDoubleClick: 'dblclick', 4008 topDrag: 'drag', 4009 topDragEnd: 'dragend', 4010 topDragEnter: 'dragenter', 4011 topDragExit: 'dragexit', 4012 topDragLeave: 'dragleave', 4013 topDragOver: 'dragover', 4014 topDragStart: 'dragstart', 4015 topDrop: 'drop', 4016 topDurationChange: 'durationchange', 4017 topEmptied: 'emptied', 4018 topEncrypted: 'encrypted', 4019 topEnded: 'ended', 4020 topError: 'error', 4021 topFocus: 'focus', 4022 topInput: 'input', 4023 topKeyDown: 'keydown', 4024 topKeyPress: 'keypress', 4025 topKeyUp: 'keyup', 4026 topLoadedData: 'loadeddata', 4027 topLoadedMetadata: 'loadedmetadata', 4028 topLoadStart: 'loadstart', 4029 topMouseDown: 'mousedown', 4030 topMouseMove: 'mousemove', 4031 topMouseOut: 'mouseout', 4032 topMouseOver: 'mouseover', 4033 topMouseUp: 'mouseup', 4034 topPaste: 'paste', 4035 topPause: 'pause', 4036 topPlay: 'play', 4037 topPlaying: 'playing', 4038 topProgress: 'progress', 4039 topRateChange: 'ratechange', 4040 topScroll: 'scroll', 4041 topSeeked: 'seeked', 4042 topSeeking: 'seeking', 4043 topSelectionChange: 'selectionchange', 4044 topStalled: 'stalled', 4045 topSuspend: 'suspend', 4046 topTextInput: 'textInput', 4047 topTimeUpdate: 'timeupdate', 4048 topTouchCancel: 'touchcancel', 4049 topTouchEnd: 'touchend', 4050 topTouchMove: 'touchmove', 4051 topTouchStart: 'touchstart', 4052 topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend', 4053 topVolumeChange: 'volumechange', 4054 topWaiting: 'waiting', 4055 topWheel: 'wheel' 4056 }; 4057 4058 /** 4059 * To ensure no conflicts with other potential React instances on the page 4060 */ 4061 var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2); 4062 4063 function getListeningForDocument(mountAt) { 4064 // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` 4065 // directly. 4066 if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { 4067 mountAt[topListenersIDKey] = reactTopListenersCounter++; 4068 alreadyListeningTo[mountAt[topListenersIDKey]] = {}; 4069 } 4070 return alreadyListeningTo[mountAt[topListenersIDKey]]; 4071 } 4072 4073 /** 4074 * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For 4075 * example: 4076 * 4077 * EventPluginHub.putListener('myID', 'onClick', myFunction); 4078 * 4079 * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'. 4080 * 4081 * @internal 4082 */ 4083 var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, { 4084 4085 /** 4086 * Injectable event backend 4087 */ 4088 ReactEventListener: null, 4089 4090 injection: { 4091 /** 4092 * @param {object} ReactEventListener 4093 */ 4094 injectReactEventListener: function (ReactEventListener) { 4095 ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel); 4096 ReactBrowserEventEmitter.ReactEventListener = ReactEventListener; 4097 } 4098 }, 4099 4100 /** 4101 * Sets whether or not any created callbacks should be enabled. 4102 * 4103 * @param {boolean} enabled True if callbacks should be enabled. 4104 */ 4105 setEnabled: function (enabled) { 4106 if (ReactBrowserEventEmitter.ReactEventListener) { 4107 ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled); 4108 } 4109 }, 4110 4111 /** 4112 * @return {boolean} True if callbacks are enabled. 4113 */ 4114 isEnabled: function () { 4115 return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled()); 4116 }, 4117 4118 /** 4119 * We listen for bubbled touch events on the document object. 4120 * 4121 * Firefox v8.01 (and possibly others) exhibited strange behavior when 4122 * mounting `onmousemove` events at some node that was not the document 4123 * element. The symptoms were that if your mouse is not moving over something 4124 * contained within that mount point (for example on the background) the 4125 * top-level listeners for `onmousemove` won't be called. However, if you 4126 * register the `mousemove` on the document object, then it will of course 4127 * catch all `mousemove`s. This along with iOS quirks, justifies restricting 4128 * top-level listeners to the document object only, at least for these 4129 * movement types of events and possibly all events. 4130 * 4131 * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html 4132 * 4133 * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but 4134 * they bubble to document. 4135 * 4136 * @param {string} registrationName Name of listener (e.g. `onClick`). 4137 * @param {object} contentDocumentHandle Document which owns the container 4138 */ 4139 listenTo: function (registrationName, contentDocumentHandle) { 4140 var mountAt = contentDocumentHandle; 4141 var isListening = getListeningForDocument(mountAt); 4142 var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName]; 4143 4144 for (var i = 0; i < dependencies.length; i++) { 4145 var dependency = dependencies[i]; 4146 if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { 4147 if (dependency === 'topWheel') { 4148 if (isEventSupported('wheel')) { 4149 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'wheel', mountAt); 4150 } else if (isEventSupported('mousewheel')) { 4151 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'mousewheel', mountAt); 4152 } else { 4153 // Firefox needs to capture a different mouse scroll event. 4154 // @see http://www.quirksmode.org/dom/events/tests/scroll.html 4155 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'DOMMouseScroll', mountAt); 4156 } 4157 } else if (dependency === 'topScroll') { 4158 4159 if (isEventSupported('scroll', true)) { 4160 ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topScroll', 'scroll', mountAt); 4161 } else { 4162 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topScroll', 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE); 4163 } 4164 } else if (dependency === 'topFocus' || dependency === 'topBlur') { 4165 4166 if (isEventSupported('focus', true)) { 4167 ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topFocus', 'focus', mountAt); 4168 ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topBlur', 'blur', mountAt); 4169 } else if (isEventSupported('focusin')) { 4170 // IE has `focusin` and `focusout` events which bubble. 4171 // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html 4172 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topFocus', 'focusin', mountAt); 4173 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topBlur', 'focusout', mountAt); 4174 } 4175 4176 // to make sure blur and focus event listeners are only attached once 4177 isListening.topBlur = true; 4178 isListening.topFocus = true; 4179 } else if (topEventMapping.hasOwnProperty(dependency)) { 4180 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt); 4181 } 4182 4183 isListening[dependency] = true; 4184 } 4185 } 4186 }, 4187 4188 trapBubbledEvent: function (topLevelType, handlerBaseName, handle) { 4189 return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle); 4190 }, 4191 4192 trapCapturedEvent: function (topLevelType, handlerBaseName, handle) { 4193 return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle); 4194 }, 4195 4196 /** 4197 * Protect against document.createEvent() returning null 4198 * Some popup blocker extensions appear to do this: 4199 * https://github.com/facebook/react/issues/6887 4200 */ 4201 supportsEventPageXY: function () { 4202 if (!document.createEvent) { 4203 return false; 4204 } 4205 var ev = document.createEvent('MouseEvent'); 4206 return ev != null && 'pageX' in ev; 4207 }, 4208 4209 /** 4210 * Listens to window scroll and resize events. We cache scroll values so that 4211 * application code can access them without triggering reflows. 4212 * 4213 * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when 4214 * pageX/pageY isn't supported (legacy browsers). 4215 * 4216 * NOTE: Scroll events do not bubble. 4217 * 4218 * @see http://www.quirksmode.org/dom/events/scroll.html 4219 */ 4220 ensureScrollValueMonitoring: function () { 4221 if (hasEventPageXY === undefined) { 4222 hasEventPageXY = ReactBrowserEventEmitter.supportsEventPageXY(); 4223 } 4224 if (!hasEventPageXY && !isMonitoringScrollValue) { 4225 var refresh = ViewportMetrics.refreshScrollValues; 4226 ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh); 4227 isMonitoringScrollValue = true; 4228 } 4229 } 4230 4231 }); 4232 4233 module.exports = ReactBrowserEventEmitter; 4234 },{"101":101,"120":120,"122":122,"158":158,"18":18,"56":56}],27:[function(_dereq_,module,exports){ 4235 (function (process){ 4236 /** 4237 * Copyright 2014-present, Facebook, Inc. 4238 * All rights reserved. 4239 * 4240 * This source code is licensed under the BSD-style license found in the 4241 * LICENSE file in the root directory of this source tree. An additional grant 4242 * of patent rights can be found in the PATENTS file in the same directory. 4243 * 4244 */ 4245 4246 'use strict'; 4247 4248 var ReactReconciler = _dereq_(75); 4249 4250 var instantiateReactComponent = _dereq_(121); 4251 var KeyEscapeUtils = _dereq_(23); 4252 var shouldUpdateReactComponent = _dereq_(129); 4253 var traverseAllChildren = _dereq_(130); 4254 var warning = _dereq_(157); 4255 4256 var ReactComponentTreeHook; 4257 4258 if (typeof process !== 'undefined' && process.env && "development" === 'test') { 4259 // Temporary hack. 4260 // Inline requires don't work well with Jest: 4261 // https://github.com/facebook/react/issues/7240 4262 // Remove the inline requires when we don't need them anymore: 4263 // https://github.com/facebook/react/pull/7178 4264 ReactComponentTreeHook = _dereq_(132); 4265 } 4266 4267 function instantiateChild(childInstances, child, name, selfDebugID) { 4268 // We found a component instance. 4269 var keyUnique = childInstances[name] === undefined; 4270 if ("development" !== 'production') { 4271 if (!ReactComponentTreeHook) { 4272 ReactComponentTreeHook = _dereq_(132); 4273 } 4274 if (!keyUnique) { 4275 "development" !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0; 4276 } 4277 } 4278 if (child != null && keyUnique) { 4279 childInstances[name] = instantiateReactComponent(child, true); 4280 } 4281 } 4282 4283 /** 4284 * ReactChildReconciler provides helpers for initializing or updating a set of 4285 * children. Its output is suitable for passing it onto ReactMultiChild which 4286 * does diffed reordering and insertion. 4287 */ 4288 var ReactChildReconciler = { 4289 /** 4290 * Generates a "mount image" for each of the supplied children. In the case 4291 * of `ReactDOMComponent`, a mount image is a string of markup. 4292 * 4293 * @param {?object} nestedChildNodes Nested child maps. 4294 * @return {?object} A set of child instances. 4295 * @internal 4296 */ 4297 instantiateChildren: function (nestedChildNodes, transaction, context, selfDebugID // 0 in production and for roots 4298 ) { 4299 if (nestedChildNodes == null) { 4300 return null; 4301 } 4302 var childInstances = {}; 4303 4304 if ("development" !== 'production') { 4305 traverseAllChildren(nestedChildNodes, function (childInsts, child, name) { 4306 return instantiateChild(childInsts, child, name, selfDebugID); 4307 }, childInstances); 4308 } else { 4309 traverseAllChildren(nestedChildNodes, instantiateChild, childInstances); 4310 } 4311 return childInstances; 4312 }, 4313 4314 /** 4315 * Updates the rendered children and returns a new set of children. 4316 * 4317 * @param {?object} prevChildren Previously initialized set of children. 4318 * @param {?object} nextChildren Flat child element maps. 4319 * @param {ReactReconcileTransaction} transaction 4320 * @param {object} context 4321 * @return {?object} A new set of child instances. 4322 * @internal 4323 */ 4324 updateChildren: function (prevChildren, nextChildren, mountImages, removedNodes, transaction, hostParent, hostContainerInfo, context, selfDebugID // 0 in production and for roots 4325 ) { 4326 // We currently don't have a way to track moves here but if we use iterators 4327 // instead of for..in we can zip the iterators and check if an item has 4328 // moved. 4329 // TODO: If nothing has changed, return the prevChildren object so that we 4330 // can quickly bailout if nothing has changed. 4331 if (!nextChildren && !prevChildren) { 4332 return; 4333 } 4334 var name; 4335 var prevChild; 4336 for (name in nextChildren) { 4337 if (!nextChildren.hasOwnProperty(name)) { 4338 continue; 4339 } 4340 prevChild = prevChildren && prevChildren[name]; 4341 var prevElement = prevChild && prevChild._currentElement; 4342 var nextElement = nextChildren[name]; 4343 if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) { 4344 ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context); 4345 nextChildren[name] = prevChild; 4346 } else { 4347 if (prevChild) { 4348 removedNodes[name] = ReactReconciler.getHostNode(prevChild); 4349 ReactReconciler.unmountComponent(prevChild, false); 4350 } 4351 // The child must be instantiated before it's mounted. 4352 var nextChildInstance = instantiateReactComponent(nextElement, true); 4353 nextChildren[name] = nextChildInstance; 4354 // Creating mount image now ensures refs are resolved in right order 4355 // (see https://github.com/facebook/react/pull/7101 for explanation). 4356 var nextChildMountImage = ReactReconciler.mountComponent(nextChildInstance, transaction, hostParent, hostContainerInfo, context, selfDebugID); 4357 mountImages.push(nextChildMountImage); 4358 } 4359 } 4360 // Unmount children that are no longer present. 4361 for (name in prevChildren) { 4362 if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) { 4363 prevChild = prevChildren[name]; 4364 removedNodes[name] = ReactReconciler.getHostNode(prevChild); 4365 ReactReconciler.unmountComponent(prevChild, false); 4366 } 4367 } 4368 }, 4369 4370 /** 4371 * Unmounts all rendered children. This should be used to clean up children 4372 * when this component is unmounted. 4373 * 4374 * @param {?object} renderedChildren Previously initialized set of children. 4375 * @internal 4376 */ 4377 unmountChildren: function (renderedChildren, safely) { 4378 for (var name in renderedChildren) { 4379 if (renderedChildren.hasOwnProperty(name)) { 4380 var renderedChild = renderedChildren[name]; 4381 ReactReconciler.unmountComponent(renderedChild, safely); 4382 } 4383 } 4384 } 4385 4386 }; 4387 4388 module.exports = ReactChildReconciler; 4389 }).call(this,undefined) 4390 },{"121":121,"129":129,"130":130,"132":132,"157":157,"23":23,"75":75}],28:[function(_dereq_,module,exports){ 4391 /** 4392 * Copyright 2013-present, Facebook, Inc. 4393 * All rights reserved. 4394 * 4395 * This source code is licensed under the BSD-style license found in the 4396 * LICENSE file in the root directory of this source tree. An additional grant 4397 * of patent rights can be found in the PATENTS file in the same directory. 4398 * 4399 */ 4400 4401 'use strict'; 4402 4403 var DOMChildrenOperations = _dereq_(8); 4404 var ReactDOMIDOperations = _dereq_(38); 4405 4406 /** 4407 * Abstracts away all functionality of the reconciler that requires knowledge of 4408 * the browser context. TODO: These callers should be refactored to avoid the 4409 * need for this injection. 4410 */ 4411 var ReactComponentBrowserEnvironment = { 4412 4413 processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates, 4414 4415 replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup 4416 4417 }; 4418 4419 module.exports = ReactComponentBrowserEnvironment; 4420 },{"38":38,"8":8}],29:[function(_dereq_,module,exports){ 4421 /** 4422 * Copyright 2014-present, Facebook, Inc. 4423 * All rights reserved. 4424 * 4425 * This source code is licensed under the BSD-style license found in the 4426 * LICENSE file in the root directory of this source tree. An additional grant 4427 * of patent rights can be found in the PATENTS file in the same directory. 4428 * 4429 * 4430 */ 4431 4432 'use strict'; 4433 4434 var _prodInvariant = _dereq_(125); 4435 4436 var invariant = _dereq_(150); 4437 4438 var injected = false; 4439 4440 var ReactComponentEnvironment = { 4441 4442 /** 4443 * Optionally injectable hook for swapping out mount images in the middle of 4444 * the tree. 4445 */ 4446 replaceNodeWithMarkup: null, 4447 4448 /** 4449 * Optionally injectable hook for processing a queue of child updates. Will 4450 * later move into MultiChildComponents. 4451 */ 4452 processChildrenUpdates: null, 4453 4454 injection: { 4455 injectEnvironment: function (environment) { 4456 !!injected ? "development" !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : _prodInvariant('104') : void 0; 4457 ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup; 4458 ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates; 4459 injected = true; 4460 } 4461 } 4462 4463 }; 4464 4465 module.exports = ReactComponentEnvironment; 4466 },{"125":125,"150":150}],30:[function(_dereq_,module,exports){ 4467 /** 4468 * Copyright 2013-present, Facebook, Inc. 4469 * All rights reserved. 4470 * 4471 * This source code is licensed under the BSD-style license found in the 4472 * LICENSE file in the root directory of this source tree. An additional grant 4473 * of patent rights can be found in the PATENTS file in the same directory. 4474 * 4475 */ 4476 4477 'use strict'; 4478 4479 var _prodInvariant = _dereq_(125), 4480 _assign = _dereq_(158); 4481 4482 var React = _dereq_(134); 4483 var ReactComponentEnvironment = _dereq_(29); 4484 var ReactCurrentOwner = _dereq_(133); 4485 var ReactErrorUtils = _dereq_(55); 4486 var ReactInstanceMap = _dereq_(63); 4487 var ReactInstrumentation = _dereq_(64); 4488 var ReactNodeTypes = _dereq_(69); 4489 var ReactReconciler = _dereq_(75); 4490 4491 if ("development" !== 'production') { 4492 var checkReactTypeSpec = _dereq_(104); 4493 } 4494 4495 var emptyObject = _dereq_(143); 4496 var invariant = _dereq_(150); 4497 var shallowEqual = _dereq_(156); 4498 var shouldUpdateReactComponent = _dereq_(129); 4499 var warning = _dereq_(157); 4500 4501 var CompositeTypes = { 4502 ImpureClass: 0, 4503 PureClass: 1, 4504 StatelessFunctional: 2 4505 }; 4506 4507 function StatelessComponent(Component) {} 4508 StatelessComponent.prototype.render = function () { 4509 var Component = ReactInstanceMap.get(this)._currentElement.type; 4510 var element = Component(this.props, this.context, this.updater); 4511 warnIfInvalidElement(Component, element); 4512 return element; 4513 }; 4514 4515 function warnIfInvalidElement(Component, element) { 4516 if ("development" !== 'production') { 4517 "development" !== 'production' ? warning(element === null || element === false || React.isValidElement(element), '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : void 0; 4518 "development" !== 'production' ? warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component') : void 0; 4519 } 4520 } 4521 4522 function shouldConstruct(Component) { 4523 return !!(Component.prototype && Component.prototype.isReactComponent); 4524 } 4525 4526 function isPureComponent(Component) { 4527 return !!(Component.prototype && Component.prototype.isPureReactComponent); 4528 } 4529 4530 // Separated into a function to contain deoptimizations caused by try/finally. 4531 function measureLifeCyclePerf(fn, debugID, timerType) { 4532 if (debugID === 0) { 4533 // Top-level wrappers (see ReactMount) and empty components (see 4534 // ReactDOMEmptyComponent) are invisible to hooks and devtools. 4535 // Both are implementation details that should go away in the future. 4536 return fn(); 4537 } 4538 4539 ReactInstrumentation.debugTool.onBeginLifeCycleTimer(debugID, timerType); 4540 try { 4541 return fn(); 4542 } finally { 4543 ReactInstrumentation.debugTool.onEndLifeCycleTimer(debugID, timerType); 4544 } 4545 } 4546 4547 /** 4548 * ------------------ The Life-Cycle of a Composite Component ------------------ 4549 * 4550 * - constructor: Initialization of state. The instance is now retained. 4551 * - componentWillMount 4552 * - render 4553 * - [children's constructors] 4554 * - [children's componentWillMount and render] 4555 * - [children's componentDidMount] 4556 * - componentDidMount 4557 * 4558 * Update Phases: 4559 * - componentWillReceiveProps (only called if parent updated) 4560 * - shouldComponentUpdate 4561 * - componentWillUpdate 4562 * - render 4563 * - [children's constructors or receive props phases] 4564 * - componentDidUpdate 4565 * 4566 * - componentWillUnmount 4567 * - [children's componentWillUnmount] 4568 * - [children destroyed] 4569 * - (destroyed): The instance is now blank, released by React and ready for GC. 4570 * 4571 * ----------------------------------------------------------------------------- 4572 */ 4573 4574 /** 4575 * An incrementing ID assigned to each component when it is mounted. This is 4576 * used to enforce the order in which `ReactUpdates` updates dirty components. 4577 * 4578 * @private 4579 */ 4580 var nextMountID = 1; 4581 4582 /** 4583 * @lends {ReactCompositeComponent.prototype} 4584 */ 4585 var ReactCompositeComponent = { 4586 4587 /** 4588 * Base constructor for all composite component. 4589 * 4590 * @param {ReactElement} element 4591 * @final 4592 * @internal 4593 */ 4594 construct: function (element) { 4595 this._currentElement = element; 4596 this._rootNodeID = 0; 4597 this._compositeType = null; 4598 this._instance = null; 4599 this._hostParent = null; 4600 this._hostContainerInfo = null; 4601 4602 // See ReactUpdateQueue 4603 this._updateBatchNumber = null; 4604 this._pendingElement = null; 4605 this._pendingStateQueue = null; 4606 this._pendingReplaceState = false; 4607 this._pendingForceUpdate = false; 4608 4609 this._renderedNodeType = null; 4610 this._renderedComponent = null; 4611 this._context = null; 4612 this._mountOrder = 0; 4613 this._topLevelWrapper = null; 4614 4615 // See ReactUpdates and ReactUpdateQueue. 4616 this._pendingCallbacks = null; 4617 4618 // ComponentWillUnmount shall only be called once 4619 this._calledComponentWillUnmount = false; 4620 4621 if ("development" !== 'production') { 4622 this._warnedAboutRefsInRender = false; 4623 } 4624 }, 4625 4626 /** 4627 * Initializes the component, renders markup, and registers event listeners. 4628 * 4629 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction 4630 * @param {?object} hostParent 4631 * @param {?object} hostContainerInfo 4632 * @param {?object} context 4633 * @return {?string} Rendered markup to be inserted into the DOM. 4634 * @final 4635 * @internal 4636 */ 4637 mountComponent: function (transaction, hostParent, hostContainerInfo, context) { 4638 var _this = this; 4639 4640 this._context = context; 4641 this._mountOrder = nextMountID++; 4642 this._hostParent = hostParent; 4643 this._hostContainerInfo = hostContainerInfo; 4644 4645 var publicProps = this._currentElement.props; 4646 var publicContext = this._processContext(context); 4647 4648 var Component = this._currentElement.type; 4649 4650 var updateQueue = transaction.getUpdateQueue(); 4651 4652 // Initialize the public class 4653 var doConstruct = shouldConstruct(Component); 4654 var inst = this._constructComponent(doConstruct, publicProps, publicContext, updateQueue); 4655 var renderedElement; 4656 4657 // Support functional components 4658 if (!doConstruct && (inst == null || inst.render == null)) { 4659 renderedElement = inst; 4660 warnIfInvalidElement(Component, renderedElement); 4661 !(inst === null || inst === false || React.isValidElement(inst)) ? "development" !== 'production' ? invariant(false, '%s(...): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : _prodInvariant('105', Component.displayName || Component.name || 'Component') : void 0; 4662 inst = new StatelessComponent(Component); 4663 this._compositeType = CompositeTypes.StatelessFunctional; 4664 } else { 4665 if (isPureComponent(Component)) { 4666 this._compositeType = CompositeTypes.PureClass; 4667 } else { 4668 this._compositeType = CompositeTypes.ImpureClass; 4669 } 4670 } 4671 4672 if ("development" !== 'production') { 4673 // This will throw later in _renderValidatedComponent, but add an early 4674 // warning now to help debugging 4675 if (inst.render == null) { 4676 "development" !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', Component.displayName || Component.name || 'Component') : void 0; 4677 } 4678 4679 var propsMutated = inst.props !== publicProps; 4680 var componentName = Component.displayName || Component.name || 'Component'; 4681 4682 "development" !== 'production' ? warning(inst.props === undefined || !propsMutated, '%s(...): When calling super() in `%s`, make sure to pass ' + 'up the same props that your component\'s constructor was passed.', componentName, componentName) : void 0; 4683 } 4684 4685 // These should be set up in the constructor, but as a convenience for 4686 // simpler class abstractions, we set them up after the fact. 4687 inst.props = publicProps; 4688 inst.context = publicContext; 4689 inst.refs = emptyObject; 4690 inst.updater = updateQueue; 4691 4692 this._instance = inst; 4693 4694 // Store a reference from the instance back to the internal representation 4695 ReactInstanceMap.set(inst, this); 4696 4697 if ("development" !== 'production') { 4698 // Since plain JS classes are defined without any special initialization 4699 // logic, we can not catch common errors early. Therefore, we have to 4700 // catch them here, at initialization time, instead. 4701 "development" !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : void 0; 4702 "development" !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : void 0; 4703 "development" !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : void 0; 4704 "development" !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : void 0; 4705 "development" !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : void 0; 4706 "development" !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : void 0; 4707 "development" !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : void 0; 4708 } 4709 4710 var initialState = inst.state; 4711 if (initialState === undefined) { 4712 inst.state = initialState = null; 4713 } 4714 !(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : _prodInvariant('106', this.getName() || 'ReactCompositeComponent') : void 0; 4715 4716 this._pendingStateQueue = null; 4717 this._pendingReplaceState = false; 4718 this._pendingForceUpdate = false; 4719 4720 var markup; 4721 if (inst.unstable_handleError) { 4722 markup = this.performInitialMountWithErrorHandling(renderedElement, hostParent, hostContainerInfo, transaction, context); 4723 } else { 4724 markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); 4725 } 4726 4727 if (inst.componentDidMount) { 4728 if ("development" !== 'production') { 4729 transaction.getReactMountReady().enqueue(function () { 4730 measureLifeCyclePerf(function () { 4731 return inst.componentDidMount(); 4732 }, _this._debugID, 'componentDidMount'); 4733 }); 4734 } else { 4735 transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); 4736 } 4737 } 4738 4739 return markup; 4740 }, 4741 4742 _constructComponent: function (doConstruct, publicProps, publicContext, updateQueue) { 4743 if ("development" !== 'production') { 4744 ReactCurrentOwner.current = this; 4745 try { 4746 return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue); 4747 } finally { 4748 ReactCurrentOwner.current = null; 4749 } 4750 } else { 4751 return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue); 4752 } 4753 }, 4754 4755 _constructComponentWithoutOwner: function (doConstruct, publicProps, publicContext, updateQueue) { 4756 var Component = this._currentElement.type; 4757 4758 if (doConstruct) { 4759 if ("development" !== 'production') { 4760 return measureLifeCyclePerf(function () { 4761 return new Component(publicProps, publicContext, updateQueue); 4762 }, this._debugID, 'ctor'); 4763 } else { 4764 return new Component(publicProps, publicContext, updateQueue); 4765 } 4766 } 4767 4768 // This can still be an instance in case of factory components 4769 // but we'll count this as time spent rendering as the more common case. 4770 if ("development" !== 'production') { 4771 return measureLifeCyclePerf(function () { 4772 return Component(publicProps, publicContext, updateQueue); 4773 }, this._debugID, 'render'); 4774 } else { 4775 return Component(publicProps, publicContext, updateQueue); 4776 } 4777 }, 4778 4779 performInitialMountWithErrorHandling: function (renderedElement, hostParent, hostContainerInfo, transaction, context) { 4780 var markup; 4781 var checkpoint = transaction.checkpoint(); 4782 try { 4783 markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); 4784 } catch (e) { 4785 // Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint 4786 transaction.rollback(checkpoint); 4787 this._instance.unstable_handleError(e); 4788 if (this._pendingStateQueue) { 4789 this._instance.state = this._processPendingState(this._instance.props, this._instance.context); 4790 } 4791 checkpoint = transaction.checkpoint(); 4792 4793 this._renderedComponent.unmountComponent(true); 4794 transaction.rollback(checkpoint); 4795 4796 // Try again - we've informed the component about the error, so they can render an error message this time. 4797 // If this throws again, the error will bubble up (and can be caught by a higher error boundary). 4798 markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); 4799 } 4800 return markup; 4801 }, 4802 4803 performInitialMount: function (renderedElement, hostParent, hostContainerInfo, transaction, context) { 4804 var inst = this._instance; 4805 4806 var debugID = 0; 4807 if ("development" !== 'production') { 4808 debugID = this._debugID; 4809 } 4810 4811 if (inst.componentWillMount) { 4812 if ("development" !== 'production') { 4813 measureLifeCyclePerf(function () { 4814 return inst.componentWillMount(); 4815 }, debugID, 'componentWillMount'); 4816 } else { 4817 inst.componentWillMount(); 4818 } 4819 // When mounting, calls to `setState` by `componentWillMount` will set 4820 // `this._pendingStateQueue` without triggering a re-render. 4821 if (this._pendingStateQueue) { 4822 inst.state = this._processPendingState(inst.props, inst.context); 4823 } 4824 } 4825 4826 // If not a stateless component, we now render 4827 if (renderedElement === undefined) { 4828 renderedElement = this._renderValidatedComponent(); 4829 } 4830 4831 var nodeType = ReactNodeTypes.getType(renderedElement); 4832 this._renderedNodeType = nodeType; 4833 var child = this._instantiateReactComponent(renderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */ 4834 ); 4835 this._renderedComponent = child; 4836 4837 var markup = ReactReconciler.mountComponent(child, transaction, hostParent, hostContainerInfo, this._processChildContext(context), debugID); 4838 4839 if ("development" !== 'production') { 4840 if (debugID !== 0) { 4841 var childDebugIDs = child._debugID !== 0 ? [child._debugID] : []; 4842 ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs); 4843 } 4844 } 4845 4846 return markup; 4847 }, 4848 4849 getHostNode: function () { 4850 return ReactReconciler.getHostNode(this._renderedComponent); 4851 }, 4852 4853 /** 4854 * Releases any resources allocated by `mountComponent`. 4855 * 4856 * @final 4857 * @internal 4858 */ 4859 unmountComponent: function (safely) { 4860 if (!this._renderedComponent) { 4861 return; 4862 } 4863 4864 var inst = this._instance; 4865 4866 if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) { 4867 inst._calledComponentWillUnmount = true; 4868 4869 if (safely) { 4870 var name = this.getName() + '.componentWillUnmount()'; 4871 ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst)); 4872 } else { 4873 if ("development" !== 'production') { 4874 measureLifeCyclePerf(function () { 4875 return inst.componentWillUnmount(); 4876 }, this._debugID, 'componentWillUnmount'); 4877 } else { 4878 inst.componentWillUnmount(); 4879 } 4880 } 4881 } 4882 4883 if (this._renderedComponent) { 4884 ReactReconciler.unmountComponent(this._renderedComponent, safely); 4885 this._renderedNodeType = null; 4886 this._renderedComponent = null; 4887 this._instance = null; 4888 } 4889 4890 // Reset pending fields 4891 // Even if this component is scheduled for another update in ReactUpdates, 4892 // it would still be ignored because these fields are reset. 4893 this._pendingStateQueue = null; 4894 this._pendingReplaceState = false; 4895 this._pendingForceUpdate = false; 4896 this._pendingCallbacks = null; 4897 this._pendingElement = null; 4898 4899 // These fields do not really need to be reset since this object is no 4900 // longer accessible. 4901 this._context = null; 4902 this._rootNodeID = 0; 4903 this._topLevelWrapper = null; 4904 4905 // Delete the reference from the instance to this internal representation 4906 // which allow the internals to be properly cleaned up even if the user 4907 // leaks a reference to the public instance. 4908 ReactInstanceMap.remove(inst); 4909 4910 // Some existing components rely on inst.props even after they've been 4911 // destroyed (in event handlers). 4912 // TODO: inst.props = null; 4913 // TODO: inst.state = null; 4914 // TODO: inst.context = null; 4915 }, 4916 4917 /** 4918 * Filters the context object to only contain keys specified in 4919 * `contextTypes` 4920 * 4921 * @param {object} context 4922 * @return {?object} 4923 * @private 4924 */ 4925 _maskContext: function (context) { 4926 var Component = this._currentElement.type; 4927 var contextTypes = Component.contextTypes; 4928 if (!contextTypes) { 4929 return emptyObject; 4930 } 4931 var maskedContext = {}; 4932 for (var contextName in contextTypes) { 4933 maskedContext[contextName] = context[contextName]; 4934 } 4935 return maskedContext; 4936 }, 4937 4938 /** 4939 * Filters the context object to only contain keys specified in 4940 * `contextTypes`, and asserts that they are valid. 4941 * 4942 * @param {object} context 4943 * @return {?object} 4944 * @private 4945 */ 4946 _processContext: function (context) { 4947 var maskedContext = this._maskContext(context); 4948 if ("development" !== 'production') { 4949 var Component = this._currentElement.type; 4950 if (Component.contextTypes) { 4951 this._checkContextTypes(Component.contextTypes, maskedContext, 'context'); 4952 } 4953 } 4954 return maskedContext; 4955 }, 4956 4957 /** 4958 * @param {object} currentContext 4959 * @return {object} 4960 * @private 4961 */ 4962 _processChildContext: function (currentContext) { 4963 var Component = this._currentElement.type; 4964 var inst = this._instance; 4965 var childContext; 4966 4967 if (inst.getChildContext) { 4968 if ("development" !== 'production') { 4969 ReactInstrumentation.debugTool.onBeginProcessingChildContext(); 4970 try { 4971 childContext = inst.getChildContext(); 4972 } finally { 4973 ReactInstrumentation.debugTool.onEndProcessingChildContext(); 4974 } 4975 } else { 4976 childContext = inst.getChildContext(); 4977 } 4978 } 4979 4980 if (childContext) { 4981 !(typeof Component.childContextTypes === 'object') ? "development" !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().', this.getName() || 'ReactCompositeComponent') : _prodInvariant('107', this.getName() || 'ReactCompositeComponent') : void 0; 4982 if ("development" !== 'production') { 4983 this._checkContextTypes(Component.childContextTypes, childContext, 'childContext'); 4984 } 4985 for (var name in childContext) { 4986 !(name in Component.childContextTypes) ? "development" !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : _prodInvariant('108', this.getName() || 'ReactCompositeComponent', name) : void 0; 4987 } 4988 return _assign({}, currentContext, childContext); 4989 } 4990 return currentContext; 4991 }, 4992 4993 /** 4994 * Assert that the context types are valid 4995 * 4996 * @param {object} typeSpecs Map of context field to a ReactPropType 4997 * @param {object} values Runtime values that need to be type-checked 4998 * @param {string} location e.g. "prop", "context", "child context" 4999 * @private 5000 */ 5001 _checkContextTypes: function (typeSpecs, values, location) { 5002 if ("development" !== 'production') { 5003 checkReactTypeSpec(typeSpecs, values, location, this.getName(), null, this._debugID); 5004 } 5005 }, 5006 5007 receiveComponent: function (nextElement, transaction, nextContext) { 5008 var prevElement = this._currentElement; 5009 var prevContext = this._context; 5010 5011 this._pendingElement = null; 5012 5013 this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext); 5014 }, 5015 5016 /** 5017 * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate` 5018 * is set, update the component. 5019 * 5020 * @param {ReactReconcileTransaction} transaction 5021 * @internal 5022 */ 5023 performUpdateIfNecessary: function (transaction) { 5024 if (this._pendingElement != null) { 5025 ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context); 5026 } else if (this._pendingStateQueue !== null || this._pendingForceUpdate) { 5027 this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context); 5028 } else { 5029 this._updateBatchNumber = null; 5030 } 5031 }, 5032 5033 /** 5034 * Perform an update to a mounted component. The componentWillReceiveProps and 5035 * shouldComponentUpdate methods are called, then (assuming the update isn't 5036 * skipped) the remaining update lifecycle methods are called and the DOM 5037 * representation is updated. 5038 * 5039 * By default, this implements React's rendering and reconciliation algorithm. 5040 * Sophisticated clients may wish to override this. 5041 * 5042 * @param {ReactReconcileTransaction} transaction 5043 * @param {ReactElement} prevParentElement 5044 * @param {ReactElement} nextParentElement 5045 * @internal 5046 * @overridable 5047 */ 5048 updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) { 5049 var inst = this._instance; 5050 !(inst != null) ? "development" !== 'production' ? invariant(false, 'Attempted to update component `%s` that has already been unmounted (or failed to mount).', this.getName() || 'ReactCompositeComponent') : _prodInvariant('136', this.getName() || 'ReactCompositeComponent') : void 0; 5051 5052 var willReceive = false; 5053 var nextContext; 5054 5055 // Determine if the context has changed or not 5056 if (this._context === nextUnmaskedContext) { 5057 nextContext = inst.context; 5058 } else { 5059 nextContext = this._processContext(nextUnmaskedContext); 5060 willReceive = true; 5061 } 5062 5063 var prevProps = prevParentElement.props; 5064 var nextProps = nextParentElement.props; 5065 5066 // Not a simple state update but a props update 5067 if (prevParentElement !== nextParentElement) { 5068 willReceive = true; 5069 } 5070 5071 // An update here will schedule an update but immediately set 5072 // _pendingStateQueue which will ensure that any state updates gets 5073 // immediately reconciled instead of waiting for the next batch. 5074 if (willReceive && inst.componentWillReceiveProps) { 5075 if ("development" !== 'production') { 5076 measureLifeCyclePerf(function () { 5077 return inst.componentWillReceiveProps(nextProps, nextContext); 5078 }, this._debugID, 'componentWillReceiveProps'); 5079 } else { 5080 inst.componentWillReceiveProps(nextProps, nextContext); 5081 } 5082 } 5083 5084 var nextState = this._processPendingState(nextProps, nextContext); 5085 var shouldUpdate = true; 5086 5087 if (!this._pendingForceUpdate) { 5088 if (inst.shouldComponentUpdate) { 5089 if ("development" !== 'production') { 5090 shouldUpdate = measureLifeCyclePerf(function () { 5091 return inst.shouldComponentUpdate(nextProps, nextState, nextContext); 5092 }, this._debugID, 'shouldComponentUpdate'); 5093 } else { 5094 shouldUpdate = inst.shouldComponentUpdate(nextProps, nextState, nextContext); 5095 } 5096 } else { 5097 if (this._compositeType === CompositeTypes.PureClass) { 5098 shouldUpdate = !shallowEqual(prevProps, nextProps) || !shallowEqual(inst.state, nextState); 5099 } 5100 } 5101 } 5102 5103 if ("development" !== 'production') { 5104 "development" !== 'production' ? warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : void 0; 5105 } 5106 5107 this._updateBatchNumber = null; 5108 if (shouldUpdate) { 5109 this._pendingForceUpdate = false; 5110 // Will set `this.props`, `this.state` and `this.context`. 5111 this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext); 5112 } else { 5113 // If it's determined that a component should not update, we still want 5114 // to set props and state but we shortcut the rest of the update. 5115 this._currentElement = nextParentElement; 5116 this._context = nextUnmaskedContext; 5117 inst.props = nextProps; 5118 inst.state = nextState; 5119 inst.context = nextContext; 5120 } 5121 }, 5122 5123 _processPendingState: function (props, context) { 5124 var inst = this._instance; 5125 var queue = this._pendingStateQueue; 5126 var replace = this._pendingReplaceState; 5127 this._pendingReplaceState = false; 5128 this._pendingStateQueue = null; 5129 5130 if (!queue) { 5131 return inst.state; 5132 } 5133 5134 if (replace && queue.length === 1) { 5135 return queue[0]; 5136 } 5137 5138 var nextState = _assign({}, replace ? queue[0] : inst.state); 5139 for (var i = replace ? 1 : 0; i < queue.length; i++) { 5140 var partial = queue[i]; 5141 _assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial); 5142 } 5143 5144 return nextState; 5145 }, 5146 5147 /** 5148 * Merges new props and state, notifies delegate methods of update and 5149 * performs update. 5150 * 5151 * @param {ReactElement} nextElement Next element 5152 * @param {object} nextProps Next public object to set as properties. 5153 * @param {?object} nextState Next object to set as state. 5154 * @param {?object} nextContext Next public object to set as context. 5155 * @param {ReactReconcileTransaction} transaction 5156 * @param {?object} unmaskedContext 5157 * @private 5158 */ 5159 _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) { 5160 var _this2 = this; 5161 5162 var inst = this._instance; 5163 5164 var hasComponentDidUpdate = Boolean(inst.componentDidUpdate); 5165 var prevProps; 5166 var prevState; 5167 var prevContext; 5168 if (hasComponentDidUpdate) { 5169 prevProps = inst.props; 5170 prevState = inst.state; 5171 prevContext = inst.context; 5172 } 5173 5174 if (inst.componentWillUpdate) { 5175 if ("development" !== 'production') { 5176 measureLifeCyclePerf(function () { 5177 return inst.componentWillUpdate(nextProps, nextState, nextContext); 5178 }, this._debugID, 'componentWillUpdate'); 5179 } else { 5180 inst.componentWillUpdate(nextProps, nextState, nextContext); 5181 } 5182 } 5183 5184 this._currentElement = nextElement; 5185 this._context = unmaskedContext; 5186 inst.props = nextProps; 5187 inst.state = nextState; 5188 inst.context = nextContext; 5189 5190 this._updateRenderedComponent(transaction, unmaskedContext); 5191 5192 if (hasComponentDidUpdate) { 5193 if ("development" !== 'production') { 5194 transaction.getReactMountReady().enqueue(function () { 5195 measureLifeCyclePerf(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), _this2._debugID, 'componentDidUpdate'); 5196 }); 5197 } else { 5198 transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst); 5199 } 5200 } 5201 }, 5202 5203 /** 5204 * Call the component's `render` method and update the DOM accordingly. 5205 * 5206 * @param {ReactReconcileTransaction} transaction 5207 * @internal 5208 */ 5209 _updateRenderedComponent: function (transaction, context) { 5210 var prevComponentInstance = this._renderedComponent; 5211 var prevRenderedElement = prevComponentInstance._currentElement; 5212 var nextRenderedElement = this._renderValidatedComponent(); 5213 5214 var debugID = 0; 5215 if ("development" !== 'production') { 5216 debugID = this._debugID; 5217 } 5218 5219 if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) { 5220 ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context)); 5221 } else { 5222 var oldHostNode = ReactReconciler.getHostNode(prevComponentInstance); 5223 ReactReconciler.unmountComponent(prevComponentInstance, false); 5224 5225 var nodeType = ReactNodeTypes.getType(nextRenderedElement); 5226 this._renderedNodeType = nodeType; 5227 var child = this._instantiateReactComponent(nextRenderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */ 5228 ); 5229 this._renderedComponent = child; 5230 5231 var nextMarkup = ReactReconciler.mountComponent(child, transaction, this._hostParent, this._hostContainerInfo, this._processChildContext(context), debugID); 5232 5233 if ("development" !== 'production') { 5234 if (debugID !== 0) { 5235 var childDebugIDs = child._debugID !== 0 ? [child._debugID] : []; 5236 ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs); 5237 } 5238 } 5239 5240 this._replaceNodeWithMarkup(oldHostNode, nextMarkup, prevComponentInstance); 5241 } 5242 }, 5243 5244 /** 5245 * Overridden in shallow rendering. 5246 * 5247 * @protected 5248 */ 5249 _replaceNodeWithMarkup: function (oldHostNode, nextMarkup, prevInstance) { 5250 ReactComponentEnvironment.replaceNodeWithMarkup(oldHostNode, nextMarkup, prevInstance); 5251 }, 5252 5253 /** 5254 * @protected 5255 */ 5256 _renderValidatedComponentWithoutOwnerOrContext: function () { 5257 var inst = this._instance; 5258 var renderedElement; 5259 5260 if ("development" !== 'production') { 5261 renderedElement = measureLifeCyclePerf(function () { 5262 return inst.render(); 5263 }, this._debugID, 'render'); 5264 } else { 5265 renderedElement = inst.render(); 5266 } 5267 5268 if ("development" !== 'production') { 5269 // We allow auto-mocks to proceed as if they're returning null. 5270 if (renderedElement === undefined && inst.render._isMockFunction) { 5271 // This is probably bad practice. Consider warning here and 5272 // deprecating this convenience. 5273 renderedElement = null; 5274 } 5275 } 5276 5277 return renderedElement; 5278 }, 5279 5280 /** 5281 * @private 5282 */ 5283 _renderValidatedComponent: function () { 5284 var renderedElement; 5285 if ("development" !== 'production' || this._compositeType !== CompositeTypes.StatelessFunctional) { 5286 ReactCurrentOwner.current = this; 5287 try { 5288 renderedElement = this._renderValidatedComponentWithoutOwnerOrContext(); 5289 } finally { 5290 ReactCurrentOwner.current = null; 5291 } 5292 } else { 5293 renderedElement = this._renderValidatedComponentWithoutOwnerOrContext(); 5294 } 5295 !( 5296 // TODO: An `isValidNode` function would probably be more appropriate 5297 renderedElement === null || renderedElement === false || React.isValidElement(renderedElement)) ? "development" !== 'production' ? invariant(false, '%s.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : _prodInvariant('109', this.getName() || 'ReactCompositeComponent') : void 0; 5298 5299 return renderedElement; 5300 }, 5301 5302 /** 5303 * Lazily allocates the refs object and stores `component` as `ref`. 5304 * 5305 * @param {string} ref Reference name. 5306 * @param {component} component Component to store as `ref`. 5307 * @final 5308 * @private 5309 */ 5310 attachRef: function (ref, component) { 5311 var inst = this.getPublicInstance(); 5312 !(inst != null) ? "development" !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : _prodInvariant('110') : void 0; 5313 var publicComponentInstance = component.getPublicInstance(); 5314 if ("development" !== 'production') { 5315 var componentName = component && component.getName ? component.getName() : 'a component'; 5316 "development" !== 'production' ? warning(publicComponentInstance != null || component._compositeType !== CompositeTypes.StatelessFunctional, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : void 0; 5317 } 5318 var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs; 5319 refs[ref] = publicComponentInstance; 5320 }, 5321 5322 /** 5323 * Detaches a reference name. 5324 * 5325 * @param {string} ref Name to dereference. 5326 * @final 5327 * @private 5328 */ 5329 detachRef: function (ref) { 5330 var refs = this.getPublicInstance().refs; 5331 delete refs[ref]; 5332 }, 5333 5334 /** 5335 * Get a text description of the component that can be used to identify it 5336 * in error messages. 5337 * @return {string} The name or null. 5338 * @internal 5339 */ 5340 getName: function () { 5341 var type = this._currentElement.type; 5342 var constructor = this._instance && this._instance.constructor; 5343 return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null; 5344 }, 5345 5346 /** 5347 * Get the publicly accessible representation of this component - i.e. what 5348 * is exposed by refs and returned by render. Can be null for stateless 5349 * components. 5350 * 5351 * @return {ReactComponent} the public component instance. 5352 * @internal 5353 */ 5354 getPublicInstance: function () { 5355 var inst = this._instance; 5356 if (this._compositeType === CompositeTypes.StatelessFunctional) { 5357 return null; 5358 } 5359 return inst; 5360 }, 5361 5362 // Stub 5363 _instantiateReactComponent: null 5364 5365 }; 5366 5367 module.exports = ReactCompositeComponent; 5368 },{"104":104,"125":125,"129":129,"133":133,"134":134,"143":143,"150":150,"156":156,"157":157,"158":158,"29":29,"55":55,"63":63,"64":64,"69":69,"75":75}],31:[function(_dereq_,module,exports){ 5369 /** 5370 * Copyright 2013-present, Facebook, Inc. 5371 * All rights reserved. 5372 * 5373 * This source code is licensed under the BSD-style license found in the 5374 * LICENSE file in the root directory of this source tree. An additional grant 5375 * of patent rights can be found in the PATENTS file in the same directory. 5376 * 5377 */ 5378 5379 /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ 5380 5381 'use strict'; 5382 5383 var ReactDOMComponentTree = _dereq_(34); 5384 var ReactDefaultInjection = _dereq_(52); 5385 var ReactMount = _dereq_(67); 5386 var ReactReconciler = _dereq_(75); 5387 var ReactUpdates = _dereq_(82); 5388 var ReactVersion = _dereq_(83); 5389 5390 var findDOMNode = _dereq_(108); 5391 var getHostComponentFromComposite = _dereq_(115); 5392 var renderSubtreeIntoContainer = _dereq_(126); 5393 var warning = _dereq_(157); 5394 5395 ReactDefaultInjection.inject(); 5396 5397 var ReactDOM = { 5398 findDOMNode: findDOMNode, 5399 render: ReactMount.render, 5400 unmountComponentAtNode: ReactMount.unmountComponentAtNode, 5401 version: ReactVersion, 5402 5403 /* eslint-disable camelcase */ 5404 unstable_batchedUpdates: ReactUpdates.batchedUpdates, 5405 unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer 5406 }; 5407 5408 // Inject the runtime into a devtools global hook regardless of browser. 5409 // Allows for debugging when the hook is injected on the page. 5410 if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') { 5411 __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ 5412 ComponentTree: { 5413 getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode, 5414 getNodeFromInstance: function (inst) { 5415 // inst is an internal instance (but could be a composite) 5416 if (inst._renderedComponent) { 5417 inst = getHostComponentFromComposite(inst); 5418 } 5419 if (inst) { 5420 return ReactDOMComponentTree.getNodeFromInstance(inst); 5421 } else { 5422 return null; 5423 } 5424 } 5425 }, 5426 Mount: ReactMount, 5427 Reconciler: ReactReconciler 5428 }); 5429 } 5430 5431 if ("development" !== 'production') { 5432 var ExecutionEnvironment = _dereq_(136); 5433 if (ExecutionEnvironment.canUseDOM && window.top === window.self) { 5434 5435 // First check if devtools is not installed 5436 if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { 5437 // If we're in Chrome or Firefox, provide a download link if not installed. 5438 if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) { 5439 // Firefox does not have the issue with devtools loaded over file:// 5440 var showFileUrlMessage = window.location.protocol.indexOf('http') === -1 && navigator.userAgent.indexOf('Firefox') === -1; 5441 console.debug('Download the React DevTools ' + (showFileUrlMessage ? 'and use an HTTP server (instead of a file: URL) ' : '') + 'for a better development experience: ' + 'https://fb.me/react-devtools'); 5442 } 5443 } 5444 5445 var testFunc = function testFn() {}; 5446 "development" !== 'production' ? warning((testFunc.name || testFunc.toString()).indexOf('testFn') !== -1, 'It looks like you\'re using a minified copy of the development build ' + 'of React. When deploying React apps to production, make sure to use ' + 'the production build which skips development warnings and is faster. ' + 'See https://fb.me/react-minification for more details.') : void 0; 5447 5448 // If we're in IE8, check to see if we are in compatibility mode and provide 5449 // information on preventing compatibility mode 5450 var ieCompatibilityMode = document.documentMode && document.documentMode < 8; 5451 5452 "development" !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : void 0; 5453 5454 var expectedFeatures = [ 5455 // shims 5456 Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.trim]; 5457 5458 for (var i = 0; i < expectedFeatures.length; i++) { 5459 if (!expectedFeatures[i]) { 5460 "development" !== 'production' ? warning(false, 'One or more ES5 shims expected by React are not available: ' + 'https://fb.me/react-warning-polyfills') : void 0; 5461 break; 5462 } 5463 } 5464 } 5465 } 5466 5467 if ("development" !== 'production') { 5468 var ReactInstrumentation = _dereq_(64); 5469 var ReactDOMUnknownPropertyHook = _dereq_(49); 5470 var ReactDOMNullInputValuePropHook = _dereq_(41); 5471 var ReactDOMInvalidARIAHook = _dereq_(40); 5472 5473 ReactInstrumentation.debugTool.addHook(ReactDOMUnknownPropertyHook); 5474 ReactInstrumentation.debugTool.addHook(ReactDOMNullInputValuePropHook); 5475 ReactInstrumentation.debugTool.addHook(ReactDOMInvalidARIAHook); 5476 } 5477 5478 module.exports = ReactDOM; 5479 },{"108":108,"115":115,"126":126,"136":136,"157":157,"34":34,"40":40,"41":41,"49":49,"52":52,"64":64,"67":67,"75":75,"82":82,"83":83}],32:[function(_dereq_,module,exports){ 5480 /** 5481 * Copyright 2013-present, Facebook, Inc. 5482 * All rights reserved. 5483 * 5484 * This source code is licensed under the BSD-style license found in the 5485 * LICENSE file in the root directory of this source tree. An additional grant 5486 * of patent rights can be found in the PATENTS file in the same directory. 5487 * 5488 */ 5489 5490 /* global hasOwnProperty:true */ 5491 5492 'use strict'; 5493 5494 var _prodInvariant = _dereq_(125), 5495 _assign = _dereq_(158); 5496 5497 var AutoFocusUtils = _dereq_(2); 5498 var CSSPropertyOperations = _dereq_(5); 5499 var DOMLazyTree = _dereq_(9); 5500 var DOMNamespaces = _dereq_(10); 5501 var DOMProperty = _dereq_(11); 5502 var DOMPropertyOperations = _dereq_(12); 5503 var EventPluginHub = _dereq_(17); 5504 var EventPluginRegistry = _dereq_(18); 5505 var ReactBrowserEventEmitter = _dereq_(26); 5506 var ReactDOMComponentFlags = _dereq_(33); 5507 var ReactDOMComponentTree = _dereq_(34); 5508 var ReactDOMInput = _dereq_(39); 5509 var ReactDOMOption = _dereq_(42); 5510 var ReactDOMSelect = _dereq_(43); 5511 var ReactDOMTextarea = _dereq_(46); 5512 var ReactInstrumentation = _dereq_(64); 5513 var ReactMultiChild = _dereq_(68); 5514 var ReactServerRenderingTransaction = _dereq_(77); 5515 5516 var emptyFunction = _dereq_(142); 5517 var escapeTextContentForBrowser = _dereq_(107); 5518 var invariant = _dereq_(150); 5519 var isEventSupported = _dereq_(122); 5520 var shallowEqual = _dereq_(156); 5521 var validateDOMNesting = _dereq_(131); 5522 var warning = _dereq_(157); 5523 5524 var Flags = ReactDOMComponentFlags; 5525 var deleteListener = EventPluginHub.deleteListener; 5526 var getNode = ReactDOMComponentTree.getNodeFromInstance; 5527 var listenTo = ReactBrowserEventEmitter.listenTo; 5528 var registrationNameModules = EventPluginRegistry.registrationNameModules; 5529 5530 // For quickly matching children type, to test if can be treated as content. 5531 var CONTENT_TYPES = { 'string': true, 'number': true }; 5532 5533 var STYLE = 'style'; 5534 var HTML = '__html'; 5535 var RESERVED_PROPS = { 5536 children: null, 5537 dangerouslySetInnerHTML: null, 5538 suppressContentEditableWarning: null 5539 }; 5540 5541 // Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE). 5542 var DOC_FRAGMENT_TYPE = 11; 5543 5544 function getDeclarationErrorAddendum(internalInstance) { 5545 if (internalInstance) { 5546 var owner = internalInstance._currentElement._owner || null; 5547 if (owner) { 5548 var name = owner.getName(); 5549 if (name) { 5550 return ' This DOM node was rendered by `' + name + '`.'; 5551 } 5552 } 5553 } 5554 return ''; 5555 } 5556 5557 function friendlyStringify(obj) { 5558 if (typeof obj === 'object') { 5559 if (Array.isArray(obj)) { 5560 return '[' + obj.map(friendlyStringify).join(', ') + ']'; 5561 } else { 5562 var pairs = []; 5563 for (var key in obj) { 5564 if (Object.prototype.hasOwnProperty.call(obj, key)) { 5565 var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key); 5566 pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key])); 5567 } 5568 } 5569 return '{' + pairs.join(', ') + '}'; 5570 } 5571 } else if (typeof obj === 'string') { 5572 return JSON.stringify(obj); 5573 } else if (typeof obj === 'function') { 5574 return '[function object]'; 5575 } 5576 // Differs from JSON.stringify in that undefined because undefined and that 5577 // inf and nan don't become null 5578 return String(obj); 5579 } 5580 5581 var styleMutationWarning = {}; 5582 5583 function checkAndWarnForMutatedStyle(style1, style2, component) { 5584 if (style1 == null || style2 == null) { 5585 return; 5586 } 5587 if (shallowEqual(style1, style2)) { 5588 return; 5589 } 5590 5591 var componentName = component._tag; 5592 var owner = component._currentElement._owner; 5593 var ownerName; 5594 if (owner) { 5595 ownerName = owner.getName(); 5596 } 5597 5598 var hash = ownerName + '|' + componentName; 5599 5600 if (styleMutationWarning.hasOwnProperty(hash)) { 5601 return; 5602 } 5603 5604 styleMutationWarning[hash] = true; 5605 5606 "development" !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : void 0; 5607 } 5608 5609 /** 5610 * @param {object} component 5611 * @param {?object} props 5612 */ 5613 function assertValidProps(component, props) { 5614 if (!props) { 5615 return; 5616 } 5617 // Note the use of `==` which checks for null or undefined. 5618 if (voidElementTags[component._tag]) { 5619 !(props.children == null && props.dangerouslySetInnerHTML == null) ? "development" !== 'production' ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : _prodInvariant('137', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : void 0; 5620 } 5621 if (props.dangerouslySetInnerHTML != null) { 5622 !(props.children == null) ? "development" !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : _prodInvariant('60') : void 0; 5623 !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? "development" !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : _prodInvariant('61') : void 0; 5624 } 5625 if ("development" !== 'production') { 5626 "development" !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : void 0; 5627 "development" !== 'production' ? warning(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0; 5628 "development" !== 'production' ? warning(props.onFocusIn == null && props.onFocusOut == null, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.') : void 0; 5629 } 5630 !(props.style == null || typeof props.style === 'object') ? "development" !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getDeclarationErrorAddendum(component)) : _prodInvariant('62', getDeclarationErrorAddendum(component)) : void 0; 5631 } 5632 5633 function enqueuePutListener(inst, registrationName, listener, transaction) { 5634 if (transaction instanceof ReactServerRenderingTransaction) { 5635 return; 5636 } 5637 if ("development" !== 'production') { 5638 // IE8 has no API for event capturing and the `onScroll` event doesn't 5639 // bubble. 5640 "development" !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : void 0; 5641 } 5642 var containerInfo = inst._hostContainerInfo; 5643 var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE; 5644 var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument; 5645 listenTo(registrationName, doc); 5646 transaction.getReactMountReady().enqueue(putListener, { 5647 inst: inst, 5648 registrationName: registrationName, 5649 listener: listener 5650 }); 5651 } 5652 5653 function putListener() { 5654 var listenerToPut = this; 5655 EventPluginHub.putListener(listenerToPut.inst, listenerToPut.registrationName, listenerToPut.listener); 5656 } 5657 5658 function inputPostMount() { 5659 var inst = this; 5660 ReactDOMInput.postMountWrapper(inst); 5661 } 5662 5663 function textareaPostMount() { 5664 var inst = this; 5665 ReactDOMTextarea.postMountWrapper(inst); 5666 } 5667 5668 function optionPostMount() { 5669 var inst = this; 5670 ReactDOMOption.postMountWrapper(inst); 5671 } 5672 5673 var setAndValidateContentChildDev = emptyFunction; 5674 if ("development" !== 'production') { 5675 setAndValidateContentChildDev = function (content) { 5676 var hasExistingContent = this._contentDebugID != null; 5677 var debugID = this._debugID; 5678 // This ID represents the inlined child that has no backing instance: 5679 var contentDebugID = -debugID; 5680 5681 if (content == null) { 5682 if (hasExistingContent) { 5683 ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID); 5684 } 5685 this._contentDebugID = null; 5686 return; 5687 } 5688 5689 validateDOMNesting(null, String(content), this, this._ancestorInfo); 5690 this._contentDebugID = contentDebugID; 5691 if (hasExistingContent) { 5692 ReactInstrumentation.debugTool.onBeforeUpdateComponent(contentDebugID, content); 5693 ReactInstrumentation.debugTool.onUpdateComponent(contentDebugID); 5694 } else { 5695 ReactInstrumentation.debugTool.onBeforeMountComponent(contentDebugID, content, debugID); 5696 ReactInstrumentation.debugTool.onMountComponent(contentDebugID); 5697 ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]); 5698 } 5699 }; 5700 } 5701 5702 // There are so many media events, it makes sense to just 5703 // maintain a list rather than create a `trapBubbledEvent` for each 5704 var mediaEvents = { 5705 topAbort: 'abort', 5706 topCanPlay: 'canplay', 5707 topCanPlayThrough: 'canplaythrough', 5708 topDurationChange: 'durationchange', 5709 topEmptied: 'emptied', 5710 topEncrypted: 'encrypted', 5711 topEnded: 'ended', 5712 topError: 'error', 5713 topLoadedData: 'loadeddata', 5714 topLoadedMetadata: 'loadedmetadata', 5715 topLoadStart: 'loadstart', 5716 topPause: 'pause', 5717 topPlay: 'play', 5718 topPlaying: 'playing', 5719 topProgress: 'progress', 5720 topRateChange: 'ratechange', 5721 topSeeked: 'seeked', 5722 topSeeking: 'seeking', 5723 topStalled: 'stalled', 5724 topSuspend: 'suspend', 5725 topTimeUpdate: 'timeupdate', 5726 topVolumeChange: 'volumechange', 5727 topWaiting: 'waiting' 5728 }; 5729 5730 function trapBubbledEventsLocal() { 5731 var inst = this; 5732 // If a component renders to null or if another component fatals and causes 5733 // the state of the tree to be corrupted, `node` here can be null. 5734 !inst._rootNodeID ? "development" !== 'production' ? invariant(false, 'Must be mounted to trap events') : _prodInvariant('63') : void 0; 5735 var node = getNode(inst); 5736 !node ? "development" !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : _prodInvariant('64') : void 0; 5737 5738 switch (inst._tag) { 5739 case 'iframe': 5740 case 'object': 5741 inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)]; 5742 break; 5743 case 'video': 5744 case 'audio': 5745 5746 inst._wrapperState.listeners = []; 5747 // Create listener for each media event 5748 for (var event in mediaEvents) { 5749 if (mediaEvents.hasOwnProperty(event)) { 5750 inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(event, mediaEvents[event], node)); 5751 } 5752 } 5753 break; 5754 case 'source': 5755 inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node)]; 5756 break; 5757 case 'img': 5758 inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node), ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)]; 5759 break; 5760 case 'form': 5761 inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topReset', 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent('topSubmit', 'submit', node)]; 5762 break; 5763 case 'input': 5764 case 'select': 5765 case 'textarea': 5766 inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topInvalid', 'invalid', node)]; 5767 break; 5768 } 5769 } 5770 5771 function postUpdateSelectWrapper() { 5772 ReactDOMSelect.postUpdateWrapper(this); 5773 } 5774 5775 // For HTML, certain tags should omit their close tag. We keep a whitelist for 5776 // those special-case tags. 5777 5778 var omittedCloseTags = { 5779 'area': true, 5780 'base': true, 5781 'br': true, 5782 'col': true, 5783 'embed': true, 5784 'hr': true, 5785 'img': true, 5786 'input': true, 5787 'keygen': true, 5788 'link': true, 5789 'meta': true, 5790 'param': true, 5791 'source': true, 5792 'track': true, 5793 'wbr': true 5794 }; 5795 5796 var newlineEatingTags = { 5797 'listing': true, 5798 'pre': true, 5799 'textarea': true 5800 }; 5801 5802 // For HTML, certain tags cannot have children. This has the same purpose as 5803 // `omittedCloseTags` except that `menuitem` should still have its closing tag. 5804 5805 var voidElementTags = _assign({ 5806 'menuitem': true 5807 }, omittedCloseTags); 5808 5809 // We accept any tag to be rendered but since this gets injected into arbitrary 5810 // HTML, we want to make sure that it's a safe tag. 5811 // http://www.w3.org/TR/REC-xml/#NT-Name 5812 5813 var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset 5814 var validatedTagCache = {}; 5815 var hasOwnProperty = {}.hasOwnProperty; 5816 5817 function validateDangerousTag(tag) { 5818 if (!hasOwnProperty.call(validatedTagCache, tag)) { 5819 !VALID_TAG_REGEX.test(tag) ? "development" !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : _prodInvariant('65', tag) : void 0; 5820 validatedTagCache[tag] = true; 5821 } 5822 } 5823 5824 function isCustomComponent(tagName, props) { 5825 return tagName.indexOf('-') >= 0 || props.is != null; 5826 } 5827 5828 var globalIdCounter = 1; 5829 5830 /** 5831 * Creates a new React class that is idempotent and capable of containing other 5832 * React components. It accepts event listeners and DOM properties that are 5833 * valid according to `DOMProperty`. 5834 * 5835 * - Event listeners: `onClick`, `onMouseDown`, etc. 5836 * - DOM properties: `className`, `name`, `title`, etc. 5837 * 5838 * The `style` property functions differently from the DOM API. It accepts an 5839 * object mapping of style properties to values. 5840 * 5841 * @constructor ReactDOMComponent 5842 * @extends ReactMultiChild 5843 */ 5844 function ReactDOMComponent(element) { 5845 var tag = element.type; 5846 validateDangerousTag(tag); 5847 this._currentElement = element; 5848 this._tag = tag.toLowerCase(); 5849 this._namespaceURI = null; 5850 this._renderedChildren = null; 5851 this._previousStyle = null; 5852 this._previousStyleCopy = null; 5853 this._hostNode = null; 5854 this._hostParent = null; 5855 this._rootNodeID = 0; 5856 this._domID = 0; 5857 this._hostContainerInfo = null; 5858 this._wrapperState = null; 5859 this._topLevelWrapper = null; 5860 this._flags = 0; 5861 if ("development" !== 'production') { 5862 this._ancestorInfo = null; 5863 setAndValidateContentChildDev.call(this, null); 5864 } 5865 } 5866 5867 ReactDOMComponent.displayName = 'ReactDOMComponent'; 5868 5869 ReactDOMComponent.Mixin = { 5870 5871 /** 5872 * Generates root tag markup then recurses. This method has side effects and 5873 * is not idempotent. 5874 * 5875 * @internal 5876 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction 5877 * @param {?ReactDOMComponent} the parent component instance 5878 * @param {?object} info about the host container 5879 * @param {object} context 5880 * @return {string} The computed markup. 5881 */ 5882 mountComponent: function (transaction, hostParent, hostContainerInfo, context) { 5883 this._rootNodeID = globalIdCounter++; 5884 this._domID = hostContainerInfo._idCounter++; 5885 this._hostParent = hostParent; 5886 this._hostContainerInfo = hostContainerInfo; 5887 5888 var props = this._currentElement.props; 5889 5890 switch (this._tag) { 5891 case 'audio': 5892 case 'form': 5893 case 'iframe': 5894 case 'img': 5895 case 'link': 5896 case 'object': 5897 case 'source': 5898 case 'video': 5899 this._wrapperState = { 5900 listeners: null 5901 }; 5902 transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); 5903 break; 5904 case 'input': 5905 ReactDOMInput.mountWrapper(this, props, hostParent); 5906 props = ReactDOMInput.getHostProps(this, props); 5907 transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); 5908 break; 5909 case 'option': 5910 ReactDOMOption.mountWrapper(this, props, hostParent); 5911 props = ReactDOMOption.getHostProps(this, props); 5912 break; 5913 case 'select': 5914 ReactDOMSelect.mountWrapper(this, props, hostParent); 5915 props = ReactDOMSelect.getHostProps(this, props); 5916 transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); 5917 break; 5918 case 'textarea': 5919 ReactDOMTextarea.mountWrapper(this, props, hostParent); 5920 props = ReactDOMTextarea.getHostProps(this, props); 5921 transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); 5922 break; 5923 } 5924 5925 assertValidProps(this, props); 5926 5927 // We create tags in the namespace of their parent container, except HTML 5928 // tags get no namespace. 5929 var namespaceURI; 5930 var parentTag; 5931 if (hostParent != null) { 5932 namespaceURI = hostParent._namespaceURI; 5933 parentTag = hostParent._tag; 5934 } else if (hostContainerInfo._tag) { 5935 namespaceURI = hostContainerInfo._namespaceURI; 5936 parentTag = hostContainerInfo._tag; 5937 } 5938 if (namespaceURI == null || namespaceURI === DOMNamespaces.svg && parentTag === 'foreignobject') { 5939 namespaceURI = DOMNamespaces.html; 5940 } 5941 if (namespaceURI === DOMNamespaces.html) { 5942 if (this._tag === 'svg') { 5943 namespaceURI = DOMNamespaces.svg; 5944 } else if (this._tag === 'math') { 5945 namespaceURI = DOMNamespaces.mathml; 5946 } 5947 } 5948 this._namespaceURI = namespaceURI; 5949 5950 if ("development" !== 'production') { 5951 var parentInfo; 5952 if (hostParent != null) { 5953 parentInfo = hostParent._ancestorInfo; 5954 } else if (hostContainerInfo._tag) { 5955 parentInfo = hostContainerInfo._ancestorInfo; 5956 } 5957 if (parentInfo) { 5958 // parentInfo should always be present except for the top-level 5959 // component when server rendering 5960 validateDOMNesting(this._tag, null, this, parentInfo); 5961 } 5962 this._ancestorInfo = validateDOMNesting.updatedAncestorInfo(parentInfo, this._tag, this); 5963 } 5964 5965 var mountImage; 5966 if (transaction.useCreateElement) { 5967 var ownerDocument = hostContainerInfo._ownerDocument; 5968 var el; 5969 if (namespaceURI === DOMNamespaces.html) { 5970 if (this._tag === 'script') { 5971 // Create the script via .innerHTML so its "parser-inserted" flag is 5972 // set to true and it does not execute 5973 var div = ownerDocument.createElement('div'); 5974 var type = this._currentElement.type; 5975 div.innerHTML = '<' + type + '></' + type + '>'; 5976 el = div.removeChild(div.firstChild); 5977 } else if (props.is) { 5978 el = ownerDocument.createElement(this._currentElement.type, props.is); 5979 } else { 5980 // Separate else branch instead of using `props.is || undefined` above becuase of a Firefox bug. 5981 // See discussion in https://github.com/facebook/react/pull/6896 5982 // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240 5983 el = ownerDocument.createElement(this._currentElement.type); 5984 } 5985 } else { 5986 el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type); 5987 } 5988 ReactDOMComponentTree.precacheNode(this, el); 5989 this._flags |= Flags.hasCachedChildNodes; 5990 if (!this._hostParent) { 5991 DOMPropertyOperations.setAttributeForRoot(el); 5992 } 5993 this._updateDOMProperties(null, props, transaction); 5994 var lazyTree = DOMLazyTree(el); 5995 this._createInitialChildren(transaction, props, context, lazyTree); 5996 mountImage = lazyTree; 5997 } else { 5998 var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props); 5999 var tagContent = this._createContentMarkup(transaction, props, context); 6000 if (!tagContent && omittedCloseTags[this._tag]) { 6001 mountImage = tagOpen + '/>'; 6002 } else { 6003 mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>'; 6004 } 6005 } 6006 6007 switch (this._tag) { 6008 case 'input': 6009 transaction.getReactMountReady().enqueue(inputPostMount, this); 6010 if (props.autoFocus) { 6011 transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); 6012 } 6013 break; 6014 case 'textarea': 6015 transaction.getReactMountReady().enqueue(textareaPostMount, this); 6016 if (props.autoFocus) { 6017 transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); 6018 } 6019 break; 6020 case 'select': 6021 if (props.autoFocus) { 6022 transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); 6023 } 6024 break; 6025 case 'button': 6026 if (props.autoFocus) { 6027 transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); 6028 } 6029 break; 6030 case 'option': 6031 transaction.getReactMountReady().enqueue(optionPostMount, this); 6032 break; 6033 } 6034 6035 return mountImage; 6036 }, 6037 6038 /** 6039 * Creates markup for the open tag and all attributes. 6040 * 6041 * This method has side effects because events get registered. 6042 * 6043 * Iterating over object properties is faster than iterating over arrays. 6044 * @see http://jsperf.com/obj-vs-arr-iteration 6045 * 6046 * @private 6047 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction 6048 * @param {object} props 6049 * @return {string} Markup of opening tag. 6050 */ 6051 _createOpenTagMarkupAndPutListeners: function (transaction, props) { 6052 var ret = '<' + this._currentElement.type; 6053 6054 for (var propKey in props) { 6055 if (!props.hasOwnProperty(propKey)) { 6056 continue; 6057 } 6058 var propValue = props[propKey]; 6059 if (propValue == null) { 6060 continue; 6061 } 6062 if (registrationNameModules.hasOwnProperty(propKey)) { 6063 if (propValue) { 6064 enqueuePutListener(this, propKey, propValue, transaction); 6065 } 6066 } else { 6067 if (propKey === STYLE) { 6068 if (propValue) { 6069 if ("development" !== 'production') { 6070 // See `_updateDOMProperties`. style block 6071 this._previousStyle = propValue; 6072 } 6073 propValue = this._previousStyleCopy = _assign({}, props.style); 6074 } 6075 propValue = CSSPropertyOperations.createMarkupForStyles(propValue, this); 6076 } 6077 var markup = null; 6078 if (this._tag != null && isCustomComponent(this._tag, props)) { 6079 if (!RESERVED_PROPS.hasOwnProperty(propKey)) { 6080 markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue); 6081 } 6082 } else { 6083 markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue); 6084 } 6085 if (markup) { 6086 ret += ' ' + markup; 6087 } 6088 } 6089 } 6090 6091 // For static pages, no need to put React ID and checksum. Saves lots of 6092 // bytes. 6093 if (transaction.renderToStaticMarkup) { 6094 return ret; 6095 } 6096 6097 if (!this._hostParent) { 6098 ret += ' ' + DOMPropertyOperations.createMarkupForRoot(); 6099 } 6100 ret += ' ' + DOMPropertyOperations.createMarkupForID(this._domID); 6101 return ret; 6102 }, 6103 6104 /** 6105 * Creates markup for the content between the tags. 6106 * 6107 * @private 6108 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction 6109 * @param {object} props 6110 * @param {object} context 6111 * @return {string} Content markup. 6112 */ 6113 _createContentMarkup: function (transaction, props, context) { 6114 var ret = ''; 6115 6116 // Intentional use of != to avoid catching zero/false. 6117 var innerHTML = props.dangerouslySetInnerHTML; 6118 if (innerHTML != null) { 6119 if (innerHTML.__html != null) { 6120 ret = innerHTML.__html; 6121 } 6122 } else { 6123 var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null; 6124 var childrenToUse = contentToUse != null ? null : props.children; 6125 if (contentToUse != null) { 6126 // TODO: Validate that text is allowed as a child of this node 6127 ret = escapeTextContentForBrowser(contentToUse); 6128 if ("development" !== 'production') { 6129 setAndValidateContentChildDev.call(this, contentToUse); 6130 } 6131 } else if (childrenToUse != null) { 6132 var mountImages = this.mountChildren(childrenToUse, transaction, context); 6133 ret = mountImages.join(''); 6134 } 6135 } 6136 if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') { 6137 // text/html ignores the first character in these tags if it's a newline 6138 // Prefer to break application/xml over text/html (for now) by adding 6139 // a newline specifically to get eaten by the parser. (Alternately for 6140 // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first 6141 // \r is normalized out by HTMLTextAreaElement#value.) 6142 // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre> 6143 // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions> 6144 // See: <http://www.w3.org/TR/html5/syntax.html#newlines> 6145 // See: Parsing of "textarea" "listing" and "pre" elements 6146 // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody> 6147 return '\n' + ret; 6148 } else { 6149 return ret; 6150 } 6151 }, 6152 6153 _createInitialChildren: function (transaction, props, context, lazyTree) { 6154 // Intentional use of != to avoid catching zero/false. 6155 var innerHTML = props.dangerouslySetInnerHTML; 6156 if (innerHTML != null) { 6157 if (innerHTML.__html != null) { 6158 DOMLazyTree.queueHTML(lazyTree, innerHTML.__html); 6159 } 6160 } else { 6161 var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null; 6162 var childrenToUse = contentToUse != null ? null : props.children; 6163 if (contentToUse != null) { 6164 // TODO: Validate that text is allowed as a child of this node 6165 if ("development" !== 'production') { 6166 setAndValidateContentChildDev.call(this, contentToUse); 6167 } 6168 DOMLazyTree.queueText(lazyTree, contentToUse); 6169 } else if (childrenToUse != null) { 6170 var mountImages = this.mountChildren(childrenToUse, transaction, context); 6171 for (var i = 0; i < mountImages.length; i++) { 6172 DOMLazyTree.queueChild(lazyTree, mountImages[i]); 6173 } 6174 } 6175 } 6176 }, 6177 6178 /** 6179 * Receives a next element and updates the component. 6180 * 6181 * @internal 6182 * @param {ReactElement} nextElement 6183 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction 6184 * @param {object} context 6185 */ 6186 receiveComponent: function (nextElement, transaction, context) { 6187 var prevElement = this._currentElement; 6188 this._currentElement = nextElement; 6189 this.updateComponent(transaction, prevElement, nextElement, context); 6190 }, 6191 6192 /** 6193 * Updates a DOM component after it has already been allocated and 6194 * attached to the DOM. Reconciles the root DOM node, then recurses. 6195 * 6196 * @param {ReactReconcileTransaction} transaction 6197 * @param {ReactElement} prevElement 6198 * @param {ReactElement} nextElement 6199 * @internal 6200 * @overridable 6201 */ 6202 updateComponent: function (transaction, prevElement, nextElement, context) { 6203 var lastProps = prevElement.props; 6204 var nextProps = this._currentElement.props; 6205 6206 switch (this._tag) { 6207 case 'input': 6208 lastProps = ReactDOMInput.getHostProps(this, lastProps); 6209 nextProps = ReactDOMInput.getHostProps(this, nextProps); 6210 break; 6211 case 'option': 6212 lastProps = ReactDOMOption.getHostProps(this, lastProps); 6213 nextProps = ReactDOMOption.getHostProps(this, nextProps); 6214 break; 6215 case 'select': 6216 lastProps = ReactDOMSelect.getHostProps(this, lastProps); 6217 nextProps = ReactDOMSelect.getHostProps(this, nextProps); 6218 break; 6219 case 'textarea': 6220 lastProps = ReactDOMTextarea.getHostProps(this, lastProps); 6221 nextProps = ReactDOMTextarea.getHostProps(this, nextProps); 6222 break; 6223 } 6224 6225 assertValidProps(this, nextProps); 6226 this._updateDOMProperties(lastProps, nextProps, transaction); 6227 this._updateDOMChildren(lastProps, nextProps, transaction, context); 6228 6229 switch (this._tag) { 6230 case 'input': 6231 // Update the wrapper around inputs *after* updating props. This has to 6232 // happen after `_updateDOMProperties`. Otherwise HTML5 input validations 6233 // raise warnings and prevent the new value from being assigned. 6234 ReactDOMInput.updateWrapper(this); 6235 break; 6236 case 'textarea': 6237 ReactDOMTextarea.updateWrapper(this); 6238 break; 6239 case 'select': 6240 // <select> value update needs to occur after <option> children 6241 // reconciliation 6242 transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this); 6243 break; 6244 } 6245 }, 6246 6247 /** 6248 * Reconciles the properties by detecting differences in property values and 6249 * updating the DOM as necessary. This function is probably the single most 6250 * critical path for performance optimization. 6251 * 6252 * TODO: Benchmark whether checking for changed values in memory actually 6253 * improves performance (especially statically positioned elements). 6254 * TODO: Benchmark the effects of putting this at the top since 99% of props 6255 * do not change for a given reconciliation. 6256 * TODO: Benchmark areas that can be improved with caching. 6257 * 6258 * @private 6259 * @param {object} lastProps 6260 * @param {object} nextProps 6261 * @param {?DOMElement} node 6262 */ 6263 _updateDOMProperties: function (lastProps, nextProps, transaction) { 6264 var propKey; 6265 var styleName; 6266 var styleUpdates; 6267 for (propKey in lastProps) { 6268 if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) { 6269 continue; 6270 } 6271 if (propKey === STYLE) { 6272 var lastStyle = this._previousStyleCopy; 6273 for (styleName in lastStyle) { 6274 if (lastStyle.hasOwnProperty(styleName)) { 6275 styleUpdates = styleUpdates || {}; 6276 styleUpdates[styleName] = ''; 6277 } 6278 } 6279 this._previousStyleCopy = null; 6280 } else if (registrationNameModules.hasOwnProperty(propKey)) { 6281 if (lastProps[propKey]) { 6282 // Only call deleteListener if there was a listener previously or 6283 // else willDeleteListener gets called when there wasn't actually a 6284 // listener (e.g., onClick={null}) 6285 deleteListener(this, propKey); 6286 } 6287 } else if (isCustomComponent(this._tag, lastProps)) { 6288 if (!RESERVED_PROPS.hasOwnProperty(propKey)) { 6289 DOMPropertyOperations.deleteValueForAttribute(getNode(this), propKey); 6290 } 6291 } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) { 6292 DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey); 6293 } 6294 } 6295 for (propKey in nextProps) { 6296 var nextProp = nextProps[propKey]; 6297 var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps != null ? lastProps[propKey] : undefined; 6298 if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) { 6299 continue; 6300 } 6301 if (propKey === STYLE) { 6302 if (nextProp) { 6303 if ("development" !== 'production') { 6304 checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this); 6305 this._previousStyle = nextProp; 6306 } 6307 nextProp = this._previousStyleCopy = _assign({}, nextProp); 6308 } else { 6309 this._previousStyleCopy = null; 6310 } 6311 if (lastProp) { 6312 // Unset styles on `lastProp` but not on `nextProp`. 6313 for (styleName in lastProp) { 6314 if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) { 6315 styleUpdates = styleUpdates || {}; 6316 styleUpdates[styleName] = ''; 6317 } 6318 } 6319 // Update styles that changed since `lastProp`. 6320 for (styleName in nextProp) { 6321 if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) { 6322 styleUpdates = styleUpdates || {}; 6323 styleUpdates[styleName] = nextProp[styleName]; 6324 } 6325 } 6326 } else { 6327 // Relies on `updateStylesByID` not mutating `styleUpdates`. 6328 styleUpdates = nextProp; 6329 } 6330 } else if (registrationNameModules.hasOwnProperty(propKey)) { 6331 if (nextProp) { 6332 enqueuePutListener(this, propKey, nextProp, transaction); 6333 } else if (lastProp) { 6334 deleteListener(this, propKey); 6335 } 6336 } else if (isCustomComponent(this._tag, nextProps)) { 6337 if (!RESERVED_PROPS.hasOwnProperty(propKey)) { 6338 DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp); 6339 } 6340 } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) { 6341 var node = getNode(this); 6342 // If we're updating to null or undefined, we should remove the property 6343 // from the DOM node instead of inadvertently setting to a string. This 6344 // brings us in line with the same behavior we have on initial render. 6345 if (nextProp != null) { 6346 DOMPropertyOperations.setValueForProperty(node, propKey, nextProp); 6347 } else { 6348 DOMPropertyOperations.deleteValueForProperty(node, propKey); 6349 } 6350 } 6351 } 6352 if (styleUpdates) { 6353 CSSPropertyOperations.setValueForStyles(getNode(this), styleUpdates, this); 6354 } 6355 }, 6356 6357 /** 6358 * Reconciles the children with the various properties that affect the 6359 * children content. 6360 * 6361 * @param {object} lastProps 6362 * @param {object} nextProps 6363 * @param {ReactReconcileTransaction} transaction 6364 * @param {object} context 6365 */ 6366 _updateDOMChildren: function (lastProps, nextProps, transaction, context) { 6367 var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null; 6368 var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null; 6369 6370 var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html; 6371 var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html; 6372 6373 // Note the use of `!=` which checks for null or undefined. 6374 var lastChildren = lastContent != null ? null : lastProps.children; 6375 var nextChildren = nextContent != null ? null : nextProps.children; 6376 6377 // If we're switching from children to content/html or vice versa, remove 6378 // the old content 6379 var lastHasContentOrHtml = lastContent != null || lastHtml != null; 6380 var nextHasContentOrHtml = nextContent != null || nextHtml != null; 6381 if (lastChildren != null && nextChildren == null) { 6382 this.updateChildren(null, transaction, context); 6383 } else if (lastHasContentOrHtml && !nextHasContentOrHtml) { 6384 this.updateTextContent(''); 6385 if ("development" !== 'production') { 6386 ReactInstrumentation.debugTool.onSetChildren(this._debugID, []); 6387 } 6388 } 6389 6390 if (nextContent != null) { 6391 if (lastContent !== nextContent) { 6392 this.updateTextContent('' + nextContent); 6393 if ("development" !== 'production') { 6394 setAndValidateContentChildDev.call(this, nextContent); 6395 } 6396 } 6397 } else if (nextHtml != null) { 6398 if (lastHtml !== nextHtml) { 6399 this.updateMarkup('' + nextHtml); 6400 } 6401 if ("development" !== 'production') { 6402 ReactInstrumentation.debugTool.onSetChildren(this._debugID, []); 6403 } 6404 } else if (nextChildren != null) { 6405 if ("development" !== 'production') { 6406 setAndValidateContentChildDev.call(this, null); 6407 } 6408 6409 this.updateChildren(nextChildren, transaction, context); 6410 } 6411 }, 6412 6413 getHostNode: function () { 6414 return getNode(this); 6415 }, 6416 6417 /** 6418 * Destroys all event registrations for this instance. Does not remove from 6419 * the DOM. That must be done by the parent. 6420 * 6421 * @internal 6422 */ 6423 unmountComponent: function (safely) { 6424 switch (this._tag) { 6425 case 'audio': 6426 case 'form': 6427 case 'iframe': 6428 case 'img': 6429 case 'link': 6430 case 'object': 6431 case 'source': 6432 case 'video': 6433 var listeners = this._wrapperState.listeners; 6434 if (listeners) { 6435 for (var i = 0; i < listeners.length; i++) { 6436 listeners[i].remove(); 6437 } 6438 } 6439 break; 6440 case 'html': 6441 case 'head': 6442 case 'body': 6443 /** 6444 * Components like <html> <head> and <body> can't be removed or added 6445 * easily in a cross-browser way, however it's valuable to be able to 6446 * take advantage of React's reconciliation for styling and <title> 6447 * management. So we just document it and throw in dangerous cases. 6448 */ 6449 !false ? "development" !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is impossible to unmount some top-level components (eg <html>, <head>, and <body>) reliably and efficiently. To fix this, have a single top-level component that never unmounts render these elements.', this._tag) : _prodInvariant('66', this._tag) : void 0; 6450 break; 6451 } 6452 6453 this.unmountChildren(safely); 6454 ReactDOMComponentTree.uncacheNode(this); 6455 EventPluginHub.deleteAllListeners(this); 6456 this._rootNodeID = 0; 6457 this._domID = 0; 6458 this._wrapperState = null; 6459 6460 if ("development" !== 'production') { 6461 setAndValidateContentChildDev.call(this, null); 6462 } 6463 }, 6464 6465 getPublicInstance: function () { 6466 return getNode(this); 6467 } 6468 6469 }; 6470 6471 _assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin); 6472 6473 module.exports = ReactDOMComponent; 6474 },{"10":10,"107":107,"11":11,"12":12,"122":122,"125":125,"131":131,"142":142,"150":150,"156":156,"157":157,"158":158,"17":17,"18":18,"2":2,"26":26,"33":33,"34":34,"39":39,"42":42,"43":43,"46":46,"5":5,"64":64,"68":68,"77":77,"9":9}],33:[function(_dereq_,module,exports){ 6475 /** 6476 * Copyright 2015-present, Facebook, Inc. 6477 * All rights reserved. 6478 * 6479 * This source code is licensed under the BSD-style license found in the 6480 * LICENSE file in the root directory of this source tree. An additional grant 6481 * of patent rights can be found in the PATENTS file in the same directory. 6482 * 6483 */ 6484 6485 'use strict'; 6486 6487 var ReactDOMComponentFlags = { 6488 hasCachedChildNodes: 1 << 0 6489 }; 6490 6491 module.exports = ReactDOMComponentFlags; 6492 },{}],34:[function(_dereq_,module,exports){ 6493 /** 6494 * Copyright 2013-present, Facebook, Inc. 6495 * All rights reserved. 6496 * 6497 * This source code is licensed under the BSD-style license found in the 6498 * LICENSE file in the root directory of this source tree. An additional grant 6499 * of patent rights can be found in the PATENTS file in the same directory. 6500 * 6501 */ 6502 6503 'use strict'; 6504 6505 var _prodInvariant = _dereq_(125); 6506 6507 var DOMProperty = _dereq_(11); 6508 var ReactDOMComponentFlags = _dereq_(33); 6509 6510 var invariant = _dereq_(150); 6511 6512 var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; 6513 var Flags = ReactDOMComponentFlags; 6514 6515 var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2); 6516 6517 /** 6518 * Drill down (through composites and empty components) until we get a host or 6519 * host text component. 6520 * 6521 * This is pretty polymorphic but unavoidable with the current structure we have 6522 * for `_renderedChildren`. 6523 */ 6524 function getRenderedHostOrTextFromComponent(component) { 6525 var rendered; 6526 while (rendered = component._renderedComponent) { 6527 component = rendered; 6528 } 6529 return component; 6530 } 6531 6532 /** 6533 * Populate `_hostNode` on the rendered host/text component with the given 6534 * DOM node. The passed `inst` can be a composite. 6535 */ 6536 function precacheNode(inst, node) { 6537 var hostInst = getRenderedHostOrTextFromComponent(inst); 6538 hostInst._hostNode = node; 6539 node[internalInstanceKey] = hostInst; 6540 } 6541 6542 function uncacheNode(inst) { 6543 var node = inst._hostNode; 6544 if (node) { 6545 delete node[internalInstanceKey]; 6546 inst._hostNode = null; 6547 } 6548 } 6549 6550 /** 6551 * Populate `_hostNode` on each child of `inst`, assuming that the children 6552 * match up with the DOM (element) children of `node`. 6553 * 6554 * We cache entire levels at once to avoid an n^2 problem where we access the 6555 * children of a node sequentially and have to walk from the start to our target 6556 * node every time. 6557 * 6558 * Since we update `_renderedChildren` and the actual DOM at (slightly) 6559 * different times, we could race here and see a newer `_renderedChildren` than 6560 * the DOM nodes we see. To avoid this, ReactMultiChild calls 6561 * `prepareToManageChildren` before we change `_renderedChildren`, at which 6562 * time the container's child nodes are always cached (until it unmounts). 6563 */ 6564 function precacheChildNodes(inst, node) { 6565 if (inst._flags & Flags.hasCachedChildNodes) { 6566 return; 6567 } 6568 var children = inst._renderedChildren; 6569 var childNode = node.firstChild; 6570 outer: for (var name in children) { 6571 if (!children.hasOwnProperty(name)) { 6572 continue; 6573 } 6574 var childInst = children[name]; 6575 var childID = getRenderedHostOrTextFromComponent(childInst)._domID; 6576 if (childID === 0) { 6577 // We're currently unmounting this child in ReactMultiChild; skip it. 6578 continue; 6579 } 6580 // We assume the child nodes are in the same order as the child instances. 6581 for (; childNode !== null; childNode = childNode.nextSibling) { 6582 if (childNode.nodeType === 1 && childNode.getAttribute(ATTR_NAME) === String(childID) || childNode.nodeType === 8 && childNode.nodeValue === ' react-text: ' + childID + ' ' || childNode.nodeType === 8 && childNode.nodeValue === ' react-empty: ' + childID + ' ') { 6583 precacheNode(childInst, childNode); 6584 continue outer; 6585 } 6586 } 6587 // We reached the end of the DOM children without finding an ID match. 6588 !false ? "development" !== 'production' ? invariant(false, 'Unable to find element with ID %s.', childID) : _prodInvariant('32', childID) : void 0; 6589 } 6590 inst._flags |= Flags.hasCachedChildNodes; 6591 } 6592 6593 /** 6594 * Given a DOM node, return the closest ReactDOMComponent or 6595 * ReactDOMTextComponent instance ancestor. 6596 */ 6597 function getClosestInstanceFromNode(node) { 6598 if (node[internalInstanceKey]) { 6599 return node[internalInstanceKey]; 6600 } 6601 6602 // Walk up the tree until we find an ancestor whose instance we have cached. 6603 var parents = []; 6604 while (!node[internalInstanceKey]) { 6605 parents.push(node); 6606 if (node.parentNode) { 6607 node = node.parentNode; 6608 } else { 6609 // Top of the tree. This node must not be part of a React tree (or is 6610 // unmounted, potentially). 6611 return null; 6612 } 6613 } 6614 6615 var closest; 6616 var inst; 6617 for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) { 6618 closest = inst; 6619 if (parents.length) { 6620 precacheChildNodes(inst, node); 6621 } 6622 } 6623 6624 return closest; 6625 } 6626 6627 /** 6628 * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent 6629 * instance, or null if the node was not rendered by this React. 6630 */ 6631 function getInstanceFromNode(node) { 6632 var inst = getClosestInstanceFromNode(node); 6633 if (inst != null && inst._hostNode === node) { 6634 return inst; 6635 } else { 6636 return null; 6637 } 6638 } 6639 6640 /** 6641 * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding 6642 * DOM node. 6643 */ 6644 function getNodeFromInstance(inst) { 6645 // Without this first invariant, passing a non-DOM-component triggers the next 6646 // invariant for a missing parent, which is super confusing. 6647 !(inst._hostNode !== undefined) ? "development" !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; 6648 6649 if (inst._hostNode) { 6650 return inst._hostNode; 6651 } 6652 6653 // Walk up the tree until we find an ancestor whose DOM node we have cached. 6654 var parents = []; 6655 while (!inst._hostNode) { 6656 parents.push(inst); 6657 !inst._hostParent ? "development" !== 'production' ? invariant(false, 'React DOM tree root should always have a node reference.') : _prodInvariant('34') : void 0; 6658 inst = inst._hostParent; 6659 } 6660 6661 // Now parents contains each ancestor that does *not* have a cached native 6662 // node, and `inst` is the deepest ancestor that does. 6663 for (; parents.length; inst = parents.pop()) { 6664 precacheChildNodes(inst, inst._hostNode); 6665 } 6666 6667 return inst._hostNode; 6668 } 6669 6670 var ReactDOMComponentTree = { 6671 getClosestInstanceFromNode: getClosestInstanceFromNode, 6672 getInstanceFromNode: getInstanceFromNode, 6673 getNodeFromInstance: getNodeFromInstance, 6674 precacheChildNodes: precacheChildNodes, 6675 precacheNode: precacheNode, 6676 uncacheNode: uncacheNode 6677 }; 6678 6679 module.exports = ReactDOMComponentTree; 6680 },{"11":11,"125":125,"150":150,"33":33}],35:[function(_dereq_,module,exports){ 6681 /** 6682 * Copyright 2013-present, Facebook, Inc. 6683 * All rights reserved. 6684 * 6685 * This source code is licensed under the BSD-style license found in the 6686 * LICENSE file in the root directory of this source tree. An additional grant 6687 * of patent rights can be found in the PATENTS file in the same directory. 6688 * 6689 */ 6690 6691 'use strict'; 6692 6693 var validateDOMNesting = _dereq_(131); 6694 6695 var DOC_NODE_TYPE = 9; 6696 6697 function ReactDOMContainerInfo(topLevelWrapper, node) { 6698 var info = { 6699 _topLevelWrapper: topLevelWrapper, 6700 _idCounter: 1, 6701 _ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null, 6702 _node: node, 6703 _tag: node ? node.nodeName.toLowerCase() : null, 6704 _namespaceURI: node ? node.namespaceURI : null 6705 }; 6706 if ("development" !== 'production') { 6707 info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null; 6708 } 6709 return info; 6710 } 6711 6712 module.exports = ReactDOMContainerInfo; 6713 },{"131":131}],36:[function(_dereq_,module,exports){ 6714 /** 6715 * Copyright 2014-present, Facebook, Inc. 6716 * All rights reserved. 6717 * 6718 * This source code is licensed under the BSD-style license found in the 6719 * LICENSE file in the root directory of this source tree. An additional grant 6720 * of patent rights can be found in the PATENTS file in the same directory. 6721 * 6722 */ 6723 6724 'use strict'; 6725 6726 var _assign = _dereq_(158); 6727 6728 var DOMLazyTree = _dereq_(9); 6729 var ReactDOMComponentTree = _dereq_(34); 6730 6731 var ReactDOMEmptyComponent = function (instantiate) { 6732 // ReactCompositeComponent uses this: 6733 this._currentElement = null; 6734 // ReactDOMComponentTree uses these: 6735 this._hostNode = null; 6736 this._hostParent = null; 6737 this._hostContainerInfo = null; 6738 this._domID = 0; 6739 }; 6740 _assign(ReactDOMEmptyComponent.prototype, { 6741 mountComponent: function (transaction, hostParent, hostContainerInfo, context) { 6742 var domID = hostContainerInfo._idCounter++; 6743 this._domID = domID; 6744 this._hostParent = hostParent; 6745 this._hostContainerInfo = hostContainerInfo; 6746 6747 var nodeValue = ' react-empty: ' + this._domID + ' '; 6748 if (transaction.useCreateElement) { 6749 var ownerDocument = hostContainerInfo._ownerDocument; 6750 var node = ownerDocument.createComment(nodeValue); 6751 ReactDOMComponentTree.precacheNode(this, node); 6752 return DOMLazyTree(node); 6753 } else { 6754 if (transaction.renderToStaticMarkup) { 6755 // Normally we'd insert a comment node, but since this is a situation 6756 // where React won't take over (static pages), we can simply return 6757 // nothing. 6758 return ''; 6759 } 6760 return '<!--' + nodeValue + '-->'; 6761 } 6762 }, 6763 receiveComponent: function () {}, 6764 getHostNode: function () { 6765 return ReactDOMComponentTree.getNodeFromInstance(this); 6766 }, 6767 unmountComponent: function () { 6768 ReactDOMComponentTree.uncacheNode(this); 6769 } 6770 }); 6771 6772 module.exports = ReactDOMEmptyComponent; 6773 },{"158":158,"34":34,"9":9}],37:[function(_dereq_,module,exports){ 6774 /** 6775 * Copyright 2013-present, Facebook, Inc. 6776 * All rights reserved. 6777 * 6778 * This source code is licensed under the BSD-style license found in the 6779 * LICENSE file in the root directory of this source tree. An additional grant 6780 * of patent rights can be found in the PATENTS file in the same directory. 6781 * 6782 */ 6783 6784 'use strict'; 6785 6786 var ReactDOMFeatureFlags = { 6787 useCreateElement: true, 6788 useFiber: false 6789 }; 6790 6791 module.exports = ReactDOMFeatureFlags; 6792 },{}],38:[function(_dereq_,module,exports){ 6793 /** 6794 * Copyright 2013-present, Facebook, Inc. 6795 * All rights reserved. 6796 * 6797 * This source code is licensed under the BSD-style license found in the 6798 * LICENSE file in the root directory of this source tree. An additional grant 6799 * of patent rights can be found in the PATENTS file in the same directory. 6800 * 6801 */ 6802 6803 'use strict'; 6804 6805 var DOMChildrenOperations = _dereq_(8); 6806 var ReactDOMComponentTree = _dereq_(34); 6807 6808 /** 6809 * Operations used to process updates to DOM nodes. 6810 */ 6811 var ReactDOMIDOperations = { 6812 6813 /** 6814 * Updates a component's children by processing a series of updates. 6815 * 6816 * @param {array<object>} updates List of update configurations. 6817 * @internal 6818 */ 6819 dangerouslyProcessChildrenUpdates: function (parentInst, updates) { 6820 var node = ReactDOMComponentTree.getNodeFromInstance(parentInst); 6821 DOMChildrenOperations.processUpdates(node, updates); 6822 } 6823 }; 6824 6825 module.exports = ReactDOMIDOperations; 6826 },{"34":34,"8":8}],39:[function(_dereq_,module,exports){ 6827 /** 6828 * Copyright 2013-present, Facebook, Inc. 6829 * All rights reserved. 6830 * 6831 * This source code is licensed under the BSD-style license found in the 6832 * LICENSE file in the root directory of this source tree. An additional grant 6833 * of patent rights can be found in the PATENTS file in the same directory. 6834 * 6835 */ 6836 6837 'use strict'; 6838 6839 var _prodInvariant = _dereq_(125), 6840 _assign = _dereq_(158); 6841 6842 var DOMPropertyOperations = _dereq_(12); 6843 var LinkedValueUtils = _dereq_(24); 6844 var ReactDOMComponentTree = _dereq_(34); 6845 var ReactUpdates = _dereq_(82); 6846 6847 var invariant = _dereq_(150); 6848 var warning = _dereq_(157); 6849 6850 var didWarnValueLink = false; 6851 var didWarnCheckedLink = false; 6852 var didWarnValueDefaultValue = false; 6853 var didWarnCheckedDefaultChecked = false; 6854 var didWarnControlledToUncontrolled = false; 6855 var didWarnUncontrolledToControlled = false; 6856 6857 function forceUpdateIfMounted() { 6858 if (this._rootNodeID) { 6859 // DOM component is still mounted; update 6860 ReactDOMInput.updateWrapper(this); 6861 } 6862 } 6863 6864 function isControlled(props) { 6865 var usesChecked = props.type === 'checkbox' || props.type === 'radio'; 6866 return usesChecked ? props.checked != null : props.value != null; 6867 } 6868 6869 /** 6870 * Implements an <input> host component that allows setting these optional 6871 * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. 6872 * 6873 * If `checked` or `value` are not supplied (or null/undefined), user actions 6874 * that affect the checked state or value will trigger updates to the element. 6875 * 6876 * If they are supplied (and not null/undefined), the rendered element will not 6877 * trigger updates to the element. Instead, the props must change in order for 6878 * the rendered element to be updated. 6879 * 6880 * The rendered element will be initialized as unchecked (or `defaultChecked`) 6881 * with an empty value (or `defaultValue`). 6882 * 6883 * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html 6884 */ 6885 var ReactDOMInput = { 6886 getHostProps: function (inst, props) { 6887 var value = LinkedValueUtils.getValue(props); 6888 var checked = LinkedValueUtils.getChecked(props); 6889 6890 var hostProps = _assign({ 6891 // Make sure we set .type before any other properties (setting .value 6892 // before .type means .value is lost in IE11 and below) 6893 type: undefined, 6894 // Make sure we set .step before .value (setting .value before .step 6895 // means .value is rounded on mount, based upon step precision) 6896 step: undefined, 6897 // Make sure we set .min & .max before .value (to ensure proper order 6898 // in corner cases such as min or max deriving from value, e.g. Issue #7170) 6899 min: undefined, 6900 max: undefined 6901 }, props, { 6902 defaultChecked: undefined, 6903 defaultValue: undefined, 6904 value: value != null ? value : inst._wrapperState.initialValue, 6905 checked: checked != null ? checked : inst._wrapperState.initialChecked, 6906 onChange: inst._wrapperState.onChange 6907 }); 6908 6909 return hostProps; 6910 }, 6911 6912 mountWrapper: function (inst, props) { 6913 if ("development" !== 'production') { 6914 LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner); 6915 6916 var owner = inst._currentElement._owner; 6917 6918 if (props.valueLink !== undefined && !didWarnValueLink) { 6919 "development" !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0; 6920 didWarnValueLink = true; 6921 } 6922 if (props.checkedLink !== undefined && !didWarnCheckedLink) { 6923 "development" !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0; 6924 didWarnCheckedLink = true; 6925 } 6926 if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) { 6927 "development" !== 'production' ? warning(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0; 6928 didWarnCheckedDefaultChecked = true; 6929 } 6930 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { 6931 "development" !== 'production' ? warning(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0; 6932 didWarnValueDefaultValue = true; 6933 } 6934 } 6935 6936 var defaultValue = props.defaultValue; 6937 inst._wrapperState = { 6938 initialChecked: props.checked != null ? props.checked : props.defaultChecked, 6939 initialValue: props.value != null ? props.value : defaultValue, 6940 listeners: null, 6941 onChange: _handleChange.bind(inst) 6942 }; 6943 6944 if ("development" !== 'production') { 6945 inst._wrapperState.controlled = isControlled(props); 6946 } 6947 }, 6948 6949 updateWrapper: function (inst) { 6950 var props = inst._currentElement.props; 6951 6952 if ("development" !== 'production') { 6953 var controlled = isControlled(props); 6954 var owner = inst._currentElement._owner; 6955 6956 if (!inst._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) { 6957 "development" !== 'production' ? warning(false, '%s is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0; 6958 didWarnUncontrolledToControlled = true; 6959 } 6960 if (inst._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) { 6961 "development" !== 'production' ? warning(false, '%s is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0; 6962 didWarnControlledToUncontrolled = true; 6963 } 6964 } 6965 6966 // TODO: Shouldn't this be getChecked(props)? 6967 var checked = props.checked; 6968 if (checked != null) { 6969 DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'checked', checked || false); 6970 } 6971 6972 var node = ReactDOMComponentTree.getNodeFromInstance(inst); 6973 var value = LinkedValueUtils.getValue(props); 6974 if (value != null) { 6975 6976 // Cast `value` to a string to ensure the value is set correctly. While 6977 // browsers typically do this as necessary, jsdom doesn't. 6978 var newValue = '' + value; 6979 6980 // To avoid side effects (such as losing text selection), only set value if changed 6981 if (newValue !== node.value) { 6982 node.value = newValue; 6983 } 6984 } else { 6985 if (props.value == null && props.defaultValue != null) { 6986 node.defaultValue = '' + props.defaultValue; 6987 } 6988 if (props.checked == null && props.defaultChecked != null) { 6989 node.defaultChecked = !!props.defaultChecked; 6990 } 6991 } 6992 }, 6993 6994 postMountWrapper: function (inst) { 6995 var props = inst._currentElement.props; 6996 6997 // This is in postMount because we need access to the DOM node, which is not 6998 // available until after the component has mounted. 6999 var node = ReactDOMComponentTree.getNodeFromInstance(inst); 7000 7001 // Detach value from defaultValue. We won't do anything if we're working on 7002 // submit or reset inputs as those values & defaultValues are linked. They 7003 // are not resetable nodes so this operation doesn't matter and actually 7004 // removes browser-default values (eg "Submit Query") when no value is 7005 // provided. 7006 7007 switch (props.type) { 7008 case 'submit': 7009 case 'reset': 7010 break; 7011 case 'color': 7012 case 'date': 7013 case 'datetime': 7014 case 'datetime-local': 7015 case 'month': 7016 case 'time': 7017 case 'week': 7018 // This fixes the no-show issue on iOS Safari and Android Chrome: 7019 // https://github.com/facebook/react/issues/7233 7020 node.value = ''; 7021 node.value = node.defaultValue; 7022 break; 7023 default: 7024 node.value = node.value; 7025 break; 7026 } 7027 7028 // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug 7029 // this is needed to work around a chrome bug where setting defaultChecked 7030 // will sometimes influence the value of checked (even after detachment). 7031 // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416 7032 // We need to temporarily unset name to avoid disrupting radio button groups. 7033 var name = node.name; 7034 if (name !== '') { 7035 node.name = ''; 7036 } 7037 node.defaultChecked = !node.defaultChecked; 7038 node.defaultChecked = !node.defaultChecked; 7039 if (name !== '') { 7040 node.name = name; 7041 } 7042 } 7043 }; 7044 7045 function _handleChange(event) { 7046 var props = this._currentElement.props; 7047 7048 var returnValue = LinkedValueUtils.executeOnChange(props, event); 7049 7050 // Here we use asap to wait until all updates have propagated, which 7051 // is important when using controlled components within layers: 7052 // https://github.com/facebook/react/issues/1698 7053 ReactUpdates.asap(forceUpdateIfMounted, this); 7054 7055 var name = props.name; 7056 if (props.type === 'radio' && name != null) { 7057 var rootNode = ReactDOMComponentTree.getNodeFromInstance(this); 7058 var queryRoot = rootNode; 7059 7060 while (queryRoot.parentNode) { 7061 queryRoot = queryRoot.parentNode; 7062 } 7063 7064 // If `rootNode.form` was non-null, then we could try `form.elements`, 7065 // but that sometimes behaves strangely in IE8. We could also try using 7066 // `form.getElementsByName`, but that will only return direct children 7067 // and won't include inputs that use the HTML5 `form=` attribute. Since 7068 // the input might not even be in a form, let's just use the global 7069 // `querySelectorAll` to ensure we don't miss anything. 7070 var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]'); 7071 7072 for (var i = 0; i < group.length; i++) { 7073 var otherNode = group[i]; 7074 if (otherNode === rootNode || otherNode.form !== rootNode.form) { 7075 continue; 7076 } 7077 // This will throw if radio buttons rendered by different copies of React 7078 // and the same name are rendered into the same form (same as #1939). 7079 // That's probably okay; we don't support it just as we don't support 7080 // mixing React radio buttons with non-React ones. 7081 var otherInstance = ReactDOMComponentTree.getInstanceFromNode(otherNode); 7082 !otherInstance ? "development" !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : _prodInvariant('90') : void 0; 7083 // If this is a controlled radio button group, forcing the input that 7084 // was previously checked to update will cause it to be come re-checked 7085 // as appropriate. 7086 ReactUpdates.asap(forceUpdateIfMounted, otherInstance); 7087 } 7088 } 7089 7090 return returnValue; 7091 } 7092 7093 module.exports = ReactDOMInput; 7094 },{"12":12,"125":125,"150":150,"157":157,"158":158,"24":24,"34":34,"82":82}],40:[function(_dereq_,module,exports){ 7095 /** 7096 * Copyright 2013-present, Facebook, Inc. 7097 * All rights reserved. 7098 * 7099 * This source code is licensed under the BSD-style license found in the 7100 * LICENSE file in the root directory of this source tree. An additional grant 7101 * of patent rights can be found in the PATENTS file in the same directory. 7102 * 7103 */ 7104 7105 'use strict'; 7106 7107 var DOMProperty = _dereq_(11); 7108 var ReactComponentTreeHook = _dereq_(132); 7109 7110 var warning = _dereq_(157); 7111 7112 var warnedProperties = {}; 7113 var rARIA = new RegExp('^(aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$'); 7114 7115 function validateProperty(tagName, name, debugID) { 7116 if (warnedProperties.hasOwnProperty(name) && warnedProperties[name]) { 7117 return true; 7118 } 7119 7120 if (rARIA.test(name)) { 7121 var lowerCasedName = name.toLowerCase(); 7122 var standardName = DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null; 7123 7124 // If this is an aria-* attribute, but is not listed in the known DOM 7125 // DOM properties, then it is an invalid aria-* attribute. 7126 if (standardName == null) { 7127 warnedProperties[name] = true; 7128 return false; 7129 } 7130 // aria-* attributes should be lowercase; suggest the lowercase version. 7131 if (name !== standardName) { 7132 "development" !== 'production' ? warning(false, 'Unknown ARIA attribute %s. Did you mean %s?%s', name, standardName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; 7133 warnedProperties[name] = true; 7134 return true; 7135 } 7136 } 7137 7138 return true; 7139 } 7140 7141 function warnInvalidARIAProps(debugID, element) { 7142 var invalidProps = []; 7143 7144 for (var key in element.props) { 7145 var isValid = validateProperty(element.type, key, debugID); 7146 if (!isValid) { 7147 invalidProps.push(key); 7148 } 7149 } 7150 7151 var unknownPropString = invalidProps.map(function (prop) { 7152 return '`' + prop + '`'; 7153 }).join(', '); 7154 7155 if (invalidProps.length === 1) { 7156 "development" !== 'production' ? warning(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; 7157 } else if (invalidProps.length > 1) { 7158 "development" !== 'production' ? warning(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; 7159 } 7160 } 7161 7162 function handleElement(debugID, element) { 7163 if (element == null || typeof element.type !== 'string') { 7164 return; 7165 } 7166 if (element.type.indexOf('-') >= 0 || element.props.is) { 7167 return; 7168 } 7169 7170 warnInvalidARIAProps(debugID, element); 7171 } 7172 7173 var ReactDOMInvalidARIAHook = { 7174 onBeforeMountComponent: function (debugID, element) { 7175 if ("development" !== 'production') { 7176 handleElement(debugID, element); 7177 } 7178 }, 7179 onBeforeUpdateComponent: function (debugID, element) { 7180 if ("development" !== 'production') { 7181 handleElement(debugID, element); 7182 } 7183 } 7184 }; 7185 7186 module.exports = ReactDOMInvalidARIAHook; 7187 },{"11":11,"132":132,"157":157}],41:[function(_dereq_,module,exports){ 7188 /** 7189 * Copyright 2013-present, Facebook, Inc. 7190 * All rights reserved. 7191 * 7192 * This source code is licensed under the BSD-style license found in the 7193 * LICENSE file in the root directory of this source tree. An additional grant 7194 * of patent rights can be found in the PATENTS file in the same directory. 7195 * 7196 */ 7197 7198 'use strict'; 7199 7200 var ReactComponentTreeHook = _dereq_(132); 7201 7202 var warning = _dereq_(157); 7203 7204 var didWarnValueNull = false; 7205 7206 function handleElement(debugID, element) { 7207 if (element == null) { 7208 return; 7209 } 7210 if (element.type !== 'input' && element.type !== 'textarea' && element.type !== 'select') { 7211 return; 7212 } 7213 if (element.props != null && element.props.value === null && !didWarnValueNull) { 7214 "development" !== 'production' ? warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.%s', element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; 7215 7216 didWarnValueNull = true; 7217 } 7218 } 7219 7220 var ReactDOMNullInputValuePropHook = { 7221 onBeforeMountComponent: function (debugID, element) { 7222 handleElement(debugID, element); 7223 }, 7224 onBeforeUpdateComponent: function (debugID, element) { 7225 handleElement(debugID, element); 7226 } 7227 }; 7228 7229 module.exports = ReactDOMNullInputValuePropHook; 7230 },{"132":132,"157":157}],42:[function(_dereq_,module,exports){ 7231 /** 7232 * Copyright 2013-present, Facebook, Inc. 7233 * All rights reserved. 7234 * 7235 * This source code is licensed under the BSD-style license found in the 7236 * LICENSE file in the root directory of this source tree. An additional grant 7237 * of patent rights can be found in the PATENTS file in the same directory. 7238 * 7239 */ 7240 7241 'use strict'; 7242 7243 var _assign = _dereq_(158); 7244 7245 var React = _dereq_(134); 7246 var ReactDOMComponentTree = _dereq_(34); 7247 var ReactDOMSelect = _dereq_(43); 7248 7249 var warning = _dereq_(157); 7250 var didWarnInvalidOptionChildren = false; 7251 7252 function flattenChildren(children) { 7253 var content = ''; 7254 7255 // Flatten children and warn if they aren't strings or numbers; 7256 // invalid types are ignored. 7257 React.Children.forEach(children, function (child) { 7258 if (child == null) { 7259 return; 7260 } 7261 if (typeof child === 'string' || typeof child === 'number') { 7262 content += child; 7263 } else if (!didWarnInvalidOptionChildren) { 7264 didWarnInvalidOptionChildren = true; 7265 "development" !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : void 0; 7266 } 7267 }); 7268 7269 return content; 7270 } 7271 7272 /** 7273 * Implements an <option> host component that warns when `selected` is set. 7274 */ 7275 var ReactDOMOption = { 7276 mountWrapper: function (inst, props, hostParent) { 7277 // TODO (yungsters): Remove support for `selected` in <option>. 7278 if ("development" !== 'production') { 7279 "development" !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : void 0; 7280 } 7281 7282 // Look up whether this option is 'selected' 7283 var selectValue = null; 7284 if (hostParent != null) { 7285 var selectParent = hostParent; 7286 7287 if (selectParent._tag === 'optgroup') { 7288 selectParent = selectParent._hostParent; 7289 } 7290 7291 if (selectParent != null && selectParent._tag === 'select') { 7292 selectValue = ReactDOMSelect.getSelectValueContext(selectParent); 7293 } 7294 } 7295 7296 // If the value is null (e.g., no specified value or after initial mount) 7297 // or missing (e.g., for <datalist>), we don't change props.selected 7298 var selected = null; 7299 if (selectValue != null) { 7300 var value; 7301 if (props.value != null) { 7302 value = props.value + ''; 7303 } else { 7304 value = flattenChildren(props.children); 7305 } 7306 selected = false; 7307 if (Array.isArray(selectValue)) { 7308 // multiple 7309 for (var i = 0; i < selectValue.length; i++) { 7310 if ('' + selectValue[i] === value) { 7311 selected = true; 7312 break; 7313 } 7314 } 7315 } else { 7316 selected = '' + selectValue === value; 7317 } 7318 } 7319 7320 inst._wrapperState = { selected: selected }; 7321 }, 7322 7323 postMountWrapper: function (inst) { 7324 // value="" should make a value attribute (#6219) 7325 var props = inst._currentElement.props; 7326 if (props.value != null) { 7327 var node = ReactDOMComponentTree.getNodeFromInstance(inst); 7328 node.setAttribute('value', props.value); 7329 } 7330 }, 7331 7332 getHostProps: function (inst, props) { 7333 var hostProps = _assign({ selected: undefined, children: undefined }, props); 7334 7335 // Read state only from initial mount because <select> updates value 7336 // manually; we need the initial state only for server rendering 7337 if (inst._wrapperState.selected != null) { 7338 hostProps.selected = inst._wrapperState.selected; 7339 } 7340 7341 var content = flattenChildren(props.children); 7342 7343 if (content) { 7344 hostProps.children = content; 7345 } 7346 7347 return hostProps; 7348 } 7349 7350 }; 7351 7352 module.exports = ReactDOMOption; 7353 },{"134":134,"157":157,"158":158,"34":34,"43":43}],43:[function(_dereq_,module,exports){ 7354 /** 7355 * Copyright 2013-present, Facebook, Inc. 7356 * All rights reserved. 7357 * 7358 * This source code is licensed under the BSD-style license found in the 7359 * LICENSE file in the root directory of this source tree. An additional grant 7360 * of patent rights can be found in the PATENTS file in the same directory. 7361 * 7362 */ 7363 7364 'use strict'; 7365 7366 var _assign = _dereq_(158); 7367 7368 var LinkedValueUtils = _dereq_(24); 7369 var ReactDOMComponentTree = _dereq_(34); 7370 var ReactUpdates = _dereq_(82); 7371 7372 var warning = _dereq_(157); 7373 7374 var didWarnValueLink = false; 7375 var didWarnValueDefaultValue = false; 7376 7377 function updateOptionsIfPendingUpdateAndMounted() { 7378 if (this._rootNodeID && this._wrapperState.pendingUpdate) { 7379 this._wrapperState.pendingUpdate = false; 7380 7381 var props = this._currentElement.props; 7382 var value = LinkedValueUtils.getValue(props); 7383 7384 if (value != null) { 7385 updateOptions(this, Boolean(props.multiple), value); 7386 } 7387 } 7388 } 7389 7390 function getDeclarationErrorAddendum(owner) { 7391 if (owner) { 7392 var name = owner.getName(); 7393 if (name) { 7394 return ' Check the render method of `' + name + '`.'; 7395 } 7396 } 7397 return ''; 7398 } 7399 7400 var valuePropNames = ['value', 'defaultValue']; 7401 7402 /** 7403 * Validation function for `value` and `defaultValue`. 7404 * @private 7405 */ 7406 function checkSelectPropTypes(inst, props) { 7407 var owner = inst._currentElement._owner; 7408 LinkedValueUtils.checkPropTypes('select', props, owner); 7409 7410 if (props.valueLink !== undefined && !didWarnValueLink) { 7411 "development" !== 'production' ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0; 7412 didWarnValueLink = true; 7413 } 7414 7415 for (var i = 0; i < valuePropNames.length; i++) { 7416 var propName = valuePropNames[i]; 7417 if (props[propName] == null) { 7418 continue; 7419 } 7420 var isArray = Array.isArray(props[propName]); 7421 if (props.multiple && !isArray) { 7422 "development" !== 'production' ? warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0; 7423 } else if (!props.multiple && isArray) { 7424 "development" !== 'production' ? warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0; 7425 } 7426 } 7427 } 7428 7429 /** 7430 * @param {ReactDOMComponent} inst 7431 * @param {boolean} multiple 7432 * @param {*} propValue A stringable (with `multiple`, a list of stringables). 7433 * @private 7434 */ 7435 function updateOptions(inst, multiple, propValue) { 7436 var selectedValue, i; 7437 var options = ReactDOMComponentTree.getNodeFromInstance(inst).options; 7438 7439 if (multiple) { 7440 selectedValue = {}; 7441 for (i = 0; i < propValue.length; i++) { 7442 selectedValue['' + propValue[i]] = true; 7443 } 7444 for (i = 0; i < options.length; i++) { 7445 var selected = selectedValue.hasOwnProperty(options[i].value); 7446 if (options[i].selected !== selected) { 7447 options[i].selected = selected; 7448 } 7449 } 7450 } else { 7451 // Do not set `select.value` as exact behavior isn't consistent across all 7452 // browsers for all cases. 7453 selectedValue = '' + propValue; 7454 for (i = 0; i < options.length; i++) { 7455 if (options[i].value === selectedValue) { 7456 options[i].selected = true; 7457 return; 7458 } 7459 } 7460 if (options.length) { 7461 options[0].selected = true; 7462 } 7463 } 7464 } 7465 7466 /** 7467 * Implements a <select> host component that allows optionally setting the 7468 * props `value` and `defaultValue`. If `multiple` is false, the prop must be a 7469 * stringable. If `multiple` is true, the prop must be an array of stringables. 7470 * 7471 * If `value` is not supplied (or null/undefined), user actions that change the 7472 * selected option will trigger updates to the rendered options. 7473 * 7474 * If it is supplied (and not null/undefined), the rendered options will not 7475 * update in response to user actions. Instead, the `value` prop must change in 7476 * order for the rendered options to update. 7477 * 7478 * If `defaultValue` is provided, any options with the supplied values will be 7479 * selected. 7480 */ 7481 var ReactDOMSelect = { 7482 getHostProps: function (inst, props) { 7483 return _assign({}, props, { 7484 onChange: inst._wrapperState.onChange, 7485 value: undefined 7486 }); 7487 }, 7488 7489 mountWrapper: function (inst, props) { 7490 if ("development" !== 'production') { 7491 checkSelectPropTypes(inst, props); 7492 } 7493 7494 var value = LinkedValueUtils.getValue(props); 7495 inst._wrapperState = { 7496 pendingUpdate: false, 7497 initialValue: value != null ? value : props.defaultValue, 7498 listeners: null, 7499 onChange: _handleChange.bind(inst), 7500 wasMultiple: Boolean(props.multiple) 7501 }; 7502 7503 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { 7504 "development" !== 'production' ? warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0; 7505 didWarnValueDefaultValue = true; 7506 } 7507 }, 7508 7509 getSelectValueContext: function (inst) { 7510 // ReactDOMOption looks at this initial value so the initial generated 7511 // markup has correct `selected` attributes 7512 return inst._wrapperState.initialValue; 7513 }, 7514 7515 postUpdateWrapper: function (inst) { 7516 var props = inst._currentElement.props; 7517 7518 // After the initial mount, we control selected-ness manually so don't pass 7519 // this value down 7520 inst._wrapperState.initialValue = undefined; 7521 7522 var wasMultiple = inst._wrapperState.wasMultiple; 7523 inst._wrapperState.wasMultiple = Boolean(props.multiple); 7524 7525 var value = LinkedValueUtils.getValue(props); 7526 if (value != null) { 7527 inst._wrapperState.pendingUpdate = false; 7528 updateOptions(inst, Boolean(props.multiple), value); 7529 } else if (wasMultiple !== Boolean(props.multiple)) { 7530 // For simplicity, reapply `defaultValue` if `multiple` is toggled. 7531 if (props.defaultValue != null) { 7532 updateOptions(inst, Boolean(props.multiple), props.defaultValue); 7533 } else { 7534 // Revert the select back to its default unselected state. 7535 updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : ''); 7536 } 7537 } 7538 } 7539 }; 7540 7541 function _handleChange(event) { 7542 var props = this._currentElement.props; 7543 var returnValue = LinkedValueUtils.executeOnChange(props, event); 7544 7545 if (this._rootNodeID) { 7546 this._wrapperState.pendingUpdate = true; 7547 } 7548 ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this); 7549 return returnValue; 7550 } 7551 7552 module.exports = ReactDOMSelect; 7553 },{"157":157,"158":158,"24":24,"34":34,"82":82}],44:[function(_dereq_,module,exports){ 7554 /** 7555 * Copyright 2013-present, Facebook, Inc. 7556 * All rights reserved. 7557 * 7558 * This source code is licensed under the BSD-style license found in the 7559 * LICENSE file in the root directory of this source tree. An additional grant 7560 * of patent rights can be found in the PATENTS file in the same directory. 7561 * 7562 */ 7563 7564 'use strict'; 7565 7566 var ExecutionEnvironment = _dereq_(136); 7567 7568 var getNodeForCharacterOffset = _dereq_(118); 7569 var getTextContentAccessor = _dereq_(119); 7570 7571 /** 7572 * While `isCollapsed` is available on the Selection object and `collapsed` 7573 * is available on the Range object, IE11 sometimes gets them wrong. 7574 * If the anchor/focus nodes and offsets are the same, the range is collapsed. 7575 */ 7576 function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) { 7577 return anchorNode === focusNode && anchorOffset === focusOffset; 7578 } 7579 7580 /** 7581 * Get the appropriate anchor and focus node/offset pairs for IE. 7582 * 7583 * The catch here is that IE's selection API doesn't provide information 7584 * about whether the selection is forward or backward, so we have to 7585 * behave as though it's always forward. 7586 * 7587 * IE text differs from modern selection in that it behaves as though 7588 * block elements end with a new line. This means character offsets will 7589 * differ between the two APIs. 7590 * 7591 * @param {DOMElement} node 7592 * @return {object} 7593 */ 7594 function getIEOffsets(node) { 7595 var selection = document.selection; 7596 var selectedRange = selection.createRange(); 7597 var selectedLength = selectedRange.text.length; 7598 7599 // Duplicate selection so we can move range without breaking user selection. 7600 var fromStart = selectedRange.duplicate(); 7601 fromStart.moveToElementText(node); 7602 fromStart.setEndPoint('EndToStart', selectedRange); 7603 7604 var startOffset = fromStart.text.length; 7605 var endOffset = startOffset + selectedLength; 7606 7607 return { 7608 start: startOffset, 7609 end: endOffset 7610 }; 7611 } 7612 7613 /** 7614 * @param {DOMElement} node 7615 * @return {?object} 7616 */ 7617 function getModernOffsets(node) { 7618 var selection = window.getSelection && window.getSelection(); 7619 7620 if (!selection || selection.rangeCount === 0) { 7621 return null; 7622 } 7623 7624 var anchorNode = selection.anchorNode; 7625 var anchorOffset = selection.anchorOffset; 7626 var focusNode = selection.focusNode; 7627 var focusOffset = selection.focusOffset; 7628 7629 var currentRange = selection.getRangeAt(0); 7630 7631 // In Firefox, range.startContainer and range.endContainer can be "anonymous 7632 // divs", e.g. the up/down buttons on an <input type="number">. Anonymous 7633 // divs do not seem to expose properties, triggering a "Permission denied 7634 // error" if any of its properties are accessed. The only seemingly possible 7635 // way to avoid erroring is to access a property that typically works for 7636 // non-anonymous divs and catch any error that may otherwise arise. See 7637 // https://bugzilla.mozilla.org/show_bug.cgi?id=208427 7638 try { 7639 /* eslint-disable no-unused-expressions */ 7640 currentRange.startContainer.nodeType; 7641 currentRange.endContainer.nodeType; 7642 /* eslint-enable no-unused-expressions */ 7643 } catch (e) { 7644 return null; 7645 } 7646 7647 // If the node and offset values are the same, the selection is collapsed. 7648 // `Selection.isCollapsed` is available natively, but IE sometimes gets 7649 // this value wrong. 7650 var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset); 7651 7652 var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length; 7653 7654 var tempRange = currentRange.cloneRange(); 7655 tempRange.selectNodeContents(node); 7656 tempRange.setEnd(currentRange.startContainer, currentRange.startOffset); 7657 7658 var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset); 7659 7660 var start = isTempRangeCollapsed ? 0 : tempRange.toString().length; 7661 var end = start + rangeLength; 7662 7663 // Detect whether the selection is backward. 7664 var detectionRange = document.createRange(); 7665 detectionRange.setStart(anchorNode, anchorOffset); 7666 detectionRange.setEnd(focusNode, focusOffset); 7667 var isBackward = detectionRange.collapsed; 7668 7669 return { 7670 start: isBackward ? end : start, 7671 end: isBackward ? start : end 7672 }; 7673 } 7674 7675 /** 7676 * @param {DOMElement|DOMTextNode} node 7677 * @param {object} offsets 7678 */ 7679 function setIEOffsets(node, offsets) { 7680 var range = document.selection.createRange().duplicate(); 7681 var start, end; 7682 7683 if (offsets.end === undefined) { 7684 start = offsets.start; 7685 end = start; 7686 } else if (offsets.start > offsets.end) { 7687 start = offsets.end; 7688 end = offsets.start; 7689 } else { 7690 start = offsets.start; 7691 end = offsets.end; 7692 } 7693 7694 range.moveToElementText(node); 7695 range.moveStart('character', start); 7696 range.setEndPoint('EndToStart', range); 7697 range.moveEnd('character', end - start); 7698 range.select(); 7699 } 7700 7701 /** 7702 * In modern non-IE browsers, we can support both forward and backward 7703 * selections. 7704 * 7705 * Note: IE10+ supports the Selection object, but it does not support 7706 * the `extend` method, which means that even in modern IE, it's not possible 7707 * to programmatically create a backward selection. Thus, for all IE 7708 * versions, we use the old IE API to create our selections. 7709 * 7710 * @param {DOMElement|DOMTextNode} node 7711 * @param {object} offsets 7712 */ 7713 function setModernOffsets(node, offsets) { 7714 if (!window.getSelection) { 7715 return; 7716 } 7717 7718 var selection = window.getSelection(); 7719 var length = node[getTextContentAccessor()].length; 7720 var start = Math.min(offsets.start, length); 7721 var end = offsets.end === undefined ? start : Math.min(offsets.end, length); 7722 7723 // IE 11 uses modern selection, but doesn't support the extend method. 7724 // Flip backward selections, so we can set with a single range. 7725 if (!selection.extend && start > end) { 7726 var temp = end; 7727 end = start; 7728 start = temp; 7729 } 7730 7731 var startMarker = getNodeForCharacterOffset(node, start); 7732 var endMarker = getNodeForCharacterOffset(node, end); 7733 7734 if (startMarker && endMarker) { 7735 var range = document.createRange(); 7736 range.setStart(startMarker.node, startMarker.offset); 7737 selection.removeAllRanges(); 7738 7739 if (start > end) { 7740 selection.addRange(range); 7741 selection.extend(endMarker.node, endMarker.offset); 7742 } else { 7743 range.setEnd(endMarker.node, endMarker.offset); 7744 selection.addRange(range); 7745 } 7746 } 7747 } 7748 7749 var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window); 7750 7751 var ReactDOMSelection = { 7752 /** 7753 * @param {DOMElement} node 7754 */ 7755 getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets, 7756 7757 /** 7758 * @param {DOMElement|DOMTextNode} node 7759 * @param {object} offsets 7760 */ 7761 setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets 7762 }; 7763 7764 module.exports = ReactDOMSelection; 7765 },{"118":118,"119":119,"136":136}],45:[function(_dereq_,module,exports){ 7766 /** 7767 * Copyright 2013-present, Facebook, Inc. 7768 * All rights reserved. 7769 * 7770 * This source code is licensed under the BSD-style license found in the 7771 * LICENSE file in the root directory of this source tree. An additional grant 7772 * of patent rights can be found in the PATENTS file in the same directory. 7773 * 7774 */ 7775 7776 'use strict'; 7777 7778 var _prodInvariant = _dereq_(125), 7779 _assign = _dereq_(158); 7780 7781 var DOMChildrenOperations = _dereq_(8); 7782 var DOMLazyTree = _dereq_(9); 7783 var ReactDOMComponentTree = _dereq_(34); 7784 7785 var escapeTextContentForBrowser = _dereq_(107); 7786 var invariant = _dereq_(150); 7787 var validateDOMNesting = _dereq_(131); 7788 7789 /** 7790 * Text nodes violate a couple assumptions that React makes about components: 7791 * 7792 * - When mounting text into the DOM, adjacent text nodes are merged. 7793 * - Text nodes cannot be assigned a React root ID. 7794 * 7795 * This component is used to wrap strings between comment nodes so that they 7796 * can undergo the same reconciliation that is applied to elements. 7797 * 7798 * TODO: Investigate representing React components in the DOM with text nodes. 7799 * 7800 * @class ReactDOMTextComponent 7801 * @extends ReactComponent 7802 * @internal 7803 */ 7804 var ReactDOMTextComponent = function (text) { 7805 // TODO: This is really a ReactText (ReactNode), not a ReactElement 7806 this._currentElement = text; 7807 this._stringText = '' + text; 7808 // ReactDOMComponentTree uses these: 7809 this._hostNode = null; 7810 this._hostParent = null; 7811 7812 // Properties 7813 this._domID = 0; 7814 this._mountIndex = 0; 7815 this._closingComment = null; 7816 this._commentNodes = null; 7817 }; 7818 7819 _assign(ReactDOMTextComponent.prototype, { 7820 7821 /** 7822 * Creates the markup for this text node. This node is not intended to have 7823 * any features besides containing text content. 7824 * 7825 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction 7826 * @return {string} Markup for this text node. 7827 * @internal 7828 */ 7829 mountComponent: function (transaction, hostParent, hostContainerInfo, context) { 7830 if ("development" !== 'production') { 7831 var parentInfo; 7832 if (hostParent != null) { 7833 parentInfo = hostParent._ancestorInfo; 7834 } else if (hostContainerInfo != null) { 7835 parentInfo = hostContainerInfo._ancestorInfo; 7836 } 7837 if (parentInfo) { 7838 // parentInfo should always be present except for the top-level 7839 // component when server rendering 7840 validateDOMNesting(null, this._stringText, this, parentInfo); 7841 } 7842 } 7843 7844 var domID = hostContainerInfo._idCounter++; 7845 var openingValue = ' react-text: ' + domID + ' '; 7846 var closingValue = ' /react-text '; 7847 this._domID = domID; 7848 this._hostParent = hostParent; 7849 if (transaction.useCreateElement) { 7850 var ownerDocument = hostContainerInfo._ownerDocument; 7851 var openingComment = ownerDocument.createComment(openingValue); 7852 var closingComment = ownerDocument.createComment(closingValue); 7853 var lazyTree = DOMLazyTree(ownerDocument.createDocumentFragment()); 7854 DOMLazyTree.queueChild(lazyTree, DOMLazyTree(openingComment)); 7855 if (this._stringText) { 7856 DOMLazyTree.queueChild(lazyTree, DOMLazyTree(ownerDocument.createTextNode(this._stringText))); 7857 } 7858 DOMLazyTree.queueChild(lazyTree, DOMLazyTree(closingComment)); 7859 ReactDOMComponentTree.precacheNode(this, openingComment); 7860 this._closingComment = closingComment; 7861 return lazyTree; 7862 } else { 7863 var escapedText = escapeTextContentForBrowser(this._stringText); 7864 7865 if (transaction.renderToStaticMarkup) { 7866 // Normally we'd wrap this between comment nodes for the reasons stated 7867 // above, but since this is a situation where React won't take over 7868 // (static pages), we can simply return the text as it is. 7869 return escapedText; 7870 } 7871 7872 return '<!--' + openingValue + '-->' + escapedText + '<!--' + closingValue + '-->'; 7873 } 7874 }, 7875 7876 /** 7877 * Updates this component by updating the text content. 7878 * 7879 * @param {ReactText} nextText The next text content 7880 * @param {ReactReconcileTransaction} transaction 7881 * @internal 7882 */ 7883 receiveComponent: function (nextText, transaction) { 7884 if (nextText !== this._currentElement) { 7885 this._currentElement = nextText; 7886 var nextStringText = '' + nextText; 7887 if (nextStringText !== this._stringText) { 7888 // TODO: Save this as pending props and use performUpdateIfNecessary 7889 // and/or updateComponent to do the actual update for consistency with 7890 // other component types? 7891 this._stringText = nextStringText; 7892 var commentNodes = this.getHostNode(); 7893 DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText); 7894 } 7895 } 7896 }, 7897 7898 getHostNode: function () { 7899 var hostNode = this._commentNodes; 7900 if (hostNode) { 7901 return hostNode; 7902 } 7903 if (!this._closingComment) { 7904 var openingComment = ReactDOMComponentTree.getNodeFromInstance(this); 7905 var node = openingComment.nextSibling; 7906 while (true) { 7907 !(node != null) ? "development" !== 'production' ? invariant(false, 'Missing closing comment for text component %s', this._domID) : _prodInvariant('67', this._domID) : void 0; 7908 if (node.nodeType === 8 && node.nodeValue === ' /react-text ') { 7909 this._closingComment = node; 7910 break; 7911 } 7912 node = node.nextSibling; 7913 } 7914 } 7915 hostNode = [this._hostNode, this._closingComment]; 7916 this._commentNodes = hostNode; 7917 return hostNode; 7918 }, 7919 7920 unmountComponent: function () { 7921 this._closingComment = null; 7922 this._commentNodes = null; 7923 ReactDOMComponentTree.uncacheNode(this); 7924 } 7925 7926 }); 7927 7928 module.exports = ReactDOMTextComponent; 7929 },{"107":107,"125":125,"131":131,"150":150,"158":158,"34":34,"8":8,"9":9}],46:[function(_dereq_,module,exports){ 7930 /** 7931 * Copyright 2013-present, Facebook, Inc. 7932 * All rights reserved. 7933 * 7934 * This source code is licensed under the BSD-style license found in the 7935 * LICENSE file in the root directory of this source tree. An additional grant 7936 * of patent rights can be found in the PATENTS file in the same directory. 7937 * 7938 */ 7939 7940 'use strict'; 7941 7942 var _prodInvariant = _dereq_(125), 7943 _assign = _dereq_(158); 7944 7945 var LinkedValueUtils = _dereq_(24); 7946 var ReactDOMComponentTree = _dereq_(34); 7947 var ReactUpdates = _dereq_(82); 7948 7949 var invariant = _dereq_(150); 7950 var warning = _dereq_(157); 7951 7952 var didWarnValueLink = false; 7953 var didWarnValDefaultVal = false; 7954 7955 function forceUpdateIfMounted() { 7956 if (this._rootNodeID) { 7957 // DOM component is still mounted; update 7958 ReactDOMTextarea.updateWrapper(this); 7959 } 7960 } 7961 7962 /** 7963 * Implements a <textarea> host component that allows setting `value`, and 7964 * `defaultValue`. This differs from the traditional DOM API because value is 7965 * usually set as PCDATA children. 7966 * 7967 * If `value` is not supplied (or null/undefined), user actions that affect the 7968 * value will trigger updates to the element. 7969 * 7970 * If `value` is supplied (and not null/undefined), the rendered element will 7971 * not trigger updates to the element. Instead, the `value` prop must change in 7972 * order for the rendered element to be updated. 7973 * 7974 * The rendered element will be initialized with an empty value, the prop 7975 * `defaultValue` if specified, or the children content (deprecated). 7976 */ 7977 var ReactDOMTextarea = { 7978 getHostProps: function (inst, props) { 7979 !(props.dangerouslySetInnerHTML == null) ? "development" !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : _prodInvariant('91') : void 0; 7980 7981 // Always set children to the same thing. In IE9, the selection range will 7982 // get reset if `textContent` is mutated. We could add a check in setTextContent 7983 // to only set the value if/when the value differs from the node value (which would 7984 // completely solve this IE9 bug), but Sebastian+Ben seemed to like this solution. 7985 // The value can be a boolean or object so that's why it's forced to be a string. 7986 var hostProps = _assign({}, props, { 7987 value: undefined, 7988 defaultValue: undefined, 7989 children: '' + inst._wrapperState.initialValue, 7990 onChange: inst._wrapperState.onChange 7991 }); 7992 7993 return hostProps; 7994 }, 7995 7996 mountWrapper: function (inst, props) { 7997 if ("development" !== 'production') { 7998 LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner); 7999 if (props.valueLink !== undefined && !didWarnValueLink) { 8000 "development" !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : void 0; 8001 didWarnValueLink = true; 8002 } 8003 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) { 8004 "development" !== 'production' ? warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0; 8005 didWarnValDefaultVal = true; 8006 } 8007 } 8008 8009 var value = LinkedValueUtils.getValue(props); 8010 var initialValue = value; 8011 8012 // Only bother fetching default value if we're going to use it 8013 if (value == null) { 8014 var defaultValue = props.defaultValue; 8015 // TODO (yungsters): Remove support for children content in <textarea>. 8016 var children = props.children; 8017 if (children != null) { 8018 if ("development" !== 'production') { 8019 "development" !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : void 0; 8020 } 8021 !(defaultValue == null) ? "development" !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : _prodInvariant('92') : void 0; 8022 if (Array.isArray(children)) { 8023 !(children.length <= 1) ? "development" !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : _prodInvariant('93') : void 0; 8024 children = children[0]; 8025 } 8026 8027 defaultValue = '' + children; 8028 } 8029 if (defaultValue == null) { 8030 defaultValue = ''; 8031 } 8032 initialValue = defaultValue; 8033 } 8034 8035 inst._wrapperState = { 8036 initialValue: '' + initialValue, 8037 listeners: null, 8038 onChange: _handleChange.bind(inst) 8039 }; 8040 }, 8041 8042 updateWrapper: function (inst) { 8043 var props = inst._currentElement.props; 8044 8045 var node = ReactDOMComponentTree.getNodeFromInstance(inst); 8046 var value = LinkedValueUtils.getValue(props); 8047 if (value != null) { 8048 // Cast `value` to a string to ensure the value is set correctly. While 8049 // browsers typically do this as necessary, jsdom doesn't. 8050 var newValue = '' + value; 8051 8052 // To avoid side effects (such as losing text selection), only set value if changed 8053 if (newValue !== node.value) { 8054 node.value = newValue; 8055 } 8056 if (props.defaultValue == null) { 8057 node.defaultValue = newValue; 8058 } 8059 } 8060 if (props.defaultValue != null) { 8061 node.defaultValue = props.defaultValue; 8062 } 8063 }, 8064 8065 postMountWrapper: function (inst) { 8066 // This is in postMount because we need access to the DOM node, which is not 8067 // available until after the component has mounted. 8068 var node = ReactDOMComponentTree.getNodeFromInstance(inst); 8069 8070 // Warning: node.value may be the empty string at this point (IE11) if placeholder is set. 8071 node.value = node.textContent; // Detach value from defaultValue 8072 } 8073 }; 8074 8075 function _handleChange(event) { 8076 var props = this._currentElement.props; 8077 var returnValue = LinkedValueUtils.executeOnChange(props, event); 8078 ReactUpdates.asap(forceUpdateIfMounted, this); 8079 return returnValue; 8080 } 8081 8082 module.exports = ReactDOMTextarea; 8083 },{"125":125,"150":150,"157":157,"158":158,"24":24,"34":34,"82":82}],47:[function(_dereq_,module,exports){ 8084 /** 8085 * Copyright 2015-present, Facebook, Inc. 8086 * All rights reserved. 8087 * 8088 * This source code is licensed under the BSD-style license found in the 8089 * LICENSE file in the root directory of this source tree. An additional grant 8090 * of patent rights can be found in the PATENTS file in the same directory. 8091 * 8092 */ 8093 8094 'use strict'; 8095 8096 var _prodInvariant = _dereq_(125); 8097 8098 var invariant = _dereq_(150); 8099 8100 /** 8101 * Return the lowest common ancestor of A and B, or null if they are in 8102 * different trees. 8103 */ 8104 function getLowestCommonAncestor(instA, instB) { 8105 !('_hostNode' in instA) ? "development" !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; 8106 !('_hostNode' in instB) ? "development" !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; 8107 8108 var depthA = 0; 8109 for (var tempA = instA; tempA; tempA = tempA._hostParent) { 8110 depthA++; 8111 } 8112 var depthB = 0; 8113 for (var tempB = instB; tempB; tempB = tempB._hostParent) { 8114 depthB++; 8115 } 8116 8117 // If A is deeper, crawl up. 8118 while (depthA - depthB > 0) { 8119 instA = instA._hostParent; 8120 depthA--; 8121 } 8122 8123 // If B is deeper, crawl up. 8124 while (depthB - depthA > 0) { 8125 instB = instB._hostParent; 8126 depthB--; 8127 } 8128 8129 // Walk in lockstep until we find a match. 8130 var depth = depthA; 8131 while (depth--) { 8132 if (instA === instB) { 8133 return instA; 8134 } 8135 instA = instA._hostParent; 8136 instB = instB._hostParent; 8137 } 8138 return null; 8139 } 8140 8141 /** 8142 * Return if A is an ancestor of B. 8143 */ 8144 function isAncestor(instA, instB) { 8145 !('_hostNode' in instA) ? "development" !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0; 8146 !('_hostNode' in instB) ? "development" !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0; 8147 8148 while (instB) { 8149 if (instB === instA) { 8150 return true; 8151 } 8152 instB = instB._hostParent; 8153 } 8154 return false; 8155 } 8156 8157 /** 8158 * Return the parent instance of the passed-in instance. 8159 */ 8160 function getParentInstance(inst) { 8161 !('_hostNode' in inst) ? "development" !== 'production' ? invariant(false, 'getParentInstance: Invalid argument.') : _prodInvariant('36') : void 0; 8162 8163 return inst._hostParent; 8164 } 8165 8166 /** 8167 * Simulates the traversal of a two-phase, capture/bubble event dispatch. 8168 */ 8169 function traverseTwoPhase(inst, fn, arg) { 8170 var path = []; 8171 while (inst) { 8172 path.push(inst); 8173 inst = inst._hostParent; 8174 } 8175 var i; 8176 for (i = path.length; i-- > 0;) { 8177 fn(path[i], 'captured', arg); 8178 } 8179 for (i = 0; i < path.length; i++) { 8180 fn(path[i], 'bubbled', arg); 8181 } 8182 } 8183 8184 /** 8185 * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that 8186 * should would receive a `mouseEnter` or `mouseLeave` event. 8187 * 8188 * Does not invoke the callback on the nearest common ancestor because nothing 8189 * "entered" or "left" that element. 8190 */ 8191 function traverseEnterLeave(from, to, fn, argFrom, argTo) { 8192 var common = from && to ? getLowestCommonAncestor(from, to) : null; 8193 var pathFrom = []; 8194 while (from && from !== common) { 8195 pathFrom.push(from); 8196 from = from._hostParent; 8197 } 8198 var pathTo = []; 8199 while (to && to !== common) { 8200 pathTo.push(to); 8201 to = to._hostParent; 8202 } 8203 var i; 8204 for (i = 0; i < pathFrom.length; i++) { 8205 fn(pathFrom[i], 'bubbled', argFrom); 8206 } 8207 for (i = pathTo.length; i-- > 0;) { 8208 fn(pathTo[i], 'captured', argTo); 8209 } 8210 } 8211 8212 module.exports = { 8213 isAncestor: isAncestor, 8214 getLowestCommonAncestor: getLowestCommonAncestor, 8215 getParentInstance: getParentInstance, 8216 traverseTwoPhase: traverseTwoPhase, 8217 traverseEnterLeave: traverseEnterLeave 8218 }; 8219 },{"125":125,"150":150}],48:[function(_dereq_,module,exports){ 8220 /** 8221 * Copyright 2013-present, Facebook, Inc. 8222 * All rights reserved. 8223 * 8224 * This source code is licensed under the BSD-style license found in the 8225 * LICENSE file in the root directory of this source tree. An additional grant 8226 * of patent rights can be found in the PATENTS file in the same directory. 8227 * 8228 */ 8229 8230 'use strict'; 8231 8232 var _assign = _dereq_(158); 8233 8234 var ReactDOM = _dereq_(31); 8235 8236 var ReactDOMUMDEntry = _assign({ 8237 __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { 8238 ReactInstanceMap: _dereq_(63) 8239 } 8240 }, ReactDOM); 8241 8242 if ("development" !== 'production') { 8243 _assign(ReactDOMUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, { 8244 // ReactPerf and ReactTestUtils currently only work with the DOM renderer 8245 // so we expose them from here, but only in DEV mode. 8246 ReactPerf: _dereq_(71), 8247 ReactTestUtils: _dereq_(80) 8248 }); 8249 } 8250 8251 module.exports = ReactDOMUMDEntry; 8252 },{"158":158,"31":31,"63":63,"71":71,"80":80}],49:[function(_dereq_,module,exports){ 8253 /** 8254 * Copyright 2013-present, Facebook, Inc. 8255 * All rights reserved. 8256 * 8257 * This source code is licensed under the BSD-style license found in the 8258 * LICENSE file in the root directory of this source tree. An additional grant 8259 * of patent rights can be found in the PATENTS file in the same directory. 8260 * 8261 */ 8262 8263 'use strict'; 8264 8265 var DOMProperty = _dereq_(11); 8266 var EventPluginRegistry = _dereq_(18); 8267 var ReactComponentTreeHook = _dereq_(132); 8268 8269 var warning = _dereq_(157); 8270 8271 if ("development" !== 'production') { 8272 var reactProps = { 8273 children: true, 8274 dangerouslySetInnerHTML: true, 8275 key: true, 8276 ref: true, 8277 8278 autoFocus: true, 8279 defaultValue: true, 8280 valueLink: true, 8281 defaultChecked: true, 8282 checkedLink: true, 8283 innerHTML: true, 8284 suppressContentEditableWarning: true, 8285 onFocusIn: true, 8286 onFocusOut: true 8287 }; 8288 var warnedProperties = {}; 8289 8290 var validateProperty = function (tagName, name, debugID) { 8291 if (DOMProperty.properties.hasOwnProperty(name) || DOMProperty.isCustomAttribute(name)) { 8292 return true; 8293 } 8294 if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) { 8295 return true; 8296 } 8297 if (EventPluginRegistry.registrationNameModules.hasOwnProperty(name)) { 8298 return true; 8299 } 8300 warnedProperties[name] = true; 8301 var lowerCasedName = name.toLowerCase(); 8302 8303 // data-* attributes should be lowercase; suggest the lowercase version 8304 var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null; 8305 8306 var registrationName = EventPluginRegistry.possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? EventPluginRegistry.possibleRegistrationNames[lowerCasedName] : null; 8307 8308 if (standardName != null) { 8309 "development" !== 'production' ? warning(false, 'Unknown DOM property %s. Did you mean %s?%s', name, standardName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; 8310 return true; 8311 } else if (registrationName != null) { 8312 "development" !== 'production' ? warning(false, 'Unknown event handler property %s. Did you mean `%s`?%s', name, registrationName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; 8313 return true; 8314 } else { 8315 // We were unable to guess which prop the user intended. 8316 // It is likely that the user was just blindly spreading/forwarding props 8317 // Components should be careful to only render valid props/attributes. 8318 // Warning will be invoked in warnUnknownProperties to allow grouping. 8319 return false; 8320 } 8321 }; 8322 } 8323 8324 var warnUnknownProperties = function (debugID, element) { 8325 var unknownProps = []; 8326 for (var key in element.props) { 8327 var isValid = validateProperty(element.type, key, debugID); 8328 if (!isValid) { 8329 unknownProps.push(key); 8330 } 8331 } 8332 8333 var unknownPropString = unknownProps.map(function (prop) { 8334 return '`' + prop + '`'; 8335 }).join(', '); 8336 8337 if (unknownProps.length === 1) { 8338 "development" !== 'production' ? warning(false, 'Unknown prop %s on <%s> tag. Remove this prop from the element. ' + 'For details, see https://fb.me/react-unknown-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; 8339 } else if (unknownProps.length > 1) { 8340 "development" !== 'production' ? warning(false, 'Unknown props %s on <%s> tag. Remove these props from the element. ' + 'For details, see https://fb.me/react-unknown-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; 8341 } 8342 }; 8343 8344 function handleElement(debugID, element) { 8345 if (element == null || typeof element.type !== 'string') { 8346 return; 8347 } 8348 if (element.type.indexOf('-') >= 0 || element.props.is) { 8349 return; 8350 } 8351 warnUnknownProperties(debugID, element); 8352 } 8353 8354 var ReactDOMUnknownPropertyHook = { 8355 onBeforeMountComponent: function (debugID, element) { 8356 handleElement(debugID, element); 8357 }, 8358 onBeforeUpdateComponent: function (debugID, element) { 8359 handleElement(debugID, element); 8360 } 8361 }; 8362 8363 module.exports = ReactDOMUnknownPropertyHook; 8364 },{"11":11,"132":132,"157":157,"18":18}],50:[function(_dereq_,module,exports){ 8365 /** 8366 * Copyright 2016-present, Facebook, Inc. 8367 * All rights reserved. 8368 * 8369 * This source code is licensed under the BSD-style license found in the 8370 * LICENSE file in the root directory of this source tree. An additional grant 8371 * of patent rights can be found in the PATENTS file in the same directory. 8372 * 8373 * 8374 */ 8375 8376 'use strict'; 8377 8378 var ReactInvalidSetStateWarningHook = _dereq_(65); 8379 var ReactHostOperationHistoryHook = _dereq_(60); 8380 var ReactComponentTreeHook = _dereq_(132); 8381 var ExecutionEnvironment = _dereq_(136); 8382 8383 var performanceNow = _dereq_(155); 8384 var warning = _dereq_(157); 8385 8386 var hooks = []; 8387 var didHookThrowForEvent = {}; 8388 8389 function callHook(event, fn, context, arg1, arg2, arg3, arg4, arg5) { 8390 try { 8391 fn.call(context, arg1, arg2, arg3, arg4, arg5); 8392 } catch (e) { 8393 "development" !== 'production' ? warning(didHookThrowForEvent[event], 'Exception thrown by hook while handling %s: %s', event, e + '\n' + e.stack) : void 0; 8394 didHookThrowForEvent[event] = true; 8395 } 8396 } 8397 8398 function emitEvent(event, arg1, arg2, arg3, arg4, arg5) { 8399 for (var i = 0; i < hooks.length; i++) { 8400 var hook = hooks[i]; 8401 var fn = hook[event]; 8402 if (fn) { 8403 callHook(event, fn, hook, arg1, arg2, arg3, arg4, arg5); 8404 } 8405 } 8406 } 8407 8408 var isProfiling = false; 8409 var flushHistory = []; 8410 var lifeCycleTimerStack = []; 8411 var currentFlushNesting = 0; 8412 var currentFlushMeasurements = []; 8413 var currentFlushStartTime = 0; 8414 var currentTimerDebugID = null; 8415 var currentTimerStartTime = 0; 8416 var currentTimerNestedFlushDuration = 0; 8417 var currentTimerType = null; 8418 8419 var lifeCycleTimerHasWarned = false; 8420 8421 function clearHistory() { 8422 ReactComponentTreeHook.purgeUnmountedComponents(); 8423 ReactHostOperationHistoryHook.clearHistory(); 8424 } 8425 8426 function getTreeSnapshot(registeredIDs) { 8427 return registeredIDs.reduce(function (tree, id) { 8428 var ownerID = ReactComponentTreeHook.getOwnerID(id); 8429 var parentID = ReactComponentTreeHook.getParentID(id); 8430 tree[id] = { 8431 displayName: ReactComponentTreeHook.getDisplayName(id), 8432 text: ReactComponentTreeHook.getText(id), 8433 updateCount: ReactComponentTreeHook.getUpdateCount(id), 8434 childIDs: ReactComponentTreeHook.getChildIDs(id), 8435 // Text nodes don't have owners but this is close enough. 8436 ownerID: ownerID || parentID && ReactComponentTreeHook.getOwnerID(parentID) || 0, 8437 parentID: parentID 8438 }; 8439 return tree; 8440 }, {}); 8441 } 8442 8443 function resetMeasurements() { 8444 var previousStartTime = currentFlushStartTime; 8445 var previousMeasurements = currentFlushMeasurements; 8446 var previousOperations = ReactHostOperationHistoryHook.getHistory(); 8447 8448 if (currentFlushNesting === 0) { 8449 currentFlushStartTime = 0; 8450 currentFlushMeasurements = []; 8451 clearHistory(); 8452 return; 8453 } 8454 8455 if (previousMeasurements.length || previousOperations.length) { 8456 var registeredIDs = ReactComponentTreeHook.getRegisteredIDs(); 8457 flushHistory.push({ 8458 duration: performanceNow() - previousStartTime, 8459 measurements: previousMeasurements || [], 8460 operations: previousOperations || [], 8461 treeSnapshot: getTreeSnapshot(registeredIDs) 8462 }); 8463 } 8464 8465 clearHistory(); 8466 currentFlushStartTime = performanceNow(); 8467 currentFlushMeasurements = []; 8468 } 8469 8470 function checkDebugID(debugID) { 8471 var allowRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 8472 8473 if (allowRoot && debugID === 0) { 8474 return; 8475 } 8476 if (!debugID) { 8477 "development" !== 'production' ? warning(false, 'ReactDebugTool: debugID may not be empty.') : void 0; 8478 } 8479 } 8480 8481 function beginLifeCycleTimer(debugID, timerType) { 8482 if (currentFlushNesting === 0) { 8483 return; 8484 } 8485 if (currentTimerType && !lifeCycleTimerHasWarned) { 8486 "development" !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'Did not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0; 8487 lifeCycleTimerHasWarned = true; 8488 } 8489 currentTimerStartTime = performanceNow(); 8490 currentTimerNestedFlushDuration = 0; 8491 currentTimerDebugID = debugID; 8492 currentTimerType = timerType; 8493 } 8494 8495 function endLifeCycleTimer(debugID, timerType) { 8496 if (currentFlushNesting === 0) { 8497 return; 8498 } 8499 if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) { 8500 "development" !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0; 8501 lifeCycleTimerHasWarned = true; 8502 } 8503 if (isProfiling) { 8504 currentFlushMeasurements.push({ 8505 timerType: timerType, 8506 instanceID: debugID, 8507 duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration 8508 }); 8509 } 8510 currentTimerStartTime = 0; 8511 currentTimerNestedFlushDuration = 0; 8512 currentTimerDebugID = null; 8513 currentTimerType = null; 8514 } 8515 8516 function pauseCurrentLifeCycleTimer() { 8517 var currentTimer = { 8518 startTime: currentTimerStartTime, 8519 nestedFlushStartTime: performanceNow(), 8520 debugID: currentTimerDebugID, 8521 timerType: currentTimerType 8522 }; 8523 lifeCycleTimerStack.push(currentTimer); 8524 currentTimerStartTime = 0; 8525 currentTimerNestedFlushDuration = 0; 8526 currentTimerDebugID = null; 8527 currentTimerType = null; 8528 } 8529 8530 function resumeCurrentLifeCycleTimer() { 8531 var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(), 8532 startTime = _lifeCycleTimerStack$.startTime, 8533 nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime, 8534 debugID = _lifeCycleTimerStack$.debugID, 8535 timerType = _lifeCycleTimerStack$.timerType; 8536 8537 var nestedFlushDuration = performanceNow() - nestedFlushStartTime; 8538 currentTimerStartTime = startTime; 8539 currentTimerNestedFlushDuration += nestedFlushDuration; 8540 currentTimerDebugID = debugID; 8541 currentTimerType = timerType; 8542 } 8543 8544 var lastMarkTimeStamp = 0; 8545 var canUsePerformanceMeasure = 8546 // $FlowFixMe https://github.com/facebook/flow/issues/2345 8547 typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function'; 8548 8549 function shouldMark(debugID) { 8550 if (!isProfiling || !canUsePerformanceMeasure) { 8551 return false; 8552 } 8553 var element = ReactComponentTreeHook.getElement(debugID); 8554 if (element == null || typeof element !== 'object') { 8555 return false; 8556 } 8557 var isHostElement = typeof element.type === 'string'; 8558 if (isHostElement) { 8559 return false; 8560 } 8561 return true; 8562 } 8563 8564 function markBegin(debugID, markType) { 8565 if (!shouldMark(debugID)) { 8566 return; 8567 } 8568 8569 var markName = debugID + '::' + markType; 8570 lastMarkTimeStamp = performanceNow(); 8571 performance.mark(markName); 8572 } 8573 8574 function markEnd(debugID, markType) { 8575 if (!shouldMark(debugID)) { 8576 return; 8577 } 8578 8579 var markName = debugID + '::' + markType; 8580 var displayName = ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown'; 8581 8582 // Chrome has an issue of dropping markers recorded too fast: 8583 // https://bugs.chromium.org/p/chromium/issues/detail?id=640652 8584 // To work around this, we will not report very small measurements. 8585 // I determined the magic number by tweaking it back and forth. 8586 // 0.05ms was enough to prevent the issue, but I set it to 0.1ms to be safe. 8587 // When the bug is fixed, we can `measure()` unconditionally if we want to. 8588 var timeStamp = performanceNow(); 8589 if (timeStamp - lastMarkTimeStamp > 0.1) { 8590 var measurementName = displayName + ' [' + markType + ']'; 8591 performance.measure(measurementName, markName); 8592 } 8593 8594 performance.clearMarks(markName); 8595 performance.clearMeasures(measurementName); 8596 } 8597 8598 var ReactDebugTool = { 8599 addHook: function (hook) { 8600 hooks.push(hook); 8601 }, 8602 removeHook: function (hook) { 8603 for (var i = 0; i < hooks.length; i++) { 8604 if (hooks[i] === hook) { 8605 hooks.splice(i, 1); 8606 i--; 8607 } 8608 } 8609 }, 8610 isProfiling: function () { 8611 return isProfiling; 8612 }, 8613 beginProfiling: function () { 8614 if (isProfiling) { 8615 return; 8616 } 8617 8618 isProfiling = true; 8619 flushHistory.length = 0; 8620 resetMeasurements(); 8621 ReactDebugTool.addHook(ReactHostOperationHistoryHook); 8622 }, 8623 endProfiling: function () { 8624 if (!isProfiling) { 8625 return; 8626 } 8627 8628 isProfiling = false; 8629 resetMeasurements(); 8630 ReactDebugTool.removeHook(ReactHostOperationHistoryHook); 8631 }, 8632 getFlushHistory: function () { 8633 return flushHistory; 8634 }, 8635 onBeginFlush: function () { 8636 currentFlushNesting++; 8637 resetMeasurements(); 8638 pauseCurrentLifeCycleTimer(); 8639 emitEvent('onBeginFlush'); 8640 }, 8641 onEndFlush: function () { 8642 resetMeasurements(); 8643 currentFlushNesting--; 8644 resumeCurrentLifeCycleTimer(); 8645 emitEvent('onEndFlush'); 8646 }, 8647 onBeginLifeCycleTimer: function (debugID, timerType) { 8648 checkDebugID(debugID); 8649 emitEvent('onBeginLifeCycleTimer', debugID, timerType); 8650 markBegin(debugID, timerType); 8651 beginLifeCycleTimer(debugID, timerType); 8652 }, 8653 onEndLifeCycleTimer: function (debugID, timerType) { 8654 checkDebugID(debugID); 8655 endLifeCycleTimer(debugID, timerType); 8656 markEnd(debugID, timerType); 8657 emitEvent('onEndLifeCycleTimer', debugID, timerType); 8658 }, 8659 onBeginProcessingChildContext: function () { 8660 emitEvent('onBeginProcessingChildContext'); 8661 }, 8662 onEndProcessingChildContext: function () { 8663 emitEvent('onEndProcessingChildContext'); 8664 }, 8665 onHostOperation: function (operation) { 8666 checkDebugID(operation.instanceID); 8667 emitEvent('onHostOperation', operation); 8668 }, 8669 onSetState: function () { 8670 emitEvent('onSetState'); 8671 }, 8672 onSetChildren: function (debugID, childDebugIDs) { 8673 checkDebugID(debugID); 8674 childDebugIDs.forEach(checkDebugID); 8675 emitEvent('onSetChildren', debugID, childDebugIDs); 8676 }, 8677 onBeforeMountComponent: function (debugID, element, parentDebugID) { 8678 checkDebugID(debugID); 8679 checkDebugID(parentDebugID, true); 8680 emitEvent('onBeforeMountComponent', debugID, element, parentDebugID); 8681 markBegin(debugID, 'mount'); 8682 }, 8683 onMountComponent: function (debugID) { 8684 checkDebugID(debugID); 8685 markEnd(debugID, 'mount'); 8686 emitEvent('onMountComponent', debugID); 8687 }, 8688 onBeforeUpdateComponent: function (debugID, element) { 8689 checkDebugID(debugID); 8690 emitEvent('onBeforeUpdateComponent', debugID, element); 8691 markBegin(debugID, 'update'); 8692 }, 8693 onUpdateComponent: function (debugID) { 8694 checkDebugID(debugID); 8695 markEnd(debugID, 'update'); 8696 emitEvent('onUpdateComponent', debugID); 8697 }, 8698 onBeforeUnmountComponent: function (debugID) { 8699 checkDebugID(debugID); 8700 emitEvent('onBeforeUnmountComponent', debugID); 8701 markBegin(debugID, 'unmount'); 8702 }, 8703 onUnmountComponent: function (debugID) { 8704 checkDebugID(debugID); 8705 markEnd(debugID, 'unmount'); 8706 emitEvent('onUnmountComponent', debugID); 8707 }, 8708 onTestEvent: function () { 8709 emitEvent('onTestEvent'); 8710 } 8711 }; 8712 8713 // TODO remove these when RN/www gets updated 8714 ReactDebugTool.addDevtool = ReactDebugTool.addHook; 8715 ReactDebugTool.removeDevtool = ReactDebugTool.removeHook; 8716 8717 ReactDebugTool.addHook(ReactInvalidSetStateWarningHook); 8718 ReactDebugTool.addHook(ReactComponentTreeHook); 8719 var url = ExecutionEnvironment.canUseDOM && window.location.href || ''; 8720 if (/[?&]react_perf\b/.test(url)) { 8721 ReactDebugTool.beginProfiling(); 8722 } 8723 8724 module.exports = ReactDebugTool; 8725 },{"132":132,"136":136,"155":155,"157":157,"60":60,"65":65}],51:[function(_dereq_,module,exports){ 8726 /** 8727 * Copyright 2013-present, Facebook, Inc. 8728 * All rights reserved. 8729 * 8730 * This source code is licensed under the BSD-style license found in the 8731 * LICENSE file in the root directory of this source tree. An additional grant 8732 * of patent rights can be found in the PATENTS file in the same directory. 8733 * 8734 */ 8735 8736 'use strict'; 8737 8738 var _assign = _dereq_(158); 8739 8740 var ReactUpdates = _dereq_(82); 8741 var Transaction = _dereq_(100); 8742 8743 var emptyFunction = _dereq_(142); 8744 8745 var RESET_BATCHED_UPDATES = { 8746 initialize: emptyFunction, 8747 close: function () { 8748 ReactDefaultBatchingStrategy.isBatchingUpdates = false; 8749 } 8750 }; 8751 8752 var FLUSH_BATCHED_UPDATES = { 8753 initialize: emptyFunction, 8754 close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates) 8755 }; 8756 8757 var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES]; 8758 8759 function ReactDefaultBatchingStrategyTransaction() { 8760 this.reinitializeTransaction(); 8761 } 8762 8763 _assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction, { 8764 getTransactionWrappers: function () { 8765 return TRANSACTION_WRAPPERS; 8766 } 8767 }); 8768 8769 var transaction = new ReactDefaultBatchingStrategyTransaction(); 8770 8771 var ReactDefaultBatchingStrategy = { 8772 isBatchingUpdates: false, 8773 8774 /** 8775 * Call the provided function in a context within which calls to `setState` 8776 * and friends are batched such that components aren't updated unnecessarily. 8777 */ 8778 batchedUpdates: function (callback, a, b, c, d, e) { 8779 var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates; 8780 8781 ReactDefaultBatchingStrategy.isBatchingUpdates = true; 8782 8783 // The code is written this way to avoid extra allocations 8784 if (alreadyBatchingUpdates) { 8785 return callback(a, b, c, d, e); 8786 } else { 8787 return transaction.perform(callback, null, a, b, c, d, e); 8788 } 8789 } 8790 }; 8791 8792 module.exports = ReactDefaultBatchingStrategy; 8793 },{"100":100,"142":142,"158":158,"82":82}],52:[function(_dereq_,module,exports){ 8794 /** 8795 * Copyright 2013-present, Facebook, Inc. 8796 * All rights reserved. 8797 * 8798 * This source code is licensed under the BSD-style license found in the 8799 * LICENSE file in the root directory of this source tree. An additional grant 8800 * of patent rights can be found in the PATENTS file in the same directory. 8801 * 8802 */ 8803 8804 'use strict'; 8805 8806 var ARIADOMPropertyConfig = _dereq_(1); 8807 var BeforeInputEventPlugin = _dereq_(3); 8808 var ChangeEventPlugin = _dereq_(7); 8809 var DefaultEventPluginOrder = _dereq_(14); 8810 var EnterLeaveEventPlugin = _dereq_(15); 8811 var HTMLDOMPropertyConfig = _dereq_(22); 8812 var ReactComponentBrowserEnvironment = _dereq_(28); 8813 var ReactDOMComponent = _dereq_(32); 8814 var ReactDOMComponentTree = _dereq_(34); 8815 var ReactDOMEmptyComponent = _dereq_(36); 8816 var ReactDOMTreeTraversal = _dereq_(47); 8817 var ReactDOMTextComponent = _dereq_(45); 8818 var ReactDefaultBatchingStrategy = _dereq_(51); 8819 var ReactEventListener = _dereq_(57); 8820 var ReactInjection = _dereq_(61); 8821 var ReactReconcileTransaction = _dereq_(74); 8822 var SVGDOMPropertyConfig = _dereq_(84); 8823 var SelectEventPlugin = _dereq_(85); 8824 var SimpleEventPlugin = _dereq_(86); 8825 8826 var alreadyInjected = false; 8827 8828 function inject() { 8829 if (alreadyInjected) { 8830 // TODO: This is currently true because these injections are shared between 8831 // the client and the server package. They should be built independently 8832 // and not share any injection state. Then this problem will be solved. 8833 return; 8834 } 8835 alreadyInjected = true; 8836 8837 ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener); 8838 8839 /** 8840 * Inject modules for resolving DOM hierarchy and plugin ordering. 8841 */ 8842 ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder); 8843 ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree); 8844 ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal); 8845 8846 /** 8847 * Some important event plugins included by default (without having to require 8848 * them). 8849 */ 8850 ReactInjection.EventPluginHub.injectEventPluginsByName({ 8851 SimpleEventPlugin: SimpleEventPlugin, 8852 EnterLeaveEventPlugin: EnterLeaveEventPlugin, 8853 ChangeEventPlugin: ChangeEventPlugin, 8854 SelectEventPlugin: SelectEventPlugin, 8855 BeforeInputEventPlugin: BeforeInputEventPlugin 8856 }); 8857 8858 ReactInjection.HostComponent.injectGenericComponentClass(ReactDOMComponent); 8859 8860 ReactInjection.HostComponent.injectTextComponentClass(ReactDOMTextComponent); 8861 8862 ReactInjection.DOMProperty.injectDOMPropertyConfig(ARIADOMPropertyConfig); 8863 ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig); 8864 ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig); 8865 8866 ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) { 8867 return new ReactDOMEmptyComponent(instantiate); 8868 }); 8869 8870 ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction); 8871 ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy); 8872 8873 ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment); 8874 } 8875 8876 module.exports = { 8877 inject: inject 8878 }; 8879 },{"1":1,"14":14,"15":15,"22":22,"28":28,"3":3,"32":32,"34":34,"36":36,"45":45,"47":47,"51":51,"57":57,"61":61,"7":7,"74":74,"84":84,"85":85,"86":86}],53:[function(_dereq_,module,exports){ 8880 /** 8881 * Copyright 2014-present, Facebook, Inc. 8882 * All rights reserved. 8883 * 8884 * This source code is licensed under the BSD-style license found in the 8885 * LICENSE file in the root directory of this source tree. An additional grant 8886 * of patent rights can be found in the PATENTS file in the same directory. 8887 * 8888 * 8889 */ 8890 8891 'use strict'; 8892 8893 // The Symbol used to tag the ReactElement type. If there is no native Symbol 8894 // nor polyfill, then a plain number is used for performance. 8895 8896 var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; 8897 8898 module.exports = REACT_ELEMENT_TYPE; 8899 },{}],54:[function(_dereq_,module,exports){ 8900 /** 8901 * Copyright 2014-present, Facebook, Inc. 8902 * All rights reserved. 8903 * 8904 * This source code is licensed under the BSD-style license found in the 8905 * LICENSE file in the root directory of this source tree. An additional grant 8906 * of patent rights can be found in the PATENTS file in the same directory. 8907 * 8908 */ 8909 8910 'use strict'; 8911 8912 var emptyComponentFactory; 8913 8914 var ReactEmptyComponentInjection = { 8915 injectEmptyComponentFactory: function (factory) { 8916 emptyComponentFactory = factory; 8917 } 8918 }; 8919 8920 var ReactEmptyComponent = { 8921 create: function (instantiate) { 8922 return emptyComponentFactory(instantiate); 8923 } 8924 }; 8925 8926 ReactEmptyComponent.injection = ReactEmptyComponentInjection; 8927 8928 module.exports = ReactEmptyComponent; 8929 },{}],55:[function(_dereq_,module,exports){ 8930 /** 8931 * Copyright 2013-present, Facebook, Inc. 8932 * All rights reserved. 8933 * 8934 * This source code is licensed under the BSD-style license found in the 8935 * LICENSE file in the root directory of this source tree. An additional grant 8936 * of patent rights can be found in the PATENTS file in the same directory. 8937 * 8938 * 8939 */ 8940 8941 'use strict'; 8942 8943 var caughtError = null; 8944 8945 /** 8946 * Call a function while guarding against errors that happens within it. 8947 * 8948 * @param {String} name of the guard to use for logging or debugging 8949 * @param {Function} func The function to invoke 8950 * @param {*} a First argument 8951 * @param {*} b Second argument 8952 */ 8953 function invokeGuardedCallback(name, func, a) { 8954 try { 8955 func(a); 8956 } catch (x) { 8957 if (caughtError === null) { 8958 caughtError = x; 8959 } 8960 } 8961 } 8962 8963 var ReactErrorUtils = { 8964 invokeGuardedCallback: invokeGuardedCallback, 8965 8966 /** 8967 * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event 8968 * handler are sure to be rethrown by rethrowCaughtError. 8969 */ 8970 invokeGuardedCallbackWithCatch: invokeGuardedCallback, 8971 8972 /** 8973 * During execution of guarded functions we will capture the first error which 8974 * we will rethrow to be handled by the top level error handler. 8975 */ 8976 rethrowCaughtError: function () { 8977 if (caughtError) { 8978 var error = caughtError; 8979 caughtError = null; 8980 throw error; 8981 } 8982 } 8983 }; 8984 8985 if ("development" !== 'production') { 8986 /** 8987 * To help development we can get better devtools integration by simulating a 8988 * real browser event. 8989 */ 8990 if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { 8991 var fakeNode = document.createElement('react'); 8992 ReactErrorUtils.invokeGuardedCallback = function (name, func, a) { 8993 var boundFunc = func.bind(null, a); 8994 var evtType = 'react-' + name; 8995 fakeNode.addEventListener(evtType, boundFunc, false); 8996 var evt = document.createEvent('Event'); 8997 // $FlowFixMe https://github.com/facebook/flow/issues/2336 8998 evt.initEvent(evtType, false, false); 8999 fakeNode.dispatchEvent(evt); 9000 fakeNode.removeEventListener(evtType, boundFunc, false); 9001 }; 9002 } 9003 } 9004 9005 module.exports = ReactErrorUtils; 9006 },{}],56:[function(_dereq_,module,exports){ 9007 /** 9008 * Copyright 2013-present, Facebook, Inc. 9009 * All rights reserved. 9010 * 9011 * This source code is licensed under the BSD-style license found in the 9012 * LICENSE file in the root directory of this source tree. An additional grant 9013 * of patent rights can be found in the PATENTS file in the same directory. 9014 * 9015 */ 9016 9017 'use strict'; 9018 9019 var EventPluginHub = _dereq_(17); 9020 9021 function runEventQueueInBatch(events) { 9022 EventPluginHub.enqueueEvents(events); 9023 EventPluginHub.processEventQueue(false); 9024 } 9025 9026 var ReactEventEmitterMixin = { 9027 9028 /** 9029 * Streams a fired top-level event to `EventPluginHub` where plugins have the 9030 * opportunity to create `ReactEvent`s to be dispatched. 9031 */ 9032 handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { 9033 var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); 9034 runEventQueueInBatch(events); 9035 } 9036 }; 9037 9038 module.exports = ReactEventEmitterMixin; 9039 },{"17":17}],57:[function(_dereq_,module,exports){ 9040 /** 9041 * Copyright 2013-present, Facebook, Inc. 9042 * All rights reserved. 9043 * 9044 * This source code is licensed under the BSD-style license found in the 9045 * LICENSE file in the root directory of this source tree. An additional grant 9046 * of patent rights can be found in the PATENTS file in the same directory. 9047 * 9048 */ 9049 9050 'use strict'; 9051 9052 var _assign = _dereq_(158); 9053 9054 var EventListener = _dereq_(135); 9055 var ExecutionEnvironment = _dereq_(136); 9056 var PooledClass = _dereq_(25); 9057 var ReactDOMComponentTree = _dereq_(34); 9058 var ReactUpdates = _dereq_(82); 9059 9060 var getEventTarget = _dereq_(114); 9061 var getUnboundedScrollPosition = _dereq_(147); 9062 9063 /** 9064 * Find the deepest React component completely containing the root of the 9065 * passed-in instance (for use when entire React trees are nested within each 9066 * other). If React trees are not nested, returns null. 9067 */ 9068 function findParent(inst) { 9069 // TODO: It may be a good idea to cache this to prevent unnecessary DOM 9070 // traversal, but caching is difficult to do correctly without using a 9071 // mutation observer to listen for all DOM changes. 9072 while (inst._hostParent) { 9073 inst = inst._hostParent; 9074 } 9075 var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst); 9076 var container = rootNode.parentNode; 9077 return ReactDOMComponentTree.getClosestInstanceFromNode(container); 9078 } 9079 9080 // Used to store ancestor hierarchy in top level callback 9081 function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) { 9082 this.topLevelType = topLevelType; 9083 this.nativeEvent = nativeEvent; 9084 this.ancestors = []; 9085 } 9086 _assign(TopLevelCallbackBookKeeping.prototype, { 9087 destructor: function () { 9088 this.topLevelType = null; 9089 this.nativeEvent = null; 9090 this.ancestors.length = 0; 9091 } 9092 }); 9093 PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler); 9094 9095 function handleTopLevelImpl(bookKeeping) { 9096 var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent); 9097 var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget); 9098 9099 // Loop through the hierarchy, in case there's any nested components. 9100 // It's important that we build the array of ancestors before calling any 9101 // event handlers, because event handlers can modify the DOM, leading to 9102 // inconsistencies with ReactMount's node cache. See #1105. 9103 var ancestor = targetInst; 9104 do { 9105 bookKeeping.ancestors.push(ancestor); 9106 ancestor = ancestor && findParent(ancestor); 9107 } while (ancestor); 9108 9109 for (var i = 0; i < bookKeeping.ancestors.length; i++) { 9110 targetInst = bookKeeping.ancestors[i]; 9111 ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent)); 9112 } 9113 } 9114 9115 function scrollValueMonitor(cb) { 9116 var scrollPosition = getUnboundedScrollPosition(window); 9117 cb(scrollPosition); 9118 } 9119 9120 var ReactEventListener = { 9121 _enabled: true, 9122 _handleTopLevel: null, 9123 9124 WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null, 9125 9126 setHandleTopLevel: function (handleTopLevel) { 9127 ReactEventListener._handleTopLevel = handleTopLevel; 9128 }, 9129 9130 setEnabled: function (enabled) { 9131 ReactEventListener._enabled = !!enabled; 9132 }, 9133 9134 isEnabled: function () { 9135 return ReactEventListener._enabled; 9136 }, 9137 9138 /** 9139 * Traps top-level events by using event bubbling. 9140 * 9141 * @param {string} topLevelType Record from `EventConstants`. 9142 * @param {string} handlerBaseName Event name (e.g. "click"). 9143 * @param {object} element Element on which to attach listener. 9144 * @return {?object} An object with a remove function which will forcefully 9145 * remove the listener. 9146 * @internal 9147 */ 9148 trapBubbledEvent: function (topLevelType, handlerBaseName, element) { 9149 if (!element) { 9150 return null; 9151 } 9152 return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType)); 9153 }, 9154 9155 /** 9156 * Traps a top-level event by using event capturing. 9157 * 9158 * @param {string} topLevelType Record from `EventConstants`. 9159 * @param {string} handlerBaseName Event name (e.g. "click"). 9160 * @param {object} element Element on which to attach listener. 9161 * @return {?object} An object with a remove function which will forcefully 9162 * remove the listener. 9163 * @internal 9164 */ 9165 trapCapturedEvent: function (topLevelType, handlerBaseName, element) { 9166 if (!element) { 9167 return null; 9168 } 9169 return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType)); 9170 }, 9171 9172 monitorScrollValue: function (refresh) { 9173 var callback = scrollValueMonitor.bind(null, refresh); 9174 EventListener.listen(window, 'scroll', callback); 9175 }, 9176 9177 dispatchEvent: function (topLevelType, nativeEvent) { 9178 if (!ReactEventListener._enabled) { 9179 return; 9180 } 9181 9182 var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent); 9183 try { 9184 // Event queue being processed in the same cycle allows 9185 // `preventDefault`. 9186 ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping); 9187 } finally { 9188 TopLevelCallbackBookKeeping.release(bookKeeping); 9189 } 9190 } 9191 }; 9192 9193 module.exports = ReactEventListener; 9194 },{"114":114,"135":135,"136":136,"147":147,"158":158,"25":25,"34":34,"82":82}],58:[function(_dereq_,module,exports){ 9195 /** 9196 * Copyright 2013-present, Facebook, Inc. 9197 * All rights reserved. 9198 * 9199 * This source code is licensed under the BSD-style license found in the 9200 * LICENSE file in the root directory of this source tree. An additional grant 9201 * of patent rights can be found in the PATENTS file in the same directory. 9202 * 9203 * 9204 */ 9205 9206 'use strict'; 9207 9208 var ReactFeatureFlags = { 9209 // When true, call console.time() before and .timeEnd() after each top-level 9210 // render (both initial renders and updates). Useful when looking at prod-mode 9211 // timeline profiles in Chrome, for example. 9212 logTopLevelRenders: false 9213 }; 9214 9215 module.exports = ReactFeatureFlags; 9216 },{}],59:[function(_dereq_,module,exports){ 9217 /** 9218 * Copyright 2014-present, Facebook, Inc. 9219 * All rights reserved. 9220 * 9221 * This source code is licensed under the BSD-style license found in the 9222 * LICENSE file in the root directory of this source tree. An additional grant 9223 * of patent rights can be found in the PATENTS file in the same directory. 9224 * 9225 */ 9226 9227 'use strict'; 9228 9229 var _prodInvariant = _dereq_(125), 9230 _assign = _dereq_(158); 9231 9232 var invariant = _dereq_(150); 9233 9234 var genericComponentClass = null; 9235 // This registry keeps track of wrapper classes around host tags. 9236 var tagToComponentClass = {}; 9237 var textComponentClass = null; 9238 9239 var ReactHostComponentInjection = { 9240 // This accepts a class that receives the tag string. This is a catch all 9241 // that can render any kind of tag. 9242 injectGenericComponentClass: function (componentClass) { 9243 genericComponentClass = componentClass; 9244 }, 9245 // This accepts a text component class that takes the text string to be 9246 // rendered as props. 9247 injectTextComponentClass: function (componentClass) { 9248 textComponentClass = componentClass; 9249 }, 9250 // This accepts a keyed object with classes as values. Each key represents a 9251 // tag. That particular tag will use this class instead of the generic one. 9252 injectComponentClasses: function (componentClasses) { 9253 _assign(tagToComponentClass, componentClasses); 9254 } 9255 }; 9256 9257 /** 9258 * Get a host internal component class for a specific tag. 9259 * 9260 * @param {ReactElement} element The element to create. 9261 * @return {function} The internal class constructor function. 9262 */ 9263 function createInternalComponent(element) { 9264 !genericComponentClass ? "development" !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : _prodInvariant('111', element.type) : void 0; 9265 return new genericComponentClass(element); 9266 } 9267 9268 /** 9269 * @param {ReactText} text 9270 * @return {ReactComponent} 9271 */ 9272 function createInstanceForText(text) { 9273 return new textComponentClass(text); 9274 } 9275 9276 /** 9277 * @param {ReactComponent} component 9278 * @return {boolean} 9279 */ 9280 function isTextComponent(component) { 9281 return component instanceof textComponentClass; 9282 } 9283 9284 var ReactHostComponent = { 9285 createInternalComponent: createInternalComponent, 9286 createInstanceForText: createInstanceForText, 9287 isTextComponent: isTextComponent, 9288 injection: ReactHostComponentInjection 9289 }; 9290 9291 module.exports = ReactHostComponent; 9292 },{"125":125,"150":150,"158":158}],60:[function(_dereq_,module,exports){ 9293 /** 9294 * Copyright 2016-present, Facebook, Inc. 9295 * All rights reserved. 9296 * 9297 * This source code is licensed under the BSD-style license found in the 9298 * LICENSE file in the root directory of this source tree. An additional grant 9299 * of patent rights can be found in the PATENTS file in the same directory. 9300 * 9301 * 9302 */ 9303 9304 'use strict'; 9305 9306 var history = []; 9307 9308 var ReactHostOperationHistoryHook = { 9309 onHostOperation: function (operation) { 9310 history.push(operation); 9311 }, 9312 clearHistory: function () { 9313 if (ReactHostOperationHistoryHook._preventClearing) { 9314 // Should only be used for tests. 9315 return; 9316 } 9317 9318 history = []; 9319 }, 9320 getHistory: function () { 9321 return history; 9322 } 9323 }; 9324 9325 module.exports = ReactHostOperationHistoryHook; 9326 },{}],61:[function(_dereq_,module,exports){ 9327 /** 9328 * Copyright 2013-present, Facebook, Inc. 9329 * All rights reserved. 9330 * 9331 * This source code is licensed under the BSD-style license found in the 9332 * LICENSE file in the root directory of this source tree. An additional grant 9333 * of patent rights can be found in the PATENTS file in the same directory. 9334 * 9335 */ 9336 9337 'use strict'; 9338 9339 var DOMProperty = _dereq_(11); 9340 var EventPluginHub = _dereq_(17); 9341 var EventPluginUtils = _dereq_(19); 9342 var ReactComponentEnvironment = _dereq_(29); 9343 var ReactEmptyComponent = _dereq_(54); 9344 var ReactBrowserEventEmitter = _dereq_(26); 9345 var ReactHostComponent = _dereq_(59); 9346 var ReactUpdates = _dereq_(82); 9347 9348 var ReactInjection = { 9349 Component: ReactComponentEnvironment.injection, 9350 DOMProperty: DOMProperty.injection, 9351 EmptyComponent: ReactEmptyComponent.injection, 9352 EventPluginHub: EventPluginHub.injection, 9353 EventPluginUtils: EventPluginUtils.injection, 9354 EventEmitter: ReactBrowserEventEmitter.injection, 9355 HostComponent: ReactHostComponent.injection, 9356 Updates: ReactUpdates.injection 9357 }; 9358 9359 module.exports = ReactInjection; 9360 },{"11":11,"17":17,"19":19,"26":26,"29":29,"54":54,"59":59,"82":82}],62:[function(_dereq_,module,exports){ 9361 /** 9362 * Copyright 2013-present, Facebook, Inc. 9363 * All rights reserved. 9364 * 9365 * This source code is licensed under the BSD-style license found in the 9366 * LICENSE file in the root directory of this source tree. An additional grant 9367 * of patent rights can be found in the PATENTS file in the same directory. 9368 * 9369 */ 9370 9371 'use strict'; 9372 9373 var ReactDOMSelection = _dereq_(44); 9374 9375 var containsNode = _dereq_(139); 9376 var focusNode = _dereq_(144); 9377 var getActiveElement = _dereq_(145); 9378 9379 function isInDocument(node) { 9380 return containsNode(document.documentElement, node); 9381 } 9382 9383 /** 9384 * @ReactInputSelection: React input selection module. Based on Selection.js, 9385 * but modified to be suitable for react and has a couple of bug fixes (doesn't 9386 * assume buttons have range selections allowed). 9387 * Input selection module for React. 9388 */ 9389 var ReactInputSelection = { 9390 9391 hasSelectionCapabilities: function (elem) { 9392 var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); 9393 return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true'); 9394 }, 9395 9396 getSelectionInformation: function () { 9397 var focusedElem = getActiveElement(); 9398 return { 9399 focusedElem: focusedElem, 9400 selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null 9401 }; 9402 }, 9403 9404 /** 9405 * @restoreSelection: If any selection information was potentially lost, 9406 * restore it. This is useful when performing operations that could remove dom 9407 * nodes and place them back in, resulting in focus being lost. 9408 */ 9409 restoreSelection: function (priorSelectionInformation) { 9410 var curFocusedElem = getActiveElement(); 9411 var priorFocusedElem = priorSelectionInformation.focusedElem; 9412 var priorSelectionRange = priorSelectionInformation.selectionRange; 9413 if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { 9414 if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) { 9415 ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange); 9416 } 9417 focusNode(priorFocusedElem); 9418 } 9419 }, 9420 9421 /** 9422 * @getSelection: Gets the selection bounds of a focused textarea, input or 9423 * contentEditable node. 9424 * -@input: Look up selection bounds of this input 9425 * -@return {start: selectionStart, end: selectionEnd} 9426 */ 9427 getSelection: function (input) { 9428 var selection; 9429 9430 if ('selectionStart' in input) { 9431 // Modern browser with input or textarea. 9432 selection = { 9433 start: input.selectionStart, 9434 end: input.selectionEnd 9435 }; 9436 } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { 9437 // IE8 input. 9438 var range = document.selection.createRange(); 9439 // There can only be one selection per document in IE, so it must 9440 // be in our element. 9441 if (range.parentElement() === input) { 9442 selection = { 9443 start: -range.moveStart('character', -input.value.length), 9444 end: -range.moveEnd('character', -input.value.length) 9445 }; 9446 } 9447 } else { 9448 // Content editable or old IE textarea. 9449 selection = ReactDOMSelection.getOffsets(input); 9450 } 9451 9452 return selection || { start: 0, end: 0 }; 9453 }, 9454 9455 /** 9456 * @setSelection: Sets the selection bounds of a textarea or input and focuses 9457 * the input. 9458 * -@input Set selection bounds of this input or textarea 9459 * -@offsets Object of same form that is returned from get* 9460 */ 9461 setSelection: function (input, offsets) { 9462 var start = offsets.start; 9463 var end = offsets.end; 9464 if (end === undefined) { 9465 end = start; 9466 } 9467 9468 if ('selectionStart' in input) { 9469 input.selectionStart = start; 9470 input.selectionEnd = Math.min(end, input.value.length); 9471 } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { 9472 var range = input.createTextRange(); 9473 range.collapse(true); 9474 range.moveStart('character', start); 9475 range.moveEnd('character', end - start); 9476 range.select(); 9477 } else { 9478 ReactDOMSelection.setOffsets(input, offsets); 9479 } 9480 } 9481 }; 9482 9483 module.exports = ReactInputSelection; 9484 },{"139":139,"144":144,"145":145,"44":44}],63:[function(_dereq_,module,exports){ 9485 /** 9486 * Copyright 2013-present, Facebook, Inc. 9487 * All rights reserved. 9488 * 9489 * This source code is licensed under the BSD-style license found in the 9490 * LICENSE file in the root directory of this source tree. An additional grant 9491 * of patent rights can be found in the PATENTS file in the same directory. 9492 * 9493 */ 9494 9495 'use strict'; 9496 9497 /** 9498 * `ReactInstanceMap` maintains a mapping from a public facing stateful 9499 * instance (key) and the internal representation (value). This allows public 9500 * methods to accept the user facing instance as an argument and map them back 9501 * to internal methods. 9502 */ 9503 9504 // TODO: Replace this with ES6: var ReactInstanceMap = new Map(); 9505 9506 var ReactInstanceMap = { 9507 9508 /** 9509 * This API should be called `delete` but we'd have to make sure to always 9510 * transform these to strings for IE support. When this transform is fully 9511 * supported we can rename it. 9512 */ 9513 remove: function (key) { 9514 key._reactInternalInstance = undefined; 9515 }, 9516 9517 get: function (key) { 9518 return key._reactInternalInstance; 9519 }, 9520 9521 has: function (key) { 9522 return key._reactInternalInstance !== undefined; 9523 }, 9524 9525 set: function (key, value) { 9526 key._reactInternalInstance = value; 9527 } 9528 9529 }; 9530 9531 module.exports = ReactInstanceMap; 9532 },{}],64:[function(_dereq_,module,exports){ 9533 /** 9534 * Copyright 2016-present, Facebook, Inc. 9535 * All rights reserved. 9536 * 9537 * This source code is licensed under the BSD-style license found in the 9538 * LICENSE file in the root directory of this source tree. An additional grant 9539 * of patent rights can be found in the PATENTS file in the same directory. 9540 * 9541 * 9542 */ 9543 9544 'use strict'; 9545 9546 // Trust the developer to only use ReactInstrumentation with a __DEV__ check 9547 9548 var debugTool = null; 9549 9550 if ("development" !== 'production') { 9551 var ReactDebugTool = _dereq_(50); 9552 debugTool = ReactDebugTool; 9553 } 9554 9555 module.exports = { debugTool: debugTool }; 9556 },{"50":50}],65:[function(_dereq_,module,exports){ 9557 /** 9558 * Copyright 2016-present, Facebook, Inc. 9559 * All rights reserved. 9560 * 9561 * This source code is licensed under the BSD-style license found in the 9562 * LICENSE file in the root directory of this source tree. An additional grant 9563 * of patent rights can be found in the PATENTS file in the same directory. 9564 * 9565 * 9566 */ 9567 9568 'use strict'; 9569 9570 var warning = _dereq_(157); 9571 9572 if ("development" !== 'production') { 9573 var processingChildContext = false; 9574 9575 var warnInvalidSetState = function () { 9576 "development" !== 'production' ? warning(!processingChildContext, 'setState(...): Cannot call setState() inside getChildContext()') : void 0; 9577 }; 9578 } 9579 9580 var ReactInvalidSetStateWarningHook = { 9581 onBeginProcessingChildContext: function () { 9582 processingChildContext = true; 9583 }, 9584 onEndProcessingChildContext: function () { 9585 processingChildContext = false; 9586 }, 9587 onSetState: function () { 9588 warnInvalidSetState(); 9589 } 9590 }; 9591 9592 module.exports = ReactInvalidSetStateWarningHook; 9593 },{"157":157}],66:[function(_dereq_,module,exports){ 9594 /** 9595 * Copyright 2013-present, Facebook, Inc. 9596 * All rights reserved. 9597 * 9598 * This source code is licensed under the BSD-style license found in the 9599 * LICENSE file in the root directory of this source tree. An additional grant 9600 * of patent rights can be found in the PATENTS file in the same directory. 9601 * 9602 */ 9603 9604 'use strict'; 9605 9606 var adler32 = _dereq_(103); 9607 9608 var TAG_END = /\/?>/; 9609 var COMMENT_START = /^<\!\-\-/; 9610 9611 var ReactMarkupChecksum = { 9612 CHECKSUM_ATTR_NAME: 'data-react-checksum', 9613 9614 /** 9615 * @param {string} markup Markup string 9616 * @return {string} Markup string with checksum attribute attached 9617 */ 9618 addChecksumToMarkup: function (markup) { 9619 var checksum = adler32(markup); 9620 9621 // Add checksum (handle both parent tags, comments and self-closing tags) 9622 if (COMMENT_START.test(markup)) { 9623 return markup; 9624 } else { 9625 return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&'); 9626 } 9627 }, 9628 9629 /** 9630 * @param {string} markup to use 9631 * @param {DOMElement} element root React element 9632 * @returns {boolean} whether or not the markup is the same 9633 */ 9634 canReuseMarkup: function (markup, element) { 9635 var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); 9636 existingChecksum = existingChecksum && parseInt(existingChecksum, 10); 9637 var markupChecksum = adler32(markup); 9638 return markupChecksum === existingChecksum; 9639 } 9640 }; 9641 9642 module.exports = ReactMarkupChecksum; 9643 },{"103":103}],67:[function(_dereq_,module,exports){ 9644 /** 9645 * Copyright 2013-present, Facebook, Inc. 9646 * All rights reserved. 9647 * 9648 * This source code is licensed under the BSD-style license found in the 9649 * LICENSE file in the root directory of this source tree. An additional grant 9650 * of patent rights can be found in the PATENTS file in the same directory. 9651 * 9652 */ 9653 9654 'use strict'; 9655 9656 var _prodInvariant = _dereq_(125); 9657 9658 var DOMLazyTree = _dereq_(9); 9659 var DOMProperty = _dereq_(11); 9660 var React = _dereq_(134); 9661 var ReactBrowserEventEmitter = _dereq_(26); 9662 var ReactCurrentOwner = _dereq_(133); 9663 var ReactDOMComponentTree = _dereq_(34); 9664 var ReactDOMContainerInfo = _dereq_(35); 9665 var ReactDOMFeatureFlags = _dereq_(37); 9666 var ReactFeatureFlags = _dereq_(58); 9667 var ReactInstanceMap = _dereq_(63); 9668 var ReactInstrumentation = _dereq_(64); 9669 var ReactMarkupChecksum = _dereq_(66); 9670 var ReactReconciler = _dereq_(75); 9671 var ReactUpdateQueue = _dereq_(81); 9672 var ReactUpdates = _dereq_(82); 9673 9674 var emptyObject = _dereq_(143); 9675 var instantiateReactComponent = _dereq_(121); 9676 var invariant = _dereq_(150); 9677 var setInnerHTML = _dereq_(127); 9678 var shouldUpdateReactComponent = _dereq_(129); 9679 var warning = _dereq_(157); 9680 9681 var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; 9682 var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME; 9683 9684 var ELEMENT_NODE_TYPE = 1; 9685 var DOC_NODE_TYPE = 9; 9686 var DOCUMENT_FRAGMENT_NODE_TYPE = 11; 9687 9688 var instancesByReactRootID = {}; 9689 9690 /** 9691 * Finds the index of the first character 9692 * that's not common between the two given strings. 9693 * 9694 * @return {number} the index of the character where the strings diverge 9695 */ 9696 function firstDifferenceIndex(string1, string2) { 9697 var minLen = Math.min(string1.length, string2.length); 9698 for (var i = 0; i < minLen; i++) { 9699 if (string1.charAt(i) !== string2.charAt(i)) { 9700 return i; 9701 } 9702 } 9703 return string1.length === string2.length ? -1 : minLen; 9704 } 9705 9706 /** 9707 * @param {DOMElement|DOMDocument} container DOM element that may contain 9708 * a React component 9709 * @return {?*} DOM element that may have the reactRoot ID, or null. 9710 */ 9711 function getReactRootElementInContainer(container) { 9712 if (!container) { 9713 return null; 9714 } 9715 9716 if (container.nodeType === DOC_NODE_TYPE) { 9717 return container.documentElement; 9718 } else { 9719 return container.firstChild; 9720 } 9721 } 9722 9723 function internalGetID(node) { 9724 // If node is something like a window, document, or text node, none of 9725 // which support attributes or a .getAttribute method, gracefully return 9726 // the empty string, as if the attribute were missing. 9727 return node.getAttribute && node.getAttribute(ATTR_NAME) || ''; 9728 } 9729 9730 /** 9731 * Mounts this component and inserts it into the DOM. 9732 * 9733 * @param {ReactComponent} componentInstance The instance to mount. 9734 * @param {DOMElement} container DOM element to mount into. 9735 * @param {ReactReconcileTransaction} transaction 9736 * @param {boolean} shouldReuseMarkup If true, do not insert markup 9737 */ 9738 function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) { 9739 var markerName; 9740 if (ReactFeatureFlags.logTopLevelRenders) { 9741 var wrappedElement = wrapperInstance._currentElement.props.child; 9742 var type = wrappedElement.type; 9743 markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name); 9744 console.time(markerName); 9745 } 9746 9747 var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */ 9748 ); 9749 9750 if (markerName) { 9751 console.timeEnd(markerName); 9752 } 9753 9754 wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance; 9755 ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction); 9756 } 9757 9758 /** 9759 * Batched mount. 9760 * 9761 * @param {ReactComponent} componentInstance The instance to mount. 9762 * @param {DOMElement} container DOM element to mount into. 9763 * @param {boolean} shouldReuseMarkup If true, do not insert markup 9764 */ 9765 function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) { 9766 var transaction = ReactUpdates.ReactReconcileTransaction.getPooled( 9767 /* useCreateElement */ 9768 !shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement); 9769 transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context); 9770 ReactUpdates.ReactReconcileTransaction.release(transaction); 9771 } 9772 9773 /** 9774 * Unmounts a component and removes it from the DOM. 9775 * 9776 * @param {ReactComponent} instance React component instance. 9777 * @param {DOMElement} container DOM element to unmount from. 9778 * @final 9779 * @internal 9780 * @see {ReactMount.unmountComponentAtNode} 9781 */ 9782 function unmountComponentFromNode(instance, container, safely) { 9783 if ("development" !== 'production') { 9784 ReactInstrumentation.debugTool.onBeginFlush(); 9785 } 9786 ReactReconciler.unmountComponent(instance, safely); 9787 if ("development" !== 'production') { 9788 ReactInstrumentation.debugTool.onEndFlush(); 9789 } 9790 9791 if (container.nodeType === DOC_NODE_TYPE) { 9792 container = container.documentElement; 9793 } 9794 9795 // http://jsperf.com/emptying-a-node 9796 while (container.lastChild) { 9797 container.removeChild(container.lastChild); 9798 } 9799 } 9800 9801 /** 9802 * True if the supplied DOM node has a direct React-rendered child that is 9803 * not a React root element. Useful for warning in `render`, 9804 * `unmountComponentAtNode`, etc. 9805 * 9806 * @param {?DOMElement} node The candidate DOM node. 9807 * @return {boolean} True if the DOM element contains a direct child that was 9808 * rendered by React but is not a root element. 9809 * @internal 9810 */ 9811 function hasNonRootReactChild(container) { 9812 var rootEl = getReactRootElementInContainer(container); 9813 if (rootEl) { 9814 var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl); 9815 return !!(inst && inst._hostParent); 9816 } 9817 } 9818 9819 /** 9820 * True if the supplied DOM node is a React DOM element and 9821 * it has been rendered by another copy of React. 9822 * 9823 * @param {?DOMElement} node The candidate DOM node. 9824 * @return {boolean} True if the DOM has been rendered by another copy of React 9825 * @internal 9826 */ 9827 function nodeIsRenderedByOtherInstance(container) { 9828 var rootEl = getReactRootElementInContainer(container); 9829 return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl)); 9830 } 9831 9832 /** 9833 * True if the supplied DOM node is a valid node element. 9834 * 9835 * @param {?DOMElement} node The candidate DOM node. 9836 * @return {boolean} True if the DOM is a valid DOM node. 9837 * @internal 9838 */ 9839 function isValidContainer(node) { 9840 return !!(node && (node.nodeType === ELEMENT_NODE_TYPE || node.nodeType === DOC_NODE_TYPE || node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)); 9841 } 9842 9843 /** 9844 * True if the supplied DOM node is a valid React node element. 9845 * 9846 * @param {?DOMElement} node The candidate DOM node. 9847 * @return {boolean} True if the DOM is a valid React DOM node. 9848 * @internal 9849 */ 9850 function isReactNode(node) { 9851 return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME)); 9852 } 9853 9854 function getHostRootInstanceInContainer(container) { 9855 var rootEl = getReactRootElementInContainer(container); 9856 var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl); 9857 return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null; 9858 } 9859 9860 function getTopLevelWrapperInContainer(container) { 9861 var root = getHostRootInstanceInContainer(container); 9862 return root ? root._hostContainerInfo._topLevelWrapper : null; 9863 } 9864 9865 /** 9866 * Temporary (?) hack so that we can store all top-level pending updates on 9867 * composites instead of having to worry about different types of components 9868 * here. 9869 */ 9870 var topLevelRootCounter = 1; 9871 var TopLevelWrapper = function () { 9872 this.rootID = topLevelRootCounter++; 9873 }; 9874 TopLevelWrapper.prototype.isReactComponent = {}; 9875 if ("development" !== 'production') { 9876 TopLevelWrapper.displayName = 'TopLevelWrapper'; 9877 } 9878 TopLevelWrapper.prototype.render = function () { 9879 return this.props.child; 9880 }; 9881 TopLevelWrapper.isReactTopLevelWrapper = true; 9882 9883 /** 9884 * Mounting is the process of initializing a React component by creating its 9885 * representative DOM elements and inserting them into a supplied `container`. 9886 * Any prior content inside `container` is destroyed in the process. 9887 * 9888 * ReactMount.render( 9889 * component, 9890 * document.getElementById('container') 9891 * ); 9892 * 9893 * <div id="container"> <-- Supplied `container`. 9894 * <div data-reactid=".3"> <-- Rendered reactRoot of React 9895 * // ... component. 9896 * </div> 9897 * </div> 9898 * 9899 * Inside of `container`, the first element rendered is the "reactRoot". 9900 */ 9901 var ReactMount = { 9902 9903 TopLevelWrapper: TopLevelWrapper, 9904 9905 /** 9906 * Used by devtools. The keys are not important. 9907 */ 9908 _instancesByReactRootID: instancesByReactRootID, 9909 9910 /** 9911 * This is a hook provided to support rendering React components while 9912 * ensuring that the apparent scroll position of its `container` does not 9913 * change. 9914 * 9915 * @param {DOMElement} container The `container` being rendered into. 9916 * @param {function} renderCallback This must be called once to do the render. 9917 */ 9918 scrollMonitor: function (container, renderCallback) { 9919 renderCallback(); 9920 }, 9921 9922 /** 9923 * Take a component that's already mounted into the DOM and replace its props 9924 * @param {ReactComponent} prevComponent component instance already in the DOM 9925 * @param {ReactElement} nextElement component instance to render 9926 * @param {DOMElement} container container to render into 9927 * @param {?function} callback function triggered on completion 9928 */ 9929 _updateRootComponent: function (prevComponent, nextElement, nextContext, container, callback) { 9930 ReactMount.scrollMonitor(container, function () { 9931 ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext); 9932 if (callback) { 9933 ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback); 9934 } 9935 }); 9936 9937 return prevComponent; 9938 }, 9939 9940 /** 9941 * Render a new component into the DOM. Hooked by hooks! 9942 * 9943 * @param {ReactElement} nextElement element to render 9944 * @param {DOMElement} container container to render into 9945 * @param {boolean} shouldReuseMarkup if we should skip the markup insertion 9946 * @return {ReactComponent} nextComponent 9947 */ 9948 _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) { 9949 // Various parts of our code (such as ReactCompositeComponent's 9950 // _renderValidatedComponent) assume that calls to render aren't nested; 9951 // verify that that's the case. 9952 "development" !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0; 9953 9954 !isValidContainer(container) ? "development" !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0; 9955 9956 ReactBrowserEventEmitter.ensureScrollValueMonitoring(); 9957 var componentInstance = instantiateReactComponent(nextElement, false); 9958 9959 // The initial render is synchronous but any updates that happen during 9960 // rendering, in componentWillMount or componentDidMount, will be batched 9961 // according to the current batching strategy. 9962 9963 ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context); 9964 9965 var wrapperID = componentInstance._instance.rootID; 9966 instancesByReactRootID[wrapperID] = componentInstance; 9967 9968 return componentInstance; 9969 }, 9970 9971 /** 9972 * Renders a React component into the DOM in the supplied `container`. 9973 * 9974 * If the React component was previously rendered into `container`, this will 9975 * perform an update on it and only mutate the DOM as necessary to reflect the 9976 * latest React component. 9977 * 9978 * @param {ReactComponent} parentComponent The conceptual parent of this render tree. 9979 * @param {ReactElement} nextElement Component element to render. 9980 * @param {DOMElement} container DOM element to render into. 9981 * @param {?function} callback function triggered on completion 9982 * @return {ReactComponent} Component instance rendered in `container`. 9983 */ 9984 renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { 9985 !(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? "development" !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0; 9986 return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback); 9987 }, 9988 9989 _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { 9990 ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render'); 9991 !React.isValidElement(nextElement) ? "development" !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : 9992 // Check if it quacks like an element 9993 nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : _prodInvariant('39', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : void 0; 9994 9995 "development" !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0; 9996 9997 var nextWrappedElement = React.createElement(TopLevelWrapper, { child: nextElement }); 9998 9999 var nextContext; 10000 if (parentComponent) { 10001 var parentInst = ReactInstanceMap.get(parentComponent); 10002 nextContext = parentInst._processChildContext(parentInst._context); 10003 } else { 10004 nextContext = emptyObject; 10005 } 10006 10007 var prevComponent = getTopLevelWrapperInContainer(container); 10008 10009 if (prevComponent) { 10010 var prevWrappedElement = prevComponent._currentElement; 10011 var prevElement = prevWrappedElement.props.child; 10012 if (shouldUpdateReactComponent(prevElement, nextElement)) { 10013 var publicInst = prevComponent._renderedComponent.getPublicInstance(); 10014 var updatedCallback = callback && function () { 10015 callback.call(publicInst); 10016 }; 10017 ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback); 10018 return publicInst; 10019 } else { 10020 ReactMount.unmountComponentAtNode(container); 10021 } 10022 } 10023 10024 var reactRootElement = getReactRootElementInContainer(container); 10025 var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement); 10026 var containerHasNonRootReactChild = hasNonRootReactChild(container); 10027 10028 if ("development" !== 'production') { 10029 "development" !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0; 10030 10031 if (!containerHasReactMarkup || reactRootElement.nextSibling) { 10032 var rootElementSibling = reactRootElement; 10033 while (rootElementSibling) { 10034 if (internalGetID(rootElementSibling)) { 10035 "development" !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : void 0; 10036 break; 10037 } 10038 rootElementSibling = rootElementSibling.nextSibling; 10039 } 10040 } 10041 } 10042 10043 var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild; 10044 var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance(); 10045 if (callback) { 10046 callback.call(component); 10047 } 10048 return component; 10049 }, 10050 10051 /** 10052 * Renders a React component into the DOM in the supplied `container`. 10053 * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render 10054 * 10055 * If the React component was previously rendered into `container`, this will 10056 * perform an update on it and only mutate the DOM as necessary to reflect the 10057 * latest React component. 10058 * 10059 * @param {ReactElement} nextElement Component element to render. 10060 * @param {DOMElement} container DOM element to render into. 10061 * @param {?function} callback function triggered on completion 10062 * @return {ReactComponent} Component instance rendered in `container`. 10063 */ 10064 render: function (nextElement, container, callback) { 10065 return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback); 10066 }, 10067 10068 /** 10069 * Unmounts and destroys the React component rendered in the `container`. 10070 * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode 10071 * 10072 * @param {DOMElement} container DOM element containing a React component. 10073 * @return {boolean} True if a component was found in and unmounted from 10074 * `container` 10075 */ 10076 unmountComponentAtNode: function (container) { 10077 // Various parts of our code (such as ReactCompositeComponent's 10078 // _renderValidatedComponent) assume that calls to render aren't nested; 10079 // verify that that's the case. (Strictly speaking, unmounting won't cause a 10080 // render but we still don't expect to be in a render call here.) 10081 "development" !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0; 10082 10083 !isValidContainer(container) ? "development" !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0; 10084 10085 if ("development" !== 'production') { 10086 "development" !== 'production' ? warning(!nodeIsRenderedByOtherInstance(container), 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by another copy of React.') : void 0; 10087 } 10088 10089 var prevComponent = getTopLevelWrapperInContainer(container); 10090 if (!prevComponent) { 10091 // Check if the node being unmounted was rendered by React, but isn't a 10092 // root node. 10093 var containerHasNonRootReactChild = hasNonRootReactChild(container); 10094 10095 // Check if the container itself is a React root node. 10096 var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME); 10097 10098 if ("development" !== 'production') { 10099 "development" !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0; 10100 } 10101 10102 return false; 10103 } 10104 delete instancesByReactRootID[prevComponent._instance.rootID]; 10105 ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false); 10106 return true; 10107 }, 10108 10109 _mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) { 10110 !isValidContainer(container) ? "development" !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0; 10111 10112 if (shouldReuseMarkup) { 10113 var rootElement = getReactRootElementInContainer(container); 10114 if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) { 10115 ReactDOMComponentTree.precacheNode(instance, rootElement); 10116 return; 10117 } else { 10118 var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); 10119 rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); 10120 10121 var rootMarkup = rootElement.outerHTML; 10122 rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum); 10123 10124 var normalizedMarkup = markup; 10125 if ("development" !== 'production') { 10126 // because rootMarkup is retrieved from the DOM, various normalizations 10127 // will have occurred which will not be present in `markup`. Here, 10128 // insert markup into a <div> or <iframe> depending on the container 10129 // type to perform the same normalizations before comparing. 10130 var normalizer; 10131 if (container.nodeType === ELEMENT_NODE_TYPE) { 10132 normalizer = document.createElement('div'); 10133 normalizer.innerHTML = markup; 10134 normalizedMarkup = normalizer.innerHTML; 10135 } else { 10136 normalizer = document.createElement('iframe'); 10137 document.body.appendChild(normalizer); 10138 normalizer.contentDocument.write(markup); 10139 normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML; 10140 document.body.removeChild(normalizer); 10141 } 10142 } 10143 10144 var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup); 10145 var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20); 10146 10147 !(container.nodeType !== DOC_NODE_TYPE) ? "development" !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s', difference) : _prodInvariant('42', difference) : void 0; 10148 10149 if ("development" !== 'production') { 10150 "development" !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : void 0; 10151 } 10152 } 10153 } 10154 10155 !(container.nodeType !== DOC_NODE_TYPE) ? "development" !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but you didn\'t use server rendering. We can\'t do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('43') : void 0; 10156 10157 if (transaction.useCreateElement) { 10158 while (container.lastChild) { 10159 container.removeChild(container.lastChild); 10160 } 10161 DOMLazyTree.insertTreeBefore(container, markup, null); 10162 } else { 10163 setInnerHTML(container, markup); 10164 ReactDOMComponentTree.precacheNode(instance, container.firstChild); 10165 } 10166 10167 if ("development" !== 'production') { 10168 var hostNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild); 10169 if (hostNode._debugID !== 0) { 10170 ReactInstrumentation.debugTool.onHostOperation({ 10171 instanceID: hostNode._debugID, 10172 type: 'mount', 10173 payload: markup.toString() 10174 }); 10175 } 10176 } 10177 } 10178 }; 10179 10180 module.exports = ReactMount; 10181 },{"11":11,"121":121,"125":125,"127":127,"129":129,"133":133,"134":134,"143":143,"150":150,"157":157,"26":26,"34":34,"35":35,"37":37,"58":58,"63":63,"64":64,"66":66,"75":75,"81":81,"82":82,"9":9}],68:[function(_dereq_,module,exports){ 10182 /** 10183 * Copyright 2013-present, Facebook, Inc. 10184 * All rights reserved. 10185 * 10186 * This source code is licensed under the BSD-style license found in the 10187 * LICENSE file in the root directory of this source tree. An additional grant 10188 * of patent rights can be found in the PATENTS file in the same directory. 10189 * 10190 */ 10191 10192 'use strict'; 10193 10194 var _prodInvariant = _dereq_(125); 10195 10196 var ReactComponentEnvironment = _dereq_(29); 10197 var ReactInstanceMap = _dereq_(63); 10198 var ReactInstrumentation = _dereq_(64); 10199 10200 var ReactCurrentOwner = _dereq_(133); 10201 var ReactReconciler = _dereq_(75); 10202 var ReactChildReconciler = _dereq_(27); 10203 10204 var emptyFunction = _dereq_(142); 10205 var flattenChildren = _dereq_(109); 10206 var invariant = _dereq_(150); 10207 10208 /** 10209 * Make an update for markup to be rendered and inserted at a supplied index. 10210 * 10211 * @param {string} markup Markup that renders into an element. 10212 * @param {number} toIndex Destination index. 10213 * @private 10214 */ 10215 function makeInsertMarkup(markup, afterNode, toIndex) { 10216 // NOTE: Null values reduce hidden classes. 10217 return { 10218 type: 'INSERT_MARKUP', 10219 content: markup, 10220 fromIndex: null, 10221 fromNode: null, 10222 toIndex: toIndex, 10223 afterNode: afterNode 10224 }; 10225 } 10226 10227 /** 10228 * Make an update for moving an existing element to another index. 10229 * 10230 * @param {number} fromIndex Source index of the existing element. 10231 * @param {number} toIndex Destination index of the element. 10232 * @private 10233 */ 10234 function makeMove(child, afterNode, toIndex) { 10235 // NOTE: Null values reduce hidden classes. 10236 return { 10237 type: 'MOVE_EXISTING', 10238 content: null, 10239 fromIndex: child._mountIndex, 10240 fromNode: ReactReconciler.getHostNode(child), 10241 toIndex: toIndex, 10242 afterNode: afterNode 10243 }; 10244 } 10245 10246 /** 10247 * Make an update for removing an element at an index. 10248 * 10249 * @param {number} fromIndex Index of the element to remove. 10250 * @private 10251 */ 10252 function makeRemove(child, node) { 10253 // NOTE: Null values reduce hidden classes. 10254 return { 10255 type: 'REMOVE_NODE', 10256 content: null, 10257 fromIndex: child._mountIndex, 10258 fromNode: node, 10259 toIndex: null, 10260 afterNode: null 10261 }; 10262 } 10263 10264 /** 10265 * Make an update for setting the markup of a node. 10266 * 10267 * @param {string} markup Markup that renders into an element. 10268 * @private 10269 */ 10270 function makeSetMarkup(markup) { 10271 // NOTE: Null values reduce hidden classes. 10272 return { 10273 type: 'SET_MARKUP', 10274 content: markup, 10275 fromIndex: null, 10276 fromNode: null, 10277 toIndex: null, 10278 afterNode: null 10279 }; 10280 } 10281 10282 /** 10283 * Make an update for setting the text content. 10284 * 10285 * @param {string} textContent Text content to set. 10286 * @private 10287 */ 10288 function makeTextContent(textContent) { 10289 // NOTE: Null values reduce hidden classes. 10290 return { 10291 type: 'TEXT_CONTENT', 10292 content: textContent, 10293 fromIndex: null, 10294 fromNode: null, 10295 toIndex: null, 10296 afterNode: null 10297 }; 10298 } 10299 10300 /** 10301 * Push an update, if any, onto the queue. Creates a new queue if none is 10302 * passed and always returns the queue. Mutative. 10303 */ 10304 function enqueue(queue, update) { 10305 if (update) { 10306 queue = queue || []; 10307 queue.push(update); 10308 } 10309 return queue; 10310 } 10311 10312 /** 10313 * Processes any enqueued updates. 10314 * 10315 * @private 10316 */ 10317 function processQueue(inst, updateQueue) { 10318 ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue); 10319 } 10320 10321 var setChildrenForInstrumentation = emptyFunction; 10322 if ("development" !== 'production') { 10323 var getDebugID = function (inst) { 10324 if (!inst._debugID) { 10325 // Check for ART-like instances. TODO: This is silly/gross. 10326 var internal; 10327 if (internal = ReactInstanceMap.get(inst)) { 10328 inst = internal; 10329 } 10330 } 10331 return inst._debugID; 10332 }; 10333 setChildrenForInstrumentation = function (children) { 10334 var debugID = getDebugID(this); 10335 // TODO: React Native empty components are also multichild. 10336 // This means they still get into this method but don't have _debugID. 10337 if (debugID !== 0) { 10338 ReactInstrumentation.debugTool.onSetChildren(debugID, children ? Object.keys(children).map(function (key) { 10339 return children[key]._debugID; 10340 }) : []); 10341 } 10342 }; 10343 } 10344 10345 /** 10346 * ReactMultiChild are capable of reconciling multiple children. 10347 * 10348 * @class ReactMultiChild 10349 * @internal 10350 */ 10351 var ReactMultiChild = { 10352 10353 /** 10354 * Provides common functionality for components that must reconcile multiple 10355 * children. This is used by `ReactDOMComponent` to mount, update, and 10356 * unmount child components. 10357 * 10358 * @lends {ReactMultiChild.prototype} 10359 */ 10360 Mixin: { 10361 10362 _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) { 10363 if ("development" !== 'production') { 10364 var selfDebugID = getDebugID(this); 10365 if (this._currentElement) { 10366 try { 10367 ReactCurrentOwner.current = this._currentElement._owner; 10368 return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context, selfDebugID); 10369 } finally { 10370 ReactCurrentOwner.current = null; 10371 } 10372 } 10373 } 10374 return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context); 10375 }, 10376 10377 _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context) { 10378 var nextChildren; 10379 var selfDebugID = 0; 10380 if ("development" !== 'production') { 10381 selfDebugID = getDebugID(this); 10382 if (this._currentElement) { 10383 try { 10384 ReactCurrentOwner.current = this._currentElement._owner; 10385 nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID); 10386 } finally { 10387 ReactCurrentOwner.current = null; 10388 } 10389 ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID); 10390 return nextChildren; 10391 } 10392 } 10393 nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID); 10394 ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID); 10395 return nextChildren; 10396 }, 10397 10398 /** 10399 * Generates a "mount image" for each of the supplied children. In the case 10400 * of `ReactDOMComponent`, a mount image is a string of markup. 10401 * 10402 * @param {?object} nestedChildren Nested child maps. 10403 * @return {array} An array of mounted representations. 10404 * @internal 10405 */ 10406 mountChildren: function (nestedChildren, transaction, context) { 10407 var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context); 10408 this._renderedChildren = children; 10409 10410 var mountImages = []; 10411 var index = 0; 10412 for (var name in children) { 10413 if (children.hasOwnProperty(name)) { 10414 var child = children[name]; 10415 var selfDebugID = 0; 10416 if ("development" !== 'production') { 10417 selfDebugID = getDebugID(this); 10418 } 10419 var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context, selfDebugID); 10420 child._mountIndex = index++; 10421 mountImages.push(mountImage); 10422 } 10423 } 10424 10425 if ("development" !== 'production') { 10426 setChildrenForInstrumentation.call(this, children); 10427 } 10428 10429 return mountImages; 10430 }, 10431 10432 /** 10433 * Replaces any rendered children with a text content string. 10434 * 10435 * @param {string} nextContent String of content. 10436 * @internal 10437 */ 10438 updateTextContent: function (nextContent) { 10439 var prevChildren = this._renderedChildren; 10440 // Remove any rendered children. 10441 ReactChildReconciler.unmountChildren(prevChildren, false); 10442 for (var name in prevChildren) { 10443 if (prevChildren.hasOwnProperty(name)) { 10444 !false ? "development" !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0; 10445 } 10446 } 10447 // Set new text content. 10448 var updates = [makeTextContent(nextContent)]; 10449 processQueue(this, updates); 10450 }, 10451 10452 /** 10453 * Replaces any rendered children with a markup string. 10454 * 10455 * @param {string} nextMarkup String of markup. 10456 * @internal 10457 */ 10458 updateMarkup: function (nextMarkup) { 10459 var prevChildren = this._renderedChildren; 10460 // Remove any rendered children. 10461 ReactChildReconciler.unmountChildren(prevChildren, false); 10462 for (var name in prevChildren) { 10463 if (prevChildren.hasOwnProperty(name)) { 10464 !false ? "development" !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0; 10465 } 10466 } 10467 var updates = [makeSetMarkup(nextMarkup)]; 10468 processQueue(this, updates); 10469 }, 10470 10471 /** 10472 * Updates the rendered children with new children. 10473 * 10474 * @param {?object} nextNestedChildrenElements Nested child element maps. 10475 * @param {ReactReconcileTransaction} transaction 10476 * @internal 10477 */ 10478 updateChildren: function (nextNestedChildrenElements, transaction, context) { 10479 // Hook used by React ART 10480 this._updateChildren(nextNestedChildrenElements, transaction, context); 10481 }, 10482 10483 /** 10484 * @param {?object} nextNestedChildrenElements Nested child element maps. 10485 * @param {ReactReconcileTransaction} transaction 10486 * @final 10487 * @protected 10488 */ 10489 _updateChildren: function (nextNestedChildrenElements, transaction, context) { 10490 var prevChildren = this._renderedChildren; 10491 var removedNodes = {}; 10492 var mountImages = []; 10493 var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context); 10494 if (!nextChildren && !prevChildren) { 10495 return; 10496 } 10497 var updates = null; 10498 var name; 10499 // `nextIndex` will increment for each child in `nextChildren`, but 10500 // `lastIndex` will be the last index visited in `prevChildren`. 10501 var nextIndex = 0; 10502 var lastIndex = 0; 10503 // `nextMountIndex` will increment for each newly mounted child. 10504 var nextMountIndex = 0; 10505 var lastPlacedNode = null; 10506 for (name in nextChildren) { 10507 if (!nextChildren.hasOwnProperty(name)) { 10508 continue; 10509 } 10510 var prevChild = prevChildren && prevChildren[name]; 10511 var nextChild = nextChildren[name]; 10512 if (prevChild === nextChild) { 10513 updates = enqueue(updates, this.moveChild(prevChild, lastPlacedNode, nextIndex, lastIndex)); 10514 lastIndex = Math.max(prevChild._mountIndex, lastIndex); 10515 prevChild._mountIndex = nextIndex; 10516 } else { 10517 if (prevChild) { 10518 // Update `lastIndex` before `_mountIndex` gets unset by unmounting. 10519 lastIndex = Math.max(prevChild._mountIndex, lastIndex); 10520 // The `removedNodes` loop below will actually remove the child. 10521 } 10522 // The child must be instantiated before it's mounted. 10523 updates = enqueue(updates, this._mountChildAtIndex(nextChild, mountImages[nextMountIndex], lastPlacedNode, nextIndex, transaction, context)); 10524 nextMountIndex++; 10525 } 10526 nextIndex++; 10527 lastPlacedNode = ReactReconciler.getHostNode(nextChild); 10528 } 10529 // Remove children that are no longer present. 10530 for (name in removedNodes) { 10531 if (removedNodes.hasOwnProperty(name)) { 10532 updates = enqueue(updates, this._unmountChild(prevChildren[name], removedNodes[name])); 10533 } 10534 } 10535 if (updates) { 10536 processQueue(this, updates); 10537 } 10538 this._renderedChildren = nextChildren; 10539 10540 if ("development" !== 'production') { 10541 setChildrenForInstrumentation.call(this, nextChildren); 10542 } 10543 }, 10544 10545 /** 10546 * Unmounts all rendered children. This should be used to clean up children 10547 * when this component is unmounted. It does not actually perform any 10548 * backend operations. 10549 * 10550 * @internal 10551 */ 10552 unmountChildren: function (safely) { 10553 var renderedChildren = this._renderedChildren; 10554 ReactChildReconciler.unmountChildren(renderedChildren, safely); 10555 this._renderedChildren = null; 10556 }, 10557 10558 /** 10559 * Moves a child component to the supplied index. 10560 * 10561 * @param {ReactComponent} child Component to move. 10562 * @param {number} toIndex Destination index of the element. 10563 * @param {number} lastIndex Last index visited of the siblings of `child`. 10564 * @protected 10565 */ 10566 moveChild: function (child, afterNode, toIndex, lastIndex) { 10567 // If the index of `child` is less than `lastIndex`, then it needs to 10568 // be moved. Otherwise, we do not need to move it because a child will be 10569 // inserted or moved before `child`. 10570 if (child._mountIndex < lastIndex) { 10571 return makeMove(child, afterNode, toIndex); 10572 } 10573 }, 10574 10575 /** 10576 * Creates a child component. 10577 * 10578 * @param {ReactComponent} child Component to create. 10579 * @param {string} mountImage Markup to insert. 10580 * @protected 10581 */ 10582 createChild: function (child, afterNode, mountImage) { 10583 return makeInsertMarkup(mountImage, afterNode, child._mountIndex); 10584 }, 10585 10586 /** 10587 * Removes a child component. 10588 * 10589 * @param {ReactComponent} child Child to remove. 10590 * @protected 10591 */ 10592 removeChild: function (child, node) { 10593 return makeRemove(child, node); 10594 }, 10595 10596 /** 10597 * Mounts a child with the supplied name. 10598 * 10599 * NOTE: This is part of `updateChildren` and is here for readability. 10600 * 10601 * @param {ReactComponent} child Component to mount. 10602 * @param {string} name Name of the child. 10603 * @param {number} index Index at which to insert the child. 10604 * @param {ReactReconcileTransaction} transaction 10605 * @private 10606 */ 10607 _mountChildAtIndex: function (child, mountImage, afterNode, index, transaction, context) { 10608 child._mountIndex = index; 10609 return this.createChild(child, afterNode, mountImage); 10610 }, 10611 10612 /** 10613 * Unmounts a rendered child. 10614 * 10615 * NOTE: This is part of `updateChildren` and is here for readability. 10616 * 10617 * @param {ReactComponent} child Component to unmount. 10618 * @private 10619 */ 10620 _unmountChild: function (child, node) { 10621 var update = this.removeChild(child, node); 10622 child._mountIndex = null; 10623 return update; 10624 } 10625 10626 } 10627 10628 }; 10629 10630 module.exports = ReactMultiChild; 10631 },{"109":109,"125":125,"133":133,"142":142,"150":150,"27":27,"29":29,"63":63,"64":64,"75":75}],69:[function(_dereq_,module,exports){ 10632 /** 10633 * Copyright 2013-present, Facebook, Inc. 10634 * All rights reserved. 10635 * 10636 * This source code is licensed under the BSD-style license found in the 10637 * LICENSE file in the root directory of this source tree. An additional grant 10638 * of patent rights can be found in the PATENTS file in the same directory. 10639 * 10640 * 10641 */ 10642 10643 'use strict'; 10644 10645 var _prodInvariant = _dereq_(125); 10646 10647 var React = _dereq_(134); 10648 10649 var invariant = _dereq_(150); 10650 10651 var ReactNodeTypes = { 10652 HOST: 0, 10653 COMPOSITE: 1, 10654 EMPTY: 2, 10655 10656 getType: function (node) { 10657 if (node === null || node === false) { 10658 return ReactNodeTypes.EMPTY; 10659 } else if (React.isValidElement(node)) { 10660 if (typeof node.type === 'function') { 10661 return ReactNodeTypes.COMPOSITE; 10662 } else { 10663 return ReactNodeTypes.HOST; 10664 } 10665 } 10666 !false ? "development" !== 'production' ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0; 10667 } 10668 }; 10669 10670 module.exports = ReactNodeTypes; 10671 },{"125":125,"134":134,"150":150}],70:[function(_dereq_,module,exports){ 10672 /** 10673 * Copyright 2013-present, Facebook, Inc. 10674 * All rights reserved. 10675 * 10676 * This source code is licensed under the BSD-style license found in the 10677 * LICENSE file in the root directory of this source tree. An additional grant 10678 * of patent rights can be found in the PATENTS file in the same directory. 10679 * 10680 * 10681 */ 10682 10683 'use strict'; 10684 10685 var _prodInvariant = _dereq_(125); 10686 10687 var invariant = _dereq_(150); 10688 10689 /** 10690 * @param {?object} object 10691 * @return {boolean} True if `object` is a valid owner. 10692 * @final 10693 */ 10694 function isValidOwner(object) { 10695 return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function'); 10696 } 10697 10698 /** 10699 * ReactOwners are capable of storing references to owned components. 10700 * 10701 * All components are capable of //being// referenced by owner components, but 10702 * only ReactOwner components are capable of //referencing// owned components. 10703 * The named reference is known as a "ref". 10704 * 10705 * Refs are available when mounted and updated during reconciliation. 10706 * 10707 * var MyComponent = React.createClass({ 10708 * render: function() { 10709 * return ( 10710 * <div onClick={this.handleClick}> 10711 * <CustomComponent ref="custom" /> 10712 * </div> 10713 * ); 10714 * }, 10715 * handleClick: function() { 10716 * this.refs.custom.handleClick(); 10717 * }, 10718 * componentDidMount: function() { 10719 * this.refs.custom.initialize(); 10720 * } 10721 * }); 10722 * 10723 * Refs should rarely be used. When refs are used, they should only be done to 10724 * control data that is not handled by React's data flow. 10725 * 10726 * @class ReactOwner 10727 */ 10728 var ReactOwner = { 10729 /** 10730 * Adds a component by ref to an owner component. 10731 * 10732 * @param {ReactComponent} component Component to reference. 10733 * @param {string} ref Name by which to refer to the component. 10734 * @param {ReactOwner} owner Component on which to record the ref. 10735 * @final 10736 * @internal 10737 */ 10738 addComponentAsRefTo: function (component, ref, owner) { 10739 !isValidOwner(owner) ? "development" !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('119') : void 0; 10740 owner.attachRef(ref, component); 10741 }, 10742 10743 /** 10744 * Removes a component by ref from an owner component. 10745 * 10746 * @param {ReactComponent} component Component to dereference. 10747 * @param {string} ref Name of the ref to remove. 10748 * @param {ReactOwner} owner Component on which the ref is recorded. 10749 * @final 10750 * @internal 10751 */ 10752 removeComponentAsRefFrom: function (component, ref, owner) { 10753 !isValidOwner(owner) ? "development" !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might be removing a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('120') : void 0; 10754 var ownerPublicInstance = owner.getPublicInstance(); 10755 // Check that `component`'s owner is still alive and that `component` is still the current ref 10756 // because we do not want to detach the ref if another component stole it. 10757 if (ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance()) { 10758 owner.detachRef(ref); 10759 } 10760 } 10761 10762 }; 10763 10764 module.exports = ReactOwner; 10765 },{"125":125,"150":150}],71:[function(_dereq_,module,exports){ 10766 /** 10767 * Copyright 2016-present, Facebook, Inc. 10768 * All rights reserved. 10769 * 10770 * This source code is licensed under the BSD-style license found in the 10771 * LICENSE file in the root directory of this source tree. An additional grant 10772 * of patent rights can be found in the PATENTS file in the same directory. 10773 * 10774 * 10775 */ 10776 10777 'use strict'; 10778 10779 var _assign = _dereq_(158); 10780 10781 var _extends = _assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; 10782 10783 var ReactDebugTool = _dereq_(50); 10784 var warning = _dereq_(157); 10785 var alreadyWarned = false; 10786 10787 function roundFloat(val) { 10788 var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2; 10789 10790 var n = Math.pow(10, base); 10791 return Math.floor(val * n) / n; 10792 } 10793 10794 // Flow type definition of console.table is too strict right now, see 10795 // https://github.com/facebook/flow/pull/2353 for updates 10796 function consoleTable(table) { 10797 console.table(table); 10798 } 10799 10800 function warnInProduction() { 10801 if (alreadyWarned) { 10802 return; 10803 } 10804 alreadyWarned = true; 10805 if (typeof console !== 'undefined') { 10806 console.error('ReactPerf is not supported in the production builds of React. ' + 'To collect measurements, please use the development build of React instead.'); 10807 } 10808 } 10809 10810 function getLastMeasurements() { 10811 if (!("development" !== 'production')) { 10812 warnInProduction(); 10813 return []; 10814 } 10815 10816 return ReactDebugTool.getFlushHistory(); 10817 } 10818 10819 function getExclusive() { 10820 var flushHistory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getLastMeasurements(); 10821 10822 if (!("development" !== 'production')) { 10823 warnInProduction(); 10824 return []; 10825 } 10826 10827 var aggregatedStats = {}; 10828 var affectedIDs = {}; 10829 10830 function updateAggregatedStats(treeSnapshot, instanceID, timerType, applyUpdate) { 10831 var displayName = treeSnapshot[instanceID].displayName; 10832 10833 var key = displayName; 10834 var stats = aggregatedStats[key]; 10835 if (!stats) { 10836 affectedIDs[key] = {}; 10837 stats = aggregatedStats[key] = { 10838 key: key, 10839 instanceCount: 0, 10840 counts: {}, 10841 durations: {}, 10842 totalDuration: 0 10843 }; 10844 } 10845 if (!stats.durations[timerType]) { 10846 stats.durations[timerType] = 0; 10847 } 10848 if (!stats.counts[timerType]) { 10849 stats.counts[timerType] = 0; 10850 } 10851 affectedIDs[key][instanceID] = true; 10852 applyUpdate(stats); 10853 } 10854 10855 flushHistory.forEach(function (flush) { 10856 var measurements = flush.measurements, 10857 treeSnapshot = flush.treeSnapshot; 10858 10859 measurements.forEach(function (measurement) { 10860 var duration = measurement.duration, 10861 instanceID = measurement.instanceID, 10862 timerType = measurement.timerType; 10863 10864 updateAggregatedStats(treeSnapshot, instanceID, timerType, function (stats) { 10865 stats.totalDuration += duration; 10866 stats.durations[timerType] += duration; 10867 stats.counts[timerType]++; 10868 }); 10869 }); 10870 }); 10871 10872 return Object.keys(aggregatedStats).map(function (key) { 10873 return _extends({}, aggregatedStats[key], { 10874 instanceCount: Object.keys(affectedIDs[key]).length 10875 }); 10876 }).sort(function (a, b) { 10877 return b.totalDuration - a.totalDuration; 10878 }); 10879 } 10880 10881 function getInclusive() { 10882 var flushHistory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getLastMeasurements(); 10883 10884 if (!("development" !== 'production')) { 10885 warnInProduction(); 10886 return []; 10887 } 10888 10889 var aggregatedStats = {}; 10890 var affectedIDs = {}; 10891 10892 function updateAggregatedStats(treeSnapshot, instanceID, applyUpdate) { 10893 var _treeSnapshot$instanc = treeSnapshot[instanceID], 10894 displayName = _treeSnapshot$instanc.displayName, 10895 ownerID = _treeSnapshot$instanc.ownerID; 10896 10897 var owner = treeSnapshot[ownerID]; 10898 var key = (owner ? owner.displayName + ' > ' : '') + displayName; 10899 var stats = aggregatedStats[key]; 10900 if (!stats) { 10901 affectedIDs[key] = {}; 10902 stats = aggregatedStats[key] = { 10903 key: key, 10904 instanceCount: 0, 10905 inclusiveRenderDuration: 0, 10906 renderCount: 0 10907 }; 10908 } 10909 affectedIDs[key][instanceID] = true; 10910 applyUpdate(stats); 10911 } 10912 10913 var isCompositeByID = {}; 10914 flushHistory.forEach(function (flush) { 10915 var measurements = flush.measurements; 10916 10917 measurements.forEach(function (measurement) { 10918 var instanceID = measurement.instanceID, 10919 timerType = measurement.timerType; 10920 10921 if (timerType !== 'render') { 10922 return; 10923 } 10924 isCompositeByID[instanceID] = true; 10925 }); 10926 }); 10927 10928 flushHistory.forEach(function (flush) { 10929 var measurements = flush.measurements, 10930 treeSnapshot = flush.treeSnapshot; 10931 10932 measurements.forEach(function (measurement) { 10933 var duration = measurement.duration, 10934 instanceID = measurement.instanceID, 10935 timerType = measurement.timerType; 10936 10937 if (timerType !== 'render') { 10938 return; 10939 } 10940 updateAggregatedStats(treeSnapshot, instanceID, function (stats) { 10941 stats.renderCount++; 10942 }); 10943 var nextParentID = instanceID; 10944 while (nextParentID) { 10945 // As we traverse parents, only count inclusive time towards composites. 10946 // We know something is a composite if its render() was called. 10947 if (isCompositeByID[nextParentID]) { 10948 updateAggregatedStats(treeSnapshot, nextParentID, function (stats) { 10949 stats.inclusiveRenderDuration += duration; 10950 }); 10951 } 10952 nextParentID = treeSnapshot[nextParentID].parentID; 10953 } 10954 }); 10955 }); 10956 10957 return Object.keys(aggregatedStats).map(function (key) { 10958 return _extends({}, aggregatedStats[key], { 10959 instanceCount: Object.keys(affectedIDs[key]).length 10960 }); 10961 }).sort(function (a, b) { 10962 return b.inclusiveRenderDuration - a.inclusiveRenderDuration; 10963 }); 10964 } 10965 10966 function getWasted() { 10967 var flushHistory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getLastMeasurements(); 10968 10969 if (!("development" !== 'production')) { 10970 warnInProduction(); 10971 return []; 10972 } 10973 10974 var aggregatedStats = {}; 10975 var affectedIDs = {}; 10976 10977 function updateAggregatedStats(treeSnapshot, instanceID, applyUpdate) { 10978 var _treeSnapshot$instanc2 = treeSnapshot[instanceID], 10979 displayName = _treeSnapshot$instanc2.displayName, 10980 ownerID = _treeSnapshot$instanc2.ownerID; 10981 10982 var owner = treeSnapshot[ownerID]; 10983 var key = (owner ? owner.displayName + ' > ' : '') + displayName; 10984 var stats = aggregatedStats[key]; 10985 if (!stats) { 10986 affectedIDs[key] = {}; 10987 stats = aggregatedStats[key] = { 10988 key: key, 10989 instanceCount: 0, 10990 inclusiveRenderDuration: 0, 10991 renderCount: 0 10992 }; 10993 } 10994 affectedIDs[key][instanceID] = true; 10995 applyUpdate(stats); 10996 } 10997 10998 flushHistory.forEach(function (flush) { 10999 var measurements = flush.measurements, 11000 treeSnapshot = flush.treeSnapshot, 11001 operations = flush.operations; 11002 11003 var isDefinitelyNotWastedByID = {}; 11004 11005 // Find host components associated with an operation in this batch. 11006 // Mark all components in their parent tree as definitely not wasted. 11007 operations.forEach(function (operation) { 11008 var instanceID = operation.instanceID; 11009 11010 var nextParentID = instanceID; 11011 while (nextParentID) { 11012 isDefinitelyNotWastedByID[nextParentID] = true; 11013 nextParentID = treeSnapshot[nextParentID].parentID; 11014 } 11015 }); 11016 11017 // Find composite components that rendered in this batch. 11018 // These are potential candidates for being wasted renders. 11019 var renderedCompositeIDs = {}; 11020 measurements.forEach(function (measurement) { 11021 var instanceID = measurement.instanceID, 11022 timerType = measurement.timerType; 11023 11024 if (timerType !== 'render') { 11025 return; 11026 } 11027 renderedCompositeIDs[instanceID] = true; 11028 }); 11029 11030 measurements.forEach(function (measurement) { 11031 var duration = measurement.duration, 11032 instanceID = measurement.instanceID, 11033 timerType = measurement.timerType; 11034 11035 if (timerType !== 'render') { 11036 return; 11037 } 11038 11039 // If there was a DOM update below this component, or it has just been 11040 // mounted, its render() is not considered wasted. 11041 var updateCount = treeSnapshot[instanceID].updateCount; 11042 11043 if (isDefinitelyNotWastedByID[instanceID] || updateCount === 0) { 11044 return; 11045 } 11046 11047 // We consider this render() wasted. 11048 updateAggregatedStats(treeSnapshot, instanceID, function (stats) { 11049 stats.renderCount++; 11050 }); 11051 11052 var nextParentID = instanceID; 11053 while (nextParentID) { 11054 // Any parents rendered during this batch are considered wasted 11055 // unless we previously marked them as dirty. 11056 var isWasted = renderedCompositeIDs[nextParentID] && !isDefinitelyNotWastedByID[nextParentID]; 11057 if (isWasted) { 11058 updateAggregatedStats(treeSnapshot, nextParentID, function (stats) { 11059 stats.inclusiveRenderDuration += duration; 11060 }); 11061 } 11062 nextParentID = treeSnapshot[nextParentID].parentID; 11063 } 11064 }); 11065 }); 11066 11067 return Object.keys(aggregatedStats).map(function (key) { 11068 return _extends({}, aggregatedStats[key], { 11069 instanceCount: Object.keys(affectedIDs[key]).length 11070 }); 11071 }).sort(function (a, b) { 11072 return b.inclusiveRenderDuration - a.inclusiveRenderDuration; 11073 }); 11074 } 11075 11076 function getOperations() { 11077 var flushHistory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getLastMeasurements(); 11078 11079 if (!("development" !== 'production')) { 11080 warnInProduction(); 11081 return []; 11082 } 11083 11084 var stats = []; 11085 flushHistory.forEach(function (flush, flushIndex) { 11086 var operations = flush.operations, 11087 treeSnapshot = flush.treeSnapshot; 11088 11089 operations.forEach(function (operation) { 11090 var instanceID = operation.instanceID, 11091 type = operation.type, 11092 payload = operation.payload; 11093 var _treeSnapshot$instanc3 = treeSnapshot[instanceID], 11094 displayName = _treeSnapshot$instanc3.displayName, 11095 ownerID = _treeSnapshot$instanc3.ownerID; 11096 11097 var owner = treeSnapshot[ownerID]; 11098 var key = (owner ? owner.displayName + ' > ' : '') + displayName; 11099 11100 stats.push({ 11101 flushIndex: flushIndex, 11102 instanceID: instanceID, 11103 key: key, 11104 type: type, 11105 ownerID: ownerID, 11106 payload: payload 11107 }); 11108 }); 11109 }); 11110 return stats; 11111 } 11112 11113 function printExclusive(flushHistory) { 11114 if (!("development" !== 'production')) { 11115 warnInProduction(); 11116 return; 11117 } 11118 11119 var stats = getExclusive(flushHistory); 11120 var table = stats.map(function (item) { 11121 var key = item.key, 11122 instanceCount = item.instanceCount, 11123 totalDuration = item.totalDuration; 11124 11125 var renderCount = item.counts.render || 0; 11126 var renderDuration = item.durations.render || 0; 11127 return { 11128 'Component': key, 11129 'Total time (ms)': roundFloat(totalDuration), 11130 'Instance count': instanceCount, 11131 'Total render time (ms)': roundFloat(renderDuration), 11132 'Average render time (ms)': renderCount ? roundFloat(renderDuration / renderCount) : undefined, 11133 'Render count': renderCount, 11134 'Total lifecycle time (ms)': roundFloat(totalDuration - renderDuration) 11135 }; 11136 }); 11137 consoleTable(table); 11138 } 11139 11140 function printInclusive(flushHistory) { 11141 if (!("development" !== 'production')) { 11142 warnInProduction(); 11143 return; 11144 } 11145 11146 var stats = getInclusive(flushHistory); 11147 var table = stats.map(function (item) { 11148 var key = item.key, 11149 instanceCount = item.instanceCount, 11150 inclusiveRenderDuration = item.inclusiveRenderDuration, 11151 renderCount = item.renderCount; 11152 11153 return { 11154 'Owner > Component': key, 11155 'Inclusive render time (ms)': roundFloat(inclusiveRenderDuration), 11156 'Instance count': instanceCount, 11157 'Render count': renderCount 11158 }; 11159 }); 11160 consoleTable(table); 11161 } 11162 11163 function printWasted(flushHistory) { 11164 if (!("development" !== 'production')) { 11165 warnInProduction(); 11166 return; 11167 } 11168 11169 var stats = getWasted(flushHistory); 11170 var table = stats.map(function (item) { 11171 var key = item.key, 11172 instanceCount = item.instanceCount, 11173 inclusiveRenderDuration = item.inclusiveRenderDuration, 11174 renderCount = item.renderCount; 11175 11176 return { 11177 'Owner > Component': key, 11178 'Inclusive wasted time (ms)': roundFloat(inclusiveRenderDuration), 11179 'Instance count': instanceCount, 11180 'Render count': renderCount 11181 }; 11182 }); 11183 consoleTable(table); 11184 } 11185 11186 function printOperations(flushHistory) { 11187 if (!("development" !== 'production')) { 11188 warnInProduction(); 11189 return; 11190 } 11191 11192 var stats = getOperations(flushHistory); 11193 var table = stats.map(function (stat) { 11194 return { 11195 'Owner > Node': stat.key, 11196 'Operation': stat.type, 11197 'Payload': typeof stat.payload === 'object' ? JSON.stringify(stat.payload) : stat.payload, 11198 'Flush index': stat.flushIndex, 11199 'Owner Component ID': stat.ownerID, 11200 'DOM Component ID': stat.instanceID 11201 }; 11202 }); 11203 consoleTable(table); 11204 } 11205 11206 var warnedAboutPrintDOM = false; 11207 function printDOM(measurements) { 11208 "development" !== 'production' ? warning(warnedAboutPrintDOM, '`ReactPerf.printDOM(...)` is deprecated. Use ' + '`ReactPerf.printOperations(...)` instead.') : void 0; 11209 warnedAboutPrintDOM = true; 11210 return printOperations(measurements); 11211 } 11212 11213 var warnedAboutGetMeasurementsSummaryMap = false; 11214 function getMeasurementsSummaryMap(measurements) { 11215 "development" !== 'production' ? warning(warnedAboutGetMeasurementsSummaryMap, '`ReactPerf.getMeasurementsSummaryMap(...)` is deprecated. Use ' + '`ReactPerf.getWasted(...)` instead.') : void 0; 11216 warnedAboutGetMeasurementsSummaryMap = true; 11217 return getWasted(measurements); 11218 } 11219 11220 function start() { 11221 if (!("development" !== 'production')) { 11222 warnInProduction(); 11223 return; 11224 } 11225 11226 ReactDebugTool.beginProfiling(); 11227 } 11228 11229 function stop() { 11230 if (!("development" !== 'production')) { 11231 warnInProduction(); 11232 return; 11233 } 11234 11235 ReactDebugTool.endProfiling(); 11236 } 11237 11238 function isRunning() { 11239 if (!("development" !== 'production')) { 11240 warnInProduction(); 11241 return false; 11242 } 11243 11244 return ReactDebugTool.isProfiling(); 11245 } 11246 11247 var ReactPerfAnalysis = { 11248 getLastMeasurements: getLastMeasurements, 11249 getExclusive: getExclusive, 11250 getInclusive: getInclusive, 11251 getWasted: getWasted, 11252 getOperations: getOperations, 11253 printExclusive: printExclusive, 11254 printInclusive: printInclusive, 11255 printWasted: printWasted, 11256 printOperations: printOperations, 11257 start: start, 11258 stop: stop, 11259 isRunning: isRunning, 11260 // Deprecated: 11261 printDOM: printDOM, 11262 getMeasurementsSummaryMap: getMeasurementsSummaryMap 11263 }; 11264 11265 module.exports = ReactPerfAnalysis; 11266 },{"157":157,"158":158,"50":50}],72:[function(_dereq_,module,exports){ 11267 /** 11268 * Copyright 2013-present, Facebook, Inc. 11269 * All rights reserved. 11270 * 11271 * This source code is licensed under the BSD-style license found in the 11272 * LICENSE file in the root directory of this source tree. An additional grant 11273 * of patent rights can be found in the PATENTS file in the same directory. 11274 * 11275 * 11276 */ 11277 11278 'use strict'; 11279 11280 var ReactPropTypeLocationNames = {}; 11281 11282 if ("development" !== 'production') { 11283 ReactPropTypeLocationNames = { 11284 prop: 'prop', 11285 context: 'context', 11286 childContext: 'child context' 11287 }; 11288 } 11289 11290 module.exports = ReactPropTypeLocationNames; 11291 },{}],73:[function(_dereq_,module,exports){ 11292 /** 11293 * Copyright 2013-present, Facebook, Inc. 11294 * All rights reserved. 11295 * 11296 * This source code is licensed under the BSD-style license found in the 11297 * LICENSE file in the root directory of this source tree. An additional grant 11298 * of patent rights can be found in the PATENTS file in the same directory. 11299 * 11300 * 11301 */ 11302 11303 'use strict'; 11304 11305 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; 11306 11307 module.exports = ReactPropTypesSecret; 11308 },{}],74:[function(_dereq_,module,exports){ 11309 /** 11310 * Copyright 2013-present, Facebook, Inc. 11311 * All rights reserved. 11312 * 11313 * This source code is licensed under the BSD-style license found in the 11314 * LICENSE file in the root directory of this source tree. An additional grant 11315 * of patent rights can be found in the PATENTS file in the same directory. 11316 * 11317 */ 11318 11319 'use strict'; 11320 11321 var _assign = _dereq_(158); 11322 11323 var CallbackQueue = _dereq_(6); 11324 var PooledClass = _dereq_(25); 11325 var ReactBrowserEventEmitter = _dereq_(26); 11326 var ReactInputSelection = _dereq_(62); 11327 var ReactInstrumentation = _dereq_(64); 11328 var Transaction = _dereq_(100); 11329 var ReactUpdateQueue = _dereq_(81); 11330 11331 /** 11332 * Ensures that, when possible, the selection range (currently selected text 11333 * input) is not disturbed by performing the transaction. 11334 */ 11335 var SELECTION_RESTORATION = { 11336 /** 11337 * @return {Selection} Selection information. 11338 */ 11339 initialize: ReactInputSelection.getSelectionInformation, 11340 /** 11341 * @param {Selection} sel Selection information returned from `initialize`. 11342 */ 11343 close: ReactInputSelection.restoreSelection 11344 }; 11345 11346 /** 11347 * Suppresses events (blur/focus) that could be inadvertently dispatched due to 11348 * high level DOM manipulations (like temporarily removing a text input from the 11349 * DOM). 11350 */ 11351 var EVENT_SUPPRESSION = { 11352 /** 11353 * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before 11354 * the reconciliation. 11355 */ 11356 initialize: function () { 11357 var currentlyEnabled = ReactBrowserEventEmitter.isEnabled(); 11358 ReactBrowserEventEmitter.setEnabled(false); 11359 return currentlyEnabled; 11360 }, 11361 11362 /** 11363 * @param {boolean} previouslyEnabled Enabled status of 11364 * `ReactBrowserEventEmitter` before the reconciliation occurred. `close` 11365 * restores the previous value. 11366 */ 11367 close: function (previouslyEnabled) { 11368 ReactBrowserEventEmitter.setEnabled(previouslyEnabled); 11369 } 11370 }; 11371 11372 /** 11373 * Provides a queue for collecting `componentDidMount` and 11374 * `componentDidUpdate` callbacks during the transaction. 11375 */ 11376 var ON_DOM_READY_QUEUEING = { 11377 /** 11378 * Initializes the internal `onDOMReady` queue. 11379 */ 11380 initialize: function () { 11381 this.reactMountReady.reset(); 11382 }, 11383 11384 /** 11385 * After DOM is flushed, invoke all registered `onDOMReady` callbacks. 11386 */ 11387 close: function () { 11388 this.reactMountReady.notifyAll(); 11389 } 11390 }; 11391 11392 /** 11393 * Executed within the scope of the `Transaction` instance. Consider these as 11394 * being member methods, but with an implied ordering while being isolated from 11395 * each other. 11396 */ 11397 var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING]; 11398 11399 if ("development" !== 'production') { 11400 TRANSACTION_WRAPPERS.push({ 11401 initialize: ReactInstrumentation.debugTool.onBeginFlush, 11402 close: ReactInstrumentation.debugTool.onEndFlush 11403 }); 11404 } 11405 11406 /** 11407 * Currently: 11408 * - The order that these are listed in the transaction is critical: 11409 * - Suppresses events. 11410 * - Restores selection range. 11411 * 11412 * Future: 11413 * - Restore document/overflow scroll positions that were unintentionally 11414 * modified via DOM insertions above the top viewport boundary. 11415 * - Implement/integrate with customized constraint based layout system and keep 11416 * track of which dimensions must be remeasured. 11417 * 11418 * @class ReactReconcileTransaction 11419 */ 11420 function ReactReconcileTransaction(useCreateElement) { 11421 this.reinitializeTransaction(); 11422 // Only server-side rendering really needs this option (see 11423 // `ReactServerRendering`), but server-side uses 11424 // `ReactServerRenderingTransaction` instead. This option is here so that it's 11425 // accessible and defaults to false when `ReactDOMComponent` and 11426 // `ReactDOMTextComponent` checks it in `mountComponent`.` 11427 this.renderToStaticMarkup = false; 11428 this.reactMountReady = CallbackQueue.getPooled(null); 11429 this.useCreateElement = useCreateElement; 11430 } 11431 11432 var Mixin = { 11433 /** 11434 * @see Transaction 11435 * @abstract 11436 * @final 11437 * @return {array<object>} List of operation wrap procedures. 11438 * TODO: convert to array<TransactionWrapper> 11439 */ 11440 getTransactionWrappers: function () { 11441 return TRANSACTION_WRAPPERS; 11442 }, 11443 11444 /** 11445 * @return {object} The queue to collect `onDOMReady` callbacks with. 11446 */ 11447 getReactMountReady: function () { 11448 return this.reactMountReady; 11449 }, 11450 11451 /** 11452 * @return {object} The queue to collect React async events. 11453 */ 11454 getUpdateQueue: function () { 11455 return ReactUpdateQueue; 11456 }, 11457 11458 /** 11459 * Save current transaction state -- if the return value from this method is 11460 * passed to `rollback`, the transaction will be reset to that state. 11461 */ 11462 checkpoint: function () { 11463 // reactMountReady is the our only stateful wrapper 11464 return this.reactMountReady.checkpoint(); 11465 }, 11466 11467 rollback: function (checkpoint) { 11468 this.reactMountReady.rollback(checkpoint); 11469 }, 11470 11471 /** 11472 * `PooledClass` looks for this, and will invoke this before allowing this 11473 * instance to be reused. 11474 */ 11475 destructor: function () { 11476 CallbackQueue.release(this.reactMountReady); 11477 this.reactMountReady = null; 11478 } 11479 }; 11480 11481 _assign(ReactReconcileTransaction.prototype, Transaction, Mixin); 11482 11483 PooledClass.addPoolingTo(ReactReconcileTransaction); 11484 11485 module.exports = ReactReconcileTransaction; 11486 },{"100":100,"158":158,"25":25,"26":26,"6":6,"62":62,"64":64,"81":81}],75:[function(_dereq_,module,exports){ 11487 /** 11488 * Copyright 2013-present, Facebook, Inc. 11489 * All rights reserved. 11490 * 11491 * This source code is licensed under the BSD-style license found in the 11492 * LICENSE file in the root directory of this source tree. An additional grant 11493 * of patent rights can be found in the PATENTS file in the same directory. 11494 * 11495 */ 11496 11497 'use strict'; 11498 11499 var ReactRef = _dereq_(76); 11500 var ReactInstrumentation = _dereq_(64); 11501 11502 var warning = _dereq_(157); 11503 11504 /** 11505 * Helper to call ReactRef.attachRefs with this composite component, split out 11506 * to avoid allocations in the transaction mount-ready queue. 11507 */ 11508 function attachRefs() { 11509 ReactRef.attachRefs(this, this._currentElement); 11510 } 11511 11512 var ReactReconciler = { 11513 11514 /** 11515 * Initializes the component, renders markup, and registers event listeners. 11516 * 11517 * @param {ReactComponent} internalInstance 11518 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction 11519 * @param {?object} the containing host component instance 11520 * @param {?object} info about the host container 11521 * @return {?string} Rendered markup to be inserted into the DOM. 11522 * @final 11523 * @internal 11524 */ 11525 mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID // 0 in production and for roots 11526 ) { 11527 if ("development" !== 'production') { 11528 if (internalInstance._debugID !== 0) { 11529 ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID); 11530 } 11531 } 11532 var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID); 11533 if (internalInstance._currentElement && internalInstance._currentElement.ref != null) { 11534 transaction.getReactMountReady().enqueue(attachRefs, internalInstance); 11535 } 11536 if ("development" !== 'production') { 11537 if (internalInstance._debugID !== 0) { 11538 ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID); 11539 } 11540 } 11541 return markup; 11542 }, 11543 11544 /** 11545 * Returns a value that can be passed to 11546 * ReactComponentEnvironment.replaceNodeWithMarkup. 11547 */ 11548 getHostNode: function (internalInstance) { 11549 return internalInstance.getHostNode(); 11550 }, 11551 11552 /** 11553 * Releases any resources allocated by `mountComponent`. 11554 * 11555 * @final 11556 * @internal 11557 */ 11558 unmountComponent: function (internalInstance, safely) { 11559 if ("development" !== 'production') { 11560 if (internalInstance._debugID !== 0) { 11561 ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID); 11562 } 11563 } 11564 ReactRef.detachRefs(internalInstance, internalInstance._currentElement); 11565 internalInstance.unmountComponent(safely); 11566 if ("development" !== 'production') { 11567 if (internalInstance._debugID !== 0) { 11568 ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID); 11569 } 11570 } 11571 }, 11572 11573 /** 11574 * Update a component using a new element. 11575 * 11576 * @param {ReactComponent} internalInstance 11577 * @param {ReactElement} nextElement 11578 * @param {ReactReconcileTransaction} transaction 11579 * @param {object} context 11580 * @internal 11581 */ 11582 receiveComponent: function (internalInstance, nextElement, transaction, context) { 11583 var prevElement = internalInstance._currentElement; 11584 11585 if (nextElement === prevElement && context === internalInstance._context) { 11586 // Since elements are immutable after the owner is rendered, 11587 // we can do a cheap identity compare here to determine if this is a 11588 // superfluous reconcile. It's possible for state to be mutable but such 11589 // change should trigger an update of the owner which would recreate 11590 // the element. We explicitly check for the existence of an owner since 11591 // it's possible for an element created outside a composite to be 11592 // deeply mutated and reused. 11593 11594 // TODO: Bailing out early is just a perf optimization right? 11595 // TODO: Removing the return statement should affect correctness? 11596 return; 11597 } 11598 11599 if ("development" !== 'production') { 11600 if (internalInstance._debugID !== 0) { 11601 ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement); 11602 } 11603 } 11604 11605 var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement); 11606 11607 if (refsChanged) { 11608 ReactRef.detachRefs(internalInstance, prevElement); 11609 } 11610 11611 internalInstance.receiveComponent(nextElement, transaction, context); 11612 11613 if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) { 11614 transaction.getReactMountReady().enqueue(attachRefs, internalInstance); 11615 } 11616 11617 if ("development" !== 'production') { 11618 if (internalInstance._debugID !== 0) { 11619 ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); 11620 } 11621 } 11622 }, 11623 11624 /** 11625 * Flush any dirty changes in a component. 11626 * 11627 * @param {ReactComponent} internalInstance 11628 * @param {ReactReconcileTransaction} transaction 11629 * @internal 11630 */ 11631 performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) { 11632 if (internalInstance._updateBatchNumber !== updateBatchNumber) { 11633 // The component's enqueued batch number should always be the current 11634 // batch or the following one. 11635 "development" !== 'production' ? warning(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1, 'performUpdateIfNecessary: Unexpected batch number (current %s, ' + 'pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : void 0; 11636 return; 11637 } 11638 if ("development" !== 'production') { 11639 if (internalInstance._debugID !== 0) { 11640 ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement); 11641 } 11642 } 11643 internalInstance.performUpdateIfNecessary(transaction); 11644 if ("development" !== 'production') { 11645 if (internalInstance._debugID !== 0) { 11646 ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); 11647 } 11648 } 11649 } 11650 11651 }; 11652 11653 module.exports = ReactReconciler; 11654 },{"157":157,"64":64,"76":76}],76:[function(_dereq_,module,exports){ 11655 /** 11656 * Copyright 2013-present, Facebook, Inc. 11657 * All rights reserved. 11658 * 11659 * This source code is licensed under the BSD-style license found in the 11660 * LICENSE file in the root directory of this source tree. An additional grant 11661 * of patent rights can be found in the PATENTS file in the same directory. 11662 * 11663 * 11664 */ 11665 11666 'use strict'; 11667 11668 var ReactOwner = _dereq_(70); 11669 11670 var ReactRef = {}; 11671 11672 function attachRef(ref, component, owner) { 11673 if (typeof ref === 'function') { 11674 ref(component.getPublicInstance()); 11675 } else { 11676 // Legacy ref 11677 ReactOwner.addComponentAsRefTo(component, ref, owner); 11678 } 11679 } 11680 11681 function detachRef(ref, component, owner) { 11682 if (typeof ref === 'function') { 11683 ref(null); 11684 } else { 11685 // Legacy ref 11686 ReactOwner.removeComponentAsRefFrom(component, ref, owner); 11687 } 11688 } 11689 11690 ReactRef.attachRefs = function (instance, element) { 11691 if (element === null || typeof element !== 'object') { 11692 return; 11693 } 11694 var ref = element.ref; 11695 if (ref != null) { 11696 attachRef(ref, instance, element._owner); 11697 } 11698 }; 11699 11700 ReactRef.shouldUpdateRefs = function (prevElement, nextElement) { 11701 // If either the owner or a `ref` has changed, make sure the newest owner 11702 // has stored a reference to `this`, and the previous owner (if different) 11703 // has forgotten the reference to `this`. We use the element instead 11704 // of the public this.props because the post processing cannot determine 11705 // a ref. The ref conceptually lives on the element. 11706 11707 // TODO: Should this even be possible? The owner cannot change because 11708 // it's forbidden by shouldUpdateReactComponent. The ref can change 11709 // if you swap the keys of but not the refs. Reconsider where this check 11710 // is made. It probably belongs where the key checking and 11711 // instantiateReactComponent is done. 11712 11713 var prevRef = null; 11714 var prevOwner = null; 11715 if (prevElement !== null && typeof prevElement === 'object') { 11716 prevRef = prevElement.ref; 11717 prevOwner = prevElement._owner; 11718 } 11719 11720 var nextRef = null; 11721 var nextOwner = null; 11722 if (nextElement !== null && typeof nextElement === 'object') { 11723 nextRef = nextElement.ref; 11724 nextOwner = nextElement._owner; 11725 } 11726 11727 return prevRef !== nextRef || 11728 // If owner changes but we have an unchanged function ref, don't update refs 11729 typeof nextRef === 'string' && nextOwner !== prevOwner; 11730 }; 11731 11732 ReactRef.detachRefs = function (instance, element) { 11733 if (element === null || typeof element !== 'object') { 11734 return; 11735 } 11736 var ref = element.ref; 11737 if (ref != null) { 11738 detachRef(ref, instance, element._owner); 11739 } 11740 }; 11741 11742 module.exports = ReactRef; 11743 },{"70":70}],77:[function(_dereq_,module,exports){ 11744 /** 11745 * Copyright 2014-present, Facebook, Inc. 11746 * All rights reserved. 11747 * 11748 * This source code is licensed under the BSD-style license found in the 11749 * LICENSE file in the root directory of this source tree. An additional grant 11750 * of patent rights can be found in the PATENTS file in the same directory. 11751 * 11752 */ 11753 11754 'use strict'; 11755 11756 var _assign = _dereq_(158); 11757 11758 var PooledClass = _dereq_(25); 11759 var Transaction = _dereq_(100); 11760 var ReactInstrumentation = _dereq_(64); 11761 var ReactServerUpdateQueue = _dereq_(78); 11762 11763 /** 11764 * Executed within the scope of the `Transaction` instance. Consider these as 11765 * being member methods, but with an implied ordering while being isolated from 11766 * each other. 11767 */ 11768 var TRANSACTION_WRAPPERS = []; 11769 11770 if ("development" !== 'production') { 11771 TRANSACTION_WRAPPERS.push({ 11772 initialize: ReactInstrumentation.debugTool.onBeginFlush, 11773 close: ReactInstrumentation.debugTool.onEndFlush 11774 }); 11775 } 11776 11777 var noopCallbackQueue = { 11778 enqueue: function () {} 11779 }; 11780 11781 /** 11782 * @class ReactServerRenderingTransaction 11783 * @param {boolean} renderToStaticMarkup 11784 */ 11785 function ReactServerRenderingTransaction(renderToStaticMarkup) { 11786 this.reinitializeTransaction(); 11787 this.renderToStaticMarkup = renderToStaticMarkup; 11788 this.useCreateElement = false; 11789 this.updateQueue = new ReactServerUpdateQueue(this); 11790 } 11791 11792 var Mixin = { 11793 /** 11794 * @see Transaction 11795 * @abstract 11796 * @final 11797 * @return {array} Empty list of operation wrap procedures. 11798 */ 11799 getTransactionWrappers: function () { 11800 return TRANSACTION_WRAPPERS; 11801 }, 11802 11803 /** 11804 * @return {object} The queue to collect `onDOMReady` callbacks with. 11805 */ 11806 getReactMountReady: function () { 11807 return noopCallbackQueue; 11808 }, 11809 11810 /** 11811 * @return {object} The queue to collect React async events. 11812 */ 11813 getUpdateQueue: function () { 11814 return this.updateQueue; 11815 }, 11816 11817 /** 11818 * `PooledClass` looks for this, and will invoke this before allowing this 11819 * instance to be reused. 11820 */ 11821 destructor: function () {}, 11822 11823 checkpoint: function () {}, 11824 11825 rollback: function () {} 11826 }; 11827 11828 _assign(ReactServerRenderingTransaction.prototype, Transaction, Mixin); 11829 11830 PooledClass.addPoolingTo(ReactServerRenderingTransaction); 11831 11832 module.exports = ReactServerRenderingTransaction; 11833 },{"100":100,"158":158,"25":25,"64":64,"78":78}],78:[function(_dereq_,module,exports){ 11834 /** 11835 * Copyright 2015-present, Facebook, Inc. 11836 * All rights reserved. 11837 * 11838 * This source code is licensed under the BSD-style license found in the 11839 * LICENSE file in the root directory of this source tree. An additional grant 11840 * of patent rights can be found in the PATENTS file in the same directory. 11841 * 11842 * 11843 */ 11844 11845 'use strict'; 11846 11847 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11848 11849 var ReactUpdateQueue = _dereq_(81); 11850 11851 var warning = _dereq_(157); 11852 11853 function warnNoop(publicInstance, callerName) { 11854 if ("development" !== 'production') { 11855 var constructor = publicInstance.constructor; 11856 "development" !== 'production' ? warning(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0; 11857 } 11858 } 11859 11860 /** 11861 * This is the update queue used for server rendering. 11862 * It delegates to ReactUpdateQueue while server rendering is in progress and 11863 * switches to ReactNoopUpdateQueue after the transaction has completed. 11864 * @class ReactServerUpdateQueue 11865 * @param {Transaction} transaction 11866 */ 11867 11868 var ReactServerUpdateQueue = function () { 11869 function ReactServerUpdateQueue(transaction) { 11870 _classCallCheck(this, ReactServerUpdateQueue); 11871 11872 this.transaction = transaction; 11873 } 11874 11875 /** 11876 * Checks whether or not this composite component is mounted. 11877 * @param {ReactClass} publicInstance The instance we want to test. 11878 * @return {boolean} True if mounted, false otherwise. 11879 * @protected 11880 * @final 11881 */ 11882 11883 11884 ReactServerUpdateQueue.prototype.isMounted = function isMounted(publicInstance) { 11885 return false; 11886 }; 11887 11888 /** 11889 * Enqueue a callback that will be executed after all the pending updates 11890 * have processed. 11891 * 11892 * @param {ReactClass} publicInstance The instance to use as `this` context. 11893 * @param {?function} callback Called after state is updated. 11894 * @internal 11895 */ 11896 11897 11898 ReactServerUpdateQueue.prototype.enqueueCallback = function enqueueCallback(publicInstance, callback, callerName) { 11899 if (this.transaction.isInTransaction()) { 11900 ReactUpdateQueue.enqueueCallback(publicInstance, callback, callerName); 11901 } 11902 }; 11903 11904 /** 11905 * Forces an update. This should only be invoked when it is known with 11906 * certainty that we are **not** in a DOM transaction. 11907 * 11908 * You may want to call this when you know that some deeper aspect of the 11909 * component's state has changed but `setState` was not called. 11910 * 11911 * This will not invoke `shouldComponentUpdate`, but it will invoke 11912 * `componentWillUpdate` and `componentDidUpdate`. 11913 * 11914 * @param {ReactClass} publicInstance The instance that should rerender. 11915 * @internal 11916 */ 11917 11918 11919 ReactServerUpdateQueue.prototype.enqueueForceUpdate = function enqueueForceUpdate(publicInstance) { 11920 if (this.transaction.isInTransaction()) { 11921 ReactUpdateQueue.enqueueForceUpdate(publicInstance); 11922 } else { 11923 warnNoop(publicInstance, 'forceUpdate'); 11924 } 11925 }; 11926 11927 /** 11928 * Replaces all of the state. Always use this or `setState` to mutate state. 11929 * You should treat `this.state` as immutable. 11930 * 11931 * There is no guarantee that `this.state` will be immediately updated, so 11932 * accessing `this.state` after calling this method may return the old value. 11933 * 11934 * @param {ReactClass} publicInstance The instance that should rerender. 11935 * @param {object|function} completeState Next state. 11936 * @internal 11937 */ 11938 11939 11940 ReactServerUpdateQueue.prototype.enqueueReplaceState = function enqueueReplaceState(publicInstance, completeState) { 11941 if (this.transaction.isInTransaction()) { 11942 ReactUpdateQueue.enqueueReplaceState(publicInstance, completeState); 11943 } else { 11944 warnNoop(publicInstance, 'replaceState'); 11945 } 11946 }; 11947 11948 /** 11949 * Sets a subset of the state. This only exists because _pendingState is 11950 * internal. This provides a merging strategy that is not available to deep 11951 * properties which is confusing. TODO: Expose pendingState or don't use it 11952 * during the merge. 11953 * 11954 * @param {ReactClass} publicInstance The instance that should rerender. 11955 * @param {object|function} partialState Next partial state to be merged with state. 11956 * @internal 11957 */ 11958 11959 11960 ReactServerUpdateQueue.prototype.enqueueSetState = function enqueueSetState(publicInstance, partialState) { 11961 if (this.transaction.isInTransaction()) { 11962 ReactUpdateQueue.enqueueSetState(publicInstance, partialState); 11963 } else { 11964 warnNoop(publicInstance, 'setState'); 11965 } 11966 }; 11967 11968 return ReactServerUpdateQueue; 11969 }(); 11970 11971 module.exports = ReactServerUpdateQueue; 11972 },{"157":157,"81":81}],79:[function(_dereq_,module,exports){ 11973 /** 11974 * Copyright 2013-present, Facebook, Inc. 11975 * All rights reserved. 11976 * 11977 * This source code is licensed under the BSD-style license found in the 11978 * LICENSE file in the root directory of this source tree. An additional grant 11979 * of patent rights can be found in the PATENTS file in the same directory. 11980 * 11981 */ 11982 11983 'use strict'; 11984 11985 var _prodInvariant = _dereq_(125), 11986 _assign = _dereq_(158); 11987 11988 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11989 11990 var React = _dereq_(134); 11991 var ReactDefaultInjection = _dereq_(52); 11992 var ReactCompositeComponent = _dereq_(30); 11993 var ReactReconciler = _dereq_(75); 11994 var ReactUpdates = _dereq_(82); 11995 11996 var emptyObject = _dereq_(143); 11997 var getNextDebugID = _dereq_(117); 11998 var invariant = _dereq_(150); 11999 12000 var NoopInternalComponent = function () { 12001 function NoopInternalComponent(element) { 12002 _classCallCheck(this, NoopInternalComponent); 12003 12004 this._renderedOutput = element; 12005 this._currentElement = element; 12006 12007 if ("development" !== 'production') { 12008 this._debugID = getNextDebugID(); 12009 } 12010 } 12011 12012 NoopInternalComponent.prototype.mountComponent = function mountComponent() {}; 12013 12014 NoopInternalComponent.prototype.receiveComponent = function receiveComponent(element) { 12015 this._renderedOutput = element; 12016 this._currentElement = element; 12017 }; 12018 12019 NoopInternalComponent.prototype.unmountComponent = function unmountComponent() {}; 12020 12021 NoopInternalComponent.prototype.getHostNode = function getHostNode() { 12022 return undefined; 12023 }; 12024 12025 NoopInternalComponent.prototype.getPublicInstance = function getPublicInstance() { 12026 return null; 12027 }; 12028 12029 return NoopInternalComponent; 12030 }(); 12031 12032 var ShallowComponentWrapper = function (element) { 12033 // TODO: Consolidate with instantiateReactComponent 12034 if ("development" !== 'production') { 12035 this._debugID = getNextDebugID(); 12036 } 12037 12038 this.construct(element); 12039 }; 12040 _assign(ShallowComponentWrapper.prototype, ReactCompositeComponent, { 12041 _constructComponent: ReactCompositeComponent._constructComponentWithoutOwner, 12042 _instantiateReactComponent: function (element) { 12043 return new NoopInternalComponent(element); 12044 }, 12045 _replaceNodeWithMarkup: function () {}, 12046 _renderValidatedComponent: ReactCompositeComponent._renderValidatedComponentWithoutOwnerOrContext 12047 }); 12048 12049 function _batchedRender(renderer, element, context) { 12050 var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(true); 12051 renderer._render(element, transaction, context); 12052 ReactUpdates.ReactReconcileTransaction.release(transaction); 12053 } 12054 12055 var ReactShallowRenderer = function () { 12056 function ReactShallowRenderer() { 12057 _classCallCheck(this, ReactShallowRenderer); 12058 12059 this._instance = null; 12060 } 12061 12062 ReactShallowRenderer.prototype.getMountedInstance = function getMountedInstance() { 12063 return this._instance ? this._instance._instance : null; 12064 }; 12065 12066 ReactShallowRenderer.prototype.render = function render(element, context) { 12067 // Ensure we've done the default injections. This might not be true in the 12068 // case of a simple test that only requires React and the TestUtils in 12069 // conjunction with an inline-requires transform. 12070 ReactDefaultInjection.inject(); 12071 12072 !React.isValidElement(element) ? "development" !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : _prodInvariant('12', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : void 0; 12073 !(typeof element.type !== 'string') ? "development" !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom components, not primitives (%s). Instead of calling `.render(el)` and inspecting the rendered output, look at `el.props` directly instead.', element.type) : _prodInvariant('13', element.type) : void 0; 12074 12075 if (!context) { 12076 context = emptyObject; 12077 } 12078 ReactUpdates.batchedUpdates(_batchedRender, this, element, context); 12079 12080 return this.getRenderOutput(); 12081 }; 12082 12083 ReactShallowRenderer.prototype.getRenderOutput = function getRenderOutput() { 12084 return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null; 12085 }; 12086 12087 ReactShallowRenderer.prototype.unmount = function unmount() { 12088 if (this._instance) { 12089 ReactReconciler.unmountComponent(this._instance, false); 12090 } 12091 }; 12092 12093 ReactShallowRenderer.prototype._render = function _render(element, transaction, context) { 12094 if (this._instance) { 12095 ReactReconciler.receiveComponent(this._instance, element, transaction, context); 12096 } else { 12097 var instance = new ShallowComponentWrapper(element); 12098 ReactReconciler.mountComponent(instance, transaction, null, null, context, 0); 12099 this._instance = instance; 12100 } 12101 }; 12102 12103 return ReactShallowRenderer; 12104 }(); 12105 12106 module.exports = ReactShallowRenderer; 12107 },{"117":117,"125":125,"134":134,"143":143,"150":150,"158":158,"30":30,"52":52,"75":75,"82":82}],80:[function(_dereq_,module,exports){ 12108 /** 12109 * Copyright 2013-present, Facebook, Inc. 12110 * All rights reserved. 12111 * 12112 * This source code is licensed under the BSD-style license found in the 12113 * LICENSE file in the root directory of this source tree. An additional grant 12114 * of patent rights can be found in the PATENTS file in the same directory. 12115 * 12116 */ 12117 12118 'use strict'; 12119 12120 var _prodInvariant = _dereq_(125), 12121 _assign = _dereq_(158); 12122 12123 var EventConstants = _dereq_(16); 12124 var EventPluginHub = _dereq_(17); 12125 var EventPluginRegistry = _dereq_(18); 12126 var EventPropagators = _dereq_(20); 12127 var React = _dereq_(134); 12128 var ReactDOM = _dereq_(31); 12129 var ReactDOMComponentTree = _dereq_(34); 12130 var ReactBrowserEventEmitter = _dereq_(26); 12131 var ReactInstanceMap = _dereq_(63); 12132 var ReactUpdates = _dereq_(82); 12133 var SyntheticEvent = _dereq_(91); 12134 var ReactShallowRenderer = _dereq_(79); 12135 12136 var findDOMNode = _dereq_(108); 12137 var invariant = _dereq_(150); 12138 12139 var topLevelTypes = EventConstants.topLevelTypes; 12140 12141 function Event(suffix) {} 12142 12143 /** 12144 * @class ReactTestUtils 12145 */ 12146 12147 function findAllInRenderedTreeInternal(inst, test) { 12148 if (!inst || !inst.getPublicInstance) { 12149 return []; 12150 } 12151 var publicInst = inst.getPublicInstance(); 12152 var ret = test(publicInst) ? [publicInst] : []; 12153 var currentElement = inst._currentElement; 12154 if (ReactTestUtils.isDOMComponent(publicInst)) { 12155 var renderedChildren = inst._renderedChildren; 12156 var key; 12157 for (key in renderedChildren) { 12158 if (!renderedChildren.hasOwnProperty(key)) { 12159 continue; 12160 } 12161 ret = ret.concat(findAllInRenderedTreeInternal(renderedChildren[key], test)); 12162 } 12163 } else if (React.isValidElement(currentElement) && typeof currentElement.type === 'function') { 12164 ret = ret.concat(findAllInRenderedTreeInternal(inst._renderedComponent, test)); 12165 } 12166 return ret; 12167 } 12168 12169 /** 12170 * Utilities for making it easy to test React components. 12171 * 12172 * See https://facebook.github.io/react/docs/test-utils.html 12173 * 12174 * Todo: Support the entire DOM.scry query syntax. For now, these simple 12175 * utilities will suffice for testing purposes. 12176 * @lends ReactTestUtils 12177 */ 12178 var ReactTestUtils = { 12179 renderIntoDocument: function (element) { 12180 var div = document.createElement('div'); 12181 // None of our tests actually require attaching the container to the 12182 // DOM, and doing so creates a mess that we rely on test isolation to 12183 // clean up, so we're going to stop honoring the name of this method 12184 // (and probably rename it eventually) if no problems arise. 12185 // document.documentElement.appendChild(div); 12186 return ReactDOM.render(element, div); 12187 }, 12188 12189 isElement: function (element) { 12190 return React.isValidElement(element); 12191 }, 12192 12193 isElementOfType: function (inst, convenienceConstructor) { 12194 return React.isValidElement(inst) && inst.type === convenienceConstructor; 12195 }, 12196 12197 isDOMComponent: function (inst) { 12198 return !!(inst && inst.nodeType === 1 && inst.tagName); 12199 }, 12200 12201 isDOMComponentElement: function (inst) { 12202 return !!(inst && React.isValidElement(inst) && !!inst.tagName); 12203 }, 12204 12205 isCompositeComponent: function (inst) { 12206 if (ReactTestUtils.isDOMComponent(inst)) { 12207 // Accessing inst.setState warns; just return false as that'll be what 12208 // this returns when we have DOM nodes as refs directly 12209 return false; 12210 } 12211 return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function'; 12212 }, 12213 12214 isCompositeComponentWithType: function (inst, type) { 12215 if (!ReactTestUtils.isCompositeComponent(inst)) { 12216 return false; 12217 } 12218 var internalInstance = ReactInstanceMap.get(inst); 12219 var constructor = internalInstance._currentElement.type; 12220 12221 return constructor === type; 12222 }, 12223 12224 isCompositeComponentElement: function (inst) { 12225 if (!React.isValidElement(inst)) { 12226 return false; 12227 } 12228 // We check the prototype of the type that will get mounted, not the 12229 // instance itself. This is a future proof way of duck typing. 12230 var prototype = inst.type.prototype; 12231 return typeof prototype.render === 'function' && typeof prototype.setState === 'function'; 12232 }, 12233 12234 isCompositeComponentElementWithType: function (inst, type) { 12235 var internalInstance = ReactInstanceMap.get(inst); 12236 var constructor = internalInstance._currentElement.type; 12237 12238 return !!(ReactTestUtils.isCompositeComponentElement(inst) && constructor === type); 12239 }, 12240 12241 getRenderedChildOfCompositeComponent: function (inst) { 12242 if (!ReactTestUtils.isCompositeComponent(inst)) { 12243 return null; 12244 } 12245 var internalInstance = ReactInstanceMap.get(inst); 12246 return internalInstance._renderedComponent.getPublicInstance(); 12247 }, 12248 12249 findAllInRenderedTree: function (inst, test) { 12250 if (!inst) { 12251 return []; 12252 } 12253 !ReactTestUtils.isCompositeComponent(inst) ? "development" !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : _prodInvariant('10') : void 0; 12254 return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test); 12255 }, 12256 12257 /** 12258 * Finds all instance of components in the rendered tree that are DOM 12259 * components with the class name matching `className`. 12260 * @return {array} an array of all the matches. 12261 */ 12262 scryRenderedDOMComponentsWithClass: function (root, classNames) { 12263 return ReactTestUtils.findAllInRenderedTree(root, function (inst) { 12264 if (ReactTestUtils.isDOMComponent(inst)) { 12265 var className = inst.className; 12266 if (typeof className !== 'string') { 12267 // SVG, probably. 12268 className = inst.getAttribute('class') || ''; 12269 } 12270 var classList = className.split(/\s+/); 12271 12272 if (!Array.isArray(classNames)) { 12273 !(classNames !== undefined) ? "development" !== 'production' ? invariant(false, 'TestUtils.scryRenderedDOMComponentsWithClass expects a className as a second argument.') : _prodInvariant('11') : void 0; 12274 classNames = classNames.split(/\s+/); 12275 } 12276 return classNames.every(function (name) { 12277 return classList.indexOf(name) !== -1; 12278 }); 12279 } 12280 return false; 12281 }); 12282 }, 12283 12284 /** 12285 * Like scryRenderedDOMComponentsWithClass but expects there to be one result, 12286 * and returns that one result, or throws exception if there is any other 12287 * number of matches besides one. 12288 * @return {!ReactDOMComponent} The one match. 12289 */ 12290 findRenderedDOMComponentWithClass: function (root, className) { 12291 var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className); 12292 if (all.length !== 1) { 12293 throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for class:' + className); 12294 } 12295 return all[0]; 12296 }, 12297 12298 /** 12299 * Finds all instance of components in the rendered tree that are DOM 12300 * components with the tag name matching `tagName`. 12301 * @return {array} an array of all the matches. 12302 */ 12303 scryRenderedDOMComponentsWithTag: function (root, tagName) { 12304 return ReactTestUtils.findAllInRenderedTree(root, function (inst) { 12305 return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase(); 12306 }); 12307 }, 12308 12309 /** 12310 * Like scryRenderedDOMComponentsWithTag but expects there to be one result, 12311 * and returns that one result, or throws exception if there is any other 12312 * number of matches besides one. 12313 * @return {!ReactDOMComponent} The one match. 12314 */ 12315 findRenderedDOMComponentWithTag: function (root, tagName) { 12316 var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName); 12317 if (all.length !== 1) { 12318 throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for tag:' + tagName); 12319 } 12320 return all[0]; 12321 }, 12322 12323 /** 12324 * Finds all instances of components with type equal to `componentType`. 12325 * @return {array} an array of all the matches. 12326 */ 12327 scryRenderedComponentsWithType: function (root, componentType) { 12328 return ReactTestUtils.findAllInRenderedTree(root, function (inst) { 12329 return ReactTestUtils.isCompositeComponentWithType(inst, componentType); 12330 }); 12331 }, 12332 12333 /** 12334 * Same as `scryRenderedComponentsWithType` but expects there to be one result 12335 * and returns that one result, or throws exception if there is any other 12336 * number of matches besides one. 12337 * @return {!ReactComponent} The one match. 12338 */ 12339 findRenderedComponentWithType: function (root, componentType) { 12340 var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType); 12341 if (all.length !== 1) { 12342 throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for componentType:' + componentType); 12343 } 12344 return all[0]; 12345 }, 12346 12347 /** 12348 * Pass a mocked component module to this method to augment it with 12349 * useful methods that allow it to be used as a dummy React component. 12350 * Instead of rendering as usual, the component will become a simple 12351 * <div> containing any provided children. 12352 * 12353 * @param {object} module the mock function object exported from a 12354 * module that defines the component to be mocked 12355 * @param {?string} mockTagName optional dummy root tag name to return 12356 * from render method (overrides 12357 * module.mockTagName if provided) 12358 * @return {object} the ReactTestUtils object (for chaining) 12359 */ 12360 mockComponent: function (module, mockTagName) { 12361 mockTagName = mockTagName || module.mockTagName || 'div'; 12362 12363 module.prototype.render.mockImplementation(function () { 12364 return React.createElement(mockTagName, null, this.props.children); 12365 }); 12366 12367 return this; 12368 }, 12369 12370 /** 12371 * Simulates a top level event being dispatched from a raw event that occurred 12372 * on an `Element` node. 12373 * @param {Object} topLevelType A type from `EventConstants.topLevelTypes` 12374 * @param {!Element} node The dom to simulate an event occurring on. 12375 * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent. 12376 */ 12377 simulateNativeEventOnNode: function (topLevelType, node, fakeNativeEvent) { 12378 fakeNativeEvent.target = node; 12379 ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent); 12380 }, 12381 12382 /** 12383 * Simulates a top level event being dispatched from a raw event that occurred 12384 * on the `ReactDOMComponent` `comp`. 12385 * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`. 12386 * @param {!ReactDOMComponent} comp 12387 * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent. 12388 */ 12389 simulateNativeEventOnDOMComponent: function (topLevelType, comp, fakeNativeEvent) { 12390 ReactTestUtils.simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent); 12391 }, 12392 12393 nativeTouchData: function (x, y) { 12394 return { 12395 touches: [{ pageX: x, pageY: y }] 12396 }; 12397 }, 12398 12399 createRenderer: function () { 12400 return new ReactShallowRenderer(); 12401 }, 12402 12403 Simulate: null, 12404 SimulateNative: {} 12405 }; 12406 12407 /** 12408 * Exports: 12409 * 12410 * - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)` 12411 * - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)` 12412 * - `ReactTestUtils.Simulate.change(Element/ReactDOMComponent)` 12413 * - ... (All keys from event plugin `eventTypes` objects) 12414 */ 12415 function makeSimulator(eventType) { 12416 return function (domComponentOrNode, eventData) { 12417 var node; 12418 !!React.isValidElement(domComponentOrNode) ? "development" !== 'production' ? invariant(false, 'TestUtils.Simulate expects a component instance and not a ReactElement.TestUtils.Simulate will not work if you are using shallow rendering.') : _prodInvariant('14') : void 0; 12419 if (ReactTestUtils.isDOMComponent(domComponentOrNode)) { 12420 node = findDOMNode(domComponentOrNode); 12421 } else if (domComponentOrNode.tagName) { 12422 node = domComponentOrNode; 12423 } 12424 12425 var dispatchConfig = EventPluginRegistry.eventNameDispatchConfigs[eventType]; 12426 12427 var fakeNativeEvent = new Event(); 12428 fakeNativeEvent.target = node; 12429 fakeNativeEvent.type = eventType.toLowerCase(); 12430 12431 // We don't use SyntheticEvent.getPooled in order to not have to worry about 12432 // properly destroying any properties assigned from `eventData` upon release 12433 var event = new SyntheticEvent(dispatchConfig, ReactDOMComponentTree.getInstanceFromNode(node), fakeNativeEvent, node); 12434 // Since we aren't using pooling, always persist the event. This will make 12435 // sure it's marked and won't warn when setting additional properties. 12436 event.persist(); 12437 _assign(event, eventData); 12438 12439 if (dispatchConfig.phasedRegistrationNames) { 12440 EventPropagators.accumulateTwoPhaseDispatches(event); 12441 } else { 12442 EventPropagators.accumulateDirectDispatches(event); 12443 } 12444 12445 ReactUpdates.batchedUpdates(function () { 12446 EventPluginHub.enqueueEvents(event); 12447 EventPluginHub.processEventQueue(true); 12448 }); 12449 }; 12450 } 12451 12452 function buildSimulators() { 12453 ReactTestUtils.Simulate = {}; 12454 12455 var eventType; 12456 for (eventType in EventPluginRegistry.eventNameDispatchConfigs) { 12457 /** 12458 * @param {!Element|ReactDOMComponent} domComponentOrNode 12459 * @param {?object} eventData Fake event data to use in SyntheticEvent. 12460 */ 12461 ReactTestUtils.Simulate[eventType] = makeSimulator(eventType); 12462 } 12463 } 12464 12465 // Rebuild ReactTestUtils.Simulate whenever event plugins are injected 12466 var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder; 12467 EventPluginHub.injection.injectEventPluginOrder = function () { 12468 oldInjectEventPluginOrder.apply(this, arguments); 12469 buildSimulators(); 12470 }; 12471 var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName; 12472 EventPluginHub.injection.injectEventPluginsByName = function () { 12473 oldInjectEventPlugins.apply(this, arguments); 12474 buildSimulators(); 12475 }; 12476 12477 buildSimulators(); 12478 12479 /** 12480 * Exports: 12481 * 12482 * - `ReactTestUtils.SimulateNative.click(Element/ReactDOMComponent)` 12483 * - `ReactTestUtils.SimulateNative.mouseMove(Element/ReactDOMComponent)` 12484 * - `ReactTestUtils.SimulateNative.mouseIn/ReactDOMComponent)` 12485 * - `ReactTestUtils.SimulateNative.mouseOut(Element/ReactDOMComponent)` 12486 * - ... (All keys from `EventConstants.topLevelTypes`) 12487 * 12488 * Note: Top level event types are a subset of the entire set of handler types 12489 * (which include a broader set of "synthetic" events). For example, onDragDone 12490 * is a synthetic event. Except when testing an event plugin or React's event 12491 * handling code specifically, you probably want to use ReactTestUtils.Simulate 12492 * to dispatch synthetic events. 12493 */ 12494 12495 function makeNativeSimulator(eventType) { 12496 return function (domComponentOrNode, nativeEventData) { 12497 var fakeNativeEvent = new Event(eventType); 12498 _assign(fakeNativeEvent, nativeEventData); 12499 if (ReactTestUtils.isDOMComponent(domComponentOrNode)) { 12500 ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent); 12501 } else if (domComponentOrNode.tagName) { 12502 // Will allow on actual dom nodes. 12503 ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent); 12504 } 12505 }; 12506 } 12507 12508 Object.keys(topLevelTypes).forEach(function (eventType) { 12509 // Event type is stored as 'topClick' - we transform that to 'click' 12510 var convenienceName = eventType.indexOf('top') === 0 ? eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType; 12511 /** 12512 * @param {!Element|ReactDOMComponent} domComponentOrNode 12513 * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent. 12514 */ 12515 ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType); 12516 }); 12517 12518 module.exports = ReactTestUtils; 12519 },{"108":108,"125":125,"134":134,"150":150,"158":158,"16":16,"17":17,"18":18,"20":20,"26":26,"31":31,"34":34,"63":63,"79":79,"82":82,"91":91}],81:[function(_dereq_,module,exports){ 12520 /** 12521 * Copyright 2015-present, Facebook, Inc. 12522 * All rights reserved. 12523 * 12524 * This source code is licensed under the BSD-style license found in the 12525 * LICENSE file in the root directory of this source tree. An additional grant 12526 * of patent rights can be found in the PATENTS file in the same directory. 12527 * 12528 */ 12529 12530 'use strict'; 12531 12532 var _prodInvariant = _dereq_(125); 12533 12534 var ReactCurrentOwner = _dereq_(133); 12535 var ReactInstanceMap = _dereq_(63); 12536 var ReactInstrumentation = _dereq_(64); 12537 var ReactUpdates = _dereq_(82); 12538 12539 var invariant = _dereq_(150); 12540 var warning = _dereq_(157); 12541 12542 function enqueueUpdate(internalInstance) { 12543 ReactUpdates.enqueueUpdate(internalInstance); 12544 } 12545 12546 function formatUnexpectedArgument(arg) { 12547 var type = typeof arg; 12548 if (type !== 'object') { 12549 return type; 12550 } 12551 var displayName = arg.constructor && arg.constructor.name || type; 12552 var keys = Object.keys(arg); 12553 if (keys.length > 0 && keys.length < 20) { 12554 return displayName + ' (keys: ' + keys.join(', ') + ')'; 12555 } 12556 return displayName; 12557 } 12558 12559 function getInternalInstanceReadyForUpdate(publicInstance, callerName) { 12560 var internalInstance = ReactInstanceMap.get(publicInstance); 12561 if (!internalInstance) { 12562 if ("development" !== 'production') { 12563 var ctor = publicInstance.constructor; 12564 // Only warn when we have a callerName. Otherwise we should be silent. 12565 // We're probably calling from enqueueCallback. We don't want to warn 12566 // there because we already warned for the corresponding lifecycle method. 12567 "development" !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, ctor && (ctor.displayName || ctor.name) || 'ReactClass') : void 0; 12568 } 12569 return null; 12570 } 12571 12572 if ("development" !== 'production') { 12573 "development" !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition (such as ' + 'within `render` or another component\'s constructor). Render methods ' + 'should be a pure function of props and state; constructor ' + 'side-effects are an anti-pattern, but can be moved to ' + '`componentWillMount`.', callerName) : void 0; 12574 } 12575 12576 return internalInstance; 12577 } 12578 12579 /** 12580 * ReactUpdateQueue allows for state updates to be scheduled into a later 12581 * reconciliation step. 12582 */ 12583 var ReactUpdateQueue = { 12584 12585 /** 12586 * Checks whether or not this composite component is mounted. 12587 * @param {ReactClass} publicInstance The instance we want to test. 12588 * @return {boolean} True if mounted, false otherwise. 12589 * @protected 12590 * @final 12591 */ 12592 isMounted: function (publicInstance) { 12593 if ("development" !== 'production') { 12594 var owner = ReactCurrentOwner.current; 12595 if (owner !== null) { 12596 "development" !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0; 12597 owner._warnedAboutRefsInRender = true; 12598 } 12599 } 12600 var internalInstance = ReactInstanceMap.get(publicInstance); 12601 if (internalInstance) { 12602 // During componentWillMount and render this will still be null but after 12603 // that will always render to something. At least for now. So we can use 12604 // this hack. 12605 return !!internalInstance._renderedComponent; 12606 } else { 12607 return false; 12608 } 12609 }, 12610 12611 /** 12612 * Enqueue a callback that will be executed after all the pending updates 12613 * have processed. 12614 * 12615 * @param {ReactClass} publicInstance The instance to use as `this` context. 12616 * @param {?function} callback Called after state is updated. 12617 * @param {string} callerName Name of the calling function in the public API. 12618 * @internal 12619 */ 12620 enqueueCallback: function (publicInstance, callback, callerName) { 12621 ReactUpdateQueue.validateCallback(callback, callerName); 12622 var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); 12623 12624 // Previously we would throw an error if we didn't have an internal 12625 // instance. Since we want to make it a no-op instead, we mirror the same 12626 // behavior we have in other enqueue* methods. 12627 // We also need to ignore callbacks in componentWillMount. See 12628 // enqueueUpdates. 12629 if (!internalInstance) { 12630 return null; 12631 } 12632 12633 if (internalInstance._pendingCallbacks) { 12634 internalInstance._pendingCallbacks.push(callback); 12635 } else { 12636 internalInstance._pendingCallbacks = [callback]; 12637 } 12638 // TODO: The callback here is ignored when setState is called from 12639 // componentWillMount. Either fix it or disallow doing so completely in 12640 // favor of getInitialState. Alternatively, we can disallow 12641 // componentWillMount during server-side rendering. 12642 enqueueUpdate(internalInstance); 12643 }, 12644 12645 enqueueCallbackInternal: function (internalInstance, callback) { 12646 if (internalInstance._pendingCallbacks) { 12647 internalInstance._pendingCallbacks.push(callback); 12648 } else { 12649 internalInstance._pendingCallbacks = [callback]; 12650 } 12651 enqueueUpdate(internalInstance); 12652 }, 12653 12654 /** 12655 * Forces an update. This should only be invoked when it is known with 12656 * certainty that we are **not** in a DOM transaction. 12657 * 12658 * You may want to call this when you know that some deeper aspect of the 12659 * component's state has changed but `setState` was not called. 12660 * 12661 * This will not invoke `shouldComponentUpdate`, but it will invoke 12662 * `componentWillUpdate` and `componentDidUpdate`. 12663 * 12664 * @param {ReactClass} publicInstance The instance that should rerender. 12665 * @internal 12666 */ 12667 enqueueForceUpdate: function (publicInstance) { 12668 var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate'); 12669 12670 if (!internalInstance) { 12671 return; 12672 } 12673 12674 internalInstance._pendingForceUpdate = true; 12675 12676 enqueueUpdate(internalInstance); 12677 }, 12678 12679 /** 12680 * Replaces all of the state. Always use this or `setState` to mutate state. 12681 * You should treat `this.state` as immutable. 12682 * 12683 * There is no guarantee that `this.state` will be immediately updated, so 12684 * accessing `this.state` after calling this method may return the old value. 12685 * 12686 * @param {ReactClass} publicInstance The instance that should rerender. 12687 * @param {object} completeState Next state. 12688 * @internal 12689 */ 12690 enqueueReplaceState: function (publicInstance, completeState) { 12691 var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState'); 12692 12693 if (!internalInstance) { 12694 return; 12695 } 12696 12697 internalInstance._pendingStateQueue = [completeState]; 12698 internalInstance._pendingReplaceState = true; 12699 12700 enqueueUpdate(internalInstance); 12701 }, 12702 12703 /** 12704 * Sets a subset of the state. This only exists because _pendingState is 12705 * internal. This provides a merging strategy that is not available to deep 12706 * properties which is confusing. TODO: Expose pendingState or don't use it 12707 * during the merge. 12708 * 12709 * @param {ReactClass} publicInstance The instance that should rerender. 12710 * @param {object} partialState Next partial state to be merged with state. 12711 * @internal 12712 */ 12713 enqueueSetState: function (publicInstance, partialState) { 12714 if ("development" !== 'production') { 12715 ReactInstrumentation.debugTool.onSetState(); 12716 "development" !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0; 12717 } 12718 12719 var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState'); 12720 12721 if (!internalInstance) { 12722 return; 12723 } 12724 12725 var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []); 12726 queue.push(partialState); 12727 12728 enqueueUpdate(internalInstance); 12729 }, 12730 12731 enqueueElementInternal: function (internalInstance, nextElement, nextContext) { 12732 internalInstance._pendingElement = nextElement; 12733 // TODO: introduce _pendingContext instead of setting it directly. 12734 internalInstance._context = nextContext; 12735 enqueueUpdate(internalInstance); 12736 }, 12737 12738 validateCallback: function (callback, callerName) { 12739 !(!callback || typeof callback === 'function') ? "development" !== 'production' ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : _prodInvariant('122', callerName, formatUnexpectedArgument(callback)) : void 0; 12740 } 12741 12742 }; 12743 12744 module.exports = ReactUpdateQueue; 12745 },{"125":125,"133":133,"150":150,"157":157,"63":63,"64":64,"82":82}],82:[function(_dereq_,module,exports){ 12746 /** 12747 * Copyright 2013-present, Facebook, Inc. 12748 * All rights reserved. 12749 * 12750 * This source code is licensed under the BSD-style license found in the 12751 * LICENSE file in the root directory of this source tree. An additional grant 12752 * of patent rights can be found in the PATENTS file in the same directory. 12753 * 12754 */ 12755 12756 'use strict'; 12757 12758 var _prodInvariant = _dereq_(125), 12759 _assign = _dereq_(158); 12760 12761 var CallbackQueue = _dereq_(6); 12762 var PooledClass = _dereq_(25); 12763 var ReactFeatureFlags = _dereq_(58); 12764 var ReactReconciler = _dereq_(75); 12765 var Transaction = _dereq_(100); 12766 12767 var invariant = _dereq_(150); 12768 12769 var dirtyComponents = []; 12770 var updateBatchNumber = 0; 12771 var asapCallbackQueue = CallbackQueue.getPooled(); 12772 var asapEnqueued = false; 12773 12774 var batchingStrategy = null; 12775 12776 function ensureInjected() { 12777 !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0; 12778 } 12779 12780 var NESTED_UPDATES = { 12781 initialize: function () { 12782 this.dirtyComponentsLength = dirtyComponents.length; 12783 }, 12784 close: function () { 12785 if (this.dirtyComponentsLength !== dirtyComponents.length) { 12786 // Additional updates were enqueued by componentDidUpdate handlers or 12787 // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run 12788 // these new updates so that if A's componentDidUpdate calls setState on 12789 // B, B will update before the callback A's updater provided when calling 12790 // setState. 12791 dirtyComponents.splice(0, this.dirtyComponentsLength); 12792 flushBatchedUpdates(); 12793 } else { 12794 dirtyComponents.length = 0; 12795 } 12796 } 12797 }; 12798 12799 var UPDATE_QUEUEING = { 12800 initialize: function () { 12801 this.callbackQueue.reset(); 12802 }, 12803 close: function () { 12804 this.callbackQueue.notifyAll(); 12805 } 12806 }; 12807 12808 var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]; 12809 12810 function ReactUpdatesFlushTransaction() { 12811 this.reinitializeTransaction(); 12812 this.dirtyComponentsLength = null; 12813 this.callbackQueue = CallbackQueue.getPooled(); 12814 this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( 12815 /* useCreateElement */true); 12816 } 12817 12818 _assign(ReactUpdatesFlushTransaction.prototype, Transaction, { 12819 getTransactionWrappers: function () { 12820 return TRANSACTION_WRAPPERS; 12821 }, 12822 12823 destructor: function () { 12824 this.dirtyComponentsLength = null; 12825 CallbackQueue.release(this.callbackQueue); 12826 this.callbackQueue = null; 12827 ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction); 12828 this.reconcileTransaction = null; 12829 }, 12830 12831 perform: function (method, scope, a) { 12832 // Essentially calls `this.reconcileTransaction.perform(method, scope, a)` 12833 // with this transaction's wrappers around it. 12834 return Transaction.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a); 12835 } 12836 }); 12837 12838 PooledClass.addPoolingTo(ReactUpdatesFlushTransaction); 12839 12840 function batchedUpdates(callback, a, b, c, d, e) { 12841 ensureInjected(); 12842 return batchingStrategy.batchedUpdates(callback, a, b, c, d, e); 12843 } 12844 12845 /** 12846 * Array comparator for ReactComponents by mount ordering. 12847 * 12848 * @param {ReactComponent} c1 first component you're comparing 12849 * @param {ReactComponent} c2 second component you're comparing 12850 * @return {number} Return value usable by Array.prototype.sort(). 12851 */ 12852 function mountOrderComparator(c1, c2) { 12853 return c1._mountOrder - c2._mountOrder; 12854 } 12855 12856 function runBatchedUpdates(transaction) { 12857 var len = transaction.dirtyComponentsLength; 12858 !(len === dirtyComponents.length) ? "development" !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to match dirty-components array length (%s).', len, dirtyComponents.length) : _prodInvariant('124', len, dirtyComponents.length) : void 0; 12859 12860 // Since reconciling a component higher in the owner hierarchy usually (not 12861 // always -- see shouldComponentUpdate()) will reconcile children, reconcile 12862 // them before their children by sorting the array. 12863 dirtyComponents.sort(mountOrderComparator); 12864 12865 // Any updates enqueued while reconciling must be performed after this entire 12866 // batch. Otherwise, if dirtyComponents is [A, B] where A has children B and 12867 // C, B could update twice in a single batch if C's render enqueues an update 12868 // to B (since B would have already updated, we should skip it, and the only 12869 // way we can know to do so is by checking the batch counter). 12870 updateBatchNumber++; 12871 12872 for (var i = 0; i < len; i++) { 12873 // If a component is unmounted before pending changes apply, it will still 12874 // be here, but we assume that it has cleared its _pendingCallbacks and 12875 // that performUpdateIfNecessary is a noop. 12876 var component = dirtyComponents[i]; 12877 12878 // If performUpdateIfNecessary happens to enqueue any new updates, we 12879 // shouldn't execute the callbacks until the next render happens, so 12880 // stash the callbacks first 12881 var callbacks = component._pendingCallbacks; 12882 component._pendingCallbacks = null; 12883 12884 var markerName; 12885 if (ReactFeatureFlags.logTopLevelRenders) { 12886 var namedComponent = component; 12887 // Duck type TopLevelWrapper. This is probably always true. 12888 if (component._currentElement.type.isReactTopLevelWrapper) { 12889 namedComponent = component._renderedComponent; 12890 } 12891 markerName = 'React update: ' + namedComponent.getName(); 12892 console.time(markerName); 12893 } 12894 12895 ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber); 12896 12897 if (markerName) { 12898 console.timeEnd(markerName); 12899 } 12900 12901 if (callbacks) { 12902 for (var j = 0; j < callbacks.length; j++) { 12903 transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance()); 12904 } 12905 } 12906 } 12907 } 12908 12909 var flushBatchedUpdates = function () { 12910 // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents 12911 // array and perform any updates enqueued by mount-ready handlers (i.e., 12912 // componentDidUpdate) but we need to check here too in order to catch 12913 // updates enqueued by setState callbacks and asap calls. 12914 while (dirtyComponents.length || asapEnqueued) { 12915 if (dirtyComponents.length) { 12916 var transaction = ReactUpdatesFlushTransaction.getPooled(); 12917 transaction.perform(runBatchedUpdates, null, transaction); 12918 ReactUpdatesFlushTransaction.release(transaction); 12919 } 12920 12921 if (asapEnqueued) { 12922 asapEnqueued = false; 12923 var queue = asapCallbackQueue; 12924 asapCallbackQueue = CallbackQueue.getPooled(); 12925 queue.notifyAll(); 12926 CallbackQueue.release(queue); 12927 } 12928 } 12929 }; 12930 12931 /** 12932 * Mark a component as needing a rerender, adding an optional callback to a 12933 * list of functions which will be executed once the rerender occurs. 12934 */ 12935 function enqueueUpdate(component) { 12936 ensureInjected(); 12937 12938 // Various parts of our code (such as ReactCompositeComponent's 12939 // _renderValidatedComponent) assume that calls to render aren't nested; 12940 // verify that that's the case. (This is called by each top-level update 12941 // function, like setState, forceUpdate, etc.; creation and 12942 // destruction of top-level components is guarded in ReactMount.) 12943 12944 if (!batchingStrategy.isBatchingUpdates) { 12945 batchingStrategy.batchedUpdates(enqueueUpdate, component); 12946 return; 12947 } 12948 12949 dirtyComponents.push(component); 12950 if (component._updateBatchNumber == null) { 12951 component._updateBatchNumber = updateBatchNumber + 1; 12952 } 12953 } 12954 12955 /** 12956 * Enqueue a callback to be run at the end of the current batching cycle. Throws 12957 * if no updates are currently being performed. 12958 */ 12959 function asap(callback, context) { 12960 !batchingStrategy.isBatchingUpdates ? "development" !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context whereupdates are not being batched.') : _prodInvariant('125') : void 0; 12961 asapCallbackQueue.enqueue(callback, context); 12962 asapEnqueued = true; 12963 } 12964 12965 var ReactUpdatesInjection = { 12966 injectReconcileTransaction: function (ReconcileTransaction) { 12967 !ReconcileTransaction ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0; 12968 ReactUpdates.ReactReconcileTransaction = ReconcileTransaction; 12969 }, 12970 12971 injectBatchingStrategy: function (_batchingStrategy) { 12972 !_batchingStrategy ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0; 12973 !(typeof _batchingStrategy.batchedUpdates === 'function') ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0; 12974 !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : _prodInvariant('129') : void 0; 12975 batchingStrategy = _batchingStrategy; 12976 } 12977 }; 12978 12979 var ReactUpdates = { 12980 /** 12981 * React references `ReactReconcileTransaction` using this property in order 12982 * to allow dependency injection. 12983 * 12984 * @internal 12985 */ 12986 ReactReconcileTransaction: null, 12987 12988 batchedUpdates: batchedUpdates, 12989 enqueueUpdate: enqueueUpdate, 12990 flushBatchedUpdates: flushBatchedUpdates, 12991 injection: ReactUpdatesInjection, 12992 asap: asap 12993 }; 12994 12995 module.exports = ReactUpdates; 12996 },{"100":100,"125":125,"150":150,"158":158,"25":25,"58":58,"6":6,"75":75}],83:[function(_dereq_,module,exports){ 12997 /** 12998 * Copyright 2013-present, Facebook, Inc. 12999 * All rights reserved. 13000 * 13001 * This source code is licensed under the BSD-style license found in the 13002 * LICENSE file in the root directory of this source tree. An additional grant 13003 * of patent rights can be found in the PATENTS file in the same directory. 13004 * 13005 */ 13006 13007 'use strict'; 13008 13009 module.exports = '15.4.1'; 13010 },{}],84:[function(_dereq_,module,exports){ 13011 /** 13012 * Copyright 2013-present, Facebook, Inc. 13013 * All rights reserved. 13014 * 13015 * This source code is licensed under the BSD-style license found in the 13016 * LICENSE file in the root directory of this source tree. An additional grant 13017 * of patent rights can be found in the PATENTS file in the same directory. 13018 * 13019 */ 13020 13021 'use strict'; 13022 13023 var NS = { 13024 xlink: 'http://www.w3.org/1999/xlink', 13025 xml: 'http://www.w3.org/XML/1998/namespace' 13026 }; 13027 13028 // We use attributes for everything SVG so let's avoid some duplication and run 13029 // code instead. 13030 // The following are all specified in the HTML config already so we exclude here. 13031 // - class (as className) 13032 // - color 13033 // - height 13034 // - id 13035 // - lang 13036 // - max 13037 // - media 13038 // - method 13039 // - min 13040 // - name 13041 // - style 13042 // - target 13043 // - type 13044 // - width 13045 var ATTRS = { 13046 accentHeight: 'accent-height', 13047 accumulate: 0, 13048 additive: 0, 13049 alignmentBaseline: 'alignment-baseline', 13050 allowReorder: 'allowReorder', 13051 alphabetic: 0, 13052 amplitude: 0, 13053 arabicForm: 'arabic-form', 13054 ascent: 0, 13055 attributeName: 'attributeName', 13056 attributeType: 'attributeType', 13057 autoReverse: 'autoReverse', 13058 azimuth: 0, 13059 baseFrequency: 'baseFrequency', 13060 baseProfile: 'baseProfile', 13061 baselineShift: 'baseline-shift', 13062 bbox: 0, 13063 begin: 0, 13064 bias: 0, 13065 by: 0, 13066 calcMode: 'calcMode', 13067 capHeight: 'cap-height', 13068 clip: 0, 13069 clipPath: 'clip-path', 13070 clipRule: 'clip-rule', 13071 clipPathUnits: 'clipPathUnits', 13072 colorInterpolation: 'color-interpolation', 13073 colorInterpolationFilters: 'color-interpolation-filters', 13074 colorProfile: 'color-profile', 13075 colorRendering: 'color-rendering', 13076 contentScriptType: 'contentScriptType', 13077 contentStyleType: 'contentStyleType', 13078 cursor: 0, 13079 cx: 0, 13080 cy: 0, 13081 d: 0, 13082 decelerate: 0, 13083 descent: 0, 13084 diffuseConstant: 'diffuseConstant', 13085 direction: 0, 13086 display: 0, 13087 divisor: 0, 13088 dominantBaseline: 'dominant-baseline', 13089 dur: 0, 13090 dx: 0, 13091 dy: 0, 13092 edgeMode: 'edgeMode', 13093 elevation: 0, 13094 enableBackground: 'enable-background', 13095 end: 0, 13096 exponent: 0, 13097 externalResourcesRequired: 'externalResourcesRequired', 13098 fill: 0, 13099 fillOpacity: 'fill-opacity', 13100 fillRule: 'fill-rule', 13101 filter: 0, 13102 filterRes: 'filterRes', 13103 filterUnits: 'filterUnits', 13104 floodColor: 'flood-color', 13105 floodOpacity: 'flood-opacity', 13106 focusable: 0, 13107 fontFamily: 'font-family', 13108 fontSize: 'font-size', 13109 fontSizeAdjust: 'font-size-adjust', 13110 fontStretch: 'font-stretch', 13111 fontStyle: 'font-style', 13112 fontVariant: 'font-variant', 13113 fontWeight: 'font-weight', 13114 format: 0, 13115 from: 0, 13116 fx: 0, 13117 fy: 0, 13118 g1: 0, 13119 g2: 0, 13120 glyphName: 'glyph-name', 13121 glyphOrientationHorizontal: 'glyph-orientation-horizontal', 13122 glyphOrientationVertical: 'glyph-orientation-vertical', 13123 glyphRef: 'glyphRef', 13124 gradientTransform: 'gradientTransform', 13125 gradientUnits: 'gradientUnits', 13126 hanging: 0, 13127 horizAdvX: 'horiz-adv-x', 13128 horizOriginX: 'horiz-origin-x', 13129 ideographic: 0, 13130 imageRendering: 'image-rendering', 13131 'in': 0, 13132 in2: 0, 13133 intercept: 0, 13134 k: 0, 13135 k1: 0, 13136 k2: 0, 13137 k3: 0, 13138 k4: 0, 13139 kernelMatrix: 'kernelMatrix', 13140 kernelUnitLength: 'kernelUnitLength', 13141 kerning: 0, 13142 keyPoints: 'keyPoints', 13143 keySplines: 'keySplines', 13144 keyTimes: 'keyTimes', 13145 lengthAdjust: 'lengthAdjust', 13146 letterSpacing: 'letter-spacing', 13147 lightingColor: 'lighting-color', 13148 limitingConeAngle: 'limitingConeAngle', 13149 local: 0, 13150 markerEnd: 'marker-end', 13151 markerMid: 'marker-mid', 13152 markerStart: 'marker-start', 13153 markerHeight: 'markerHeight', 13154 markerUnits: 'markerUnits', 13155 markerWidth: 'markerWidth', 13156 mask: 0, 13157 maskContentUnits: 'maskContentUnits', 13158 maskUnits: 'maskUnits', 13159 mathematical: 0, 13160 mode: 0, 13161 numOctaves: 'numOctaves', 13162 offset: 0, 13163 opacity: 0, 13164 operator: 0, 13165 order: 0, 13166 orient: 0, 13167 orientation: 0, 13168 origin: 0, 13169 overflow: 0, 13170 overlinePosition: 'overline-position', 13171 overlineThickness: 'overline-thickness', 13172 paintOrder: 'paint-order', 13173 panose1: 'panose-1', 13174 pathLength: 'pathLength', 13175 patternContentUnits: 'patternContentUnits', 13176 patternTransform: 'patternTransform', 13177 patternUnits: 'patternUnits', 13178 pointerEvents: 'pointer-events', 13179 points: 0, 13180 pointsAtX: 'pointsAtX', 13181 pointsAtY: 'pointsAtY', 13182 pointsAtZ: 'pointsAtZ', 13183 preserveAlpha: 'preserveAlpha', 13184 preserveAspectRatio: 'preserveAspectRatio', 13185 primitiveUnits: 'primitiveUnits', 13186 r: 0, 13187 radius: 0, 13188 refX: 'refX', 13189 refY: 'refY', 13190 renderingIntent: 'rendering-intent', 13191 repeatCount: 'repeatCount', 13192 repeatDur: 'repeatDur', 13193 requiredExtensions: 'requiredExtensions', 13194 requiredFeatures: 'requiredFeatures', 13195 restart: 0, 13196 result: 0, 13197 rotate: 0, 13198 rx: 0, 13199 ry: 0, 13200 scale: 0, 13201 seed: 0, 13202 shapeRendering: 'shape-rendering', 13203 slope: 0, 13204 spacing: 0, 13205 specularConstant: 'specularConstant', 13206 specularExponent: 'specularExponent', 13207 speed: 0, 13208 spreadMethod: 'spreadMethod', 13209 startOffset: 'startOffset', 13210 stdDeviation: 'stdDeviation', 13211 stemh: 0, 13212 stemv: 0, 13213 stitchTiles: 'stitchTiles', 13214 stopColor: 'stop-color', 13215 stopOpacity: 'stop-opacity', 13216 strikethroughPosition: 'strikethrough-position', 13217 strikethroughThickness: 'strikethrough-thickness', 13218 string: 0, 13219 stroke: 0, 13220 strokeDasharray: 'stroke-dasharray', 13221 strokeDashoffset: 'stroke-dashoffset', 13222 strokeLinecap: 'stroke-linecap', 13223 strokeLinejoin: 'stroke-linejoin', 13224 strokeMiterlimit: 'stroke-miterlimit', 13225 strokeOpacity: 'stroke-opacity', 13226 strokeWidth: 'stroke-width', 13227 surfaceScale: 'surfaceScale', 13228 systemLanguage: 'systemLanguage', 13229 tableValues: 'tableValues', 13230 targetX: 'targetX', 13231 targetY: 'targetY', 13232 textAnchor: 'text-anchor', 13233 textDecoration: 'text-decoration', 13234 textRendering: 'text-rendering', 13235 textLength: 'textLength', 13236 to: 0, 13237 transform: 0, 13238 u1: 0, 13239 u2: 0, 13240 underlinePosition: 'underline-position', 13241 underlineThickness: 'underline-thickness', 13242 unicode: 0, 13243 unicodeBidi: 'unicode-bidi', 13244 unicodeRange: 'unicode-range', 13245 unitsPerEm: 'units-per-em', 13246 vAlphabetic: 'v-alphabetic', 13247 vHanging: 'v-hanging', 13248 vIdeographic: 'v-ideographic', 13249 vMathematical: 'v-mathematical', 13250 values: 0, 13251 vectorEffect: 'vector-effect', 13252 version: 0, 13253 vertAdvY: 'vert-adv-y', 13254 vertOriginX: 'vert-origin-x', 13255 vertOriginY: 'vert-origin-y', 13256 viewBox: 'viewBox', 13257 viewTarget: 'viewTarget', 13258 visibility: 0, 13259 widths: 0, 13260 wordSpacing: 'word-spacing', 13261 writingMode: 'writing-mode', 13262 x: 0, 13263 xHeight: 'x-height', 13264 x1: 0, 13265 x2: 0, 13266 xChannelSelector: 'xChannelSelector', 13267 xlinkActuate: 'xlink:actuate', 13268 xlinkArcrole: 'xlink:arcrole', 13269 xlinkHref: 'xlink:href', 13270 xlinkRole: 'xlink:role', 13271 xlinkShow: 'xlink:show', 13272 xlinkTitle: 'xlink:title', 13273 xlinkType: 'xlink:type', 13274 xmlBase: 'xml:base', 13275 xmlns: 0, 13276 xmlnsXlink: 'xmlns:xlink', 13277 xmlLang: 'xml:lang', 13278 xmlSpace: 'xml:space', 13279 y: 0, 13280 y1: 0, 13281 y2: 0, 13282 yChannelSelector: 'yChannelSelector', 13283 z: 0, 13284 zoomAndPan: 'zoomAndPan' 13285 }; 13286 13287 var SVGDOMPropertyConfig = { 13288 Properties: {}, 13289 DOMAttributeNamespaces: { 13290 xlinkActuate: NS.xlink, 13291 xlinkArcrole: NS.xlink, 13292 xlinkHref: NS.xlink, 13293 xlinkRole: NS.xlink, 13294 xlinkShow: NS.xlink, 13295 xlinkTitle: NS.xlink, 13296 xlinkType: NS.xlink, 13297 xmlBase: NS.xml, 13298 xmlLang: NS.xml, 13299 xmlSpace: NS.xml 13300 }, 13301 DOMAttributeNames: {} 13302 }; 13303 13304 Object.keys(ATTRS).forEach(function (key) { 13305 SVGDOMPropertyConfig.Properties[key] = 0; 13306 if (ATTRS[key]) { 13307 SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key]; 13308 } 13309 }); 13310 13311 module.exports = SVGDOMPropertyConfig; 13312 },{}],85:[function(_dereq_,module,exports){ 13313 /** 13314 * Copyright 2013-present, Facebook, Inc. 13315 * All rights reserved. 13316 * 13317 * This source code is licensed under the BSD-style license found in the 13318 * LICENSE file in the root directory of this source tree. An additional grant 13319 * of patent rights can be found in the PATENTS file in the same directory. 13320 * 13321 */ 13322 13323 'use strict'; 13324 13325 var EventPropagators = _dereq_(20); 13326 var ExecutionEnvironment = _dereq_(136); 13327 var ReactDOMComponentTree = _dereq_(34); 13328 var ReactInputSelection = _dereq_(62); 13329 var SyntheticEvent = _dereq_(91); 13330 13331 var getActiveElement = _dereq_(145); 13332 var isTextInputElement = _dereq_(123); 13333 var shallowEqual = _dereq_(156); 13334 13335 var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11; 13336 13337 var eventTypes = { 13338 select: { 13339 phasedRegistrationNames: { 13340 bubbled: 'onSelect', 13341 captured: 'onSelectCapture' 13342 }, 13343 dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange'] 13344 } 13345 }; 13346 13347 var activeElement = null; 13348 var activeElementInst = null; 13349 var lastSelection = null; 13350 var mouseDown = false; 13351 13352 // Track whether a listener exists for this plugin. If none exist, we do 13353 // not extract events. See #3639. 13354 var hasListener = false; 13355 13356 /** 13357 * Get an object which is a unique representation of the current selection. 13358 * 13359 * The return value will not be consistent across nodes or browsers, but 13360 * two identical selections on the same node will return identical objects. 13361 * 13362 * @param {DOMElement} node 13363 * @return {object} 13364 */ 13365 function getSelection(node) { 13366 if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) { 13367 return { 13368 start: node.selectionStart, 13369 end: node.selectionEnd 13370 }; 13371 } else if (window.getSelection) { 13372 var selection = window.getSelection(); 13373 return { 13374 anchorNode: selection.anchorNode, 13375 anchorOffset: selection.anchorOffset, 13376 focusNode: selection.focusNode, 13377 focusOffset: selection.focusOffset 13378 }; 13379 } else if (document.selection) { 13380 var range = document.selection.createRange(); 13381 return { 13382 parentElement: range.parentElement(), 13383 text: range.text, 13384 top: range.boundingTop, 13385 left: range.boundingLeft 13386 }; 13387 } 13388 } 13389 13390 /** 13391 * Poll selection to see whether it's changed. 13392 * 13393 * @param {object} nativeEvent 13394 * @return {?SyntheticEvent} 13395 */ 13396 function constructSelectEvent(nativeEvent, nativeEventTarget) { 13397 // Ensure we have the right element, and that the user is not dragging a 13398 // selection (this matches native `select` event behavior). In HTML5, select 13399 // fires only on input and textarea thus if there's no focused element we 13400 // won't dispatch. 13401 if (mouseDown || activeElement == null || activeElement !== getActiveElement()) { 13402 return null; 13403 } 13404 13405 // Only fire when selection has actually changed. 13406 var currentSelection = getSelection(activeElement); 13407 if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { 13408 lastSelection = currentSelection; 13409 13410 var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget); 13411 13412 syntheticEvent.type = 'select'; 13413 syntheticEvent.target = activeElement; 13414 13415 EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent); 13416 13417 return syntheticEvent; 13418 } 13419 13420 return null; 13421 } 13422 13423 /** 13424 * This plugin creates an `onSelect` event that normalizes select events 13425 * across form elements. 13426 * 13427 * Supported elements are: 13428 * - input (see `isTextInputElement`) 13429 * - textarea 13430 * - contentEditable 13431 * 13432 * This differs from native browser implementations in the following ways: 13433 * - Fires on contentEditable fields as well as inputs. 13434 * - Fires for collapsed selection. 13435 * - Fires after user input. 13436 */ 13437 var SelectEventPlugin = { 13438 13439 eventTypes: eventTypes, 13440 13441 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { 13442 if (!hasListener) { 13443 return null; 13444 } 13445 13446 var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window; 13447 13448 switch (topLevelType) { 13449 // Track the input node that has focus. 13450 case 'topFocus': 13451 if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') { 13452 activeElement = targetNode; 13453 activeElementInst = targetInst; 13454 lastSelection = null; 13455 } 13456 break; 13457 case 'topBlur': 13458 activeElement = null; 13459 activeElementInst = null; 13460 lastSelection = null; 13461 break; 13462 13463 // Don't fire the event while the user is dragging. This matches the 13464 // semantics of the native select event. 13465 case 'topMouseDown': 13466 mouseDown = true; 13467 break; 13468 case 'topContextMenu': 13469 case 'topMouseUp': 13470 mouseDown = false; 13471 return constructSelectEvent(nativeEvent, nativeEventTarget); 13472 13473 // Chrome and IE fire non-standard event when selection is changed (and 13474 // sometimes when it hasn't). IE's event fires out of order with respect 13475 // to key and input events on deletion, so we discard it. 13476 // 13477 // Firefox doesn't support selectionchange, so check selection status 13478 // after each key entry. The selection changes after keydown and before 13479 // keyup, but we check on keydown as well in the case of holding down a 13480 // key, when multiple keydown events are fired but only one keyup is. 13481 // This is also our approach for IE handling, for the reason above. 13482 case 'topSelectionChange': 13483 if (skipSelectionChangeEvent) { 13484 break; 13485 } 13486 // falls through 13487 case 'topKeyDown': 13488 case 'topKeyUp': 13489 return constructSelectEvent(nativeEvent, nativeEventTarget); 13490 } 13491 13492 return null; 13493 }, 13494 13495 didPutListener: function (inst, registrationName, listener) { 13496 if (registrationName === 'onSelect') { 13497 hasListener = true; 13498 } 13499 } 13500 }; 13501 13502 module.exports = SelectEventPlugin; 13503 },{"123":123,"136":136,"145":145,"156":156,"20":20,"34":34,"62":62,"91":91}],86:[function(_dereq_,module,exports){ 13504 /** 13505 * Copyright 2013-present, Facebook, Inc. 13506 * All rights reserved. 13507 * 13508 * This source code is licensed under the BSD-style license found in the 13509 * LICENSE file in the root directory of this source tree. An additional grant 13510 * of patent rights can be found in the PATENTS file in the same directory. 13511 * 13512 * 13513 */ 13514 13515 'use strict'; 13516 13517 var _prodInvariant = _dereq_(125); 13518 13519 var EventListener = _dereq_(135); 13520 var EventPropagators = _dereq_(20); 13521 var ReactDOMComponentTree = _dereq_(34); 13522 var SyntheticAnimationEvent = _dereq_(87); 13523 var SyntheticClipboardEvent = _dereq_(88); 13524 var SyntheticEvent = _dereq_(91); 13525 var SyntheticFocusEvent = _dereq_(92); 13526 var SyntheticKeyboardEvent = _dereq_(94); 13527 var SyntheticMouseEvent = _dereq_(95); 13528 var SyntheticDragEvent = _dereq_(90); 13529 var SyntheticTouchEvent = _dereq_(96); 13530 var SyntheticTransitionEvent = _dereq_(97); 13531 var SyntheticUIEvent = _dereq_(98); 13532 var SyntheticWheelEvent = _dereq_(99); 13533 13534 var emptyFunction = _dereq_(142); 13535 var getEventCharCode = _dereq_(111); 13536 var invariant = _dereq_(150); 13537 13538 /** 13539 * Turns 13540 * ['abort', ...] 13541 * into 13542 * eventTypes = { 13543 * 'abort': { 13544 * phasedRegistrationNames: { 13545 * bubbled: 'onAbort', 13546 * captured: 'onAbortCapture', 13547 * }, 13548 * dependencies: ['topAbort'], 13549 * }, 13550 * ... 13551 * }; 13552 * topLevelEventsToDispatchConfig = { 13553 * 'topAbort': { sameConfig } 13554 * }; 13555 */ 13556 var eventTypes = {}; 13557 var topLevelEventsToDispatchConfig = {}; 13558 ['abort', 'animationEnd', 'animationIteration', 'animationStart', 'blur', 'canPlay', 'canPlayThrough', 'click', 'contextMenu', 'copy', 'cut', 'doubleClick', 'drag', 'dragEnd', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'dragStart', 'drop', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'focus', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'mouseDown', 'mouseMove', 'mouseOut', 'mouseOver', 'mouseUp', 'paste', 'pause', 'play', 'playing', 'progress', 'rateChange', 'reset', 'scroll', 'seeked', 'seeking', 'stalled', 'submit', 'suspend', 'timeUpdate', 'touchCancel', 'touchEnd', 'touchMove', 'touchStart', 'transitionEnd', 'volumeChange', 'waiting', 'wheel'].forEach(function (event) { 13559 var capitalizedEvent = event[0].toUpperCase() + event.slice(1); 13560 var onEvent = 'on' + capitalizedEvent; 13561 var topEvent = 'top' + capitalizedEvent; 13562 13563 var type = { 13564 phasedRegistrationNames: { 13565 bubbled: onEvent, 13566 captured: onEvent + 'Capture' 13567 }, 13568 dependencies: [topEvent] 13569 }; 13570 eventTypes[event] = type; 13571 topLevelEventsToDispatchConfig[topEvent] = type; 13572 }); 13573 13574 var onClickListeners = {}; 13575 13576 function getDictionaryKey(inst) { 13577 // Prevents V8 performance issue: 13578 // https://github.com/facebook/react/pull/7232 13579 return '.' + inst._rootNodeID; 13580 } 13581 13582 function isInteractive(tag) { 13583 return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; 13584 } 13585 13586 var SimpleEventPlugin = { 13587 13588 eventTypes: eventTypes, 13589 13590 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { 13591 var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType]; 13592 if (!dispatchConfig) { 13593 return null; 13594 } 13595 var EventConstructor; 13596 switch (topLevelType) { 13597 case 'topAbort': 13598 case 'topCanPlay': 13599 case 'topCanPlayThrough': 13600 case 'topDurationChange': 13601 case 'topEmptied': 13602 case 'topEncrypted': 13603 case 'topEnded': 13604 case 'topError': 13605 case 'topInput': 13606 case 'topInvalid': 13607 case 'topLoad': 13608 case 'topLoadedData': 13609 case 'topLoadedMetadata': 13610 case 'topLoadStart': 13611 case 'topPause': 13612 case 'topPlay': 13613 case 'topPlaying': 13614 case 'topProgress': 13615 case 'topRateChange': 13616 case 'topReset': 13617 case 'topSeeked': 13618 case 'topSeeking': 13619 case 'topStalled': 13620 case 'topSubmit': 13621 case 'topSuspend': 13622 case 'topTimeUpdate': 13623 case 'topVolumeChange': 13624 case 'topWaiting': 13625 // HTML Events 13626 // @see http://www.w3.org/TR/html5/index.html#events-0 13627 EventConstructor = SyntheticEvent; 13628 break; 13629 case 'topKeyPress': 13630 // Firefox creates a keypress event for function keys too. This removes 13631 // the unwanted keypress events. Enter is however both printable and 13632 // non-printable. One would expect Tab to be as well (but it isn't). 13633 if (getEventCharCode(nativeEvent) === 0) { 13634 return null; 13635 } 13636 /* falls through */ 13637 case 'topKeyDown': 13638 case 'topKeyUp': 13639 EventConstructor = SyntheticKeyboardEvent; 13640 break; 13641 case 'topBlur': 13642 case 'topFocus': 13643 EventConstructor = SyntheticFocusEvent; 13644 break; 13645 case 'topClick': 13646 // Firefox creates a click event on right mouse clicks. This removes the 13647 // unwanted click events. 13648 if (nativeEvent.button === 2) { 13649 return null; 13650 } 13651 /* falls through */ 13652 case 'topDoubleClick': 13653 case 'topMouseDown': 13654 case 'topMouseMove': 13655 case 'topMouseUp': 13656 // TODO: Disabled elements should not respond to mouse events 13657 /* falls through */ 13658 case 'topMouseOut': 13659 case 'topMouseOver': 13660 case 'topContextMenu': 13661 EventConstructor = SyntheticMouseEvent; 13662 break; 13663 case 'topDrag': 13664 case 'topDragEnd': 13665 case 'topDragEnter': 13666 case 'topDragExit': 13667 case 'topDragLeave': 13668 case 'topDragOver': 13669 case 'topDragStart': 13670 case 'topDrop': 13671 EventConstructor = SyntheticDragEvent; 13672 break; 13673 case 'topTouchCancel': 13674 case 'topTouchEnd': 13675 case 'topTouchMove': 13676 case 'topTouchStart': 13677 EventConstructor = SyntheticTouchEvent; 13678 break; 13679 case 'topAnimationEnd': 13680 case 'topAnimationIteration': 13681 case 'topAnimationStart': 13682 EventConstructor = SyntheticAnimationEvent; 13683 break; 13684 case 'topTransitionEnd': 13685 EventConstructor = SyntheticTransitionEvent; 13686 break; 13687 case 'topScroll': 13688 EventConstructor = SyntheticUIEvent; 13689 break; 13690 case 'topWheel': 13691 EventConstructor = SyntheticWheelEvent; 13692 break; 13693 case 'topCopy': 13694 case 'topCut': 13695 case 'topPaste': 13696 EventConstructor = SyntheticClipboardEvent; 13697 break; 13698 } 13699 !EventConstructor ? "development" !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : _prodInvariant('86', topLevelType) : void 0; 13700 var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget); 13701 EventPropagators.accumulateTwoPhaseDispatches(event); 13702 return event; 13703 }, 13704 13705 didPutListener: function (inst, registrationName, listener) { 13706 // Mobile Safari does not fire properly bubble click events on 13707 // non-interactive elements, which means delegated click listeners do not 13708 // fire. The workaround for this bug involves attaching an empty click 13709 // listener on the target node. 13710 // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html 13711 if (registrationName === 'onClick' && !isInteractive(inst._tag)) { 13712 var key = getDictionaryKey(inst); 13713 var node = ReactDOMComponentTree.getNodeFromInstance(inst); 13714 if (!onClickListeners[key]) { 13715 onClickListeners[key] = EventListener.listen(node, 'click', emptyFunction); 13716 } 13717 } 13718 }, 13719 13720 willDeleteListener: function (inst, registrationName) { 13721 if (registrationName === 'onClick' && !isInteractive(inst._tag)) { 13722 var key = getDictionaryKey(inst); 13723 onClickListeners[key].remove(); 13724 delete onClickListeners[key]; 13725 } 13726 } 13727 13728 }; 13729 13730 module.exports = SimpleEventPlugin; 13731 },{"111":111,"125":125,"135":135,"142":142,"150":150,"20":20,"34":34,"87":87,"88":88,"90":90,"91":91,"92":92,"94":94,"95":95,"96":96,"97":97,"98":98,"99":99}],87:[function(_dereq_,module,exports){ 13732 /** 13733 * Copyright 2013-present, Facebook, Inc. 13734 * All rights reserved. 13735 * 13736 * This source code is licensed under the BSD-style license found in the 13737 * LICENSE file in the root directory of this source tree. An additional grant 13738 * of patent rights can be found in the PATENTS file in the same directory. 13739 * 13740 */ 13741 13742 'use strict'; 13743 13744 var SyntheticEvent = _dereq_(91); 13745 13746 /** 13747 * @interface Event 13748 * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface 13749 * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent 13750 */ 13751 var AnimationEventInterface = { 13752 animationName: null, 13753 elapsedTime: null, 13754 pseudoElement: null 13755 }; 13756 13757 /** 13758 * @param {object} dispatchConfig Configuration used to dispatch this event. 13759 * @param {string} dispatchMarker Marker identifying the event target. 13760 * @param {object} nativeEvent Native browser event. 13761 * @extends {SyntheticEvent} 13762 */ 13763 function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 13764 return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 13765 } 13766 13767 SyntheticEvent.augmentClass(SyntheticAnimationEvent, AnimationEventInterface); 13768 13769 module.exports = SyntheticAnimationEvent; 13770 },{"91":91}],88:[function(_dereq_,module,exports){ 13771 /** 13772 * Copyright 2013-present, Facebook, Inc. 13773 * All rights reserved. 13774 * 13775 * This source code is licensed under the BSD-style license found in the 13776 * LICENSE file in the root directory of this source tree. An additional grant 13777 * of patent rights can be found in the PATENTS file in the same directory. 13778 * 13779 */ 13780 13781 'use strict'; 13782 13783 var SyntheticEvent = _dereq_(91); 13784 13785 /** 13786 * @interface Event 13787 * @see http://www.w3.org/TR/clipboard-apis/ 13788 */ 13789 var ClipboardEventInterface = { 13790 clipboardData: function (event) { 13791 return 'clipboardData' in event ? event.clipboardData : window.clipboardData; 13792 } 13793 }; 13794 13795 /** 13796 * @param {object} dispatchConfig Configuration used to dispatch this event. 13797 * @param {string} dispatchMarker Marker identifying the event target. 13798 * @param {object} nativeEvent Native browser event. 13799 * @extends {SyntheticUIEvent} 13800 */ 13801 function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 13802 return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 13803 } 13804 13805 SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface); 13806 13807 module.exports = SyntheticClipboardEvent; 13808 },{"91":91}],89:[function(_dereq_,module,exports){ 13809 /** 13810 * Copyright 2013-present, Facebook, Inc. 13811 * All rights reserved. 13812 * 13813 * This source code is licensed under the BSD-style license found in the 13814 * LICENSE file in the root directory of this source tree. An additional grant 13815 * of patent rights can be found in the PATENTS file in the same directory. 13816 * 13817 */ 13818 13819 'use strict'; 13820 13821 var SyntheticEvent = _dereq_(91); 13822 13823 /** 13824 * @interface Event 13825 * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents 13826 */ 13827 var CompositionEventInterface = { 13828 data: null 13829 }; 13830 13831 /** 13832 * @param {object} dispatchConfig Configuration used to dispatch this event. 13833 * @param {string} dispatchMarker Marker identifying the event target. 13834 * @param {object} nativeEvent Native browser event. 13835 * @extends {SyntheticUIEvent} 13836 */ 13837 function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 13838 return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 13839 } 13840 13841 SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface); 13842 13843 module.exports = SyntheticCompositionEvent; 13844 },{"91":91}],90:[function(_dereq_,module,exports){ 13845 /** 13846 * Copyright 2013-present, Facebook, Inc. 13847 * All rights reserved. 13848 * 13849 * This source code is licensed under the BSD-style license found in the 13850 * LICENSE file in the root directory of this source tree. An additional grant 13851 * of patent rights can be found in the PATENTS file in the same directory. 13852 * 13853 */ 13854 13855 'use strict'; 13856 13857 var SyntheticMouseEvent = _dereq_(95); 13858 13859 /** 13860 * @interface DragEvent 13861 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 13862 */ 13863 var DragEventInterface = { 13864 dataTransfer: null 13865 }; 13866 13867 /** 13868 * @param {object} dispatchConfig Configuration used to dispatch this event. 13869 * @param {string} dispatchMarker Marker identifying the event target. 13870 * @param {object} nativeEvent Native browser event. 13871 * @extends {SyntheticUIEvent} 13872 */ 13873 function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 13874 return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 13875 } 13876 13877 SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface); 13878 13879 module.exports = SyntheticDragEvent; 13880 },{"95":95}],91:[function(_dereq_,module,exports){ 13881 /** 13882 * Copyright 2013-present, Facebook, Inc. 13883 * All rights reserved. 13884 * 13885 * This source code is licensed under the BSD-style license found in the 13886 * LICENSE file in the root directory of this source tree. An additional grant 13887 * of patent rights can be found in the PATENTS file in the same directory. 13888 * 13889 */ 13890 13891 'use strict'; 13892 13893 var _assign = _dereq_(158); 13894 13895 var PooledClass = _dereq_(25); 13896 13897 var emptyFunction = _dereq_(142); 13898 var warning = _dereq_(157); 13899 13900 var didWarnForAddedNewProperty = false; 13901 var isProxySupported = typeof Proxy === 'function'; 13902 13903 var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances']; 13904 13905 /** 13906 * @interface Event 13907 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 13908 */ 13909 var EventInterface = { 13910 type: null, 13911 target: null, 13912 // currentTarget is set when dispatching; no use in copying it here 13913 currentTarget: emptyFunction.thatReturnsNull, 13914 eventPhase: null, 13915 bubbles: null, 13916 cancelable: null, 13917 timeStamp: function (event) { 13918 return event.timeStamp || Date.now(); 13919 }, 13920 defaultPrevented: null, 13921 isTrusted: null 13922 }; 13923 13924 /** 13925 * Synthetic events are dispatched by event plugins, typically in response to a 13926 * top-level event delegation handler. 13927 * 13928 * These systems should generally use pooling to reduce the frequency of garbage 13929 * collection. The system should check `isPersistent` to determine whether the 13930 * event should be released into the pool after being dispatched. Users that 13931 * need a persisted event should invoke `persist`. 13932 * 13933 * Synthetic events (and subclasses) implement the DOM Level 3 Events API by 13934 * normalizing browser quirks. Subclasses do not necessarily have to implement a 13935 * DOM interface; custom application-specific events can also subclass this. 13936 * 13937 * @param {object} dispatchConfig Configuration used to dispatch this event. 13938 * @param {*} targetInst Marker identifying the event target. 13939 * @param {object} nativeEvent Native browser event. 13940 * @param {DOMEventTarget} nativeEventTarget Target node. 13941 */ 13942 function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) { 13943 if ("development" !== 'production') { 13944 // these have a getter/setter for warnings 13945 delete this.nativeEvent; 13946 delete this.preventDefault; 13947 delete this.stopPropagation; 13948 } 13949 13950 this.dispatchConfig = dispatchConfig; 13951 this._targetInst = targetInst; 13952 this.nativeEvent = nativeEvent; 13953 13954 var Interface = this.constructor.Interface; 13955 for (var propName in Interface) { 13956 if (!Interface.hasOwnProperty(propName)) { 13957 continue; 13958 } 13959 if ("development" !== 'production') { 13960 delete this[propName]; // this has a getter/setter for warnings 13961 } 13962 var normalize = Interface[propName]; 13963 if (normalize) { 13964 this[propName] = normalize(nativeEvent); 13965 } else { 13966 if (propName === 'target') { 13967 this.target = nativeEventTarget; 13968 } else { 13969 this[propName] = nativeEvent[propName]; 13970 } 13971 } 13972 } 13973 13974 var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; 13975 if (defaultPrevented) { 13976 this.isDefaultPrevented = emptyFunction.thatReturnsTrue; 13977 } else { 13978 this.isDefaultPrevented = emptyFunction.thatReturnsFalse; 13979 } 13980 this.isPropagationStopped = emptyFunction.thatReturnsFalse; 13981 return this; 13982 } 13983 13984 _assign(SyntheticEvent.prototype, { 13985 13986 preventDefault: function () { 13987 this.defaultPrevented = true; 13988 var event = this.nativeEvent; 13989 if (!event) { 13990 return; 13991 } 13992 13993 if (event.preventDefault) { 13994 event.preventDefault(); 13995 } else if (typeof event.returnValue !== 'unknown') { 13996 // eslint-disable-line valid-typeof 13997 event.returnValue = false; 13998 } 13999 this.isDefaultPrevented = emptyFunction.thatReturnsTrue; 14000 }, 14001 14002 stopPropagation: function () { 14003 var event = this.nativeEvent; 14004 if (!event) { 14005 return; 14006 } 14007 14008 if (event.stopPropagation) { 14009 event.stopPropagation(); 14010 } else if (typeof event.cancelBubble !== 'unknown') { 14011 // eslint-disable-line valid-typeof 14012 // The ChangeEventPlugin registers a "propertychange" event for 14013 // IE. This event does not support bubbling or cancelling, and 14014 // any references to cancelBubble throw "Member not found". A 14015 // typeof check of "unknown" circumvents this issue (and is also 14016 // IE specific). 14017 event.cancelBubble = true; 14018 } 14019 14020 this.isPropagationStopped = emptyFunction.thatReturnsTrue; 14021 }, 14022 14023 /** 14024 * We release all dispatched `SyntheticEvent`s after each event loop, adding 14025 * them back into the pool. This allows a way to hold onto a reference that 14026 * won't be added back into the pool. 14027 */ 14028 persist: function () { 14029 this.isPersistent = emptyFunction.thatReturnsTrue; 14030 }, 14031 14032 /** 14033 * Checks if this event should be released back into the pool. 14034 * 14035 * @return {boolean} True if this should not be released, false otherwise. 14036 */ 14037 isPersistent: emptyFunction.thatReturnsFalse, 14038 14039 /** 14040 * `PooledClass` looks for `destructor` on each instance it releases. 14041 */ 14042 destructor: function () { 14043 var Interface = this.constructor.Interface; 14044 for (var propName in Interface) { 14045 if ("development" !== 'production') { 14046 Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName])); 14047 } else { 14048 this[propName] = null; 14049 } 14050 } 14051 for (var i = 0; i < shouldBeReleasedProperties.length; i++) { 14052 this[shouldBeReleasedProperties[i]] = null; 14053 } 14054 if ("development" !== 'production') { 14055 Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null)); 14056 Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction)); 14057 Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction)); 14058 } 14059 } 14060 14061 }); 14062 14063 SyntheticEvent.Interface = EventInterface; 14064 14065 if ("development" !== 'production') { 14066 if (isProxySupported) { 14067 /*eslint-disable no-func-assign */ 14068 SyntheticEvent = new Proxy(SyntheticEvent, { 14069 construct: function (target, args) { 14070 return this.apply(target, Object.create(target.prototype), args); 14071 }, 14072 apply: function (constructor, that, args) { 14073 return new Proxy(constructor.apply(that, args), { 14074 set: function (target, prop, value) { 14075 if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) { 14076 "development" !== 'production' ? warning(didWarnForAddedNewProperty || target.isPersistent(), 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re adding a new property in the synthetic event object. ' + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0; 14077 didWarnForAddedNewProperty = true; 14078 } 14079 target[prop] = value; 14080 return true; 14081 } 14082 }); 14083 } 14084 }); 14085 /*eslint-enable no-func-assign */ 14086 } 14087 } 14088 /** 14089 * Helper to reduce boilerplate when creating subclasses. 14090 * 14091 * @param {function} Class 14092 * @param {?object} Interface 14093 */ 14094 SyntheticEvent.augmentClass = function (Class, Interface) { 14095 var Super = this; 14096 14097 var E = function () {}; 14098 E.prototype = Super.prototype; 14099 var prototype = new E(); 14100 14101 _assign(prototype, Class.prototype); 14102 Class.prototype = prototype; 14103 Class.prototype.constructor = Class; 14104 14105 Class.Interface = _assign({}, Super.Interface, Interface); 14106 Class.augmentClass = Super.augmentClass; 14107 14108 PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler); 14109 }; 14110 14111 PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler); 14112 14113 module.exports = SyntheticEvent; 14114 14115 /** 14116 * Helper to nullify syntheticEvent instance properties when destructing 14117 * 14118 * @param {object} SyntheticEvent 14119 * @param {String} propName 14120 * @return {object} defineProperty object 14121 */ 14122 function getPooledWarningPropertyDefinition(propName, getVal) { 14123 var isFunction = typeof getVal === 'function'; 14124 return { 14125 configurable: true, 14126 set: set, 14127 get: get 14128 }; 14129 14130 function set(val) { 14131 var action = isFunction ? 'setting the method' : 'setting the property'; 14132 warn(action, 'This is effectively a no-op'); 14133 return val; 14134 } 14135 14136 function get() { 14137 var action = isFunction ? 'accessing the method' : 'accessing the property'; 14138 var result = isFunction ? 'This is a no-op function' : 'This is set to null'; 14139 warn(action, result); 14140 return getVal; 14141 } 14142 14143 function warn(action, result) { 14144 var warningCondition = false; 14145 "development" !== 'production' ? warning(warningCondition, 'This synthetic event is reused for performance reasons. If you\'re seeing this, ' + 'you\'re %s `%s` on a released/nullified synthetic event. %s. ' + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0; 14146 } 14147 } 14148 },{"142":142,"157":157,"158":158,"25":25}],92:[function(_dereq_,module,exports){ 14149 /** 14150 * Copyright 2013-present, Facebook, Inc. 14151 * All rights reserved. 14152 * 14153 * This source code is licensed under the BSD-style license found in the 14154 * LICENSE file in the root directory of this source tree. An additional grant 14155 * of patent rights can be found in the PATENTS file in the same directory. 14156 * 14157 */ 14158 14159 'use strict'; 14160 14161 var SyntheticUIEvent = _dereq_(98); 14162 14163 /** 14164 * @interface FocusEvent 14165 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 14166 */ 14167 var FocusEventInterface = { 14168 relatedTarget: null 14169 }; 14170 14171 /** 14172 * @param {object} dispatchConfig Configuration used to dispatch this event. 14173 * @param {string} dispatchMarker Marker identifying the event target. 14174 * @param {object} nativeEvent Native browser event. 14175 * @extends {SyntheticUIEvent} 14176 */ 14177 function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 14178 return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 14179 } 14180 14181 SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface); 14182 14183 module.exports = SyntheticFocusEvent; 14184 },{"98":98}],93:[function(_dereq_,module,exports){ 14185 /** 14186 * Copyright 2013-present, Facebook, Inc. 14187 * All rights reserved. 14188 * 14189 * This source code is licensed under the BSD-style license found in the 14190 * LICENSE file in the root directory of this source tree. An additional grant 14191 * of patent rights can be found in the PATENTS file in the same directory. 14192 * 14193 */ 14194 14195 'use strict'; 14196 14197 var SyntheticEvent = _dereq_(91); 14198 14199 /** 14200 * @interface Event 14201 * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 14202 * /#events-inputevents 14203 */ 14204 var InputEventInterface = { 14205 data: null 14206 }; 14207 14208 /** 14209 * @param {object} dispatchConfig Configuration used to dispatch this event. 14210 * @param {string} dispatchMarker Marker identifying the event target. 14211 * @param {object} nativeEvent Native browser event. 14212 * @extends {SyntheticUIEvent} 14213 */ 14214 function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 14215 return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 14216 } 14217 14218 SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface); 14219 14220 module.exports = SyntheticInputEvent; 14221 },{"91":91}],94:[function(_dereq_,module,exports){ 14222 /** 14223 * Copyright 2013-present, Facebook, Inc. 14224 * All rights reserved. 14225 * 14226 * This source code is licensed under the BSD-style license found in the 14227 * LICENSE file in the root directory of this source tree. An additional grant 14228 * of patent rights can be found in the PATENTS file in the same directory. 14229 * 14230 */ 14231 14232 'use strict'; 14233 14234 var SyntheticUIEvent = _dereq_(98); 14235 14236 var getEventCharCode = _dereq_(111); 14237 var getEventKey = _dereq_(112); 14238 var getEventModifierState = _dereq_(113); 14239 14240 /** 14241 * @interface KeyboardEvent 14242 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 14243 */ 14244 var KeyboardEventInterface = { 14245 key: getEventKey, 14246 location: null, 14247 ctrlKey: null, 14248 shiftKey: null, 14249 altKey: null, 14250 metaKey: null, 14251 repeat: null, 14252 locale: null, 14253 getModifierState: getEventModifierState, 14254 // Legacy Interface 14255 charCode: function (event) { 14256 // `charCode` is the result of a KeyPress event and represents the value of 14257 // the actual printable character. 14258 14259 // KeyPress is deprecated, but its replacement is not yet final and not 14260 // implemented in any major browser. Only KeyPress has charCode. 14261 if (event.type === 'keypress') { 14262 return getEventCharCode(event); 14263 } 14264 return 0; 14265 }, 14266 keyCode: function (event) { 14267 // `keyCode` is the result of a KeyDown/Up event and represents the value of 14268 // physical keyboard key. 14269 14270 // The actual meaning of the value depends on the users' keyboard layout 14271 // which cannot be detected. Assuming that it is a US keyboard layout 14272 // provides a surprisingly accurate mapping for US and European users. 14273 // Due to this, it is left to the user to implement at this time. 14274 if (event.type === 'keydown' || event.type === 'keyup') { 14275 return event.keyCode; 14276 } 14277 return 0; 14278 }, 14279 which: function (event) { 14280 // `which` is an alias for either `keyCode` or `charCode` depending on the 14281 // type of the event. 14282 if (event.type === 'keypress') { 14283 return getEventCharCode(event); 14284 } 14285 if (event.type === 'keydown' || event.type === 'keyup') { 14286 return event.keyCode; 14287 } 14288 return 0; 14289 } 14290 }; 14291 14292 /** 14293 * @param {object} dispatchConfig Configuration used to dispatch this event. 14294 * @param {string} dispatchMarker Marker identifying the event target. 14295 * @param {object} nativeEvent Native browser event. 14296 * @extends {SyntheticUIEvent} 14297 */ 14298 function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 14299 return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 14300 } 14301 14302 SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface); 14303 14304 module.exports = SyntheticKeyboardEvent; 14305 },{"111":111,"112":112,"113":113,"98":98}],95:[function(_dereq_,module,exports){ 14306 /** 14307 * Copyright 2013-present, Facebook, Inc. 14308 * All rights reserved. 14309 * 14310 * This source code is licensed under the BSD-style license found in the 14311 * LICENSE file in the root directory of this source tree. An additional grant 14312 * of patent rights can be found in the PATENTS file in the same directory. 14313 * 14314 */ 14315 14316 'use strict'; 14317 14318 var SyntheticUIEvent = _dereq_(98); 14319 var ViewportMetrics = _dereq_(101); 14320 14321 var getEventModifierState = _dereq_(113); 14322 14323 /** 14324 * @interface MouseEvent 14325 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 14326 */ 14327 var MouseEventInterface = { 14328 screenX: null, 14329 screenY: null, 14330 clientX: null, 14331 clientY: null, 14332 ctrlKey: null, 14333 shiftKey: null, 14334 altKey: null, 14335 metaKey: null, 14336 getModifierState: getEventModifierState, 14337 button: function (event) { 14338 // Webkit, Firefox, IE9+ 14339 // which: 1 2 3 14340 // button: 0 1 2 (standard) 14341 var button = event.button; 14342 if ('which' in event) { 14343 return button; 14344 } 14345 // IE<9 14346 // which: undefined 14347 // button: 0 0 0 14348 // button: 1 4 2 (onmouseup) 14349 return button === 2 ? 2 : button === 4 ? 1 : 0; 14350 }, 14351 buttons: null, 14352 relatedTarget: function (event) { 14353 return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement); 14354 }, 14355 // "Proprietary" Interface. 14356 pageX: function (event) { 14357 return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft; 14358 }, 14359 pageY: function (event) { 14360 return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop; 14361 } 14362 }; 14363 14364 /** 14365 * @param {object} dispatchConfig Configuration used to dispatch this event. 14366 * @param {string} dispatchMarker Marker identifying the event target. 14367 * @param {object} nativeEvent Native browser event. 14368 * @extends {SyntheticUIEvent} 14369 */ 14370 function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 14371 return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 14372 } 14373 14374 SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); 14375 14376 module.exports = SyntheticMouseEvent; 14377 },{"101":101,"113":113,"98":98}],96:[function(_dereq_,module,exports){ 14378 /** 14379 * Copyright 2013-present, Facebook, Inc. 14380 * All rights reserved. 14381 * 14382 * This source code is licensed under the BSD-style license found in the 14383 * LICENSE file in the root directory of this source tree. An additional grant 14384 * of patent rights can be found in the PATENTS file in the same directory. 14385 * 14386 */ 14387 14388 'use strict'; 14389 14390 var SyntheticUIEvent = _dereq_(98); 14391 14392 var getEventModifierState = _dereq_(113); 14393 14394 /** 14395 * @interface TouchEvent 14396 * @see http://www.w3.org/TR/touch-events/ 14397 */ 14398 var TouchEventInterface = { 14399 touches: null, 14400 targetTouches: null, 14401 changedTouches: null, 14402 altKey: null, 14403 metaKey: null, 14404 ctrlKey: null, 14405 shiftKey: null, 14406 getModifierState: getEventModifierState 14407 }; 14408 14409 /** 14410 * @param {object} dispatchConfig Configuration used to dispatch this event. 14411 * @param {string} dispatchMarker Marker identifying the event target. 14412 * @param {object} nativeEvent Native browser event. 14413 * @extends {SyntheticUIEvent} 14414 */ 14415 function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 14416 return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 14417 } 14418 14419 SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface); 14420 14421 module.exports = SyntheticTouchEvent; 14422 },{"113":113,"98":98}],97:[function(_dereq_,module,exports){ 14423 /** 14424 * Copyright 2013-present, Facebook, Inc. 14425 * All rights reserved. 14426 * 14427 * This source code is licensed under the BSD-style license found in the 14428 * LICENSE file in the root directory of this source tree. An additional grant 14429 * of patent rights can be found in the PATENTS file in the same directory. 14430 * 14431 */ 14432 14433 'use strict'; 14434 14435 var SyntheticEvent = _dereq_(91); 14436 14437 /** 14438 * @interface Event 14439 * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events- 14440 * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent 14441 */ 14442 var TransitionEventInterface = { 14443 propertyName: null, 14444 elapsedTime: null, 14445 pseudoElement: null 14446 }; 14447 14448 /** 14449 * @param {object} dispatchConfig Configuration used to dispatch this event. 14450 * @param {string} dispatchMarker Marker identifying the event target. 14451 * @param {object} nativeEvent Native browser event. 14452 * @extends {SyntheticEvent} 14453 */ 14454 function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 14455 return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 14456 } 14457 14458 SyntheticEvent.augmentClass(SyntheticTransitionEvent, TransitionEventInterface); 14459 14460 module.exports = SyntheticTransitionEvent; 14461 },{"91":91}],98:[function(_dereq_,module,exports){ 14462 /** 14463 * Copyright 2013-present, Facebook, Inc. 14464 * All rights reserved. 14465 * 14466 * This source code is licensed under the BSD-style license found in the 14467 * LICENSE file in the root directory of this source tree. An additional grant 14468 * of patent rights can be found in the PATENTS file in the same directory. 14469 * 14470 */ 14471 14472 'use strict'; 14473 14474 var SyntheticEvent = _dereq_(91); 14475 14476 var getEventTarget = _dereq_(114); 14477 14478 /** 14479 * @interface UIEvent 14480 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 14481 */ 14482 var UIEventInterface = { 14483 view: function (event) { 14484 if (event.view) { 14485 return event.view; 14486 } 14487 14488 var target = getEventTarget(event); 14489 if (target.window === target) { 14490 // target is a window object 14491 return target; 14492 } 14493 14494 var doc = target.ownerDocument; 14495 // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. 14496 if (doc) { 14497 return doc.defaultView || doc.parentWindow; 14498 } else { 14499 return window; 14500 } 14501 }, 14502 detail: function (event) { 14503 return event.detail || 0; 14504 } 14505 }; 14506 14507 /** 14508 * @param {object} dispatchConfig Configuration used to dispatch this event. 14509 * @param {string} dispatchMarker Marker identifying the event target. 14510 * @param {object} nativeEvent Native browser event. 14511 * @extends {SyntheticEvent} 14512 */ 14513 function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 14514 return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 14515 } 14516 14517 SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); 14518 14519 module.exports = SyntheticUIEvent; 14520 },{"114":114,"91":91}],99:[function(_dereq_,module,exports){ 14521 /** 14522 * Copyright 2013-present, Facebook, Inc. 14523 * All rights reserved. 14524 * 14525 * This source code is licensed under the BSD-style license found in the 14526 * LICENSE file in the root directory of this source tree. An additional grant 14527 * of patent rights can be found in the PATENTS file in the same directory. 14528 * 14529 */ 14530 14531 'use strict'; 14532 14533 var SyntheticMouseEvent = _dereq_(95); 14534 14535 /** 14536 * @interface WheelEvent 14537 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 14538 */ 14539 var WheelEventInterface = { 14540 deltaX: function (event) { 14541 return 'deltaX' in event ? event.deltaX : 14542 // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive). 14543 'wheelDeltaX' in event ? -event.wheelDeltaX : 0; 14544 }, 14545 deltaY: function (event) { 14546 return 'deltaY' in event ? event.deltaY : 14547 // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive). 14548 'wheelDeltaY' in event ? -event.wheelDeltaY : 14549 // Fallback to `wheelDelta` for IE<9 and normalize (down is positive). 14550 'wheelDelta' in event ? -event.wheelDelta : 0; 14551 }, 14552 deltaZ: null, 14553 14554 // Browsers without "deltaMode" is reporting in raw wheel delta where one 14555 // notch on the scroll is always +/- 120, roughly equivalent to pixels. 14556 // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or 14557 // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size. 14558 deltaMode: null 14559 }; 14560 14561 /** 14562 * @param {object} dispatchConfig Configuration used to dispatch this event. 14563 * @param {string} dispatchMarker Marker identifying the event target. 14564 * @param {object} nativeEvent Native browser event. 14565 * @extends {SyntheticMouseEvent} 14566 */ 14567 function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { 14568 return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); 14569 } 14570 14571 SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface); 14572 14573 module.exports = SyntheticWheelEvent; 14574 },{"95":95}],100:[function(_dereq_,module,exports){ 14575 /** 14576 * Copyright 2013-present, Facebook, Inc. 14577 * All rights reserved. 14578 * 14579 * This source code is licensed under the BSD-style license found in the 14580 * LICENSE file in the root directory of this source tree. An additional grant 14581 * of patent rights can be found in the PATENTS file in the same directory. 14582 * 14583 * 14584 */ 14585 14586 'use strict'; 14587 14588 var _prodInvariant = _dereq_(125); 14589 14590 var invariant = _dereq_(150); 14591 14592 var OBSERVED_ERROR = {}; 14593 14594 /** 14595 * `Transaction` creates a black box that is able to wrap any method such that 14596 * certain invariants are maintained before and after the method is invoked 14597 * (Even if an exception is thrown while invoking the wrapped method). Whoever 14598 * instantiates a transaction can provide enforcers of the invariants at 14599 * creation time. The `Transaction` class itself will supply one additional 14600 * automatic invariant for you - the invariant that any transaction instance 14601 * should not be run while it is already being run. You would typically create a 14602 * single instance of a `Transaction` for reuse multiple times, that potentially 14603 * is used to wrap several different methods. Wrappers are extremely simple - 14604 * they only require implementing two methods. 14605 * 14606 * <pre> 14607 * wrappers (injected at creation time) 14608 * + + 14609 * | | 14610 * +-----------------|--------|--------------+ 14611 * | v | | 14612 * | +---------------+ | | 14613 * | +--| wrapper1 |---|----+ | 14614 * | | +---------------+ v | | 14615 * | | +-------------+ | | 14616 * | | +----| wrapper2 |--------+ | 14617 * | | | +-------------+ | | | 14618 * | | | | | | 14619 * | v v v v | wrapper 14620 * | +---+ +---+ +---------+ +---+ +---+ | invariants 14621 * perform(anyMethod) | | | | | | | | | | | | maintained 14622 * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|--------> 14623 * | | | | | | | | | | | | 14624 * | | | | | | | | | | | | 14625 * | | | | | | | | | | | | 14626 * | +---+ +---+ +---------+ +---+ +---+ | 14627 * | initialize close | 14628 * +-----------------------------------------+ 14629 * </pre> 14630 * 14631 * Use cases: 14632 * - Preserving the input selection ranges before/after reconciliation. 14633 * Restoring selection even in the event of an unexpected error. 14634 * - Deactivating events while rearranging the DOM, preventing blurs/focuses, 14635 * while guaranteeing that afterwards, the event system is reactivated. 14636 * - Flushing a queue of collected DOM mutations to the main UI thread after a 14637 * reconciliation takes place in a worker thread. 14638 * - Invoking any collected `componentDidUpdate` callbacks after rendering new 14639 * content. 14640 * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue 14641 * to preserve the `scrollTop` (an automatic scroll aware DOM). 14642 * - (Future use case): Layout calculations before and after DOM updates. 14643 * 14644 * Transactional plugin API: 14645 * - A module that has an `initialize` method that returns any precomputation. 14646 * - and a `close` method that accepts the precomputation. `close` is invoked 14647 * when the wrapped process is completed, or has failed. 14648 * 14649 * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules 14650 * that implement `initialize` and `close`. 14651 * @return {Transaction} Single transaction for reuse in thread. 14652 * 14653 * @class Transaction 14654 */ 14655 var TransactionImpl = { 14656 /** 14657 * Sets up this instance so that it is prepared for collecting metrics. Does 14658 * so such that this setup method may be used on an instance that is already 14659 * initialized, in a way that does not consume additional memory upon reuse. 14660 * That can be useful if you decide to make your subclass of this mixin a 14661 * "PooledClass". 14662 */ 14663 reinitializeTransaction: function () { 14664 this.transactionWrappers = this.getTransactionWrappers(); 14665 if (this.wrapperInitData) { 14666 this.wrapperInitData.length = 0; 14667 } else { 14668 this.wrapperInitData = []; 14669 } 14670 this._isInTransaction = false; 14671 }, 14672 14673 _isInTransaction: false, 14674 14675 /** 14676 * @abstract 14677 * @return {Array<TransactionWrapper>} Array of transaction wrappers. 14678 */ 14679 getTransactionWrappers: null, 14680 14681 isInTransaction: function () { 14682 return !!this._isInTransaction; 14683 }, 14684 14685 /** 14686 * Executes the function within a safety window. Use this for the top level 14687 * methods that result in large amounts of computation/mutations that would 14688 * need to be safety checked. The optional arguments helps prevent the need 14689 * to bind in many cases. 14690 * 14691 * @param {function} method Member of scope to call. 14692 * @param {Object} scope Scope to invoke from. 14693 * @param {Object?=} a Argument to pass to the method. 14694 * @param {Object?=} b Argument to pass to the method. 14695 * @param {Object?=} c Argument to pass to the method. 14696 * @param {Object?=} d Argument to pass to the method. 14697 * @param {Object?=} e Argument to pass to the method. 14698 * @param {Object?=} f Argument to pass to the method. 14699 * 14700 * @return {*} Return value from `method`. 14701 */ 14702 perform: function (method, scope, a, b, c, d, e, f) { 14703 !!this.isInTransaction() ? "development" !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there is already an outstanding transaction.') : _prodInvariant('27') : void 0; 14704 var errorThrown; 14705 var ret; 14706 try { 14707 this._isInTransaction = true; 14708 // Catching errors makes debugging more difficult, so we start with 14709 // errorThrown set to true before setting it to false after calling 14710 // close -- if it's still set to true in the finally block, it means 14711 // one of these calls threw. 14712 errorThrown = true; 14713 this.initializeAll(0); 14714 ret = method.call(scope, a, b, c, d, e, f); 14715 errorThrown = false; 14716 } finally { 14717 try { 14718 if (errorThrown) { 14719 // If `method` throws, prefer to show that stack trace over any thrown 14720 // by invoking `closeAll`. 14721 try { 14722 this.closeAll(0); 14723 } catch (err) {} 14724 } else { 14725 // Since `method` didn't throw, we don't want to silence the exception 14726 // here. 14727 this.closeAll(0); 14728 } 14729 } finally { 14730 this._isInTransaction = false; 14731 } 14732 } 14733 return ret; 14734 }, 14735 14736 initializeAll: function (startIndex) { 14737 var transactionWrappers = this.transactionWrappers; 14738 for (var i = startIndex; i < transactionWrappers.length; i++) { 14739 var wrapper = transactionWrappers[i]; 14740 try { 14741 // Catching errors makes debugging more difficult, so we start with the 14742 // OBSERVED_ERROR state before overwriting it with the real return value 14743 // of initialize -- if it's still set to OBSERVED_ERROR in the finally 14744 // block, it means wrapper.initialize threw. 14745 this.wrapperInitData[i] = OBSERVED_ERROR; 14746 this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null; 14747 } finally { 14748 if (this.wrapperInitData[i] === OBSERVED_ERROR) { 14749 // The initializer for wrapper i threw an error; initialize the 14750 // remaining wrappers but silence any exceptions from them to ensure 14751 // that the first error is the one to bubble up. 14752 try { 14753 this.initializeAll(i + 1); 14754 } catch (err) {} 14755 } 14756 } 14757 } 14758 }, 14759 14760 /** 14761 * Invokes each of `this.transactionWrappers.close[i]` functions, passing into 14762 * them the respective return values of `this.transactionWrappers.init[i]` 14763 * (`close`rs that correspond to initializers that failed will not be 14764 * invoked). 14765 */ 14766 closeAll: function (startIndex) { 14767 !this.isInTransaction() ? "development" !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0; 14768 var transactionWrappers = this.transactionWrappers; 14769 for (var i = startIndex; i < transactionWrappers.length; i++) { 14770 var wrapper = transactionWrappers[i]; 14771 var initData = this.wrapperInitData[i]; 14772 var errorThrown; 14773 try { 14774 // Catching errors makes debugging more difficult, so we start with 14775 // errorThrown set to true before setting it to false after calling 14776 // close -- if it's still set to true in the finally block, it means 14777 // wrapper.close threw. 14778 errorThrown = true; 14779 if (initData !== OBSERVED_ERROR && wrapper.close) { 14780 wrapper.close.call(this, initData); 14781 } 14782 errorThrown = false; 14783 } finally { 14784 if (errorThrown) { 14785 // The closer for wrapper i threw an error; close the remaining 14786 // wrappers but silence any exceptions from them to ensure that the 14787 // first error is the one to bubble up. 14788 try { 14789 this.closeAll(i + 1); 14790 } catch (e) {} 14791 } 14792 } 14793 } 14794 this.wrapperInitData.length = 0; 14795 } 14796 }; 14797 14798 module.exports = TransactionImpl; 14799 },{"125":125,"150":150}],101:[function(_dereq_,module,exports){ 14800 /** 14801 * Copyright 2013-present, Facebook, Inc. 14802 * All rights reserved. 14803 * 14804 * This source code is licensed under the BSD-style license found in the 14805 * LICENSE file in the root directory of this source tree. An additional grant 14806 * of patent rights can be found in the PATENTS file in the same directory. 14807 * 14808 */ 14809 14810 'use strict'; 14811 14812 var ViewportMetrics = { 14813 14814 currentScrollLeft: 0, 14815 14816 currentScrollTop: 0, 14817 14818 refreshScrollValues: function (scrollPosition) { 14819 ViewportMetrics.currentScrollLeft = scrollPosition.x; 14820 ViewportMetrics.currentScrollTop = scrollPosition.y; 14821 } 14822 14823 }; 14824 14825 module.exports = ViewportMetrics; 14826 },{}],102:[function(_dereq_,module,exports){ 14827 /** 14828 * Copyright 2014-present, Facebook, Inc. 14829 * All rights reserved. 14830 * 14831 * This source code is licensed under the BSD-style license found in the 14832 * LICENSE file in the root directory of this source tree. An additional grant 14833 * of patent rights can be found in the PATENTS file in the same directory. 14834 * 14835 * 14836 */ 14837 14838 'use strict'; 14839 14840 var _prodInvariant = _dereq_(125); 14841 14842 var invariant = _dereq_(150); 14843 14844 /** 14845 * Accumulates items that must not be null or undefined into the first one. This 14846 * is used to conserve memory by avoiding array allocations, and thus sacrifices 14847 * API cleanness. Since `current` can be null before being passed in and not 14848 * null after this function, make sure to assign it back to `current`: 14849 * 14850 * `a = accumulateInto(a, b);` 14851 * 14852 * This API should be sparingly used. Try `accumulate` for something cleaner. 14853 * 14854 * @return {*|array<*>} An accumulation of items. 14855 */ 14856 14857 function accumulateInto(current, next) { 14858 !(next != null) ? "development" !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0; 14859 14860 if (current == null) { 14861 return next; 14862 } 14863 14864 // Both are not empty. Warning: Never call x.concat(y) when you are not 14865 // certain that x is an Array (x could be a string with concat method). 14866 if (Array.isArray(current)) { 14867 if (Array.isArray(next)) { 14868 current.push.apply(current, next); 14869 return current; 14870 } 14871 current.push(next); 14872 return current; 14873 } 14874 14875 if (Array.isArray(next)) { 14876 // A bit too dangerous to mutate `next`. 14877 return [current].concat(next); 14878 } 14879 14880 return [current, next]; 14881 } 14882 14883 module.exports = accumulateInto; 14884 },{"125":125,"150":150}],103:[function(_dereq_,module,exports){ 14885 /** 14886 * Copyright 2013-present, Facebook, Inc. 14887 * All rights reserved. 14888 * 14889 * This source code is licensed under the BSD-style license found in the 14890 * LICENSE file in the root directory of this source tree. An additional grant 14891 * of patent rights can be found in the PATENTS file in the same directory. 14892 * 14893 * 14894 */ 14895 14896 'use strict'; 14897 14898 var MOD = 65521; 14899 14900 // adler32 is not cryptographically strong, and is only used to sanity check that 14901 // markup generated on the server matches the markup generated on the client. 14902 // This implementation (a modified version of the SheetJS version) has been optimized 14903 // for our use case, at the expense of conforming to the adler32 specification 14904 // for non-ascii inputs. 14905 function adler32(data) { 14906 var a = 1; 14907 var b = 0; 14908 var i = 0; 14909 var l = data.length; 14910 var m = l & ~0x3; 14911 while (i < m) { 14912 var n = Math.min(i + 4096, m); 14913 for (; i < n; i += 4) { 14914 b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3)); 14915 } 14916 a %= MOD; 14917 b %= MOD; 14918 } 14919 for (; i < l; i++) { 14920 b += a += data.charCodeAt(i); 14921 } 14922 a %= MOD; 14923 b %= MOD; 14924 return a | b << 16; 14925 } 14926 14927 module.exports = adler32; 14928 },{}],104:[function(_dereq_,module,exports){ 14929 (function (process){ 14930 /** 14931 * Copyright 2013-present, Facebook, Inc. 14932 * All rights reserved. 14933 * 14934 * This source code is licensed under the BSD-style license found in the 14935 * LICENSE file in the root directory of this source tree. An additional grant 14936 * of patent rights can be found in the PATENTS file in the same directory. 14937 * 14938 */ 14939 14940 'use strict'; 14941 14942 var _prodInvariant = _dereq_(125); 14943 14944 var ReactPropTypeLocationNames = _dereq_(72); 14945 var ReactPropTypesSecret = _dereq_(73); 14946 14947 var invariant = _dereq_(150); 14948 var warning = _dereq_(157); 14949 14950 var ReactComponentTreeHook; 14951 14952 if (typeof process !== 'undefined' && process.env && "development" === 'test') { 14953 // Temporary hack. 14954 // Inline requires don't work well with Jest: 14955 // https://github.com/facebook/react/issues/7240 14956 // Remove the inline requires when we don't need them anymore: 14957 // https://github.com/facebook/react/pull/7178 14958 ReactComponentTreeHook = _dereq_(132); 14959 } 14960 14961 var loggedTypeFailures = {}; 14962 14963 /** 14964 * Assert that the values match with the type specs. 14965 * Error messages are memorized and will only be shown once. 14966 * 14967 * @param {object} typeSpecs Map of name to a ReactPropType 14968 * @param {object} values Runtime values that need to be type-checked 14969 * @param {string} location e.g. "prop", "context", "child context" 14970 * @param {string} componentName Name of the component for error messages. 14971 * @param {?object} element The React element that is being type-checked 14972 * @param {?number} debugID The React component instance that is being type-checked 14973 * @private 14974 */ 14975 function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) { 14976 for (var typeSpecName in typeSpecs) { 14977 if (typeSpecs.hasOwnProperty(typeSpecName)) { 14978 var error; 14979 // Prop type validation may throw. In case they do, we don't want to 14980 // fail the render phase where it didn't fail before. So we log it. 14981 // After these have been cleaned up, we'll let them throw. 14982 try { 14983 // This is intentionally an invariant that gets caught. It's the same 14984 // behavior as without this statement except with a better message. 14985 !(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; 14986 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); 14987 } catch (ex) { 14988 error = ex; 14989 } 14990 "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; 14991 if (error instanceof Error && !(error.message in loggedTypeFailures)) { 14992 // Only monitor this failure once because there tends to be a lot of the 14993 // same error. 14994 loggedTypeFailures[error.message] = true; 14995 14996 var componentStackInfo = ''; 14997 14998 if ("development" !== 'production') { 14999 if (!ReactComponentTreeHook) { 15000 ReactComponentTreeHook = _dereq_(132); 15001 } 15002 if (debugID !== null) { 15003 componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID); 15004 } else if (element !== null) { 15005 componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element); 15006 } 15007 } 15008 15009 "development" !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0; 15010 } 15011 } 15012 } 15013 } 15014 15015 module.exports = checkReactTypeSpec; 15016 }).call(this,undefined) 15017 },{"125":125,"132":132,"150":150,"157":157,"72":72,"73":73}],105:[function(_dereq_,module,exports){ 15018 /** 15019 * Copyright 2013-present, Facebook, Inc. 15020 * All rights reserved. 15021 * 15022 * This source code is licensed under the BSD-style license found in the 15023 * LICENSE file in the root directory of this source tree. An additional grant 15024 * of patent rights can be found in the PATENTS file in the same directory. 15025 * 15026 */ 15027 15028 /* globals MSApp */ 15029 15030 'use strict'; 15031 15032 /** 15033 * Create a function which has 'unsafe' privileges (required by windows8 apps) 15034 */ 15035 15036 var createMicrosoftUnsafeLocalFunction = function (func) { 15037 if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { 15038 return function (arg0, arg1, arg2, arg3) { 15039 MSApp.execUnsafeLocalFunction(function () { 15040 return func(arg0, arg1, arg2, arg3); 15041 }); 15042 }; 15043 } else { 15044 return func; 15045 } 15046 }; 15047 15048 module.exports = createMicrosoftUnsafeLocalFunction; 15049 },{}],106:[function(_dereq_,module,exports){ 15050 /** 15051 * Copyright 2013-present, Facebook, Inc. 15052 * All rights reserved. 15053 * 15054 * This source code is licensed under the BSD-style license found in the 15055 * LICENSE file in the root directory of this source tree. An additional grant 15056 * of patent rights can be found in the PATENTS file in the same directory. 15057 * 15058 */ 15059 15060 'use strict'; 15061 15062 var CSSProperty = _dereq_(4); 15063 var warning = _dereq_(157); 15064 15065 var isUnitlessNumber = CSSProperty.isUnitlessNumber; 15066 var styleWarnings = {}; 15067 15068 /** 15069 * Convert a value into the proper css writable value. The style name `name` 15070 * should be logical (no hyphens), as specified 15071 * in `CSSProperty.isUnitlessNumber`. 15072 * 15073 * @param {string} name CSS property name such as `topMargin`. 15074 * @param {*} value CSS property value such as `10px`. 15075 * @param {ReactDOMComponent} component 15076 * @return {string} Normalized style value with dimensions applied. 15077 */ 15078 function dangerousStyleValue(name, value, component) { 15079 // Note that we've removed escapeTextForBrowser() calls here since the 15080 // whole string will be escaped when the attribute is injected into 15081 // the markup. If you provide unsafe user data here they can inject 15082 // arbitrary CSS which may be problematic (I couldn't repro this): 15083 // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet 15084 // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/ 15085 // This is not an XSS hole but instead a potential CSS injection issue 15086 // which has lead to a greater discussion about how we're going to 15087 // trust URLs moving forward. See #2115901 15088 15089 var isEmpty = value == null || typeof value === 'boolean' || value === ''; 15090 if (isEmpty) { 15091 return ''; 15092 } 15093 15094 var isNonNumeric = isNaN(value); 15095 if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) { 15096 return '' + value; // cast to string 15097 } 15098 15099 if (typeof value === 'string') { 15100 if ("development" !== 'production') { 15101 // Allow '0' to pass through without warning. 0 is already special and 15102 // doesn't require units, so we don't need to warn about it. 15103 if (component && value !== '0') { 15104 var owner = component._currentElement._owner; 15105 var ownerName = owner ? owner.getName() : null; 15106 if (ownerName && !styleWarnings[ownerName]) { 15107 styleWarnings[ownerName] = {}; 15108 } 15109 var warned = false; 15110 if (ownerName) { 15111 var warnings = styleWarnings[ownerName]; 15112 warned = warnings[name]; 15113 if (!warned) { 15114 warnings[name] = true; 15115 } 15116 } 15117 if (!warned) { 15118 "development" !== 'production' ? warning(false, 'a `%s` tag (owner: `%s`) was passed a numeric string value ' + 'for CSS property `%s` (value: `%s`) which will be treated ' + 'as a unitless number in a future version of React.', component._currentElement.type, ownerName || 'unknown', name, value) : void 0; 15119 } 15120 } 15121 } 15122 value = value.trim(); 15123 } 15124 return value + 'px'; 15125 } 15126 15127 module.exports = dangerousStyleValue; 15128 },{"157":157,"4":4}],107:[function(_dereq_,module,exports){ 15129 /** 15130 * Copyright 2016-present, Facebook, Inc. 15131 * All rights reserved. 15132 * 15133 * This source code is licensed under the BSD-style license found in the 15134 * LICENSE file in the root directory of this source tree. An additional grant 15135 * of patent rights can be found in the PATENTS file in the same directory. 15136 * 15137 * Based on the escape-html library, which is used under the MIT License below: 15138 * 15139 * Copyright (c) 2012-2013 TJ Holowaychuk 15140 * Copyright (c) 2015 Andreas Lubbe 15141 * Copyright (c) 2015 Tiancheng "Timothy" Gu 15142 * 15143 * Permission is hereby granted, free of charge, to any person obtaining 15144 * a copy of this software and associated documentation files (the 15145 * 'Software'), to deal in the Software without restriction, including 15146 * without limitation the rights to use, copy, modify, merge, publish, 15147 * distribute, sublicense, and/or sell copies of the Software, and to 15148 * permit persons to whom the Software is furnished to do so, subject to 15149 * the following conditions: 15150 * 15151 * The above copyright notice and this permission notice shall be 15152 * included in all copies or substantial portions of the Software. 15153 * 15154 * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 15155 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 15156 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15157 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 15158 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 15159 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 15160 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15161 * 15162 */ 15163 15164 'use strict'; 15165 15166 // code copied and modified from escape-html 15167 /** 15168 * Module variables. 15169 * @private 15170 */ 15171 15172 var matchHtmlRegExp = /["'&<>]/; 15173 15174 /** 15175 * Escape special characters in the given string of html. 15176 * 15177 * @param {string} string The string to escape for inserting into HTML 15178 * @return {string} 15179 * @public 15180 */ 15181 15182 function escapeHtml(string) { 15183 var str = '' + string; 15184 var match = matchHtmlRegExp.exec(str); 15185 15186 if (!match) { 15187 return str; 15188 } 15189 15190 var escape; 15191 var html = ''; 15192 var index = 0; 15193 var lastIndex = 0; 15194 15195 for (index = match.index; index < str.length; index++) { 15196 switch (str.charCodeAt(index)) { 15197 case 34: 15198 // " 15199 escape = '"'; 15200 break; 15201 case 38: 15202 // & 15203 escape = '&'; 15204 break; 15205 case 39: 15206 // ' 15207 escape = '''; // modified from escape-html; used to be ''' 15208 break; 15209 case 60: 15210 // < 15211 escape = '<'; 15212 break; 15213 case 62: 15214 // > 15215 escape = '>'; 15216 break; 15217 default: 15218 continue; 15219 } 15220 15221 if (lastIndex !== index) { 15222 html += str.substring(lastIndex, index); 15223 } 15224 15225 lastIndex = index + 1; 15226 html += escape; 15227 } 15228 15229 return lastIndex !== index ? html + str.substring(lastIndex, index) : html; 15230 } 15231 // end code copied and modified from escape-html 15232 15233 15234 /** 15235 * Escapes text to prevent scripting attacks. 15236 * 15237 * @param {*} text Text value to escape. 15238 * @return {string} An escaped string. 15239 */ 15240 function escapeTextContentForBrowser(text) { 15241 if (typeof text === 'boolean' || typeof text === 'number') { 15242 // this shortcircuit helps perf for types that we know will never have 15243 // special characters, especially given that this function is used often 15244 // for numeric dom ids. 15245 return '' + text; 15246 } 15247 return escapeHtml(text); 15248 } 15249 15250 module.exports = escapeTextContentForBrowser; 15251 },{}],108:[function(_dereq_,module,exports){ 15252 /** 15253 * Copyright 2013-present, Facebook, Inc. 15254 * All rights reserved. 15255 * 15256 * This source code is licensed under the BSD-style license found in the 15257 * LICENSE file in the root directory of this source tree. An additional grant 15258 * of patent rights can be found in the PATENTS file in the same directory. 15259 * 15260 */ 15261 15262 'use strict'; 15263 15264 var _prodInvariant = _dereq_(125); 15265 15266 var ReactCurrentOwner = _dereq_(133); 15267 var ReactDOMComponentTree = _dereq_(34); 15268 var ReactInstanceMap = _dereq_(63); 15269 15270 var getHostComponentFromComposite = _dereq_(115); 15271 var invariant = _dereq_(150); 15272 var warning = _dereq_(157); 15273 15274 /** 15275 * Returns the DOM node rendered by this element. 15276 * 15277 * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode 15278 * 15279 * @param {ReactComponent|DOMElement} componentOrElement 15280 * @return {?DOMElement} The root node of this element. 15281 */ 15282 function findDOMNode(componentOrElement) { 15283 if ("development" !== 'production') { 15284 var owner = ReactCurrentOwner.current; 15285 if (owner !== null) { 15286 "development" !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0; 15287 owner._warnedAboutRefsInRender = true; 15288 } 15289 } 15290 if (componentOrElement == null) { 15291 return null; 15292 } 15293 if (componentOrElement.nodeType === 1) { 15294 return componentOrElement; 15295 } 15296 15297 var inst = ReactInstanceMap.get(componentOrElement); 15298 if (inst) { 15299 inst = getHostComponentFromComposite(inst); 15300 return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null; 15301 } 15302 15303 if (typeof componentOrElement.render === 'function') { 15304 !false ? "development" !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : _prodInvariant('44') : void 0; 15305 } else { 15306 !false ? "development" !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : _prodInvariant('45', Object.keys(componentOrElement)) : void 0; 15307 } 15308 } 15309 15310 module.exports = findDOMNode; 15311 },{"115":115,"125":125,"133":133,"150":150,"157":157,"34":34,"63":63}],109:[function(_dereq_,module,exports){ 15312 (function (process){ 15313 /** 15314 * Copyright 2013-present, Facebook, Inc. 15315 * All rights reserved. 15316 * 15317 * This source code is licensed under the BSD-style license found in the 15318 * LICENSE file in the root directory of this source tree. An additional grant 15319 * of patent rights can be found in the PATENTS file in the same directory. 15320 * 15321 * 15322 */ 15323 15324 'use strict'; 15325 15326 var KeyEscapeUtils = _dereq_(23); 15327 var traverseAllChildren = _dereq_(130); 15328 var warning = _dereq_(157); 15329 15330 var ReactComponentTreeHook; 15331 15332 if (typeof process !== 'undefined' && process.env && "development" === 'test') { 15333 // Temporary hack. 15334 // Inline requires don't work well with Jest: 15335 // https://github.com/facebook/react/issues/7240 15336 // Remove the inline requires when we don't need them anymore: 15337 // https://github.com/facebook/react/pull/7178 15338 ReactComponentTreeHook = _dereq_(132); 15339 } 15340 15341 /** 15342 * @param {function} traverseContext Context passed through traversal. 15343 * @param {?ReactComponent} child React child component. 15344 * @param {!string} name String name of key path to child. 15345 * @param {number=} selfDebugID Optional debugID of the current internal instance. 15346 */ 15347 function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) { 15348 // We found a component instance. 15349 if (traverseContext && typeof traverseContext === 'object') { 15350 var result = traverseContext; 15351 var keyUnique = result[name] === undefined; 15352 if ("development" !== 'production') { 15353 if (!ReactComponentTreeHook) { 15354 ReactComponentTreeHook = _dereq_(132); 15355 } 15356 if (!keyUnique) { 15357 "development" !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0; 15358 } 15359 } 15360 if (keyUnique && child != null) { 15361 result[name] = child; 15362 } 15363 } 15364 } 15365 15366 /** 15367 * Flattens children that are typically specified as `props.children`. Any null 15368 * children will not be included in the resulting object. 15369 * @return {!object} flattened children keyed by name. 15370 */ 15371 function flattenChildren(children, selfDebugID) { 15372 if (children == null) { 15373 return children; 15374 } 15375 var result = {}; 15376 15377 if ("development" !== 'production') { 15378 traverseAllChildren(children, function (traverseContext, child, name) { 15379 return flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID); 15380 }, result); 15381 } else { 15382 traverseAllChildren(children, flattenSingleChildIntoContext, result); 15383 } 15384 return result; 15385 } 15386 15387 module.exports = flattenChildren; 15388 }).call(this,undefined) 15389 },{"130":130,"132":132,"157":157,"23":23}],110:[function(_dereq_,module,exports){ 15390 /** 15391 * Copyright 2013-present, Facebook, Inc. 15392 * All rights reserved. 15393 * 15394 * This source code is licensed under the BSD-style license found in the 15395 * LICENSE file in the root directory of this source tree. An additional grant 15396 * of patent rights can be found in the PATENTS file in the same directory. 15397 * 15398 * 15399 */ 15400 15401 'use strict'; 15402 15403 /** 15404 * @param {array} arr an "accumulation" of items which is either an Array or 15405 * a single item. Useful when paired with the `accumulate` module. This is a 15406 * simple utility that allows us to reason about a collection of items, but 15407 * handling the case when there is exactly one item (and we do not need to 15408 * allocate an array). 15409 */ 15410 15411 function forEachAccumulated(arr, cb, scope) { 15412 if (Array.isArray(arr)) { 15413 arr.forEach(cb, scope); 15414 } else if (arr) { 15415 cb.call(scope, arr); 15416 } 15417 } 15418 15419 module.exports = forEachAccumulated; 15420 },{}],111:[function(_dereq_,module,exports){ 15421 /** 15422 * Copyright 2013-present, Facebook, Inc. 15423 * All rights reserved. 15424 * 15425 * This source code is licensed under the BSD-style license found in the 15426 * LICENSE file in the root directory of this source tree. An additional grant 15427 * of patent rights can be found in the PATENTS file in the same directory. 15428 * 15429 */ 15430 15431 'use strict'; 15432 15433 /** 15434 * `charCode` represents the actual "character code" and is safe to use with 15435 * `String.fromCharCode`. As such, only keys that correspond to printable 15436 * characters produce a valid `charCode`, the only exception to this is Enter. 15437 * The Tab-key is considered non-printable and does not have a `charCode`, 15438 * presumably because it does not produce a tab-character in browsers. 15439 * 15440 * @param {object} nativeEvent Native browser event. 15441 * @return {number} Normalized `charCode` property. 15442 */ 15443 15444 function getEventCharCode(nativeEvent) { 15445 var charCode; 15446 var keyCode = nativeEvent.keyCode; 15447 15448 if ('charCode' in nativeEvent) { 15449 charCode = nativeEvent.charCode; 15450 15451 // FF does not set `charCode` for the Enter-key, check against `keyCode`. 15452 if (charCode === 0 && keyCode === 13) { 15453 charCode = 13; 15454 } 15455 } else { 15456 // IE8 does not implement `charCode`, but `keyCode` has the correct value. 15457 charCode = keyCode; 15458 } 15459 15460 // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. 15461 // Must not discard the (non-)printable Enter-key. 15462 if (charCode >= 32 || charCode === 13) { 15463 return charCode; 15464 } 15465 15466 return 0; 15467 } 15468 15469 module.exports = getEventCharCode; 15470 },{}],112:[function(_dereq_,module,exports){ 15471 /** 15472 * Copyright 2013-present, Facebook, Inc. 15473 * All rights reserved. 15474 * 15475 * This source code is licensed under the BSD-style license found in the 15476 * LICENSE file in the root directory of this source tree. An additional grant 15477 * of patent rights can be found in the PATENTS file in the same directory. 15478 * 15479 */ 15480 15481 'use strict'; 15482 15483 var getEventCharCode = _dereq_(111); 15484 15485 /** 15486 * Normalization of deprecated HTML5 `key` values 15487 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names 15488 */ 15489 var normalizeKey = { 15490 'Esc': 'Escape', 15491 'Spacebar': ' ', 15492 'Left': 'ArrowLeft', 15493 'Up': 'ArrowUp', 15494 'Right': 'ArrowRight', 15495 'Down': 'ArrowDown', 15496 'Del': 'Delete', 15497 'Win': 'OS', 15498 'Menu': 'ContextMenu', 15499 'Apps': 'ContextMenu', 15500 'Scroll': 'ScrollLock', 15501 'MozPrintableKey': 'Unidentified' 15502 }; 15503 15504 /** 15505 * Translation from legacy `keyCode` to HTML5 `key` 15506 * Only special keys supported, all others depend on keyboard layout or browser 15507 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names 15508 */ 15509 var translateToKey = { 15510 8: 'Backspace', 15511 9: 'Tab', 15512 12: 'Clear', 15513 13: 'Enter', 15514 16: 'Shift', 15515 17: 'Control', 15516 18: 'Alt', 15517 19: 'Pause', 15518 20: 'CapsLock', 15519 27: 'Escape', 15520 32: ' ', 15521 33: 'PageUp', 15522 34: 'PageDown', 15523 35: 'End', 15524 36: 'Home', 15525 37: 'ArrowLeft', 15526 38: 'ArrowUp', 15527 39: 'ArrowRight', 15528 40: 'ArrowDown', 15529 45: 'Insert', 15530 46: 'Delete', 15531 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6', 15532 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12', 15533 144: 'NumLock', 15534 145: 'ScrollLock', 15535 224: 'Meta' 15536 }; 15537 15538 /** 15539 * @param {object} nativeEvent Native browser event. 15540 * @return {string} Normalized `key` property. 15541 */ 15542 function getEventKey(nativeEvent) { 15543 if (nativeEvent.key) { 15544 // Normalize inconsistent values reported by browsers due to 15545 // implementations of a working draft specification. 15546 15547 // FireFox implements `key` but returns `MozPrintableKey` for all 15548 // printable characters (normalized to `Unidentified`), ignore it. 15549 var key = normalizeKey[nativeEvent.key] || nativeEvent.key; 15550 if (key !== 'Unidentified') { 15551 return key; 15552 } 15553 } 15554 15555 // Browser does not implement `key`, polyfill as much of it as we can. 15556 if (nativeEvent.type === 'keypress') { 15557 var charCode = getEventCharCode(nativeEvent); 15558 15559 // The enter-key is technically both printable and non-printable and can 15560 // thus be captured by `keypress`, no other non-printable key should. 15561 return charCode === 13 ? 'Enter' : String.fromCharCode(charCode); 15562 } 15563 if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') { 15564 // While user keyboard layout determines the actual meaning of each 15565 // `keyCode` value, almost all function keys have a universal value. 15566 return translateToKey[nativeEvent.keyCode] || 'Unidentified'; 15567 } 15568 return ''; 15569 } 15570 15571 module.exports = getEventKey; 15572 },{"111":111}],113:[function(_dereq_,module,exports){ 15573 /** 15574 * Copyright 2013-present, Facebook, Inc. 15575 * All rights reserved. 15576 * 15577 * This source code is licensed under the BSD-style license found in the 15578 * LICENSE file in the root directory of this source tree. An additional grant 15579 * of patent rights can be found in the PATENTS file in the same directory. 15580 * 15581 */ 15582 15583 'use strict'; 15584 15585 /** 15586 * Translation from modifier key to the associated property in the event. 15587 * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers 15588 */ 15589 15590 var modifierKeyToProp = { 15591 'Alt': 'altKey', 15592 'Control': 'ctrlKey', 15593 'Meta': 'metaKey', 15594 'Shift': 'shiftKey' 15595 }; 15596 15597 // IE8 does not implement getModifierState so we simply map it to the only 15598 // modifier keys exposed by the event itself, does not support Lock-keys. 15599 // Currently, all major browsers except Chrome seems to support Lock-keys. 15600 function modifierStateGetter(keyArg) { 15601 var syntheticEvent = this; 15602 var nativeEvent = syntheticEvent.nativeEvent; 15603 if (nativeEvent.getModifierState) { 15604 return nativeEvent.getModifierState(keyArg); 15605 } 15606 var keyProp = modifierKeyToProp[keyArg]; 15607 return keyProp ? !!nativeEvent[keyProp] : false; 15608 } 15609 15610 function getEventModifierState(nativeEvent) { 15611 return modifierStateGetter; 15612 } 15613 15614 module.exports = getEventModifierState; 15615 },{}],114:[function(_dereq_,module,exports){ 15616 /** 15617 * Copyright 2013-present, Facebook, Inc. 15618 * All rights reserved. 15619 * 15620 * This source code is licensed under the BSD-style license found in the 15621 * LICENSE file in the root directory of this source tree. An additional grant 15622 * of patent rights can be found in the PATENTS file in the same directory. 15623 * 15624 */ 15625 15626 'use strict'; 15627 15628 /** 15629 * Gets the target node from a native browser event by accounting for 15630 * inconsistencies in browser DOM APIs. 15631 * 15632 * @param {object} nativeEvent Native browser event. 15633 * @return {DOMEventTarget} Target node. 15634 */ 15635 15636 function getEventTarget(nativeEvent) { 15637 var target = nativeEvent.target || nativeEvent.srcElement || window; 15638 15639 // Normalize SVG <use> element events #4963 15640 if (target.correspondingUseElement) { 15641 target = target.correspondingUseElement; 15642 } 15643 15644 // Safari may fire events on text nodes (Node.TEXT_NODE is 3). 15645 // @see http://www.quirksmode.org/js/events_properties.html 15646 return target.nodeType === 3 ? target.parentNode : target; 15647 } 15648 15649 module.exports = getEventTarget; 15650 },{}],115:[function(_dereq_,module,exports){ 15651 /** 15652 * Copyright 2013-present, Facebook, Inc. 15653 * All rights reserved. 15654 * 15655 * This source code is licensed under the BSD-style license found in the 15656 * LICENSE file in the root directory of this source tree. An additional grant 15657 * of patent rights can be found in the PATENTS file in the same directory. 15658 * 15659 */ 15660 15661 'use strict'; 15662 15663 var ReactNodeTypes = _dereq_(69); 15664 15665 function getHostComponentFromComposite(inst) { 15666 var type; 15667 15668 while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) { 15669 inst = inst._renderedComponent; 15670 } 15671 15672 if (type === ReactNodeTypes.HOST) { 15673 return inst._renderedComponent; 15674 } else if (type === ReactNodeTypes.EMPTY) { 15675 return null; 15676 } 15677 } 15678 15679 module.exports = getHostComponentFromComposite; 15680 },{"69":69}],116:[function(_dereq_,module,exports){ 15681 /** 15682 * Copyright 2013-present, Facebook, Inc. 15683 * All rights reserved. 15684 * 15685 * This source code is licensed under the BSD-style license found in the 15686 * LICENSE file in the root directory of this source tree. An additional grant 15687 * of patent rights can be found in the PATENTS file in the same directory. 15688 * 15689 * 15690 */ 15691 15692 'use strict'; 15693 15694 /* global Symbol */ 15695 15696 var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; 15697 var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. 15698 15699 /** 15700 * Returns the iterator method function contained on the iterable object. 15701 * 15702 * Be sure to invoke the function with the iterable as context: 15703 * 15704 * var iteratorFn = getIteratorFn(myIterable); 15705 * if (iteratorFn) { 15706 * var iterator = iteratorFn.call(myIterable); 15707 * ... 15708 * } 15709 * 15710 * @param {?object} maybeIterable 15711 * @return {?function} 15712 */ 15713 function getIteratorFn(maybeIterable) { 15714 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); 15715 if (typeof iteratorFn === 'function') { 15716 return iteratorFn; 15717 } 15718 } 15719 15720 module.exports = getIteratorFn; 15721 },{}],117:[function(_dereq_,module,exports){ 15722 /** 15723 * Copyright 2013-present, Facebook, Inc. 15724 * All rights reserved. 15725 * 15726 * This source code is licensed under the BSD-style license found in the 15727 * LICENSE file in the root directory of this source tree. An additional grant 15728 * of patent rights can be found in the PATENTS file in the same directory. 15729 * 15730 * 15731 */ 15732 15733 'use strict'; 15734 15735 var nextDebugID = 1; 15736 15737 function getNextDebugID() { 15738 return nextDebugID++; 15739 } 15740 15741 module.exports = getNextDebugID; 15742 },{}],118:[function(_dereq_,module,exports){ 15743 /** 15744 * Copyright 2013-present, Facebook, Inc. 15745 * All rights reserved. 15746 * 15747 * This source code is licensed under the BSD-style license found in the 15748 * LICENSE file in the root directory of this source tree. An additional grant 15749 * of patent rights can be found in the PATENTS file in the same directory. 15750 * 15751 */ 15752 15753 'use strict'; 15754 15755 /** 15756 * Given any node return the first leaf node without children. 15757 * 15758 * @param {DOMElement|DOMTextNode} node 15759 * @return {DOMElement|DOMTextNode} 15760 */ 15761 15762 function getLeafNode(node) { 15763 while (node && node.firstChild) { 15764 node = node.firstChild; 15765 } 15766 return node; 15767 } 15768 15769 /** 15770 * Get the next sibling within a container. This will walk up the 15771 * DOM if a node's siblings have been exhausted. 15772 * 15773 * @param {DOMElement|DOMTextNode} node 15774 * @return {?DOMElement|DOMTextNode} 15775 */ 15776 function getSiblingNode(node) { 15777 while (node) { 15778 if (node.nextSibling) { 15779 return node.nextSibling; 15780 } 15781 node = node.parentNode; 15782 } 15783 } 15784 15785 /** 15786 * Get object describing the nodes which contain characters at offset. 15787 * 15788 * @param {DOMElement|DOMTextNode} root 15789 * @param {number} offset 15790 * @return {?object} 15791 */ 15792 function getNodeForCharacterOffset(root, offset) { 15793 var node = getLeafNode(root); 15794 var nodeStart = 0; 15795 var nodeEnd = 0; 15796 15797 while (node) { 15798 if (node.nodeType === 3) { 15799 nodeEnd = nodeStart + node.textContent.length; 15800 15801 if (nodeStart <= offset && nodeEnd >= offset) { 15802 return { 15803 node: node, 15804 offset: offset - nodeStart 15805 }; 15806 } 15807 15808 nodeStart = nodeEnd; 15809 } 15810 15811 node = getLeafNode(getSiblingNode(node)); 15812 } 15813 } 15814 15815 module.exports = getNodeForCharacterOffset; 15816 },{}],119:[function(_dereq_,module,exports){ 15817 /** 15818 * Copyright 2013-present, Facebook, Inc. 15819 * All rights reserved. 15820 * 15821 * This source code is licensed under the BSD-style license found in the 15822 * LICENSE file in the root directory of this source tree. An additional grant 15823 * of patent rights can be found in the PATENTS file in the same directory. 15824 * 15825 */ 15826 15827 'use strict'; 15828 15829 var ExecutionEnvironment = _dereq_(136); 15830 15831 var contentKey = null; 15832 15833 /** 15834 * Gets the key used to access text content on a DOM node. 15835 * 15836 * @return {?string} Key used to access text content. 15837 * @internal 15838 */ 15839 function getTextContentAccessor() { 15840 if (!contentKey && ExecutionEnvironment.canUseDOM) { 15841 // Prefer textContent to innerText because many browsers support both but 15842 // SVG <text> elements don't support innerText even when <div> does. 15843 contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText'; 15844 } 15845 return contentKey; 15846 } 15847 15848 module.exports = getTextContentAccessor; 15849 },{"136":136}],120:[function(_dereq_,module,exports){ 15850 /** 15851 * Copyright 2013-present, Facebook, Inc. 15852 * All rights reserved. 15853 * 15854 * This source code is licensed under the BSD-style license found in the 15855 * LICENSE file in the root directory of this source tree. An additional grant 15856 * of patent rights can be found in the PATENTS file in the same directory. 15857 * 15858 */ 15859 15860 'use strict'; 15861 15862 var ExecutionEnvironment = _dereq_(136); 15863 15864 /** 15865 * Generate a mapping of standard vendor prefixes using the defined style property and event name. 15866 * 15867 * @param {string} styleProp 15868 * @param {string} eventName 15869 * @returns {object} 15870 */ 15871 function makePrefixMap(styleProp, eventName) { 15872 var prefixes = {}; 15873 15874 prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); 15875 prefixes['Webkit' + styleProp] = 'webkit' + eventName; 15876 prefixes['Moz' + styleProp] = 'moz' + eventName; 15877 prefixes['ms' + styleProp] = 'MS' + eventName; 15878 prefixes['O' + styleProp] = 'o' + eventName.toLowerCase(); 15879 15880 return prefixes; 15881 } 15882 15883 /** 15884 * A list of event names to a configurable list of vendor prefixes. 15885 */ 15886 var vendorPrefixes = { 15887 animationend: makePrefixMap('Animation', 'AnimationEnd'), 15888 animationiteration: makePrefixMap('Animation', 'AnimationIteration'), 15889 animationstart: makePrefixMap('Animation', 'AnimationStart'), 15890 transitionend: makePrefixMap('Transition', 'TransitionEnd') 15891 }; 15892 15893 /** 15894 * Event names that have already been detected and prefixed (if applicable). 15895 */ 15896 var prefixedEventNames = {}; 15897 15898 /** 15899 * Element to check for prefixes on. 15900 */ 15901 var style = {}; 15902 15903 /** 15904 * Bootstrap if a DOM exists. 15905 */ 15906 if (ExecutionEnvironment.canUseDOM) { 15907 style = document.createElement('div').style; 15908 15909 // On some platforms, in particular some releases of Android 4.x, 15910 // the un-prefixed "animation" and "transition" properties are defined on the 15911 // style object but the events that fire will still be prefixed, so we need 15912 // to check if the un-prefixed events are usable, and if not remove them from the map. 15913 if (!('AnimationEvent' in window)) { 15914 delete vendorPrefixes.animationend.animation; 15915 delete vendorPrefixes.animationiteration.animation; 15916 delete vendorPrefixes.animationstart.animation; 15917 } 15918 15919 // Same as above 15920 if (!('TransitionEvent' in window)) { 15921 delete vendorPrefixes.transitionend.transition; 15922 } 15923 } 15924 15925 /** 15926 * Attempts to determine the correct vendor prefixed event name. 15927 * 15928 * @param {string} eventName 15929 * @returns {string} 15930 */ 15931 function getVendorPrefixedEventName(eventName) { 15932 if (prefixedEventNames[eventName]) { 15933 return prefixedEventNames[eventName]; 15934 } else if (!vendorPrefixes[eventName]) { 15935 return eventName; 15936 } 15937 15938 var prefixMap = vendorPrefixes[eventName]; 15939 15940 for (var styleProp in prefixMap) { 15941 if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) { 15942 return prefixedEventNames[eventName] = prefixMap[styleProp]; 15943 } 15944 } 15945 15946 return ''; 15947 } 15948 15949 module.exports = getVendorPrefixedEventName; 15950 },{"136":136}],121:[function(_dereq_,module,exports){ 15951 /** 15952 * Copyright 2013-present, Facebook, Inc. 15953 * All rights reserved. 15954 * 15955 * This source code is licensed under the BSD-style license found in the 15956 * LICENSE file in the root directory of this source tree. An additional grant 15957 * of patent rights can be found in the PATENTS file in the same directory. 15958 * 15959 */ 15960 15961 'use strict'; 15962 15963 var _prodInvariant = _dereq_(125), 15964 _assign = _dereq_(158); 15965 15966 var ReactCompositeComponent = _dereq_(30); 15967 var ReactEmptyComponent = _dereq_(54); 15968 var ReactHostComponent = _dereq_(59); 15969 15970 var getNextDebugID = _dereq_(117); 15971 var invariant = _dereq_(150); 15972 var warning = _dereq_(157); 15973 15974 // To avoid a cyclic dependency, we create the final class in this module 15975 var ReactCompositeComponentWrapper = function (element) { 15976 this.construct(element); 15977 }; 15978 _assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent, { 15979 _instantiateReactComponent: instantiateReactComponent 15980 }); 15981 15982 function getDeclarationErrorAddendum(owner) { 15983 if (owner) { 15984 var name = owner.getName(); 15985 if (name) { 15986 return ' Check the render method of `' + name + '`.'; 15987 } 15988 } 15989 return ''; 15990 } 15991 15992 /** 15993 * Check if the type reference is a known internal type. I.e. not a user 15994 * provided composite type. 15995 * 15996 * @param {function} type 15997 * @return {boolean} Returns true if this is a valid internal type. 15998 */ 15999 function isInternalComponentType(type) { 16000 return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function'; 16001 } 16002 16003 /** 16004 * Given a ReactNode, create an instance that will actually be mounted. 16005 * 16006 * @param {ReactNode} node 16007 * @param {boolean} shouldHaveDebugID 16008 * @return {object} A new instance of the element's constructor. 16009 * @protected 16010 */ 16011 function instantiateReactComponent(node, shouldHaveDebugID) { 16012 var instance; 16013 16014 if (node === null || node === false) { 16015 instance = ReactEmptyComponent.create(instantiateReactComponent); 16016 } else if (typeof node === 'object') { 16017 var element = node; 16018 !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? "development" !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : _prodInvariant('130', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : void 0; 16019 16020 // Special case string values 16021 if (typeof element.type === 'string') { 16022 instance = ReactHostComponent.createInternalComponent(element); 16023 } else if (isInternalComponentType(element.type)) { 16024 // This is temporarily available for custom components that are not string 16025 // representations. I.e. ART. Once those are updated to use the string 16026 // representation, we can drop this code path. 16027 instance = new element.type(element); 16028 16029 // We renamed this. Allow the old name for compat. :( 16030 if (!instance.getHostNode) { 16031 instance.getHostNode = instance.getNativeNode; 16032 } 16033 } else { 16034 instance = new ReactCompositeComponentWrapper(element); 16035 } 16036 } else if (typeof node === 'string' || typeof node === 'number') { 16037 instance = ReactHostComponent.createInstanceForText(node); 16038 } else { 16039 !false ? "development" !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : _prodInvariant('131', typeof node) : void 0; 16040 } 16041 16042 if ("development" !== 'production') { 16043 "development" !== 'production' ? warning(typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.getHostNode === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : void 0; 16044 } 16045 16046 // These two fields are used by the DOM and ART diffing algorithms 16047 // respectively. Instead of using expandos on components, we should be 16048 // storing the state needed by the diffing algorithms elsewhere. 16049 instance._mountIndex = 0; 16050 instance._mountImage = null; 16051 16052 if ("development" !== 'production') { 16053 instance._debugID = shouldHaveDebugID ? getNextDebugID() : 0; 16054 } 16055 16056 // Internal instances should fully constructed at this point, so they should 16057 // not get any new fields added to them at this point. 16058 if ("development" !== 'production') { 16059 if (Object.preventExtensions) { 16060 Object.preventExtensions(instance); 16061 } 16062 } 16063 16064 return instance; 16065 } 16066 16067 module.exports = instantiateReactComponent; 16068 },{"117":117,"125":125,"150":150,"157":157,"158":158,"30":30,"54":54,"59":59}],122:[function(_dereq_,module,exports){ 16069 /** 16070 * Copyright 2013-present, Facebook, Inc. 16071 * All rights reserved. 16072 * 16073 * This source code is licensed under the BSD-style license found in the 16074 * LICENSE file in the root directory of this source tree. An additional grant 16075 * of patent rights can be found in the PATENTS file in the same directory. 16076 * 16077 */ 16078 16079 'use strict'; 16080 16081 var ExecutionEnvironment = _dereq_(136); 16082 16083 var useHasFeature; 16084 if (ExecutionEnvironment.canUseDOM) { 16085 useHasFeature = document.implementation && document.implementation.hasFeature && 16086 // always returns true in newer browsers as per the standard. 16087 // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature 16088 document.implementation.hasFeature('', '') !== true; 16089 } 16090 16091 /** 16092 * Checks if an event is supported in the current execution environment. 16093 * 16094 * NOTE: This will not work correctly for non-generic events such as `change`, 16095 * `reset`, `load`, `error`, and `select`. 16096 * 16097 * Borrows from Modernizr. 16098 * 16099 * @param {string} eventNameSuffix Event name, e.g. "click". 16100 * @param {?boolean} capture Check if the capture phase is supported. 16101 * @return {boolean} True if the event is supported. 16102 * @internal 16103 * @license Modernizr 3.0.0pre (Custom Build) | MIT 16104 */ 16105 function isEventSupported(eventNameSuffix, capture) { 16106 if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { 16107 return false; 16108 } 16109 16110 var eventName = 'on' + eventNameSuffix; 16111 var isSupported = eventName in document; 16112 16113 if (!isSupported) { 16114 var element = document.createElement('div'); 16115 element.setAttribute(eventName, 'return;'); 16116 isSupported = typeof element[eventName] === 'function'; 16117 } 16118 16119 if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { 16120 // This is the only way to test support for the `wheel` event in IE9+. 16121 isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); 16122 } 16123 16124 return isSupported; 16125 } 16126 16127 module.exports = isEventSupported; 16128 },{"136":136}],123:[function(_dereq_,module,exports){ 16129 /** 16130 * Copyright 2013-present, Facebook, Inc. 16131 * All rights reserved. 16132 * 16133 * This source code is licensed under the BSD-style license found in the 16134 * LICENSE file in the root directory of this source tree. An additional grant 16135 * of patent rights can be found in the PATENTS file in the same directory. 16136 * 16137 * 16138 */ 16139 16140 'use strict'; 16141 16142 /** 16143 * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary 16144 */ 16145 16146 var supportedInputTypes = { 16147 'color': true, 16148 'date': true, 16149 'datetime': true, 16150 'datetime-local': true, 16151 'email': true, 16152 'month': true, 16153 'number': true, 16154 'password': true, 16155 'range': true, 16156 'search': true, 16157 'tel': true, 16158 'text': true, 16159 'time': true, 16160 'url': true, 16161 'week': true 16162 }; 16163 16164 function isTextInputElement(elem) { 16165 var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); 16166 16167 if (nodeName === 'input') { 16168 return !!supportedInputTypes[elem.type]; 16169 } 16170 16171 if (nodeName === 'textarea') { 16172 return true; 16173 } 16174 16175 return false; 16176 } 16177 16178 module.exports = isTextInputElement; 16179 },{}],124:[function(_dereq_,module,exports){ 16180 /** 16181 * Copyright 2013-present, Facebook, Inc. 16182 * All rights reserved. 16183 * 16184 * This source code is licensed under the BSD-style license found in the 16185 * LICENSE file in the root directory of this source tree. An additional grant 16186 * of patent rights can be found in the PATENTS file in the same directory. 16187 * 16188 */ 16189 16190 'use strict'; 16191 16192 var escapeTextContentForBrowser = _dereq_(107); 16193 16194 /** 16195 * Escapes attribute value to prevent scripting attacks. 16196 * 16197 * @param {*} value Value to escape. 16198 * @return {string} An escaped string. 16199 */ 16200 function quoteAttributeValueForBrowser(value) { 16201 return '"' + escapeTextContentForBrowser(value) + '"'; 16202 } 16203 16204 module.exports = quoteAttributeValueForBrowser; 16205 },{"107":107}],125:[function(_dereq_,module,exports){ 16206 /** 16207 * Copyright (c) 2013-present, Facebook, Inc. 16208 * All rights reserved. 16209 * 16210 * This source code is licensed under the BSD-style license found in the 16211 * LICENSE file in the root directory of this source tree. An additional grant 16212 * of patent rights can be found in the PATENTS file in the same directory. 16213 * 16214 * 16215 */ 16216 'use strict'; 16217 16218 /** 16219 * WARNING: DO NOT manually require this module. 16220 * This is a replacement for `invariant(...)` used by the error code system 16221 * and will _only_ be required by the corresponding babel pass. 16222 * It always throws. 16223 */ 16224 16225 function reactProdInvariant(code) { 16226 var argCount = arguments.length - 1; 16227 16228 var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; 16229 16230 for (var argIdx = 0; argIdx < argCount; argIdx++) { 16231 message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); 16232 } 16233 16234 message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.'; 16235 16236 var error = new Error(message); 16237 error.name = 'Invariant Violation'; 16238 error.framesToPop = 1; // we don't care about reactProdInvariant's own frame 16239 16240 throw error; 16241 } 16242 16243 module.exports = reactProdInvariant; 16244 },{}],126:[function(_dereq_,module,exports){ 16245 /** 16246 * Copyright 2013-present, Facebook, Inc. 16247 * All rights reserved. 16248 * 16249 * This source code is licensed under the BSD-style license found in the 16250 * LICENSE file in the root directory of this source tree. An additional grant 16251 * of patent rights can be found in the PATENTS file in the same directory. 16252 * 16253 */ 16254 16255 'use strict'; 16256 16257 var ReactMount = _dereq_(67); 16258 16259 module.exports = ReactMount.renderSubtreeIntoContainer; 16260 },{"67":67}],127:[function(_dereq_,module,exports){ 16261 /** 16262 * Copyright 2013-present, Facebook, Inc. 16263 * All rights reserved. 16264 * 16265 * This source code is licensed under the BSD-style license found in the 16266 * LICENSE file in the root directory of this source tree. An additional grant 16267 * of patent rights can be found in the PATENTS file in the same directory. 16268 * 16269 */ 16270 16271 'use strict'; 16272 16273 var ExecutionEnvironment = _dereq_(136); 16274 var DOMNamespaces = _dereq_(10); 16275 16276 var WHITESPACE_TEST = /^[ \r\n\t\f]/; 16277 var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/; 16278 16279 var createMicrosoftUnsafeLocalFunction = _dereq_(105); 16280 16281 // SVG temp container for IE lacking innerHTML 16282 var reusableSVGContainer; 16283 16284 /** 16285 * Set the innerHTML property of a node, ensuring that whitespace is preserved 16286 * even in IE8. 16287 * 16288 * @param {DOMElement} node 16289 * @param {string} html 16290 * @internal 16291 */ 16292 var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) { 16293 // IE does not have innerHTML for SVG nodes, so instead we inject the 16294 // new markup in a temp node and then move the child nodes across into 16295 // the target node 16296 if (node.namespaceURI === DOMNamespaces.svg && !('innerHTML' in node)) { 16297 reusableSVGContainer = reusableSVGContainer || document.createElement('div'); 16298 reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>'; 16299 var svgNode = reusableSVGContainer.firstChild; 16300 while (svgNode.firstChild) { 16301 node.appendChild(svgNode.firstChild); 16302 } 16303 } else { 16304 node.innerHTML = html; 16305 } 16306 }); 16307 16308 if (ExecutionEnvironment.canUseDOM) { 16309 // IE8: When updating a just created node with innerHTML only leading 16310 // whitespace is removed. When updating an existing node with innerHTML 16311 // whitespace in root TextNodes is also collapsed. 16312 // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html 16313 16314 // Feature detection; only IE8 is known to behave improperly like this. 16315 var testElement = document.createElement('div'); 16316 testElement.innerHTML = ' '; 16317 if (testElement.innerHTML === '') { 16318 setInnerHTML = function (node, html) { 16319 // Magic theory: IE8 supposedly differentiates between added and updated 16320 // nodes when processing innerHTML, innerHTML on updated nodes suffers 16321 // from worse whitespace behavior. Re-adding a node like this triggers 16322 // the initial and more favorable whitespace behavior. 16323 // TODO: What to do on a detached node? 16324 if (node.parentNode) { 16325 node.parentNode.replaceChild(node, node); 16326 } 16327 16328 // We also implement a workaround for non-visible tags disappearing into 16329 // thin air on IE8, this only happens if there is no visible text 16330 // in-front of the non-visible tags. Piggyback on the whitespace fix 16331 // and simply check if any non-visible tags appear in the source. 16332 if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) { 16333 // Recover leading whitespace by temporarily prepending any character. 16334 // \uFEFF has the potential advantage of being zero-width/invisible. 16335 // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode 16336 // in hopes that this is preserved even if "\uFEFF" is transformed to 16337 // the actual Unicode character (by Babel, for example). 16338 // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216 16339 node.innerHTML = String.fromCharCode(0xFEFF) + html; 16340 16341 // deleteData leaves an empty `TextNode` which offsets the index of all 16342 // children. Definitely want to avoid this. 16343 var textNode = node.firstChild; 16344 if (textNode.data.length === 1) { 16345 node.removeChild(textNode); 16346 } else { 16347 textNode.deleteData(0, 1); 16348 } 16349 } else { 16350 node.innerHTML = html; 16351 } 16352 }; 16353 } 16354 testElement = null; 16355 } 16356 16357 module.exports = setInnerHTML; 16358 },{"10":10,"105":105,"136":136}],128:[function(_dereq_,module,exports){ 16359 /** 16360 * Copyright 2013-present, Facebook, Inc. 16361 * All rights reserved. 16362 * 16363 * This source code is licensed under the BSD-style license found in the 16364 * LICENSE file in the root directory of this source tree. An additional grant 16365 * of patent rights can be found in the PATENTS file in the same directory. 16366 * 16367 */ 16368 16369 'use strict'; 16370 16371 var ExecutionEnvironment = _dereq_(136); 16372 var escapeTextContentForBrowser = _dereq_(107); 16373 var setInnerHTML = _dereq_(127); 16374 16375 /** 16376 * Set the textContent property of a node, ensuring that whitespace is preserved 16377 * even in IE8. innerText is a poor substitute for textContent and, among many 16378 * issues, inserts <br> instead of the literal newline chars. innerHTML behaves 16379 * as it should. 16380 * 16381 * @param {DOMElement} node 16382 * @param {string} text 16383 * @internal 16384 */ 16385 var setTextContent = function (node, text) { 16386 if (text) { 16387 var firstChild = node.firstChild; 16388 16389 if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) { 16390 firstChild.nodeValue = text; 16391 return; 16392 } 16393 } 16394 node.textContent = text; 16395 }; 16396 16397 if (ExecutionEnvironment.canUseDOM) { 16398 if (!('textContent' in document.documentElement)) { 16399 setTextContent = function (node, text) { 16400 if (node.nodeType === 3) { 16401 node.nodeValue = text; 16402 return; 16403 } 16404 setInnerHTML(node, escapeTextContentForBrowser(text)); 16405 }; 16406 } 16407 } 16408 16409 module.exports = setTextContent; 16410 },{"107":107,"127":127,"136":136}],129:[function(_dereq_,module,exports){ 16411 /** 16412 * Copyright 2013-present, Facebook, Inc. 16413 * All rights reserved. 16414 * 16415 * This source code is licensed under the BSD-style license found in the 16416 * LICENSE file in the root directory of this source tree. An additional grant 16417 * of patent rights can be found in the PATENTS file in the same directory. 16418 * 16419 */ 16420 16421 'use strict'; 16422 16423 /** 16424 * Given a `prevElement` and `nextElement`, determines if the existing 16425 * instance should be updated as opposed to being destroyed or replaced by a new 16426 * instance. Both arguments are elements. This ensures that this logic can 16427 * operate on stateless trees without any backing instance. 16428 * 16429 * @param {?object} prevElement 16430 * @param {?object} nextElement 16431 * @return {boolean} True if the existing instance should be updated. 16432 * @protected 16433 */ 16434 16435 function shouldUpdateReactComponent(prevElement, nextElement) { 16436 var prevEmpty = prevElement === null || prevElement === false; 16437 var nextEmpty = nextElement === null || nextElement === false; 16438 if (prevEmpty || nextEmpty) { 16439 return prevEmpty === nextEmpty; 16440 } 16441 16442 var prevType = typeof prevElement; 16443 var nextType = typeof nextElement; 16444 if (prevType === 'string' || prevType === 'number') { 16445 return nextType === 'string' || nextType === 'number'; 16446 } else { 16447 return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key; 16448 } 16449 } 16450 16451 module.exports = shouldUpdateReactComponent; 16452 },{}],130:[function(_dereq_,module,exports){ 16453 /** 16454 * Copyright 2013-present, Facebook, Inc. 16455 * All rights reserved. 16456 * 16457 * This source code is licensed under the BSD-style license found in the 16458 * LICENSE file in the root directory of this source tree. An additional grant 16459 * of patent rights can be found in the PATENTS file in the same directory. 16460 * 16461 */ 16462 16463 'use strict'; 16464 16465 var _prodInvariant = _dereq_(125); 16466 16467 var ReactCurrentOwner = _dereq_(133); 16468 var REACT_ELEMENT_TYPE = _dereq_(53); 16469 16470 var getIteratorFn = _dereq_(116); 16471 var invariant = _dereq_(150); 16472 var KeyEscapeUtils = _dereq_(23); 16473 var warning = _dereq_(157); 16474 16475 var SEPARATOR = '.'; 16476 var SUBSEPARATOR = ':'; 16477 16478 /** 16479 * This is inlined from ReactElement since this file is shared between 16480 * isomorphic and renderers. We could extract this to a 16481 * 16482 */ 16483 16484 /** 16485 * TODO: Test that a single child and an array with one item have the same key 16486 * pattern. 16487 */ 16488 16489 var didWarnAboutMaps = false; 16490 16491 /** 16492 * Generate a key string that identifies a component within a set. 16493 * 16494 * @param {*} component A component that could contain a manual key. 16495 * @param {number} index Index that is used if a manual key is not provided. 16496 * @return {string} 16497 */ 16498 function getComponentKey(component, index) { 16499 // Do some typechecking here since we call this blindly. We want to ensure 16500 // that we don't block potential future ES APIs. 16501 if (component && typeof component === 'object' && component.key != null) { 16502 // Explicit key 16503 return KeyEscapeUtils.escape(component.key); 16504 } 16505 // Implicit key determined by the index in the set 16506 return index.toString(36); 16507 } 16508 16509 /** 16510 * @param {?*} children Children tree container. 16511 * @param {!string} nameSoFar Name of the key path so far. 16512 * @param {!function} callback Callback to invoke with each child found. 16513 * @param {?*} traverseContext Used to pass information throughout the traversal 16514 * process. 16515 * @return {!number} The number of children in this subtree. 16516 */ 16517 function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { 16518 var type = typeof children; 16519 16520 if (type === 'undefined' || type === 'boolean') { 16521 // All of the above are perceived as null. 16522 children = null; 16523 } 16524 16525 if (children === null || type === 'string' || type === 'number' || 16526 // The following is inlined from ReactElement. This means we can optimize 16527 // some checks. React Fiber also inlines this logic for similar purposes. 16528 type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) { 16529 callback(traverseContext, children, 16530 // If it's the only child, treat the name as if it was wrapped in an array 16531 // so that it's consistent if the number of children grows. 16532 nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); 16533 return 1; 16534 } 16535 16536 var child; 16537 var nextName; 16538 var subtreeCount = 0; // Count of children found in the current subtree. 16539 var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; 16540 16541 if (Array.isArray(children)) { 16542 for (var i = 0; i < children.length; i++) { 16543 child = children[i]; 16544 nextName = nextNamePrefix + getComponentKey(child, i); 16545 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); 16546 } 16547 } else { 16548 var iteratorFn = getIteratorFn(children); 16549 if (iteratorFn) { 16550 var iterator = iteratorFn.call(children); 16551 var step; 16552 if (iteratorFn !== children.entries) { 16553 var ii = 0; 16554 while (!(step = iterator.next()).done) { 16555 child = step.value; 16556 nextName = nextNamePrefix + getComponentKey(child, ii++); 16557 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); 16558 } 16559 } else { 16560 if ("development" !== 'production') { 16561 var mapsAsChildrenAddendum = ''; 16562 if (ReactCurrentOwner.current) { 16563 var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName(); 16564 if (mapsAsChildrenOwnerName) { 16565 mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.'; 16566 } 16567 } 16568 "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; 16569 didWarnAboutMaps = true; 16570 } 16571 // Iterator will provide entry [k,v] tuples rather than values. 16572 while (!(step = iterator.next()).done) { 16573 var entry = step.value; 16574 if (entry) { 16575 child = entry[1]; 16576 nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); 16577 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); 16578 } 16579 } 16580 } 16581 } else if (type === 'object') { 16582 var addendum = ''; 16583 if ("development" !== 'production') { 16584 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.'; 16585 if (children._isReactElement) { 16586 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.'; 16587 } 16588 if (ReactCurrentOwner.current) { 16589 var name = ReactCurrentOwner.current.getName(); 16590 if (name) { 16591 addendum += ' Check the render method of `' + name + '`.'; 16592 } 16593 } 16594 } 16595 var childrenString = String(children); 16596 !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; 16597 } 16598 } 16599 16600 return subtreeCount; 16601 } 16602 16603 /** 16604 * Traverses children that are typically specified as `props.children`, but 16605 * might also be specified through attributes: 16606 * 16607 * - `traverseAllChildren(this.props.children, ...)` 16608 * - `traverseAllChildren(this.props.leftPanelChildren, ...)` 16609 * 16610 * The `traverseContext` is an optional argument that is passed through the 16611 * entire traversal. It can be used to store accumulations or anything else that 16612 * the callback might find relevant. 16613 * 16614 * @param {?*} children Children tree object. 16615 * @param {!function} callback To invoke upon traversing each child. 16616 * @param {?*} traverseContext Context for traversal. 16617 * @return {!number} The number of children in this subtree. 16618 */ 16619 function traverseAllChildren(children, callback, traverseContext) { 16620 if (children == null) { 16621 return 0; 16622 } 16623 16624 return traverseAllChildrenImpl(children, '', callback, traverseContext); 16625 } 16626 16627 module.exports = traverseAllChildren; 16628 },{"116":116,"125":125,"133":133,"150":150,"157":157,"23":23,"53":53}],131:[function(_dereq_,module,exports){ 16629 /** 16630 * Copyright 2015-present, Facebook, Inc. 16631 * All rights reserved. 16632 * 16633 * This source code is licensed under the BSD-style license found in the 16634 * LICENSE file in the root directory of this source tree. An additional grant 16635 * of patent rights can be found in the PATENTS file in the same directory. 16636 * 16637 */ 16638 16639 'use strict'; 16640 16641 var _assign = _dereq_(158); 16642 16643 var emptyFunction = _dereq_(142); 16644 var warning = _dereq_(157); 16645 16646 var validateDOMNesting = emptyFunction; 16647 16648 if ("development" !== 'production') { 16649 // This validation code was written based on the HTML5 parsing spec: 16650 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope 16651 // 16652 // Note: this does not catch all invalid nesting, nor does it try to (as it's 16653 // not clear what practical benefit doing so provides); instead, we warn only 16654 // for cases where the parser will give a parse tree differing from what React 16655 // intended. For example, <b><div></div></b> is invalid but we don't warn 16656 // because it still parses correctly; we do warn for other cases like nested 16657 // <p> tags where the beginning of the second element implicitly closes the 16658 // first, causing a confusing mess. 16659 16660 // https://html.spec.whatwg.org/multipage/syntax.html#special 16661 var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp']; 16662 16663 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope 16664 var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template', 16665 16666 // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point 16667 // TODO: Distinguish by namespace here -- for <title>, including it here 16668 // errs on the side of fewer warnings 16669 'foreignObject', 'desc', 'title']; 16670 16671 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope 16672 var buttonScopeTags = inScopeTags.concat(['button']); 16673 16674 // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags 16675 var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt']; 16676 16677 var emptyAncestorInfo = { 16678 current: null, 16679 16680 formTag: null, 16681 aTagInScope: null, 16682 buttonTagInScope: null, 16683 nobrTagInScope: null, 16684 pTagInButtonScope: null, 16685 16686 listItemTagAutoclosing: null, 16687 dlItemTagAutoclosing: null 16688 }; 16689 16690 var updatedAncestorInfo = function (oldInfo, tag, instance) { 16691 var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo); 16692 var info = { tag: tag, instance: instance }; 16693 16694 if (inScopeTags.indexOf(tag) !== -1) { 16695 ancestorInfo.aTagInScope = null; 16696 ancestorInfo.buttonTagInScope = null; 16697 ancestorInfo.nobrTagInScope = null; 16698 } 16699 if (buttonScopeTags.indexOf(tag) !== -1) { 16700 ancestorInfo.pTagInButtonScope = null; 16701 } 16702 16703 // See rules for 'li', 'dd', 'dt' start tags in 16704 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody 16705 if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') { 16706 ancestorInfo.listItemTagAutoclosing = null; 16707 ancestorInfo.dlItemTagAutoclosing = null; 16708 } 16709 16710 ancestorInfo.current = info; 16711 16712 if (tag === 'form') { 16713 ancestorInfo.formTag = info; 16714 } 16715 if (tag === 'a') { 16716 ancestorInfo.aTagInScope = info; 16717 } 16718 if (tag === 'button') { 16719 ancestorInfo.buttonTagInScope = info; 16720 } 16721 if (tag === 'nobr') { 16722 ancestorInfo.nobrTagInScope = info; 16723 } 16724 if (tag === 'p') { 16725 ancestorInfo.pTagInButtonScope = info; 16726 } 16727 if (tag === 'li') { 16728 ancestorInfo.listItemTagAutoclosing = info; 16729 } 16730 if (tag === 'dd' || tag === 'dt') { 16731 ancestorInfo.dlItemTagAutoclosing = info; 16732 } 16733 16734 return ancestorInfo; 16735 }; 16736 16737 /** 16738 * Returns whether 16739 */ 16740 var isTagValidWithParent = function (tag, parentTag) { 16741 // First, let's check if we're in an unusual parsing mode... 16742 switch (parentTag) { 16743 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect 16744 case 'select': 16745 return tag === 'option' || tag === 'optgroup' || tag === '#text'; 16746 case 'optgroup': 16747 return tag === 'option' || tag === '#text'; 16748 // Strictly speaking, seeing an <option> doesn't mean we're in a <select> 16749 // but 16750 case 'option': 16751 return tag === '#text'; 16752 16753 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd 16754 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption 16755 // No special behavior since these rules fall back to "in body" mode for 16756 // all except special table nodes which cause bad parsing behavior anyway. 16757 16758 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr 16759 case 'tr': 16760 return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template'; 16761 16762 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody 16763 case 'tbody': 16764 case 'thead': 16765 case 'tfoot': 16766 return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template'; 16767 16768 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup 16769 case 'colgroup': 16770 return tag === 'col' || tag === 'template'; 16771 16772 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable 16773 case 'table': 16774 return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template'; 16775 16776 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead 16777 case 'head': 16778 return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template'; 16779 16780 // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element 16781 case 'html': 16782 return tag === 'head' || tag === 'body'; 16783 case '#document': 16784 return tag === 'html'; 16785 } 16786 16787 // Probably in the "in body" parsing mode, so we outlaw only tag combos 16788 // where the parsing rules cause implicit opens or closes to be added. 16789 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody 16790 switch (tag) { 16791 case 'h1': 16792 case 'h2': 16793 case 'h3': 16794 case 'h4': 16795 case 'h5': 16796 case 'h6': 16797 return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6'; 16798 16799 case 'rp': 16800 case 'rt': 16801 return impliedEndTags.indexOf(parentTag) === -1; 16802 16803 case 'body': 16804 case 'caption': 16805 case 'col': 16806 case 'colgroup': 16807 case 'frame': 16808 case 'head': 16809 case 'html': 16810 case 'tbody': 16811 case 'td': 16812 case 'tfoot': 16813 case 'th': 16814 case 'thead': 16815 case 'tr': 16816 // These tags are only valid with a few parents that have special child 16817 // parsing rules -- if we're down here, then none of those matched and 16818 // so we allow it only if we don't know what the parent is, as all other 16819 // cases are invalid. 16820 return parentTag == null; 16821 } 16822 16823 return true; 16824 }; 16825 16826 /** 16827 * Returns whether 16828 */ 16829 var findInvalidAncestorForTag = function (tag, ancestorInfo) { 16830 switch (tag) { 16831 case 'address': 16832 case 'article': 16833 case 'aside': 16834 case 'blockquote': 16835 case 'center': 16836 case 'details': 16837 case 'dialog': 16838 case 'dir': 16839 case 'div': 16840 case 'dl': 16841 case 'fieldset': 16842 case 'figcaption': 16843 case 'figure': 16844 case 'footer': 16845 case 'header': 16846 case 'hgroup': 16847 case 'main': 16848 case 'menu': 16849 case 'nav': 16850 case 'ol': 16851 case 'p': 16852 case 'section': 16853 case 'summary': 16854 case 'ul': 16855 16856 case 'pre': 16857 case 'listing': 16858 16859 case 'table': 16860 16861 case 'hr': 16862 16863 case 'xmp': 16864 16865 case 'h1': 16866 case 'h2': 16867 case 'h3': 16868 case 'h4': 16869 case 'h5': 16870 case 'h6': 16871 return ancestorInfo.pTagInButtonScope; 16872 16873 case 'form': 16874 return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope; 16875 16876 case 'li': 16877 return ancestorInfo.listItemTagAutoclosing; 16878 16879 case 'dd': 16880 case 'dt': 16881 return ancestorInfo.dlItemTagAutoclosing; 16882 16883 case 'button': 16884 return ancestorInfo.buttonTagInScope; 16885 16886 case 'a': 16887 // Spec says something about storing a list of markers, but it sounds 16888 // equivalent to this check. 16889 return ancestorInfo.aTagInScope; 16890 16891 case 'nobr': 16892 return ancestorInfo.nobrTagInScope; 16893 } 16894 16895 return null; 16896 }; 16897 16898 /** 16899 * Given a ReactCompositeComponent instance, return a list of its recursive 16900 * owners, starting at the root and ending with the instance itself. 16901 */ 16902 var findOwnerStack = function (instance) { 16903 if (!instance) { 16904 return []; 16905 } 16906 16907 var stack = []; 16908 do { 16909 stack.push(instance); 16910 } while (instance = instance._currentElement._owner); 16911 stack.reverse(); 16912 return stack; 16913 }; 16914 16915 var didWarn = {}; 16916 16917 validateDOMNesting = function (childTag, childText, childInstance, ancestorInfo) { 16918 ancestorInfo = ancestorInfo || emptyAncestorInfo; 16919 var parentInfo = ancestorInfo.current; 16920 var parentTag = parentInfo && parentInfo.tag; 16921 16922 if (childText != null) { 16923 "development" !== 'production' ? warning(childTag == null, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0; 16924 childTag = '#text'; 16925 } 16926 16927 var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo; 16928 var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo); 16929 var problematic = invalidParent || invalidAncestor; 16930 16931 if (problematic) { 16932 var ancestorTag = problematic.tag; 16933 var ancestorInstance = problematic.instance; 16934 16935 var childOwner = childInstance && childInstance._currentElement._owner; 16936 var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner; 16937 16938 var childOwners = findOwnerStack(childOwner); 16939 var ancestorOwners = findOwnerStack(ancestorOwner); 16940 16941 var minStackLen = Math.min(childOwners.length, ancestorOwners.length); 16942 var i; 16943 16944 var deepestCommon = -1; 16945 for (i = 0; i < minStackLen; i++) { 16946 if (childOwners[i] === ancestorOwners[i]) { 16947 deepestCommon = i; 16948 } else { 16949 break; 16950 } 16951 } 16952 16953 var UNKNOWN = '(unknown)'; 16954 var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) { 16955 return inst.getName() || UNKNOWN; 16956 }); 16957 var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) { 16958 return inst.getName() || UNKNOWN; 16959 }); 16960 var ownerInfo = [].concat( 16961 // If the parent and child instances have a common owner ancestor, start 16962 // with that -- otherwise we just start with the parent's owners. 16963 deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag, 16964 // If we're warning about an invalid (non-parent) ancestry, add '...' 16965 invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > '); 16966 16967 var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo; 16968 if (didWarn[warnKey]) { 16969 return; 16970 } 16971 didWarn[warnKey] = true; 16972 16973 var tagDisplayName = childTag; 16974 var whitespaceInfo = ''; 16975 if (childTag === '#text') { 16976 if (/\S/.test(childText)) { 16977 tagDisplayName = 'Text nodes'; 16978 } else { 16979 tagDisplayName = 'Whitespace text nodes'; 16980 whitespaceInfo = ' Make sure you don\'t have any extra whitespace between tags on ' + 'each line of your source code.'; 16981 } 16982 } else { 16983 tagDisplayName = '<' + childTag + '>'; 16984 } 16985 16986 if (invalidParent) { 16987 var info = ''; 16988 if (ancestorTag === 'table' && childTag === 'tr') { 16989 info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.'; 16990 } 16991 "development" !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s ' + 'See %s.%s', tagDisplayName, ancestorTag, whitespaceInfo, ownerInfo, info) : void 0; 16992 } else { 16993 "development" !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0; 16994 } 16995 } 16996 }; 16997 16998 validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo; 16999 17000 // For testing 17001 validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) { 17002 ancestorInfo = ancestorInfo || emptyAncestorInfo; 17003 var parentInfo = ancestorInfo.current; 17004 var parentTag = parentInfo && parentInfo.tag; 17005 return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo); 17006 }; 17007 } 17008 17009 module.exports = validateDOMNesting; 17010 },{"142":142,"157":157,"158":158}],132:[function(_dereq_,module,exports){ 17011 /** 17012 * Copyright 2013-present, Facebook, Inc. 17013 * All rights reserved. 17014 * 17015 * This source code is licensed under the BSD-style license found in the 17016 * LICENSE file in the root directory of this source tree. An additional grant 17017 * of patent rights can be found in the PATENTS file in the same directory. 17018 * 17019 */ 17020 17021 /* globals React */ 17022 17023 'use strict'; 17024 17025 var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; 17026 17027 module.exports = ReactInternals.ReactComponentTreeHook; 17028 },{}],133:[function(_dereq_,module,exports){ 17029 /** 17030 * Copyright 2013-present, Facebook, Inc. 17031 * All rights reserved. 17032 * 17033 * This source code is licensed under the BSD-style license found in the 17034 * LICENSE file in the root directory of this source tree. An additional grant 17035 * of patent rights can be found in the PATENTS file in the same directory. 17036 * 17037 */ 17038 17039 /* globals React */ 17040 17041 'use strict'; 17042 17043 var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; 17044 17045 module.exports = ReactInternals.ReactCurrentOwner; 17046 },{}],134:[function(_dereq_,module,exports){ 17047 /** 17048 * Copyright 2013-present, Facebook, Inc. 17049 * All rights reserved. 17050 * 17051 * This source code is licensed under the BSD-style license found in the 17052 * LICENSE file in the root directory of this source tree. An additional grant 17053 * of patent rights can be found in the PATENTS file in the same directory. 17054 * 17055 */ 17056 17057 /* globals React */ 17058 17059 'use strict'; 17060 17061 module.exports = React; 17062 },{}],135:[function(_dereq_,module,exports){ 17063 'use strict'; 17064 17065 /** 17066 * Copyright (c) 2013-present, Facebook, Inc. 17067 * 17068 * Licensed under the Apache License, Version 2.0 (the "License"); 17069 * you may not use this file except in compliance with the License. 17070 * You may obtain a copy of the License at 17071 * 17072 * http://www.apache.org/licenses/LICENSE-2.0 17073 * 17074 * Unless required by applicable law or agreed to in writing, software 17075 * distributed under the License is distributed on an "AS IS" BASIS, 17076 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17077 * See the License for the specific language governing permissions and 17078 * limitations under the License. 17079 * 17080 * @typechecks 17081 */ 17082 17083 var emptyFunction = _dereq_(142); 17084 17085 /** 17086 * Upstream version of event listener. Does not take into account specific 17087 * nature of platform. 17088 */ 17089 var EventListener = { 17090 /** 17091 * Listen to DOM events during the bubble phase. 17092 * 17093 * @param {DOMEventTarget} target DOM element to register listener on. 17094 * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. 17095 * @param {function} callback Callback function. 17096 * @return {object} Object with a `remove` method. 17097 */ 17098 listen: function listen(target, eventType, callback) { 17099 if (target.addEventListener) { 17100 target.addEventListener(eventType, callback, false); 17101 return { 17102 remove: function remove() { 17103 target.removeEventListener(eventType, callback, false); 17104 } 17105 }; 17106 } else if (target.attachEvent) { 17107 target.attachEvent('on' + eventType, callback); 17108 return { 17109 remove: function remove() { 17110 target.detachEvent('on' + eventType, callback); 17111 } 17112 }; 17113 } 17114 }, 17115 17116 /** 17117 * Listen to DOM events during the capture phase. 17118 * 17119 * @param {DOMEventTarget} target DOM element to register listener on. 17120 * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. 17121 * @param {function} callback Callback function. 17122 * @return {object} Object with a `remove` method. 17123 */ 17124 capture: function capture(target, eventType, callback) { 17125 if (target.addEventListener) { 17126 target.addEventListener(eventType, callback, true); 17127 return { 17128 remove: function remove() { 17129 target.removeEventListener(eventType, callback, true); 17130 } 17131 }; 17132 } else { 17133 if ("development" !== 'production') { 17134 console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.'); 17135 } 17136 return { 17137 remove: emptyFunction 17138 }; 17139 } 17140 }, 17141 17142 registerDefault: function registerDefault() {} 17143 }; 17144 17145 module.exports = EventListener; 17146 },{"142":142}],136:[function(_dereq_,module,exports){ 17147 /** 17148 * Copyright (c) 2013-present, Facebook, Inc. 17149 * All rights reserved. 17150 * 17151 * This source code is licensed under the BSD-style license found in the 17152 * LICENSE file in the root directory of this source tree. An additional grant 17153 * of patent rights can be found in the PATENTS file in the same directory. 17154 * 17155 */ 17156 17157 'use strict'; 17158 17159 var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); 17160 17161 /** 17162 * Simple, lightweight module assisting with the detection and context of 17163 * Worker. Helps avoid circular dependencies and allows code to reason about 17164 * whether or not they are in a Worker, even if they never include the main 17165 * `ReactWorker` dependency. 17166 */ 17167 var ExecutionEnvironment = { 17168 17169 canUseDOM: canUseDOM, 17170 17171 canUseWorkers: typeof Worker !== 'undefined', 17172 17173 canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), 17174 17175 canUseViewport: canUseDOM && !!window.screen, 17176 17177 isInWorker: !canUseDOM // For now, this is true - might change in the future. 17178 17179 }; 17180 17181 module.exports = ExecutionEnvironment; 17182 },{}],137:[function(_dereq_,module,exports){ 17183 "use strict"; 17184 17185 /** 17186 * Copyright (c) 2013-present, Facebook, Inc. 17187 * All rights reserved. 17188 * 17189 * This source code is licensed under the BSD-style license found in the 17190 * LICENSE file in the root directory of this source tree. An additional grant 17191 * of patent rights can be found in the PATENTS file in the same directory. 17192 * 17193 * @typechecks 17194 */ 17195 17196 var _hyphenPattern = /-(.)/g; 17197 17198 /** 17199 * Camelcases a hyphenated string, for example: 17200 * 17201 * > camelize('background-color') 17202 * < "backgroundColor" 17203 * 17204 * @param {string} string 17205 * @return {string} 17206 */ 17207 function camelize(string) { 17208 return string.replace(_hyphenPattern, function (_, character) { 17209 return character.toUpperCase(); 17210 }); 17211 } 17212 17213 module.exports = camelize; 17214 },{}],138:[function(_dereq_,module,exports){ 17215 /** 17216 * Copyright (c) 2013-present, Facebook, Inc. 17217 * All rights reserved. 17218 * 17219 * This source code is licensed under the BSD-style license found in the 17220 * LICENSE file in the root directory of this source tree. An additional grant 17221 * of patent rights can be found in the PATENTS file in the same directory. 17222 * 17223 * @typechecks 17224 */ 17225 17226 'use strict'; 17227 17228 var camelize = _dereq_(137); 17229 17230 var msPattern = /^-ms-/; 17231 17232 /** 17233 * Camelcases a hyphenated CSS property name, for example: 17234 * 17235 * > camelizeStyleName('background-color') 17236 * < "backgroundColor" 17237 * > camelizeStyleName('-moz-transition') 17238 * < "MozTransition" 17239 * > camelizeStyleName('-ms-transition') 17240 * < "msTransition" 17241 * 17242 * As Andi Smith suggests 17243 * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix 17244 * is converted to lowercase `ms`. 17245 * 17246 * @param {string} string 17247 * @return {string} 17248 */ 17249 function camelizeStyleName(string) { 17250 return camelize(string.replace(msPattern, 'ms-')); 17251 } 17252 17253 module.exports = camelizeStyleName; 17254 },{"137":137}],139:[function(_dereq_,module,exports){ 17255 'use strict'; 17256 17257 /** 17258 * Copyright (c) 2013-present, Facebook, Inc. 17259 * All rights reserved. 17260 * 17261 * This source code is licensed under the BSD-style license found in the 17262 * LICENSE file in the root directory of this source tree. An additional grant 17263 * of patent rights can be found in the PATENTS file in the same directory. 17264 * 17265 * 17266 */ 17267 17268 var isTextNode = _dereq_(152); 17269 17270 /*eslint-disable no-bitwise */ 17271 17272 /** 17273 * Checks if a given DOM node contains or is another DOM node. 17274 */ 17275 function containsNode(outerNode, innerNode) { 17276 if (!outerNode || !innerNode) { 17277 return false; 17278 } else if (outerNode === innerNode) { 17279 return true; 17280 } else if (isTextNode(outerNode)) { 17281 return false; 17282 } else if (isTextNode(innerNode)) { 17283 return containsNode(outerNode, innerNode.parentNode); 17284 } else if ('contains' in outerNode) { 17285 return outerNode.contains(innerNode); 17286 } else if (outerNode.compareDocumentPosition) { 17287 return !!(outerNode.compareDocumentPosition(innerNode) & 16); 17288 } else { 17289 return false; 17290 } 17291 } 17292 17293 module.exports = containsNode; 17294 },{"152":152}],140:[function(_dereq_,module,exports){ 17295 'use strict'; 17296 17297 /** 17298 * Copyright (c) 2013-present, Facebook, Inc. 17299 * All rights reserved. 17300 * 17301 * This source code is licensed under the BSD-style license found in the 17302 * LICENSE file in the root directory of this source tree. An additional grant 17303 * of patent rights can be found in the PATENTS file in the same directory. 17304 * 17305 * @typechecks 17306 */ 17307 17308 var invariant = _dereq_(150); 17309 17310 /** 17311 * Convert array-like objects to arrays. 17312 * 17313 * This API assumes the caller knows the contents of the data type. For less 17314 * well defined inputs use createArrayFromMixed. 17315 * 17316 * @param {object|function|filelist} obj 17317 * @return {array} 17318 */ 17319 function toArray(obj) { 17320 var length = obj.length; 17321 17322 // Some browsers builtin objects can report typeof 'function' (e.g. NodeList 17323 // in old versions of Safari). 17324 !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? "development" !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0; 17325 17326 !(typeof length === 'number') ? "development" !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0; 17327 17328 !(length === 0 || length - 1 in obj) ? "development" !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0; 17329 17330 !(typeof obj.callee !== 'function') ? "development" !== 'production' ? invariant(false, 'toArray: Object can\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0; 17331 17332 // Old IE doesn't give collections access to hasOwnProperty. Assume inputs 17333 // without method will throw during the slice call and skip straight to the 17334 // fallback. 17335 if (obj.hasOwnProperty) { 17336 try { 17337 return Array.prototype.slice.call(obj); 17338 } catch (e) { 17339 // IE < 9 does not support Array#slice on collections objects 17340 } 17341 } 17342 17343 // Fall back to copying key by key. This assumes all keys have a value, 17344 // so will not preserve sparsely populated inputs. 17345 var ret = Array(length); 17346 for (var ii = 0; ii < length; ii++) { 17347 ret[ii] = obj[ii]; 17348 } 17349 return ret; 17350 } 17351 17352 /** 17353 * Perform a heuristic test to determine if an object is "array-like". 17354 * 17355 * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" 17356 * Joshu replied: "Mu." 17357 * 17358 * This function determines if its argument has "array nature": it returns 17359 * true if the argument is an actual array, an `arguments' object, or an 17360 * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). 17361 * 17362 * It will return false for other array-like objects like Filelist. 17363 * 17364 * @param {*} obj 17365 * @return {boolean} 17366 */ 17367 function hasArrayNature(obj) { 17368 return ( 17369 // not null/false 17370 !!obj && ( 17371 // arrays are objects, NodeLists are functions in Safari 17372 typeof obj == 'object' || typeof obj == 'function') && 17373 // quacks like an array 17374 'length' in obj && 17375 // not window 17376 !('setInterval' in obj) && 17377 // no DOM node should be considered an array-like 17378 // a 'select' element has 'length' and 'item' properties on IE8 17379 typeof obj.nodeType != 'number' && ( 17380 // a real array 17381 Array.isArray(obj) || 17382 // arguments 17383 'callee' in obj || 17384 // HTMLCollection/NodeList 17385 'item' in obj) 17386 ); 17387 } 17388 17389 /** 17390 * Ensure that the argument is an array by wrapping it in an array if it is not. 17391 * Creates a copy of the argument if it is already an array. 17392 * 17393 * This is mostly useful idiomatically: 17394 * 17395 * var createArrayFromMixed = require('createArrayFromMixed'); 17396 * 17397 * function takesOneOrMoreThings(things) { 17398 * things = createArrayFromMixed(things); 17399 * ... 17400 * } 17401 * 17402 * This allows you to treat `things' as an array, but accept scalars in the API. 17403 * 17404 * If you need to convert an array-like object, like `arguments`, into an array 17405 * use toArray instead. 17406 * 17407 * @param {*} obj 17408 * @return {array} 17409 */ 17410 function createArrayFromMixed(obj) { 17411 if (!hasArrayNature(obj)) { 17412 return [obj]; 17413 } else if (Array.isArray(obj)) { 17414 return obj.slice(); 17415 } else { 17416 return toArray(obj); 17417 } 17418 } 17419 17420 module.exports = createArrayFromMixed; 17421 },{"150":150}],141:[function(_dereq_,module,exports){ 17422 'use strict'; 17423 17424 /** 17425 * Copyright (c) 2013-present, Facebook, Inc. 17426 * All rights reserved. 17427 * 17428 * This source code is licensed under the BSD-style license found in the 17429 * LICENSE file in the root directory of this source tree. An additional grant 17430 * of patent rights can be found in the PATENTS file in the same directory. 17431 * 17432 * @typechecks 17433 */ 17434 17435 /*eslint-disable fb-www/unsafe-html*/ 17436 17437 var ExecutionEnvironment = _dereq_(136); 17438 17439 var createArrayFromMixed = _dereq_(140); 17440 var getMarkupWrap = _dereq_(146); 17441 var invariant = _dereq_(150); 17442 17443 /** 17444 * Dummy container used to render all markup. 17445 */ 17446 var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; 17447 17448 /** 17449 * Pattern used by `getNodeName`. 17450 */ 17451 var nodeNamePattern = /^\s*<(\w+)/; 17452 17453 /** 17454 * Extracts the `nodeName` of the first element in a string of markup. 17455 * 17456 * @param {string} markup String of markup. 17457 * @return {?string} Node name of the supplied markup. 17458 */ 17459 function getNodeName(markup) { 17460 var nodeNameMatch = markup.match(nodeNamePattern); 17461 return nodeNameMatch && nodeNameMatch[1].toLowerCase(); 17462 } 17463 17464 /** 17465 * Creates an array containing the nodes rendered from the supplied markup. The 17466 * optionally supplied `handleScript` function will be invoked once for each 17467 * <script> element that is rendered. If no `handleScript` function is supplied, 17468 * an exception is thrown if any <script> elements are rendered. 17469 * 17470 * @param {string} markup A string of valid HTML markup. 17471 * @param {?function} handleScript Invoked once for each rendered <script>. 17472 * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes. 17473 */ 17474 function createNodesFromMarkup(markup, handleScript) { 17475 var node = dummyNode; 17476 !!!dummyNode ? "development" !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0; 17477 var nodeName = getNodeName(markup); 17478 17479 var wrap = nodeName && getMarkupWrap(nodeName); 17480 if (wrap) { 17481 node.innerHTML = wrap[1] + markup + wrap[2]; 17482 17483 var wrapDepth = wrap[0]; 17484 while (wrapDepth--) { 17485 node = node.lastChild; 17486 } 17487 } else { 17488 node.innerHTML = markup; 17489 } 17490 17491 var scripts = node.getElementsByTagName('script'); 17492 if (scripts.length) { 17493 !handleScript ? "development" !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0; 17494 createArrayFromMixed(scripts).forEach(handleScript); 17495 } 17496 17497 var nodes = Array.from(node.childNodes); 17498 while (node.lastChild) { 17499 node.removeChild(node.lastChild); 17500 } 17501 return nodes; 17502 } 17503 17504 module.exports = createNodesFromMarkup; 17505 },{"136":136,"140":140,"146":146,"150":150}],142:[function(_dereq_,module,exports){ 17506 "use strict"; 17507 17508 /** 17509 * Copyright (c) 2013-present, Facebook, Inc. 17510 * All rights reserved. 17511 * 17512 * This source code is licensed under the BSD-style license found in the 17513 * LICENSE file in the root directory of this source tree. An additional grant 17514 * of patent rights can be found in the PATENTS file in the same directory. 17515 * 17516 * 17517 */ 17518 17519 function makeEmptyFunction(arg) { 17520 return function () { 17521 return arg; 17522 }; 17523 } 17524 17525 /** 17526 * This function accepts and discards inputs; it has no side effects. This is 17527 * primarily useful idiomatically for overridable function endpoints which 17528 * always need to be callable, since JS lacks a null-call idiom ala Cocoa. 17529 */ 17530 var emptyFunction = function emptyFunction() {}; 17531 17532 emptyFunction.thatReturns = makeEmptyFunction; 17533 emptyFunction.thatReturnsFalse = makeEmptyFunction(false); 17534 emptyFunction.thatReturnsTrue = makeEmptyFunction(true); 17535 emptyFunction.thatReturnsNull = makeEmptyFunction(null); 17536 emptyFunction.thatReturnsThis = function () { 17537 return this; 17538 }; 17539 emptyFunction.thatReturnsArgument = function (arg) { 17540 return arg; 17541 }; 17542 17543 module.exports = emptyFunction; 17544 },{}],143:[function(_dereq_,module,exports){ 17545 /** 17546 * Copyright (c) 2013-present, Facebook, Inc. 17547 * All rights reserved. 17548 * 17549 * This source code is licensed under the BSD-style license found in the 17550 * LICENSE file in the root directory of this source tree. An additional grant 17551 * of patent rights can be found in the PATENTS file in the same directory. 17552 * 17553 */ 17554 17555 'use strict'; 17556 17557 var emptyObject = {}; 17558 17559 if ("development" !== 'production') { 17560 Object.freeze(emptyObject); 17561 } 17562 17563 module.exports = emptyObject; 17564 },{}],144:[function(_dereq_,module,exports){ 17565 /** 17566 * Copyright (c) 2013-present, Facebook, Inc. 17567 * All rights reserved. 17568 * 17569 * This source code is licensed under the BSD-style license found in the 17570 * LICENSE file in the root directory of this source tree. An additional grant 17571 * of patent rights can be found in the PATENTS file in the same directory. 17572 * 17573 */ 17574 17575 'use strict'; 17576 17577 /** 17578 * @param {DOMElement} node input/textarea to focus 17579 */ 17580 17581 function focusNode(node) { 17582 // IE8 can throw "Can't move focus to the control because it is invisible, 17583 // not enabled, or of a type that does not accept the focus." for all kinds of 17584 // reasons that are too expensive and fragile to test. 17585 try { 17586 node.focus(); 17587 } catch (e) {} 17588 } 17589 17590 module.exports = focusNode; 17591 },{}],145:[function(_dereq_,module,exports){ 17592 'use strict'; 17593 17594 /** 17595 * Copyright (c) 2013-present, Facebook, Inc. 17596 * All rights reserved. 17597 * 17598 * This source code is licensed under the BSD-style license found in the 17599 * LICENSE file in the root directory of this source tree. An additional grant 17600 * of patent rights can be found in the PATENTS file in the same directory. 17601 * 17602 * @typechecks 17603 */ 17604 17605 /* eslint-disable fb-www/typeof-undefined */ 17606 17607 /** 17608 * Same as document.activeElement but wraps in a try-catch block. In IE it is 17609 * not safe to call document.activeElement if there is nothing focused. 17610 * 17611 * The activeElement will be null only if the document or document body is not 17612 * yet defined. 17613 */ 17614 function getActiveElement() /*?DOMElement*/{ 17615 if (typeof document === 'undefined') { 17616 return null; 17617 } 17618 try { 17619 return document.activeElement || document.body; 17620 } catch (e) { 17621 return document.body; 17622 } 17623 } 17624 17625 module.exports = getActiveElement; 17626 },{}],146:[function(_dereq_,module,exports){ 17627 'use strict'; 17628 17629 /** 17630 * Copyright (c) 2013-present, Facebook, Inc. 17631 * All rights reserved. 17632 * 17633 * This source code is licensed under the BSD-style license found in the 17634 * LICENSE file in the root directory of this source tree. An additional grant 17635 * of patent rights can be found in the PATENTS file in the same directory. 17636 * 17637 */ 17638 17639 /*eslint-disable fb-www/unsafe-html */ 17640 17641 var ExecutionEnvironment = _dereq_(136); 17642 17643 var invariant = _dereq_(150); 17644 17645 /** 17646 * Dummy container used to detect which wraps are necessary. 17647 */ 17648 var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; 17649 17650 /** 17651 * Some browsers cannot use `innerHTML` to render certain elements standalone, 17652 * so we wrap them, render the wrapped nodes, then extract the desired node. 17653 * 17654 * In IE8, certain elements cannot render alone, so wrap all elements ('*'). 17655 */ 17656 17657 var shouldWrap = {}; 17658 17659 var selectWrap = [1, '<select multiple="true">', '</select>']; 17660 var tableWrap = [1, '<table>', '</table>']; 17661 var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>']; 17662 17663 var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>']; 17664 17665 var markupWrap = { 17666 '*': [1, '?<div>', '</div>'], 17667 17668 'area': [1, '<map>', '</map>'], 17669 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'], 17670 'legend': [1, '<fieldset>', '</fieldset>'], 17671 'param': [1, '<object>', '</object>'], 17672 'tr': [2, '<table><tbody>', '</tbody></table>'], 17673 17674 'optgroup': selectWrap, 17675 'option': selectWrap, 17676 17677 'caption': tableWrap, 17678 'colgroup': tableWrap, 17679 'tbody': tableWrap, 17680 'tfoot': tableWrap, 17681 'thead': tableWrap, 17682 17683 'td': trWrap, 17684 'th': trWrap 17685 }; 17686 17687 // Initialize the SVG elements since we know they'll always need to be wrapped 17688 // consistently. If they are created inside a <div> they will be initialized in 17689 // the wrong namespace (and will not display). 17690 var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan']; 17691 svgElements.forEach(function (nodeName) { 17692 markupWrap[nodeName] = svgWrap; 17693 shouldWrap[nodeName] = true; 17694 }); 17695 17696 /** 17697 * Gets the markup wrap configuration for the supplied `nodeName`. 17698 * 17699 * NOTE: This lazily detects which wraps are necessary for the current browser. 17700 * 17701 * @param {string} nodeName Lowercase `nodeName`. 17702 * @return {?array} Markup wrap configuration, if applicable. 17703 */ 17704 function getMarkupWrap(nodeName) { 17705 !!!dummyNode ? "development" !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0; 17706 if (!markupWrap.hasOwnProperty(nodeName)) { 17707 nodeName = '*'; 17708 } 17709 if (!shouldWrap.hasOwnProperty(nodeName)) { 17710 if (nodeName === '*') { 17711 dummyNode.innerHTML = '<link />'; 17712 } else { 17713 dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>'; 17714 } 17715 shouldWrap[nodeName] = !dummyNode.firstChild; 17716 } 17717 return shouldWrap[nodeName] ? markupWrap[nodeName] : null; 17718 } 17719 17720 module.exports = getMarkupWrap; 17721 },{"136":136,"150":150}],147:[function(_dereq_,module,exports){ 17722 /** 17723 * Copyright (c) 2013-present, Facebook, Inc. 17724 * All rights reserved. 17725 * 17726 * This source code is licensed under the BSD-style license found in the 17727 * LICENSE file in the root directory of this source tree. An additional grant 17728 * of patent rights can be found in the PATENTS file in the same directory. 17729 * 17730 * @typechecks 17731 */ 17732 17733 'use strict'; 17734 17735 /** 17736 * Gets the scroll position of the supplied element or window. 17737 * 17738 * The return values are unbounded, unlike `getScrollPosition`. This means they 17739 * may be negative or exceed the element boundaries (which is possible using 17740 * inertial scrolling). 17741 * 17742 * @param {DOMWindow|DOMElement} scrollable 17743 * @return {object} Map with `x` and `y` keys. 17744 */ 17745 17746 function getUnboundedScrollPosition(scrollable) { 17747 if (scrollable === window) { 17748 return { 17749 x: window.pageXOffset || document.documentElement.scrollLeft, 17750 y: window.pageYOffset || document.documentElement.scrollTop 17751 }; 17752 } 17753 return { 17754 x: scrollable.scrollLeft, 17755 y: scrollable.scrollTop 17756 }; 17757 } 17758 17759 module.exports = getUnboundedScrollPosition; 17760 },{}],148:[function(_dereq_,module,exports){ 17761 'use strict'; 17762 17763 /** 17764 * Copyright (c) 2013-present, Facebook, Inc. 17765 * All rights reserved. 17766 * 17767 * This source code is licensed under the BSD-style license found in the 17768 * LICENSE file in the root directory of this source tree. An additional grant 17769 * of patent rights can be found in the PATENTS file in the same directory. 17770 * 17771 * @typechecks 17772 */ 17773 17774 var _uppercasePattern = /([A-Z])/g; 17775 17776 /** 17777 * Hyphenates a camelcased string, for example: 17778 * 17779 * > hyphenate('backgroundColor') 17780 * < "background-color" 17781 * 17782 * For CSS style names, use `hyphenateStyleName` instead which works properly 17783 * with all vendor prefixes, including `ms`. 17784 * 17785 * @param {string} string 17786 * @return {string} 17787 */ 17788 function hyphenate(string) { 17789 return string.replace(_uppercasePattern, '-$1').toLowerCase(); 17790 } 17791 17792 module.exports = hyphenate; 17793 },{}],149:[function(_dereq_,module,exports){ 17794 /** 17795 * Copyright (c) 2013-present, Facebook, Inc. 17796 * All rights reserved. 17797 * 17798 * This source code is licensed under the BSD-style license found in the 17799 * LICENSE file in the root directory of this source tree. An additional grant 17800 * of patent rights can be found in the PATENTS file in the same directory. 17801 * 17802 * @typechecks 17803 */ 17804 17805 'use strict'; 17806 17807 var hyphenate = _dereq_(148); 17808 17809 var msPattern = /^ms-/; 17810 17811 /** 17812 * Hyphenates a camelcased CSS property name, for example: 17813 * 17814 * > hyphenateStyleName('backgroundColor') 17815 * < "background-color" 17816 * > hyphenateStyleName('MozTransition') 17817 * < "-moz-transition" 17818 * > hyphenateStyleName('msTransition') 17819 * < "-ms-transition" 17820 * 17821 * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix 17822 * is converted to `-ms-`. 17823 * 17824 * @param {string} string 17825 * @return {string} 17826 */ 17827 function hyphenateStyleName(string) { 17828 return hyphenate(string).replace(msPattern, '-ms-'); 17829 } 17830 17831 module.exports = hyphenateStyleName; 17832 },{"148":148}],150:[function(_dereq_,module,exports){ 17833 /** 17834 * Copyright (c) 2013-present, Facebook, Inc. 17835 * All rights reserved. 17836 * 17837 * This source code is licensed under the BSD-style license found in the 17838 * LICENSE file in the root directory of this source tree. An additional grant 17839 * of patent rights can be found in the PATENTS file in the same directory. 17840 * 17841 */ 17842 17843 'use strict'; 17844 17845 /** 17846 * Use invariant() to assert state which your program assumes to be true. 17847 * 17848 * Provide sprintf-style format (only %s is supported) and arguments 17849 * to provide information about what broke and what you were 17850 * expecting. 17851 * 17852 * The invariant message will be stripped in production, but the invariant 17853 * will remain to ensure logic does not differ in production. 17854 */ 17855 17856 function invariant(condition, format, a, b, c, d, e, f) { 17857 if ("development" !== 'production') { 17858 if (format === undefined) { 17859 throw new Error('invariant requires an error message argument'); 17860 } 17861 } 17862 17863 if (!condition) { 17864 var error; 17865 if (format === undefined) { 17866 error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); 17867 } else { 17868 var args = [a, b, c, d, e, f]; 17869 var argIndex = 0; 17870 error = new Error(format.replace(/%s/g, function () { 17871 return args[argIndex++]; 17872 })); 17873 error.name = 'Invariant Violation'; 17874 } 17875 17876 error.framesToPop = 1; // we don't care about invariant's own frame 17877 throw error; 17878 } 17879 } 17880 17881 module.exports = invariant; 17882 },{}],151:[function(_dereq_,module,exports){ 17883 'use strict'; 17884 17885 /** 17886 * Copyright (c) 2013-present, Facebook, Inc. 17887 * All rights reserved. 17888 * 17889 * This source code is licensed under the BSD-style license found in the 17890 * LICENSE file in the root directory of this source tree. An additional grant 17891 * of patent rights can be found in the PATENTS file in the same directory. 17892 * 17893 * @typechecks 17894 */ 17895 17896 /** 17897 * @param {*} object The object to check. 17898 * @return {boolean} Whether or not the object is a DOM node. 17899 */ 17900 function isNode(object) { 17901 return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')); 17902 } 17903 17904 module.exports = isNode; 17905 },{}],152:[function(_dereq_,module,exports){ 17906 'use strict'; 17907 17908 /** 17909 * Copyright (c) 2013-present, Facebook, Inc. 17910 * All rights reserved. 17911 * 17912 * This source code is licensed under the BSD-style license found in the 17913 * LICENSE file in the root directory of this source tree. An additional grant 17914 * of patent rights can be found in the PATENTS file in the same directory. 17915 * 17916 * @typechecks 17917 */ 17918 17919 var isNode = _dereq_(151); 17920 17921 /** 17922 * @param {*} object The object to check. 17923 * @return {boolean} Whether or not the object is a DOM text node. 17924 */ 17925 function isTextNode(object) { 17926 return isNode(object) && object.nodeType == 3; 17927 } 17928 17929 module.exports = isTextNode; 17930 },{"151":151}],153:[function(_dereq_,module,exports){ 17931 /** 17932 * Copyright (c) 2013-present, Facebook, Inc. 17933 * All rights reserved. 17934 * 17935 * This source code is licensed under the BSD-style license found in the 17936 * LICENSE file in the root directory of this source tree. An additional grant 17937 * of patent rights can be found in the PATENTS file in the same directory. 17938 * 17939 * 17940 * @typechecks static-only 17941 */ 17942 17943 'use strict'; 17944 17945 /** 17946 * Memoizes the return value of a function that accepts one string argument. 17947 */ 17948 17949 function memoizeStringOnly(callback) { 17950 var cache = {}; 17951 return function (string) { 17952 if (!cache.hasOwnProperty(string)) { 17953 cache[string] = callback.call(this, string); 17954 } 17955 return cache[string]; 17956 }; 17957 } 17958 17959 module.exports = memoizeStringOnly; 17960 },{}],154:[function(_dereq_,module,exports){ 17961 /** 17962 * Copyright (c) 2013-present, Facebook, Inc. 17963 * All rights reserved. 17964 * 17965 * This source code is licensed under the BSD-style license found in the 17966 * LICENSE file in the root directory of this source tree. An additional grant 17967 * of patent rights can be found in the PATENTS file in the same directory. 17968 * 17969 * @typechecks 17970 */ 17971 17972 'use strict'; 17973 17974 var ExecutionEnvironment = _dereq_(136); 17975 17976 var performance; 17977 17978 if (ExecutionEnvironment.canUseDOM) { 17979 performance = window.performance || window.msPerformance || window.webkitPerformance; 17980 } 17981 17982 module.exports = performance || {}; 17983 },{"136":136}],155:[function(_dereq_,module,exports){ 17984 'use strict'; 17985 17986 /** 17987 * Copyright (c) 2013-present, Facebook, Inc. 17988 * All rights reserved. 17989 * 17990 * This source code is licensed under the BSD-style license found in the 17991 * LICENSE file in the root directory of this source tree. An additional grant 17992 * of patent rights can be found in the PATENTS file in the same directory. 17993 * 17994 * @typechecks 17995 */ 17996 17997 var performance = _dereq_(154); 17998 17999 var performanceNow; 18000 18001 /** 18002 * Detect if we can use `window.performance.now()` and gracefully fallback to 18003 * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now 18004 * because of Facebook's testing infrastructure. 18005 */ 18006 if (performance.now) { 18007 performanceNow = function performanceNow() { 18008 return performance.now(); 18009 }; 18010 } else { 18011 performanceNow = function performanceNow() { 18012 return Date.now(); 18013 }; 18014 } 18015 18016 module.exports = performanceNow; 18017 },{"154":154}],156:[function(_dereq_,module,exports){ 18018 /** 18019 * Copyright (c) 2013-present, Facebook, Inc. 18020 * All rights reserved. 18021 * 18022 * This source code is licensed under the BSD-style license found in the 18023 * LICENSE file in the root directory of this source tree. An additional grant 18024 * of patent rights can be found in the PATENTS file in the same directory. 18025 * 18026 * @typechecks 18027 * 18028 */ 18029 18030 /*eslint-disable no-self-compare */ 18031 18032 'use strict'; 18033 18034 var hasOwnProperty = Object.prototype.hasOwnProperty; 18035 18036 /** 18037 * inlined Object.is polyfill to avoid requiring consumers ship their own 18038 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is 18039 */ 18040 function is(x, y) { 18041 // SameValue algorithm 18042 if (x === y) { 18043 // Steps 1-5, 7-10 18044 // Steps 6.b-6.e: +0 != -0 18045 // Added the nonzero y check to make Flow happy, but it is redundant 18046 return x !== 0 || y !== 0 || 1 / x === 1 / y; 18047 } else { 18048 // Step 6.a: NaN == NaN 18049 return x !== x && y !== y; 18050 } 18051 } 18052 18053 /** 18054 * Performs equality by iterating through keys on an object and returning false 18055 * when any key has values which are not strictly equal between the arguments. 18056 * Returns true when the values of all keys are strictly equal. 18057 */ 18058 function shallowEqual(objA, objB) { 18059 if (is(objA, objB)) { 18060 return true; 18061 } 18062 18063 if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { 18064 return false; 18065 } 18066 18067 var keysA = Object.keys(objA); 18068 var keysB = Object.keys(objB); 18069 18070 if (keysA.length !== keysB.length) { 18071 return false; 18072 } 18073 18074 // Test for A's keys different from B. 18075 for (var i = 0; i < keysA.length; i++) { 18076 if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { 18077 return false; 18078 } 18079 } 18080 18081 return true; 18082 } 18083 18084 module.exports = shallowEqual; 18085 },{}],157:[function(_dereq_,module,exports){ 18086 /** 18087 * Copyright 2014-2015, Facebook, Inc. 18088 * All rights reserved. 18089 * 18090 * This source code is licensed under the BSD-style license found in the 18091 * LICENSE file in the root directory of this source tree. An additional grant 18092 * of patent rights can be found in the PATENTS file in the same directory. 18093 * 18094 */ 18095 18096 'use strict'; 18097 18098 var emptyFunction = _dereq_(142); 18099 18100 /** 18101 * Similar to invariant but only logs a warning if the condition is not met. 18102 * This can be used to log issues in development environments in critical 18103 * paths. Removing the logging code for production environments will keep the 18104 * same logic and follow the same code paths. 18105 */ 18106 18107 var warning = emptyFunction; 18108 18109 if ("development" !== 'production') { 18110 (function () { 18111 var printWarning = function printWarning(format) { 18112 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 18113 args[_key - 1] = arguments[_key]; 18114 } 18115 18116 var argIndex = 0; 18117 var message = 'Warning: ' + format.replace(/%s/g, function () { 18118 return args[argIndex++]; 18119 }); 18120 if (typeof console !== 'undefined') { 18121 console.error(message); 18122 } 18123 try { 18124 // --- Welcome to debugging React --- 18125 // This error was thrown as a convenience so that you can use this stack 18126 // to find the callsite that caused this warning to fire. 18127 throw new Error(message); 18128 } catch (x) {} 18129 }; 18130 18131 warning = function warning(condition, format) { 18132 if (format === undefined) { 18133 throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); 18134 } 18135 18136 if (format.indexOf('Failed Composite propType: ') === 0) { 18137 return; // Ignore CompositeComponent proptype check. 18138 } 18139 18140 if (!condition) { 18141 for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { 18142 args[_key2 - 2] = arguments[_key2]; 18143 } 18144 18145 printWarning.apply(undefined, [format].concat(args)); 18146 } 18147 }; 18148 })(); 18149 } 18150 18151 module.exports = warning; 18152 },{"142":142}],158:[function(_dereq_,module,exports){ 18153 'use strict'; 18154 /* eslint-disable no-unused-vars */ 18155 var hasOwnProperty = Object.prototype.hasOwnProperty; 18156 var propIsEnumerable = Object.prototype.propertyIsEnumerable; 18157 18158 function toObject(val) { 18159 if (val === null || val === undefined) { 18160 throw new TypeError('Object.assign cannot be called with null or undefined'); 18161 } 18162 18163 return Object(val); 18164 } 18165 18166 function shouldUseNative() { 18167 try { 18168 if (!Object.assign) { 18169 return false; 18170 } 18171 18172 // Detect buggy property enumeration order in older V8 versions. 18173 18174 // https://bugs.chromium.org/p/v8/issues/detail?id=4118 18175 var test1 = new String('abc'); // eslint-disable-line 18176 test1[5] = 'de'; 18177 if (Object.getOwnPropertyNames(test1)[0] === '5') { 18178 return false; 18179 } 18180 18181 // https://bugs.chromium.org/p/v8/issues/detail?id=3056 18182 var test2 = {}; 18183 for (var i = 0; i < 10; i++) { 18184 test2['_' + String.fromCharCode(i)] = i; 18185 } 18186 var order2 = Object.getOwnPropertyNames(test2).map(function (n) { 18187 return test2[n]; 18188 }); 18189 if (order2.join('') !== '0123456789') { 18190 return false; 18191 } 18192 18193 // https://bugs.chromium.org/p/v8/issues/detail?id=3056 18194 var test3 = {}; 18195 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { 18196 test3[letter] = letter; 18197 }); 18198 if (Object.keys(Object.assign({}, test3)).join('') !== 18199 'abcdefghijklmnopqrst') { 18200 return false; 18201 } 18202 18203 return true; 18204 } catch (e) { 18205 // We don't expect any of the above to throw, but better to be safe. 18206 return false; 18207 } 18208 } 18209 18210 module.exports = shouldUseNative() ? Object.assign : function (target, source) { 18211 var from; 18212 var to = toObject(target); 18213 var symbols; 18214 18215 for (var s = 1; s < arguments.length; s++) { 18216 from = Object(arguments[s]); 18217 18218 for (var key in from) { 18219 if (hasOwnProperty.call(from, key)) { 18220 to[key] = from[key]; 18221 } 18222 } 18223 18224 if (Object.getOwnPropertySymbols) { 18225 symbols = Object.getOwnPropertySymbols(from); 18226 for (var i = 0; i < symbols.length; i++) { 18227 if (propIsEnumerable.call(from, symbols[i])) { 18228 to[symbols[i]] = from[symbols[i]]; 18229 } 18230 } 18231 } 18232 } 18233 18234 return to; 18235 }; 18236 18237 },{}]},{},[48])(48); 18238 }); 18239 });