diff --git a/static/highlight.js b/static/highlight.js new file mode 100644 index 0000000..c53ebfc --- /dev/null +++ b/static/highlight.js @@ -0,0 +1,83 @@ +// Copyright 2018 The Rustw Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +import React from 'react'; + +export const Highlight = (props) => { + const src_line_prefix = 'src_line_'; + const highlight = props.highlight; + const is_valid_highlight = validate_highlight(highlight); + + if (!is_valid_highlight) { + return null; + } + + const lhs = (highlight.column_start - 1); + const rhs = (highlight.column_end - 1); + const highlight_specs = make_highlight(src_line_prefix, highlight.line_start, lhs, rhs); + if (highlight_specs) { + const { top, left, width } = highlight_specs; + const style = { + top: top, + left: left, + width: width, + } + return
 
; + } + + return null; +} + +function make_highlight(src_line_prefix, line_number, left, right) { + const line_div = $("#" + src_line_prefix + line_number); + + // TODO: get adjust variable as prop through diffIndent in FileResult + // if Highlight component is to be used in the SearchResults component + // const adjust = line_div.data('adjust'); + // if (adjust) { + // left -= adjust; + // right -= adjust; + // } + + left *= CHAR_WIDTH; + right *= CHAR_WIDTH; + if (right === 0) { + right = line_div.width(); + } + + let width = right - left; + const paddingLeft = parseInt(line_div.css("padding-left")); + const paddingTop = parseInt(line_div.css("padding-top")); + if (left >= 0) { + left -= paddingLeft; + } else { + width += paddingLeft; + } + + const position = line_div.position(); + if (position) { + position.left += left; + position.top += paddingTop; + return { top: position.top, left: position.left, width }; + } + // If no position, don't render the highlight + return null; +} + +// TODO: this could maybe be validated in app.js, at srcHighlight declaration +function validate_highlight(highlight) { + const required_keys = ['line_start', 'line_end', 'column_start', 'column_end']; + const has_keys = required_keys.reduce((acc, k) => { + return acc && highlight[k] !== undefined; + }, true); + + if (!has_keys || highlight.column_start <= 0) { + return false; + } + return true; +} diff --git a/static/rustw.out.js b/static/rustw.out.js index c99a6f7..5510e5b 100644 --- a/static/rustw.out.js +++ b/static/rustw.out.js @@ -64,7 +64,7 @@ var Rustw = /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 303); +/******/ return __webpack_require__(__webpack_require__.s = 456); /******/ }) /************************************************************************/ /******/ ([ @@ -75,9 +75,9 @@ var Rustw = /* WEBPACK VAR INJECTION */(function(process) { if (process.env.NODE_ENV === 'production') { - module.exports = __webpack_require__(300); + module.exports = __webpack_require__(453); } else { - module.exports = __webpack_require__(299); + module.exports = __webpack_require__(452); } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) @@ -108,11 +108,11 @@ if (process.env.NODE_ENV !== 'production') { // By explicitly using `prop-types` you are opting into new development behavior. // http://fb.me/prop-types-in-prod var throwOnDirectAccess = true; - module.exports = __webpack_require__(250)(isValidElement, throwOnDirectAccess); + module.exports = __webpack_require__(401)(isValidElement, throwOnDirectAccess); } else { // By explicitly using `prop-types` you are opting into new production behavior. // http://fb.me/prop-types-in-prod - module.exports = __webpack_require__(249)(); + module.exports = __webpack_require__(400)(); } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) @@ -377,16 +377,54 @@ module.exports = warning; /***/ }), /* 4 */ +/***/ (function(module, exports) { + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +module.exports = isArray; + + +/***/ }), +/* 5 */ +/***/ (function(module, exports) { + +var core = module.exports = { version: '2.5.6' }; +if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef + + +/***/ }), +/* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. + * Copyright (c) 2013-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ @@ -435,49 +473,22 @@ module.exports = invariant; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }), -/* 5 */ -/***/ (function(module, exports) { +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { -var core = module.exports = { version: '2.5.1' }; -if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef +var freeGlobal = __webpack_require__(143); +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; -/***/ }), -/* 6 */ -/***/ (function(module, exports) { +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -module.exports = isObject; +module.exports = root; /***/ }), -/* 7 */ +/* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -494,101 +505,108 @@ exports.default = function (prefixedValue, value, keepUnprefixed) { module.exports = exports["default"]; /***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { +/* 9 */ +/***/ (function(module, exports) { + +// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 +var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self + // eslint-disable-next-line no-new-func + : Function('return this')(); +if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef -var isObject = __webpack_require__(6); + +/***/ }), +/* 10 */ +/***/ (function(module, exports) { /** - * Converts `value` to an object if it's not one. + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * - * @private - * @param {*} value The value to process. - * @returns {Object} Returns the object. + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false */ -function toObject(value) { - return isObject(value) ? value : Object(value); +function isObject(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); } -module.exports = toObject; +module.exports = isObject; /***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { - -var getNative = __webpack_require__(48), - isLength = __webpack_require__(21), - isObjectLike = __webpack_require__(22); - -/** `Object#toString` result references. */ -var arrayTag = '[object Array]'; - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeIsArray = getNative(Array, 'isArray'); +/* 11 */ +/***/ (function(module, exports) { /** - * Checks if `value` is classified as an `Array` object. + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * - * _.isArray([1, 2, 3]); + * _.isObjectLike({}); * // => true * - * _.isArray(function() { return arguments; }()); + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); * // => false */ -var isArray = nativeIsArray || function(value) { - return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; -}; - -module.exports = isArray; - - -/***/ }), -/* 10 */ -/***/ (function(module, exports) { +function isObjectLike(value) { + return value != null && typeof value == 'object'; +} -// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 -var global = module.exports = typeof window != 'undefined' && window.Math == Math - ? window : typeof self != 'undefined' && self.Math == Math ? self - // eslint-disable-next-line no-new-func - : Function('return this')(); -if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef +module.exports = isObjectLike; /***/ }), -/* 11 */ +/* 12 */ /***/ (function(module, exports, __webpack_require__) { // Thank's IE8 for his funny defineProperty -module.exports = !__webpack_require__(17)(function () { +module.exports = !__webpack_require__(20)(function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; }); /***/ }), -/* 12 */ +/* 13 */ /***/ (function(module, exports, __webpack_require__) { -var global = __webpack_require__(10); +var global = __webpack_require__(9); var core = __webpack_require__(5); -var ctx = __webpack_require__(88); -var hide = __webpack_require__(18); +var ctx = __webpack_require__(114); +var hide = __webpack_require__(21); +var has = __webpack_require__(14); var PROTOTYPE = 'prototype'; var $export = function (type, name, source) { @@ -606,7 +624,7 @@ var $export = function (type, name, source) { for (key in source) { // contains in native own = !IS_FORCED && target && target[key] !== undefined; - if (own && key in exports) continue; + if (own && has(exports, key)) continue; // export native or passed out = own ? target[key] : source[key]; // prevent global pollution for namespaces @@ -649,7 +667,7 @@ module.exports = $export; /***/ }), -/* 13 */ +/* 14 */ /***/ (function(module, exports) { var hasOwnProperty = {}.hasOwnProperty; @@ -659,15 +677,15 @@ module.exports = function (it, key) { /***/ }), -/* 14 */ +/* 15 */ /***/ (function(module, exports, __webpack_require__) { -var anObject = __webpack_require__(24); -var IE8_DOM_DEFINE = __webpack_require__(90); -var toPrimitive = __webpack_require__(60); +var anObject = __webpack_require__(29); +var IE8_DOM_DEFINE = __webpack_require__(116); +var toPrimitive = __webpack_require__(71); var dP = Object.defineProperty; -exports.f = __webpack_require__(11) ? Object.defineProperty : function defineProperty(O, P, Attributes) { +exports.f = __webpack_require__(12) ? Object.defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); @@ -681,7 +699,7 @@ exports.f = __webpack_require__(11) ? Object.defineProperty : function definePro /***/ }), -/* 15 */ +/* 16 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -723,25 +741,105 @@ emptyFunction.thatReturnsArgument = function (arg) { module.exports = emptyFunction; /***/ }), -/* 16 */ +/* 17 */ /***/ (function(module, exports, __webpack_require__) { -var getNative = __webpack_require__(48), - isArrayLike = __webpack_require__(32), - isObject = __webpack_require__(6), - shimKeys = __webpack_require__(345); +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeKeys = getNative(Object, 'keys'); + +/** + * Use invariant() to assert state which your program assumes to be true. + * + * Provide sprintf-style format (only %s is supported) and arguments + * to provide information about what broke and what you were + * expecting. + * + * The invariant message will be stripped in production, but the invariant + * will remain to ensure logic does not differ in production. + */ + +var validateFormat = function validateFormat(format) {}; + +if (process.env.NODE_ENV !== 'production') { + validateFormat = function validateFormat(format) { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + }; +} + +function invariant(condition, format, a, b, c, d, e, f) { + validateFormat(format); + + if (!condition) { + var error; + if (format === undefined) { + error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + error = new Error(format.replace(/%s/g, function () { + return args[argIndex++]; + })); + error.name = 'Invariant Violation'; + } + + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; + } +} + +module.exports = invariant; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseIsNative = __webpack_require__(306), + getValue = __webpack_require__(343); + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +module.exports = getNative; + + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + +var arrayLikeKeys = __webpack_require__(136), + baseKeys = __webpack_require__(310), + isArrayLike = __webpack_require__(34); /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. @@ -761,20 +859,15 @@ var nativeKeys = getNative(Object, 'keys'); * _.keys('hi'); * // => ['0', '1'] */ -var keys = !nativeKeys ? shimKeys : function(object) { - var Ctor = object == null ? undefined : object.constructor; - if ((typeof Ctor == 'function' && Ctor.prototype === object) || - (typeof object != 'function' && isArrayLike(object))) { - return shimKeys(object); - } - return isObject(object) ? nativeKeys(object) : []; -}; +function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); +} module.exports = keys; /***/ }), -/* 17 */ +/* 20 */ /***/ (function(module, exports) { module.exports = function (exec) { @@ -787,12 +880,12 @@ module.exports = function (exec) { /***/ }), -/* 18 */ +/* 21 */ /***/ (function(module, exports, __webpack_require__) { -var dP = __webpack_require__(14); -var createDesc = __webpack_require__(39); -module.exports = __webpack_require__(11) ? function (object, key, value) { +var dP = __webpack_require__(15); +var createDesc = __webpack_require__(43); +module.exports = __webpack_require__(12) ? function (object, key, value) { return dP.f(object, key, createDesc(1, value)); } : function (object, key, value) { object[key] = value; @@ -801,24 +894,33 @@ module.exports = __webpack_require__(11) ? function (object, key, value) { /***/ }), -/* 19 */ +/* 22 */ +/***/ (function(module, exports) { + +module.exports = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; +}; + + +/***/ }), +/* 23 */ /***/ (function(module, exports, __webpack_require__) { // to indexed object, toObject with fallback for non-array-like ES3 strings -var IObject = __webpack_require__(91); -var defined = __webpack_require__(50); +var IObject = __webpack_require__(117); +var defined = __webpack_require__(62); module.exports = function (it) { return IObject(defined(it)); }; /***/ }), -/* 20 */ +/* 24 */ /***/ (function(module, exports, __webpack_require__) { -var store = __webpack_require__(58)('wks'); -var uid = __webpack_require__(41); -var Symbol = __webpack_require__(10).Symbol; +var store = __webpack_require__(69)('wks'); +var uid = __webpack_require__(45); +var Symbol = __webpack_require__(9).Symbol; var USE_SYMBOL = typeof Symbol == 'function'; var $exports = module.exports = function (name) { @@ -830,51 +932,99 @@ $exports.store = store; /***/ }), -/* 21 */ -/***/ (function(module, exports) { +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) - * of an array-like value. - */ -var MAX_SAFE_INTEGER = 9007199254740991; +var root = __webpack_require__(7); + +/** Built-in value references. */ +var Symbol = root.Symbol; + +module.exports = Symbol; + + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { + +var Symbol = __webpack_require__(25), + getRawTag = __webpack_require__(342), + objectToString = __webpack_require__(371); + +/** `Object#toString` result references. */ +var nullTag = '[object Null]', + undefinedTag = '[object Undefined]'; + +/** Built-in value references. */ +var symToStringTag = Symbol ? Symbol.toStringTag : undefined; /** - * Checks if `value` is a valid array-like length. - * - * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * The base implementation of `getTag` without fallbacks for buggy environments. * * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. */ -function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); } -module.exports = isLength; +module.exports = baseGetTag; /***/ }), -/* 22 */ -/***/ (function(module, exports) { +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { + +var assignValue = __webpack_require__(137), + baseAssignValue = __webpack_require__(138); /** - * Checks if `value` is object-like. + * Copies properties of `source` to `object`. * * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @param {Object} source The object to copy properties from. + * @param {Array} props The property identifiers to copy. + * @param {Object} [object={}] The object to copy properties to. + * @param {Function} [customizer] The function to customize copied values. + * @returns {Object} Returns `object`. */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; +function copyObject(source, props, object, customizer) { + var isNew = !object; + object || (object = {}); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : undefined; + + if (newValue === undefined) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue(object, key, newValue); + } else { + assignValue(object, key, newValue); + } + } + return object; } -module.exports = isObjectLike; +module.exports = copyObject; /***/ }), -/* 23 */ +/* 28 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1061,10 +1211,10 @@ function make_highlight(src_line_prefix, line_number, left, right, css_class) { } /***/ }), -/* 24 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { -var isObject = __webpack_require__(25); +var isObject = __webpack_require__(22); module.exports = function (it) { if (!isObject(it)) throw TypeError(it + ' is not an object!'); return it; @@ -1072,21 +1222,12 @@ module.exports = function (it) { /***/ }), -/* 25 */ -/***/ (function(module, exports) { - -module.exports = function (it) { - return typeof it === 'object' ? it !== null : typeof it === 'function'; -}; - - -/***/ }), -/* 26 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.14 / 15.2.3.14 Object.keys(O) -var $keys = __webpack_require__(96); -var enumBugKeys = __webpack_require__(51); +var $keys = __webpack_require__(122); +var enumBugKeys = __webpack_require__(63); module.exports = Object.keys || function keys(O) { return $keys(O, enumBugKeys); @@ -1094,67 +1235,7 @@ module.exports = Object.keys || function keys(O) { /***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - - - -/** - * Use invariant() to assert state which your program assumes to be true. - * - * Provide sprintf-style format (only %s is supported) and arguments - * to provide information about what broke and what you were - * expecting. - * - * The invariant message will be stripped in production, but the invariant - * will remain to ensure logic does not differ in production. - */ - -var validateFormat = function validateFormat(format) {}; - -if (process.env.NODE_ENV !== 'production') { - validateFormat = function validateFormat(format) { - if (format === undefined) { - throw new Error('invariant requires an error message argument'); - } - }; -} - -function invariant(condition, format, a, b, c, d, e, f) { - validateFormat(format); - - if (!condition) { - var error; - if (format === undefined) { - error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); - } else { - var args = [a, b, c, d, e, f]; - var argIndex = 0; - error = new Error(format.replace(/%s/g, function () { - return args[argIndex++]; - })); - error.name = 'Invariant Violation'; - } - - error.framesToPop = 1; // we don't care about invariant's own frame - throw error; - } -} - -module.exports = invariant; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) - -/***/ }), -/* 28 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1221,7 +1302,7 @@ var createPath = exports.createPath = function createPath(location) { }; /***/ }), -/* 29 */ +/* 32 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -1292,7 +1373,73 @@ var createPath = function createPath(location) { }; /***/ }), -/* 30 */ +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { + +var isSymbol = __webpack_require__(98); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ +function toKey(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + +module.exports = toKey; + + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { + +var isFunction = __webpack_require__(154), + isLength = __webpack_require__(97); + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); +} + +module.exports = isArrayLike; + + +/***/ }), +/* 35 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1389,79 +1536,13 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { /***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { - -var identity = __webpack_require__(142); - -/** - * A specialized version of `baseCallback` which only supports `this` binding - * and specifying the number of arguments to provide to `func`. - * - * @private - * @param {Function} func The function to bind. - * @param {*} thisArg The `this` binding of `func`. - * @param {number} [argCount] The number of arguments to provide to `func`. - * @returns {Function} Returns the callback. - */ -function bindCallback(func, thisArg, argCount) { - if (typeof func != 'function') { - return identity; - } - if (thisArg === undefined) { - return func; - } - switch (argCount) { - case 1: return function(value) { - return func.call(thisArg, value); - }; - case 3: return function(value, index, collection) { - return func.call(thisArg, value, index, collection); - }; - case 4: return function(accumulator, value, index, collection) { - return func.call(thisArg, accumulator, value, index, collection); - }; - case 5: return function(value, other, key, object, source) { - return func.call(thisArg, value, other, key, object, source); - }; - } - return function() { - return func.apply(thisArg, arguments); - }; -} - -module.exports = bindCallback; - - -/***/ }), -/* 32 */ -/***/ (function(module, exports, __webpack_require__) { - -var getLength = __webpack_require__(136), - isLength = __webpack_require__(21); - -/** - * Checks if `value` is array-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - */ -function isArrayLike(value) { - return value != null && isLength(getLength(value)); -} - -module.exports = isArrayLike; - - -/***/ }), -/* 33 */ +/* 36 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(163), __esModule: true }; +module.exports = { "default": __webpack_require__(201), __esModule: true }; /***/ }), -/* 34 */ +/* 37 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1476,7 +1557,7 @@ exports.default = function (instance, Constructor) { }; /***/ }), -/* 35 */ +/* 38 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1484,7 +1565,7 @@ exports.default = function (instance, Constructor) { exports.__esModule = true; -var _defineProperty = __webpack_require__(153); +var _defineProperty = __webpack_require__(191); var _defineProperty2 = _interopRequireDefault(_defineProperty); @@ -1509,7 +1590,7 @@ exports.default = function () { }(); /***/ }), -/* 36 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1517,15 +1598,15 @@ exports.default = function () { exports.__esModule = true; -var _setPrototypeOf = __webpack_require__(155); +var _setPrototypeOf = __webpack_require__(193); var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf); -var _create = __webpack_require__(152); +var _create = __webpack_require__(190); var _create2 = _interopRequireDefault(_create); -var _typeof2 = __webpack_require__(86); +var _typeof2 = __webpack_require__(112); var _typeof3 = _interopRequireDefault(_typeof2); @@ -1548,7 +1629,7 @@ exports.default = function (subClass, superClass) { }; /***/ }), -/* 37 */ +/* 40 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1556,7 +1637,7 @@ exports.default = function (subClass, superClass) { exports.__esModule = true; -var _typeof2 = __webpack_require__(86); +var _typeof2 = __webpack_require__(112); var _typeof3 = _interopRequireDefault(_typeof2); @@ -1571,14 +1652,21 @@ exports.default = function (self, call) { }; /***/ }), -/* 38 */ +/* 41 */ +/***/ (function(module, exports) { + +module.exports = true; + + +/***/ }), +/* 42 */ /***/ (function(module, exports) { exports.f = {}.propertyIsEnumerable; /***/ }), -/* 39 */ +/* 43 */ /***/ (function(module, exports) { module.exports = function (bitmap, value) { @@ -1592,18 +1680,18 @@ module.exports = function (bitmap, value) { /***/ }), -/* 40 */ +/* 44 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.13 ToObject(argument) -var defined = __webpack_require__(50); +var defined = __webpack_require__(62); module.exports = function (it) { return Object(defined(it)); }; /***/ }), -/* 41 */ +/* 45 */ /***/ (function(module, exports) { var id = 0; @@ -1614,7 +1702,7 @@ module.exports = function (key) { /***/ }), -/* 42 */ +/* 46 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! @@ -1669,7 +1757,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! /***/ }), -/* 43 */ +/* 47 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1693,7 +1781,7 @@ module.exports = emptyObject; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }), -/* 44 */ +/* 48 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1707,7 +1795,7 @@ module.exports = emptyObject; -var emptyFunction = __webpack_require__(15); +var emptyFunction = __webpack_require__(16); /** * Similar to invariant but only logs a warning if the condition is not met. @@ -1762,15 +1850,15 @@ module.exports = warning; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }), -/* 45 */ +/* 49 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createLocation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return locationsAreEqual; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_resolve_pathname__ = __webpack_require__(126); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_value_equal__ = __webpack_require__(128); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__PathUtils__ = __webpack_require__(29); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_resolve_pathname__ = __webpack_require__(176); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_value_equal__ = __webpack_require__(178); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__PathUtils__ = __webpack_require__(32); var _extends = Object.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; }; @@ -1838,7 +1926,7 @@ var locationsAreEqual = function locationsAreEqual(a, b) { }; /***/ }), -/* 46 */ +/* 50 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1864,53 +1952,339 @@ exports.default = function (property, value) { module.exports = exports['default']; /***/ }), -/* 47 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/* 51 */ +/***/ (function(module, exports, __webpack_require__) { -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["b"] = isTab; -/* harmony export (immutable) */ __webpack_exports__["c"] = isTabPanel; -/* harmony export (immutable) */ __webpack_exports__["a"] = isTabList; -function isTab(el) { - return el.type && el.type.tabsRole === 'Tab'; +var listCacheClear = __webpack_require__(357), + listCacheDelete = __webpack_require__(358), + listCacheGet = __webpack_require__(359), + listCacheHas = __webpack_require__(360), + listCacheSet = __webpack_require__(361); + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } } -function isTabPanel(el) { - return el.type && el.type.tabsRole === 'TabPanel'; + +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + +module.exports = ListCache; + + +/***/ }), +/* 52 */ +/***/ (function(module, exports, __webpack_require__) { + +var eq = __webpack_require__(57); + +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; } -function isTabList(el) { - return el.type && el.type.tabsRole === 'TabList'; + +module.exports = assocIndexOf; + + +/***/ }), +/* 53 */ +/***/ (function(module, exports, __webpack_require__) { + +var isArray = __webpack_require__(4), + isKey = __webpack_require__(91), + stringToPath = __webpack_require__(382), + toString = __webpack_require__(398); + +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @param {Object} [object] The object to query keys on. + * @returns {Array} Returns the cast property path array. + */ +function castPath(value, object) { + if (isArray(value)) { + return value; + } + return isKey(value, object) ? [value] : stringToPath(toString(value)); } +module.exports = castPath; + + /***/ }), -/* 48 */ +/* 54 */ /***/ (function(module, exports, __webpack_require__) { -var isNative = __webpack_require__(347); +var isKeyable = __webpack_require__(355); /** - * Gets the native function at `key` of `object`. + * Gets the data for `map`. * * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. */ -function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; } -module.exports = getNative; +module.exports = getMapData; /***/ }), -/* 49 */ +/* 55 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(160), __esModule: true }; +var DataView = __webpack_require__(285), + Map = __webpack_require__(79), + Promise = __webpack_require__(287), + Set = __webpack_require__(288), + WeakMap = __webpack_require__(290), + baseGetTag = __webpack_require__(26), + toSource = __webpack_require__(152); + +/** `Object#toString` result references. */ +var mapTag = '[object Map]', + objectTag = '[object Object]', + promiseTag = '[object Promise]', + setTag = '[object Set]', + weakMapTag = '[object WeakMap]'; + +var dataViewTag = '[object DataView]'; + +/** Used to detect maps, sets, and weakmaps. */ +var dataViewCtorString = toSource(DataView), + mapCtorString = toSource(Map), + promiseCtorString = toSource(Promise), + setCtorString = toSource(Set), + weakMapCtorString = toSource(WeakMap); + +/** + * Gets the `toStringTag` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +var getTag = baseGetTag; + +// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. +if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || + (Map && getTag(new Map) != mapTag) || + (Promise && getTag(Promise.resolve()) != promiseTag) || + (Set && getTag(new Set) != setTag) || + (WeakMap && getTag(new WeakMap) != weakMapTag)) { + getTag = function(value) { + var result = baseGetTag(value), + Ctor = result == objectTag ? value.constructor : undefined, + ctorString = Ctor ? toSource(Ctor) : ''; + + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: return dataViewTag; + case mapCtorString: return mapTag; + case promiseCtorString: return promiseTag; + case setCtorString: return setTag; + case weakMapCtorString: return weakMapTag; + } + } + return result; + }; +} + +module.exports = getTag; + /***/ }), -/* 50 */ +/* 56 */ +/***/ (function(module, exports, __webpack_require__) { + +var getNative = __webpack_require__(18); + +/* Built-in method references that are verified to be native. */ +var nativeCreate = getNative(Object, 'create'); + +module.exports = nativeCreate; + + +/***/ }), +/* 57 */ +/***/ (function(module, exports) { + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + +module.exports = eq; + + +/***/ }), +/* 58 */ +/***/ (function(module, exports) { + +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ +function identity(value) { + return value; +} + +module.exports = identity; + + +/***/ }), +/* 59 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) { + +function checkDCE() { + /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ + if ( + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' || + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function' + ) { + return; + } + if (process.env.NODE_ENV !== 'production') { + // This branch is unreachable because this function is only called + // in production, but the condition is true only in development. + // Therefore if the branch is still here, dead code elimination wasn't + // properly applied. + // Don't change the message. React DevTools relies on it. Also make sure + // this message doesn't occur elsewhere in this function, or it will cause + // a false positive. + throw new Error('^_^'); + } + try { + // Verify that the code above has been dead code eliminated (DCE'd). + __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE); + } catch (err) { + // DevTools shouldn't crash React, no matter what. + // We should still report in case we break this code. + console.error(err); + } +} + +if (process.env.NODE_ENV === 'production') { + // DCE check should happen before ReactDOM bundle executes so that + // DevTools can report bad minification during injection. + checkDCE(); + module.exports = __webpack_require__(420); +} else { + module.exports = __webpack_require__(419); +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) + +/***/ }), +/* 60 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["b"] = isTab; +/* harmony export (immutable) */ __webpack_exports__["c"] = isTabPanel; +/* harmony export (immutable) */ __webpack_exports__["a"] = isTabList; +function isTab(el) { + return el.type && el.type.tabsRole === 'Tab'; +} +function isTabPanel(el) { + return el.type && el.type.tabsRole === 'TabPanel'; +} +function isTabList(el) { + return el.type && el.type.tabsRole === 'TabList'; +} + +/***/ }), +/* 61 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = { "default": __webpack_require__(198), __esModule: true }; + +/***/ }), +/* 62 */ /***/ (function(module, exports) { // 7.2.1 RequireObjectCoercible(argument) @@ -1921,7 +2295,7 @@ module.exports = function (it) { /***/ }), -/* 51 */ +/* 63 */ /***/ (function(module, exports) { // IE 8- don't enum bug keys @@ -1931,41 +2305,34 @@ module.exports = ( /***/ }), -/* 52 */ +/* 64 */ /***/ (function(module, exports) { module.exports = {}; /***/ }), -/* 53 */ -/***/ (function(module, exports) { - -module.exports = true; - - -/***/ }), -/* 54 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) -var anObject = __webpack_require__(24); -var dPs = __webpack_require__(178); -var enumBugKeys = __webpack_require__(51); -var IE_PROTO = __webpack_require__(57)('IE_PROTO'); +var anObject = __webpack_require__(29); +var dPs = __webpack_require__(216); +var enumBugKeys = __webpack_require__(63); +var IE_PROTO = __webpack_require__(68)('IE_PROTO'); var Empty = function () { /* empty */ }; var PROTOTYPE = 'prototype'; // Create object with fake `null` prototype: use iframe Object with cleared prototype var createDict = function () { // Thrash, waste and sodomy: IE GC bug - var iframe = __webpack_require__(89)('iframe'); + var iframe = __webpack_require__(115)('iframe'); var i = enumBugKeys.length; var lt = '<'; var gt = '>'; var iframeDocument; iframe.style.display = 'none'; - __webpack_require__(172).appendChild(iframe); + __webpack_require__(210).appendChild(iframe); iframe.src = 'javascript:'; // eslint-disable-line no-script-url // createDict = iframe.contentWindow.Object; // html.removeChild(iframe); @@ -1992,19 +2359,19 @@ module.exports = Object.create || function create(O, Properties) { /***/ }), -/* 55 */ +/* 66 */ /***/ (function(module, exports) { exports.f = Object.getOwnPropertySymbols; /***/ }), -/* 56 */ +/* 67 */ /***/ (function(module, exports, __webpack_require__) { -var def = __webpack_require__(14).f; -var has = __webpack_require__(13); -var TAG = __webpack_require__(20)('toStringTag'); +var def = __webpack_require__(15).f; +var has = __webpack_require__(14); +var TAG = __webpack_require__(24)('toStringTag'); module.exports = function (it, tag, stat) { if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); @@ -2012,30 +2379,36 @@ module.exports = function (it, tag, stat) { /***/ }), -/* 57 */ +/* 68 */ /***/ (function(module, exports, __webpack_require__) { -var shared = __webpack_require__(58)('keys'); -var uid = __webpack_require__(41); +var shared = __webpack_require__(69)('keys'); +var uid = __webpack_require__(45); module.exports = function (key) { return shared[key] || (shared[key] = uid(key)); }; /***/ }), -/* 58 */ +/* 69 */ /***/ (function(module, exports, __webpack_require__) { -var global = __webpack_require__(10); +var core = __webpack_require__(5); +var global = __webpack_require__(9); var SHARED = '__core-js_shared__'; var store = global[SHARED] || (global[SHARED] = {}); -module.exports = function (key) { - return store[key] || (store[key] = {}); -}; + +(module.exports = function (key, value) { + return store[key] || (store[key] = value !== undefined ? value : {}); +})('versions', []).push({ + version: core.version, + mode: __webpack_require__(41) ? 'pure' : 'global', + copyright: '© 2018 Denis Pushkarev (zloirock.ru)' +}); /***/ }), -/* 59 */ +/* 70 */ /***/ (function(module, exports) { // 7.1.4 ToInteger @@ -2047,11 +2420,11 @@ module.exports = function (it) { /***/ }), -/* 60 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.1 ToPrimitive(input [, PreferredType]) -var isObject = __webpack_require__(25); +var isObject = __webpack_require__(22); // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string module.exports = function (it, S) { @@ -2065,14 +2438,14 @@ module.exports = function (it, S) { /***/ }), -/* 61 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { -var global = __webpack_require__(10); +var global = __webpack_require__(9); var core = __webpack_require__(5); -var LIBRARY = __webpack_require__(53); -var wksExt = __webpack_require__(62); -var defineProperty = __webpack_require__(14).f; +var LIBRARY = __webpack_require__(41); +var wksExt = __webpack_require__(73); +var defineProperty = __webpack_require__(15).f; module.exports = function (name) { var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) }); @@ -2080,14 +2453,14 @@ module.exports = function (name) { /***/ }), -/* 62 */ +/* 73 */ /***/ (function(module, exports, __webpack_require__) { -exports.f = __webpack_require__(20); +exports.f = __webpack_require__(24); /***/ }), -/* 63 */ +/* 74 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2098,15 +2471,15 @@ exports.locationsAreEqual = exports.createLocation = undefined; var _extends = Object.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; }; -var _resolvePathname = __webpack_require__(126); +var _resolvePathname = __webpack_require__(176); var _resolvePathname2 = _interopRequireDefault(_resolvePathname); -var _valueEqual = __webpack_require__(128); +var _valueEqual = __webpack_require__(178); var _valueEqual2 = _interopRequireDefault(_valueEqual); -var _PathUtils = __webpack_require__(28); +var _PathUtils = __webpack_require__(31); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -2171,7 +2544,7 @@ var locationsAreEqual = exports.locationsAreEqual = function locationsAreEqual(a }; /***/ }), -/* 64 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2262,7 +2635,7 @@ var createTransitionManager = function createTransitionManager() { exports.default = createTransitionManager; /***/ }), -/* 65 */ +/* 76 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -2347,7 +2720,7 @@ var createTransitionManager = function createTransitionManager() { /* harmony default export */ __webpack_exports__["a"] = (createTransitionManager); /***/ }), -/* 66 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2365,7 +2738,7 @@ exports.default = function (str) { module.exports = exports["default"]; /***/ }), -/* 67 */ +/* 78 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2384,7 +2757,673 @@ exports.default = function (value) { module.exports = exports['default']; /***/ }), -/* 68 */ +/* 79 */ +/***/ (function(module, exports, __webpack_require__) { + +var getNative = __webpack_require__(18), + root = __webpack_require__(7); + +/* Built-in method references that are verified to be native. */ +var Map = getNative(root, 'Map'); + +module.exports = Map; + + +/***/ }), +/* 80 */ +/***/ (function(module, exports, __webpack_require__) { + +var mapCacheClear = __webpack_require__(362), + mapCacheDelete = __webpack_require__(363), + mapCacheGet = __webpack_require__(364), + mapCacheHas = __webpack_require__(365), + mapCacheSet = __webpack_require__(366); + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; + +module.exports = MapCache; + + +/***/ }), +/* 81 */ +/***/ (function(module, exports, __webpack_require__) { + +var ListCache = __webpack_require__(51), + stackClear = __webpack_require__(377), + stackDelete = __webpack_require__(378), + stackGet = __webpack_require__(379), + stackHas = __webpack_require__(380), + stackSet = __webpack_require__(381); + +/** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Stack(entries) { + var data = this.__data__ = new ListCache(entries); + this.size = data.size; +} + +// Add methods to `Stack`. +Stack.prototype.clear = stackClear; +Stack.prototype['delete'] = stackDelete; +Stack.prototype.get = stackGet; +Stack.prototype.has = stackHas; +Stack.prototype.set = stackSet; + +module.exports = Stack; + + +/***/ }), +/* 82 */ +/***/ (function(module, exports) { + +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + +module.exports = arrayMap; + + +/***/ }), +/* 83 */ +/***/ (function(module, exports) { + +/** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ +function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; + + while (++index < length) { + array[offset + index] = values[index]; + } + return array; +} + +module.exports = arrayPush; + + +/***/ }), +/* 84 */ +/***/ (function(module, exports, __webpack_require__) { + +var castPath = __webpack_require__(53), + toKey = __webpack_require__(33); + +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = castPath(path, object); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[toKey(path[index++])]; + } + return (index && index == length) ? object : undefined; +} + +module.exports = baseGet; + + +/***/ }), +/* 85 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseIsEqualDeep = __webpack_require__(303), + isObjectLike = __webpack_require__(11); + +/** + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {boolean} bitmask The bitmask flags. + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Function} [customizer] The function to customize comparisons. + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ +function baseIsEqual(value, other, bitmask, customizer, stack) { + if (value === other) { + return true; + } + if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); +} + +module.exports = baseIsEqual; + + +/***/ }), +/* 86 */ +/***/ (function(module, exports) { + +/** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ +function baseUnary(func) { + return function(value) { + return func(value); + }; +} + +module.exports = baseUnary; + + +/***/ }), +/* 87 */ +/***/ (function(module, exports, __webpack_require__) { + +var Uint8Array = __webpack_require__(134); + +/** + * Creates a clone of `arrayBuffer`. + * + * @private + * @param {ArrayBuffer} arrayBuffer The array buffer to clone. + * @returns {ArrayBuffer} Returns the cloned array buffer. + */ +function cloneArrayBuffer(arrayBuffer) { + var result = new arrayBuffer.constructor(arrayBuffer.byteLength); + new Uint8Array(result).set(new Uint8Array(arrayBuffer)); + return result; +} + +module.exports = cloneArrayBuffer; + + +/***/ }), +/* 88 */ +/***/ (function(module, exports, __webpack_require__) { + +var overArg = __webpack_require__(149); + +/** Built-in value references. */ +var getPrototype = overArg(Object.getPrototypeOf, Object); + +module.exports = getPrototype; + + +/***/ }), +/* 89 */ +/***/ (function(module, exports, __webpack_require__) { + +var arrayFilter = __webpack_require__(292), + stubArray = __webpack_require__(157); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeGetSymbols = Object.getOwnPropertySymbols; + +/** + * Creates an array of the own enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ +var getSymbols = !nativeGetSymbols ? stubArray : function(object) { + if (object == null) { + return []; + } + object = Object(object); + return arrayFilter(nativeGetSymbols(object), function(symbol) { + return propertyIsEnumerable.call(object, symbol); + }); +}; + +module.exports = getSymbols; + + +/***/ }), +/* 90 */ +/***/ (function(module, exports) { + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER : length; + + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); +} + +module.exports = isIndex; + + +/***/ }), +/* 91 */ +/***/ (function(module, exports, __webpack_require__) { + +var isArray = __webpack_require__(4), + isSymbol = __webpack_require__(98); + +/** Used to match property names within property paths. */ +var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/; + +/** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ +function isKey(value, object) { + if (isArray(value)) { + return false; + } + var type = typeof value; + if (type == 'number' || type == 'symbol' || type == 'boolean' || + value == null || isSymbol(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object)); +} + +module.exports = isKey; + + +/***/ }), +/* 92 */ +/***/ (function(module, exports) { + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; +} + +module.exports = isPrototype; + + +/***/ }), +/* 93 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__(143); + +/** Detect free variable `exports`. */ +var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; + +/** Detect free variable `module`. */ +var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; + +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports = freeModule && freeModule.exports === freeExports; + +/** Detect free variable `process` from Node.js. */ +var freeProcess = moduleExports && freeGlobal.process; + +/** Used to access faster Node.js helpers. */ +var nodeUtil = (function() { + try { + // Use `util.types` for Node.js 10+. + var types = freeModule && freeModule.require && freeModule.require('util').types; + + if (types) { + return types; + } + + // Legacy `process.binding('util')` for Node.js < 10. + return freeProcess && freeProcess.binding && freeProcess.binding('util'); + } catch (e) {} +}()); + +module.exports = nodeUtil; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(110)(module))) + +/***/ }), +/* 94 */ +/***/ (function(module, exports, __webpack_require__) { + +var arrayEach = __webpack_require__(135), + baseEach = __webpack_require__(139), + castFunction = __webpack_require__(324), + isArray = __webpack_require__(4); + +/** + * Iterates over elements of `collection` and invokes `iteratee` for each element. + * The iteratee is invoked with three arguments: (value, index|key, collection). + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * **Note:** As with other "Collections" methods, objects with a "length" + * property are iterated like arrays. To avoid this behavior use `_.forIn` + * or `_.forOwn` for object iteration. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @alias each + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + * @see _.forEachRight + * @example + * + * _.forEach([1, 2], function(value) { + * console.log(value); + * }); + * // => Logs `1` then `2`. + * + * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ +function forEach(collection, iteratee) { + var func = isArray(collection) ? arrayEach : baseEach; + return func(collection, castFunction(iteratee)); +} + +module.exports = forEach; + + +/***/ }), +/* 95 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseIsArguments = __webpack_require__(302), + isObjectLike = __webpack_require__(11); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { + return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && + !propertyIsEnumerable.call(value, 'callee'); +}; + +module.exports = isArguments; + + +/***/ }), +/* 96 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(7), + stubFalse = __webpack_require__(397); + +/** Detect free variable `exports`. */ +var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; + +/** Detect free variable `module`. */ +var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; + +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports = freeModule && freeModule.exports === freeExports; + +/** Built-in value references. */ +var Buffer = moduleExports ? root.Buffer : undefined; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; + +/** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ +var isBuffer = nativeIsBuffer || stubFalse; + +module.exports = isBuffer; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(110)(module))) + +/***/ }), +/* 97 */ +/***/ (function(module, exports) { + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +module.exports = isLength; + + +/***/ }), +/* 98 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseGetTag = __webpack_require__(26), + isObjectLike = __webpack_require__(11); + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && baseGetTag(value) == symbolTag); +} + +module.exports = isSymbol; + + +/***/ }), +/* 99 */ +/***/ (function(module, exports, __webpack_require__) { + +var arrayLikeKeys = __webpack_require__(136), + baseKeysIn = __webpack_require__(311), + isArrayLike = __webpack_require__(34); + +/** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ +function keysIn(object) { + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); +} + +module.exports = keysIn; + + +/***/ }), +/* 100 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2398,9 +3437,9 @@ module.exports = exports['default']; if (process.env.NODE_ENV !== 'production') { - var invariant = __webpack_require__(27); - var warning = __webpack_require__(44); - var ReactPropTypesSecret = __webpack_require__(69); + var invariant = __webpack_require__(17); + var warning = __webpack_require__(48); + var ReactPropTypesSecret = __webpack_require__(101); var loggedTypeFailures = {}; } @@ -2451,7 +3490,7 @@ module.exports = checkPropTypes; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }), -/* 69 */ +/* 101 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2470,7 +3509,7 @@ module.exports = ReactPropTypesSecret; /***/ }), -/* 70 */ +/* 102 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2481,19 +3520,19 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = cssRuleSetToString; -var _appendPxIfNeeded = __webpack_require__(108); +var _appendPxIfNeeded = __webpack_require__(158); var _appendPxIfNeeded2 = _interopRequireDefault(_appendPxIfNeeded); -var _camelCasePropsToDashCase = __webpack_require__(252); +var _camelCasePropsToDashCase = __webpack_require__(403); var _camelCasePropsToDashCase2 = _interopRequireDefault(_camelCasePropsToDashCase); -var _mapObject = __webpack_require__(113); +var _mapObject = __webpack_require__(163); var _mapObject2 = _interopRequireDefault(_mapObject); -var _prefixer = __webpack_require__(71); +var _prefixer = __webpack_require__(103); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -2520,7 +3559,7 @@ function cssRuleSetToString(selector, rules, userAgent) { module.exports = exports['default']; /***/ }), -/* 71 */ +/* 103 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2540,7 +3579,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol exports.getPrefixedKeyframes = getPrefixedKeyframes; exports.getPrefixedStyle = getPrefixedStyle; -var _inlineStylePrefixer = __webpack_require__(217); +var _inlineStylePrefixer = __webpack_require__(254); var _inlineStylePrefixer2 = _interopRequireDefault(_inlineStylePrefixer); @@ -2602,10 +3641,10 @@ function getPrefixedStyle(style, userAgent) { var prefixedStyle = prefixer.prefix(styleWithFallbacks); return prefixedStyle; } -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(84), __webpack_require__(2))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(180), __webpack_require__(2))) /***/ }), -/* 72 */ +/* 104 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2678,70 +3717,24 @@ exports.default = StyleKeeper; module.exports = exports['default']; /***/ }), -/* 73 */ -/***/ (function(module, exports, __webpack_require__) { +/* 105 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* WEBPACK VAR INJECTION */(function(process) { - -function checkDCE() { - /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ - if ( - typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' || - typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function' - ) { - return; - } - if (process.env.NODE_ENV !== 'production') { - // This branch is unreachable because this function is only called - // in production, but the condition is true only in development. - // Therefore if the branch is still here, dead code elimination wasn't - // properly applied. - // Don't change the message. React DevTools relies on it. Also make sure - // this message doesn't occur elsewhere in this function, or it will cause - // a false positive. - throw new Error('^_^'); - } - try { - // Verify that the code above has been dead code eliminated (DCE'd). - __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE); - } catch (err) { - // DevTools shouldn't crash React, no matter what. - // We should still report in case we break this code. - console.error(err); - } -} - -if (process.env.NODE_ENV === 'production') { - // DCE check should happen before ReactDOM bundle executes so that - // DevTools can report bad minification during injection. - checkDCE(); - module.exports = __webpack_require__(269); -} else { - module.exports = __webpack_require__(268); -} - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) - -/***/ }), -/* 74 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react_router_es_Router__ = __webpack_require__(75); -// Written in this round about way for babel-transform-imports +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react_router_es_Router__ = __webpack_require__(106); +// Written in this round about way for babel-transform-imports /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0_react_router_es_Router__["a" /* default */]); /***/ }), -/* 75 */ +/* 106 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_warning__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_warning___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_warning__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_invariant__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_invariant__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_invariant___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_invariant__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_react__); @@ -2854,11 +3847,11 @@ Router.childContextTypes = { /* harmony default export */ __webpack_exports__["a"] = (Router); /***/ }), -/* 76 */ +/* 107 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_path_to_regexp__ = __webpack_require__(247); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_path_to_regexp__ = __webpack_require__(399); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_path_to_regexp___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_path_to_regexp__); @@ -2931,7 +3924,7 @@ var matchPath = function matchPath(pathname) { /* harmony default export */ __webpack_exports__["a"] = (matchPath); /***/ }), -/* 77 */ +/* 108 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -2939,10 +3932,10 @@ var matchPath = function matchPath(pathname) { /* harmony export (immutable) */ __webpack_exports__["a"] = deepForEach; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_elementTypes__ = __webpack_require__(47); -function _extends() { _extends = Object.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; }; return _extends.apply(this, arguments); } +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_elementTypes__ = __webpack_require__(60); +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } @@ -2961,9 +3954,9 @@ function deepMap(children, callback) { return callback(child); } - if (child.props && child.props.children && _typeof(child.props.children) === 'object') { + if (child.props && child.props.children && typeof child.props.children === 'object') { // Clone the child that has children and map them too - return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_react__["cloneElement"])(child, _extends({}, child.props, { + return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_react__["cloneElement"])(child, _objectSpread({}, child.props, { children: deepMap(child.props.children, callback) })); } @@ -2979,7 +3972,7 @@ function deepForEach(children, callback) { if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__helpers_elementTypes__["b" /* isTab */])(child) || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__helpers_elementTypes__["c" /* isTabPanel */])(child)) { callback(child); - } else if (child.props && child.props.children && _typeof(child.props.children) === 'object') { + } else if (child.props && child.props.children && typeof child.props.children === 'object') { if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__helpers_elementTypes__["a" /* isTabList */])(child)) callback(child); deepForEach(child.props.children, callback); } @@ -2987,7 +3980,7 @@ function deepForEach(children, callback) { } /***/ }), -/* 78 */ +/* 109 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3003,8 +3996,7 @@ function deepForEach(children, callback) { // https://github.com/twitter-fabric/velocity-react/issues/119 // but there may have been different loading issues in that case, // not a global incompatibility with jsdom. -if (typeof window === 'undefined' || typeof navigator === 'undefined' || navigator.userAgent.indexOf("Node.js") !== -1 || navigator.userAgent.indexOf("jsdom") !== -1) { - +if (typeof window === 'undefined' || typeof navigator === 'undefined' || navigator.userAgent.indexOf('Node.js') !== -1 || navigator.userAgent.indexOf('jsdom') !== -1) { var Velocity = function Velocity() {}; Velocity.Utilities = {}; Velocity.Utilities.removeData = function () {}; @@ -3015,255 +4007,39 @@ if (typeof window === 'undefined' || typeof navigator === 'undefined' || navigat var g = window.jQuery || window.Zepto || window; // require Velocity if it doesn't already exist - module.exports = g.Velocity ? g.Velocity : __webpack_require__(304); -} - -/***/ }), -/* 79 */ -/***/ (function(module, exports, __webpack_require__) { - -var arrayEach = __webpack_require__(310), - baseEach = __webpack_require__(132), - createForEach = __webpack_require__(336); - -/** - * Iterates over elements of `collection` invoking `iteratee` for each element. - * The `iteratee` is bound to `thisArg` and invoked with three arguments: - * (value, index|key, collection). Iteratee functions may exit iteration early - * by explicitly returning `false`. - * - * **Note:** As with other "Collections" methods, objects with a "length" property - * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` - * may be used for object iteration. - * - * @static - * @memberOf _ - * @alias each - * @category Collection - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [thisArg] The `this` binding of `iteratee`. - * @returns {Array|Object|string} Returns `collection`. - * @example - * - * _([1, 2]).forEach(function(n) { - * console.log(n); - * }).value(); - * // => logs each value from left to right and returns the array - * - * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) { - * console.log(n, key); - * }); - * // => logs each value-key pair and returns the object (iteration order is not guaranteed) - */ -var forEach = createForEach(arrayEach, baseEach); - -module.exports = forEach; - - -/***/ }), -/* 80 */ -/***/ (function(module, exports, __webpack_require__) { - -var baseIsEqualDeep = __webpack_require__(322), - isObject = __webpack_require__(6), - isObjectLike = __webpack_require__(22); - -/** - * The base implementation of `_.isEqual` without support for `this` binding - * `customizer` functions. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {Function} [customizer] The function to customize comparing values. - * @param {boolean} [isLoose] Specify performing partial comparisons. - * @param {Array} [stackA] Tracks traversed `value` objects. - * @param {Array} [stackB] Tracks traversed `other` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ -function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { - if (value === other) { - return true; - } - if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { - return value !== value && other !== other; - } - return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB); -} - -module.exports = baseIsEqual; - - -/***/ }), -/* 81 */ -/***/ (function(module, exports) { - -/** Used to detect unsigned integer values. */ -var reIsUint = /^\d+$/; - -/** - * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) - * of an array-like value. - */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ -function isIndex(value, length) { - value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; - length = length == null ? MAX_SAFE_INTEGER : length; - return value > -1 && value % 1 == 0 && value < length; -} - -module.exports = isIndex; - - -/***/ }), -/* 82 */ -/***/ (function(module, exports, __webpack_require__) { - -var isArrayLike = __webpack_require__(32), - isObjectLike = __webpack_require__(22); - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** Native method references. */ -var propertyIsEnumerable = objectProto.propertyIsEnumerable; - -/** - * Checks if `value` is classified as an `arguments` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ -function isArguments(value) { - return isObjectLike(value) && isArrayLike(value) && - hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); -} - -module.exports = isArguments; - - -/***/ }), -/* 83 */ -/***/ (function(module, exports, __webpack_require__) { - -var isArguments = __webpack_require__(82), - isArray = __webpack_require__(9), - isIndex = __webpack_require__(81), - isLength = __webpack_require__(21), - isObject = __webpack_require__(6); - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Creates an array of the own and inherited enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) - */ -function keysIn(object) { - if (object == null) { - return []; - } - if (!isObject(object)) { - object = Object(object); - } - var length = object.length; - length = (length && isLength(length) && - (isArray(object) || isArguments(object)) && length) || 0; - - var Ctor = object.constructor, - index = -1, - isProto = typeof Ctor == 'function' && Ctor.prototype === object, - result = Array(length), - skipIndexes = length > 0; - - while (++index < length) { - result[index] = (index + ''); - } - for (var key in object) { - if (!(skipIndexes && isIndex(key, length)) && - !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; + module.exports = g.Velocity ? g.Velocity : __webpack_require__(457); } -module.exports = keysIn; - - /***/ }), -/* 84 */ +/* 110 */ /***/ (function(module, exports) { -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); - -try { - // This works if eval is allowed (see CSP) - g = g || Function("return this")() || (1,eval)("this"); -} catch(e) { - // This works if the window reference is available - if(typeof window === "object") - g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; +module.exports = function(module) { + if(!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + if(!module.children) module.children = []; + Object.defineProperty(module, "loaded", { + enumerable: true, + get: function() { + return module.l; + } + }); + Object.defineProperty(module, "id", { + enumerable: true, + get: function() { + return module.i; + } + }); + module.webpackPolyfill = 1; + } + return module; +}; /***/ }), -/* 85 */ +/* 111 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3282,9 +4058,9 @@ var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); -var _reactTreebeard = __webpack_require__(122); +var _reactTreebeard = __webpack_require__(172); -var _utils = __webpack_require__(23); +var _utils = __webpack_require__(28); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -3470,7 +4246,7 @@ var style = { }; /***/ }), -/* 86 */ +/* 112 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3478,11 +4254,11 @@ var style = { exports.__esModule = true; -var _iterator = __webpack_require__(157); +var _iterator = __webpack_require__(195); var _iterator2 = _interopRequireDefault(_iterator); -var _symbol = __webpack_require__(156); +var _symbol = __webpack_require__(194); var _symbol2 = _interopRequireDefault(_symbol); @@ -3497,7 +4273,7 @@ exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.d }; /***/ }), -/* 87 */ +/* 113 */ /***/ (function(module, exports) { var toString = {}.toString; @@ -3508,11 +4284,11 @@ module.exports = function (it) { /***/ }), -/* 88 */ +/* 114 */ /***/ (function(module, exports, __webpack_require__) { // optional / simple context binding -var aFunction = __webpack_require__(168); +var aFunction = __webpack_require__(206); module.exports = function (fn, that, length) { aFunction(fn); if (that === undefined) return fn; @@ -3534,11 +4310,11 @@ module.exports = function (fn, that, length) { /***/ }), -/* 89 */ +/* 115 */ /***/ (function(module, exports, __webpack_require__) { -var isObject = __webpack_require__(25); -var document = __webpack_require__(10).document; +var isObject = __webpack_require__(22); +var document = __webpack_require__(9).document; // typeof document.createElement is 'object' in old IE var is = isObject(document) && isObject(document.createElement); module.exports = function (it) { @@ -3547,20 +4323,20 @@ module.exports = function (it) { /***/ }), -/* 90 */ +/* 116 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = !__webpack_require__(11) && !__webpack_require__(17)(function () { - return Object.defineProperty(__webpack_require__(89)('div'), 'a', { get: function () { return 7; } }).a != 7; +module.exports = !__webpack_require__(12) && !__webpack_require__(20)(function () { + return Object.defineProperty(__webpack_require__(115)('div'), 'a', { get: function () { return 7; } }).a != 7; }); /***/ }), -/* 91 */ +/* 117 */ /***/ (function(module, exports, __webpack_require__) { // fallback for non-array-like ES3 and non-enumerable old V8 strings -var cof = __webpack_require__(87); +var cof = __webpack_require__(113); // eslint-disable-next-line no-prototype-builtins module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { return cof(it) == 'String' ? it.split('') : Object(it); @@ -3568,21 +4344,20 @@ module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { /***/ }), -/* 92 */ +/* 118 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var LIBRARY = __webpack_require__(53); -var $export = __webpack_require__(12); -var redefine = __webpack_require__(98); -var hide = __webpack_require__(18); -var has = __webpack_require__(13); -var Iterators = __webpack_require__(52); -var $iterCreate = __webpack_require__(174); -var setToStringTag = __webpack_require__(56); -var getPrototypeOf = __webpack_require__(95); -var ITERATOR = __webpack_require__(20)('iterator'); +var LIBRARY = __webpack_require__(41); +var $export = __webpack_require__(13); +var redefine = __webpack_require__(124); +var hide = __webpack_require__(21); +var Iterators = __webpack_require__(64); +var $iterCreate = __webpack_require__(212); +var setToStringTag = __webpack_require__(67); +var getPrototypeOf = __webpack_require__(121); +var ITERATOR = __webpack_require__(24)('iterator'); var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` var FF_ITERATOR = '@@iterator'; var KEYS = 'keys'; @@ -3615,7 +4390,7 @@ module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE // Set @@toStringTag to native iterators setToStringTag(IteratorPrototype, TAG, true); // fix for some old engines - if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis); + if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis); } } // fix Array#{values, @@iterator}.name in V8 / FF @@ -3645,18 +4420,18 @@ module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE /***/ }), -/* 93 */ +/* 119 */ /***/ (function(module, exports, __webpack_require__) { -var pIE = __webpack_require__(38); -var createDesc = __webpack_require__(39); -var toIObject = __webpack_require__(19); -var toPrimitive = __webpack_require__(60); -var has = __webpack_require__(13); -var IE8_DOM_DEFINE = __webpack_require__(90); +var pIE = __webpack_require__(42); +var createDesc = __webpack_require__(43); +var toIObject = __webpack_require__(23); +var toPrimitive = __webpack_require__(71); +var has = __webpack_require__(14); +var IE8_DOM_DEFINE = __webpack_require__(116); var gOPD = Object.getOwnPropertyDescriptor; -exports.f = __webpack_require__(11) ? gOPD : function getOwnPropertyDescriptor(O, P) { +exports.f = __webpack_require__(12) ? gOPD : function getOwnPropertyDescriptor(O, P) { O = toIObject(O); P = toPrimitive(P, true); if (IE8_DOM_DEFINE) try { @@ -3667,12 +4442,12 @@ exports.f = __webpack_require__(11) ? gOPD : function getOwnPropertyDescriptor(O /***/ }), -/* 94 */ +/* 120 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) -var $keys = __webpack_require__(96); -var hiddenKeys = __webpack_require__(51).concat('length', 'prototype'); +var $keys = __webpack_require__(122); +var hiddenKeys = __webpack_require__(63).concat('length', 'prototype'); exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return $keys(O, hiddenKeys); @@ -3680,13 +4455,13 @@ exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { /***/ }), -/* 95 */ +/* 121 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) -var has = __webpack_require__(13); -var toObject = __webpack_require__(40); -var IE_PROTO = __webpack_require__(57)('IE_PROTO'); +var has = __webpack_require__(14); +var toObject = __webpack_require__(44); +var IE_PROTO = __webpack_require__(68)('IE_PROTO'); var ObjectProto = Object.prototype; module.exports = Object.getPrototypeOf || function (O) { @@ -3699,13 +4474,13 @@ module.exports = Object.getPrototypeOf || function (O) { /***/ }), -/* 96 */ +/* 122 */ /***/ (function(module, exports, __webpack_require__) { -var has = __webpack_require__(13); -var toIObject = __webpack_require__(19); -var arrayIndexOf = __webpack_require__(170)(false); -var IE_PROTO = __webpack_require__(57)('IE_PROTO'); +var has = __webpack_require__(14); +var toIObject = __webpack_require__(23); +var arrayIndexOf = __webpack_require__(208)(false); +var IE_PROTO = __webpack_require__(68)('IE_PROTO'); module.exports = function (object, names) { var O = toIObject(object); @@ -3722,13 +4497,13 @@ module.exports = function (object, names) { /***/ }), -/* 97 */ +/* 123 */ /***/ (function(module, exports, __webpack_require__) { // most Object methods by ES6 should accept primitives -var $export = __webpack_require__(12); +var $export = __webpack_require__(13); var core = __webpack_require__(5); -var fails = __webpack_require__(17); +var fails = __webpack_require__(20); module.exports = function (KEY, exec) { var fn = (core.Object || {})[KEY] || Object[KEY]; var exp = {}; @@ -3738,14 +4513,14 @@ module.exports = function (KEY, exec) { /***/ }), -/* 98 */ +/* 124 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(18); +module.exports = __webpack_require__(21); /***/ }), -/* 99 */ +/* 125 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3784,7 +4559,7 @@ var ExecutionEnvironment = { module.exports = ExecutionEnvironment; /***/ }), -/* 100 */ +/* 126 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3799,7 +4574,7 @@ module.exports = ExecutionEnvironment; * */ -var isTextNode = __webpack_require__(208); +var isTextNode = __webpack_require__(245); /*eslint-disable no-bitwise */ @@ -3827,7 +4602,7 @@ function containsNode(outerNode, innerNode) { module.exports = containsNode; /***/ }), -/* 101 */ +/* 127 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3869,7 +4644,7 @@ function getActiveElement(doc) /*?DOMElement*/{ module.exports = getActiveElement; /***/ }), -/* 102 */ +/* 128 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3940,7 +4715,7 @@ function shallowEqual(objA, objB) { module.exports = shallowEqual; /***/ }), -/* 103 */ +/* 129 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4001,7 +4776,7 @@ var isExtraneousPopstateEvent = exports.isExtraneousPopstateEvent = function isE }; /***/ }), -/* 104 */ +/* 130 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -4067,7 +4842,7 @@ var isExtraneousPopstateEvent = function isExtraneousPopstateEvent(event) { }; /***/ }), -/* 105 */ +/* 131 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4090,7 +4865,7 @@ module.exports = hyphenateStyleName; /***/ }), -/* 106 */ +/* 132 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4103,7 +4878,7 @@ exports.default = { "Webkit": { "transform": true, "transformOrigin": true, "tra module.exports = exports["default"]; /***/ }), -/* 107 */ +/* 133 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4114,7 +4889,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = sortPrefixedStyle; -var _isPrefixedProperty = __webpack_require__(241); +var _isPrefixedProperty = __webpack_require__(278); var _isPrefixedProperty2 = _interopRequireDefault(_isPrefixedProperty); @@ -4136,7 +4911,777 @@ function sortPrefixedStyle(style) { module.exports = exports['default']; /***/ }), -/* 108 */ +/* 134 */ +/***/ (function(module, exports, __webpack_require__) { + +var root = __webpack_require__(7); + +/** Built-in value references. */ +var Uint8Array = root.Uint8Array; + +module.exports = Uint8Array; + + +/***/ }), +/* 135 */ +/***/ (function(module, exports) { + +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + +module.exports = arrayEach; + + +/***/ }), +/* 136 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseTimes = __webpack_require__(320), + isArguments = __webpack_require__(95), + isArray = __webpack_require__(4), + isBuffer = __webpack_require__(96), + isIndex = __webpack_require__(90), + isTypedArray = __webpack_require__(155); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), + isArg = !isArr && isArguments(value), + isBuff = !isArr && !isArg && isBuffer(value), + isType = !isArr && !isArg && !isBuff && isTypedArray(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? baseTimes(value.length, String) : [], + length = result.length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && ( + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) + ))) { + result.push(key); + } + } + return result; +} + +module.exports = arrayLikeKeys; + + +/***/ }), +/* 137 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseAssignValue = __webpack_require__(138), + eq = __webpack_require__(57); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } +} + +module.exports = assignValue; + + +/***/ }), +/* 138 */ +/***/ (function(module, exports, __webpack_require__) { + +var defineProperty = __webpack_require__(141); + +/** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } +} + +module.exports = baseAssignValue; + + +/***/ }), +/* 139 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseForOwn = __webpack_require__(300), + createBaseEach = __webpack_require__(335); + +/** + * The base implementation of `_.forEach` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ +var baseEach = createBaseEach(baseForOwn); + +module.exports = baseEach; + + +/***/ }), +/* 140 */ +/***/ (function(module, exports, __webpack_require__) { + +var arrayPush = __webpack_require__(83), + isArray = __webpack_require__(4); + +/** + * The base implementation of `getAllKeys` and `getAllKeysIn` which uses + * `keysFunc` and `symbolsFunc` to get the enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Function} keysFunc The function to get the keys of `object`. + * @param {Function} symbolsFunc The function to get the symbols of `object`. + * @returns {Array} Returns the array of property names and symbols. + */ +function baseGetAllKeys(object, keysFunc, symbolsFunc) { + var result = keysFunc(object); + return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); +} + +module.exports = baseGetAllKeys; + + +/***/ }), +/* 141 */ +/***/ (function(module, exports, __webpack_require__) { + +var getNative = __webpack_require__(18); + +var defineProperty = (function() { + try { + var func = getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} +}()); + +module.exports = defineProperty; + + +/***/ }), +/* 142 */ +/***/ (function(module, exports, __webpack_require__) { + +var SetCache = __webpack_require__(289), + arraySome = __webpack_require__(293), + cacheHas = __webpack_require__(323); + +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; + +/** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `array` and `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ +function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(array); + if (stacked && stack.get(other)) { + return stacked == other; + } + var index = -1, + result = true, + seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; + + stack.set(array, other); + stack.set(other, array); + + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); + } + if (compared !== undefined) { + if (compared) { + continue; + } + result = false; + break; + } + // Recursively compare arrays (susceptible to call stack limits). + if (seen) { + if (!arraySome(other, function(othValue, othIndex) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { + result = false; + break; + } + } else if (!( + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { + result = false; + break; + } + } + stack['delete'](array); + stack['delete'](other); + return result; +} + +module.exports = equalArrays; + + +/***/ }), +/* 143 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +module.exports = freeGlobal; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(180))) + +/***/ }), +/* 144 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseGetAllKeys = __webpack_require__(140), + getSymbols = __webpack_require__(89), + keys = __webpack_require__(19); + +/** + * Creates an array of own enumerable property names and symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ +function getAllKeys(object) { + return baseGetAllKeys(object, keys, getSymbols); +} + +module.exports = getAllKeys; + + +/***/ }), +/* 145 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseGetAllKeys = __webpack_require__(140), + getSymbolsIn = __webpack_require__(146), + keysIn = __webpack_require__(99); + +/** + * Creates an array of own and inherited enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ +function getAllKeysIn(object) { + return baseGetAllKeys(object, keysIn, getSymbolsIn); +} + +module.exports = getAllKeysIn; + + +/***/ }), +/* 146 */ +/***/ (function(module, exports, __webpack_require__) { + +var arrayPush = __webpack_require__(83), + getPrototype = __webpack_require__(88), + getSymbols = __webpack_require__(89), + stubArray = __webpack_require__(157); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeGetSymbols = Object.getOwnPropertySymbols; + +/** + * Creates an array of the own and inherited enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ +var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { + var result = []; + while (object) { + arrayPush(result, getSymbols(object)); + object = getPrototype(object); + } + return result; +}; + +module.exports = getSymbolsIn; + + +/***/ }), +/* 147 */ +/***/ (function(module, exports, __webpack_require__) { + +var isObject = __webpack_require__(10); + +/** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ +function isStrictComparable(value) { + return value === value && !isObject(value); +} + +module.exports = isStrictComparable; + + +/***/ }), +/* 148 */ +/***/ (function(module, exports) { + +/** + * A specialized version of `matchesProperty` for source values suitable + * for strict equality comparisons, i.e. `===`. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ +function matchesStrictComparable(key, srcValue) { + return function(object) { + if (object == null) { + return false; + } + return object[key] === srcValue && + (srcValue !== undefined || (key in Object(object))); + }; +} + +module.exports = matchesStrictComparable; + + +/***/ }), +/* 149 */ +/***/ (function(module, exports) { + +/** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; +} + +module.exports = overArg; + + +/***/ }), +/* 150 */ +/***/ (function(module, exports, __webpack_require__) { + +var apply = __webpack_require__(291); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ +function overRest(func, start, transform) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return apply(func, this, otherArgs); + }; +} + +module.exports = overRest; + + +/***/ }), +/* 151 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseSetToString = __webpack_require__(318), + shortOut = __webpack_require__(376); + +/** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var setToString = shortOut(baseSetToString); + +module.exports = setToString; + + +/***/ }), +/* 152 */ +/***/ (function(module, exports) { + +/** Used for built-in method references. */ +var funcProto = Function.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +module.exports = toSource; + + +/***/ }), +/* 153 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseIsEqual = __webpack_require__(85); + +/** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are compared by strict equality, i.e. `===`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ +function isEqual(value, other) { + return baseIsEqual(value, other); +} + +module.exports = isEqual; + + +/***/ }), +/* 154 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseGetTag = __webpack_require__(26), + isObject = __webpack_require__(10); + +/** `Object#toString` result references. */ +var asyncTag = '[object AsyncFunction]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + proxyTag = '[object Proxy]'; + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + if (!isObject(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; +} + +module.exports = isFunction; + + +/***/ }), +/* 155 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseIsTypedArray = __webpack_require__(308), + baseUnary = __webpack_require__(86), + nodeUtil = __webpack_require__(93); + +/* Node.js helper references. */ +var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + +/** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ +var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + +module.exports = isTypedArray; + + +/***/ }), +/* 156 */ +/***/ (function(module, exports, __webpack_require__) { + +var arrayMap = __webpack_require__(82), + baseClone = __webpack_require__(296), + baseUnset = __webpack_require__(322), + castPath = __webpack_require__(53), + copyObject = __webpack_require__(27), + customOmitClone = __webpack_require__(337), + flatRest = __webpack_require__(340), + getAllKeysIn = __webpack_require__(145); + +/** Used to compose bitmasks for cloning. */ +var CLONE_DEEP_FLAG = 1, + CLONE_FLAT_FLAG = 2, + CLONE_SYMBOLS_FLAG = 4; + +/** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable property paths of `object` that are not omitted. + * + * **Note:** This method is considerably slower than `_.pick`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [paths] The property paths to omit. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ +var omit = flatRest(function(object, paths) { + var result = {}; + if (object == null) { + return result; + } + var isDeep = false; + paths = arrayMap(paths, function(path) { + path = castPath(path, object); + isDeep || (isDeep = path.length > 1); + return path; + }); + copyObject(object, getAllKeysIn(object), result); + if (isDeep) { + result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); + } + var length = paths.length; + while (length--) { + baseUnset(result, paths[length]); + } + return result; +}); + +module.exports = omit; + + +/***/ }), +/* 157 */ +/***/ (function(module, exports) { + +/** + * This method returns a new empty array. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {Array} Returns the new empty array. + * @example + * + * var arrays = _.times(2, _.stubArray); + * + * console.log(arrays); + * // => [[], []] + * + * console.log(arrays[0] === arrays[1]); + * // => false + */ +function stubArray() { + return []; +} + +module.exports = stubArray; + + +/***/ }), +/* 158 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4191,7 +5736,7 @@ function appendPxIfNeeded(propertyName, value) { module.exports = exports['default']; /***/ }), -/* 109 */ +/* 159 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4213,11 +5758,11 @@ var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); -var _styleKeeper = __webpack_require__(72); +var _styleKeeper = __webpack_require__(104); var _styleKeeper2 = _interopRequireDefault(_styleKeeper); -var _resolveStyles = __webpack_require__(115); +var _resolveStyles = __webpack_require__(165); var _resolveStyles2 = _interopRequireDefault(_resolveStyles); @@ -4436,7 +5981,7 @@ module.exports = exports['default']; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }), -/* 110 */ +/* 160 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4453,7 +5998,7 @@ exports.default = getStateKey; module.exports = exports['default']; /***/ }), -/* 111 */ +/* 161 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4463,7 +6008,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _getStateKey = __webpack_require__(110); +var _getStateKey = __webpack_require__(160); var _getStateKey2 = _interopRequireDefault(_getStateKey); @@ -4479,7 +6024,7 @@ exports.default = getState; module.exports = exports['default']; /***/ }), -/* 112 */ +/* 162 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4512,7 +6057,7 @@ function hash(text) { module.exports = exports['default']; /***/ }), -/* 113 */ +/* 163 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4531,7 +6076,7 @@ function mapObject(object, mapper) { module.exports = exports["default"]; /***/ }), -/* 114 */ +/* 164 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4541,35 +6086,35 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _checkPropsPlugin = __webpack_require__(259); +var _checkPropsPlugin = __webpack_require__(410); var _checkPropsPlugin2 = _interopRequireDefault(_checkPropsPlugin); -var _keyframesPlugin = __webpack_require__(260); +var _keyframesPlugin = __webpack_require__(411); var _keyframesPlugin2 = _interopRequireDefault(_keyframesPlugin); -var _mergeStyleArrayPlugin = __webpack_require__(261); +var _mergeStyleArrayPlugin = __webpack_require__(412); var _mergeStyleArrayPlugin2 = _interopRequireDefault(_mergeStyleArrayPlugin); -var _prefixPlugin = __webpack_require__(263); +var _prefixPlugin = __webpack_require__(414); var _prefixPlugin2 = _interopRequireDefault(_prefixPlugin); -var _removeNestedStylesPlugin = __webpack_require__(264); +var _removeNestedStylesPlugin = __webpack_require__(415); var _removeNestedStylesPlugin2 = _interopRequireDefault(_removeNestedStylesPlugin); -var _resolveInteractionStylesPlugin = __webpack_require__(265); +var _resolveInteractionStylesPlugin = __webpack_require__(416); var _resolveInteractionStylesPlugin2 = _interopRequireDefault(_resolveInteractionStylesPlugin); -var _resolveMediaQueriesPlugin = __webpack_require__(266); +var _resolveMediaQueriesPlugin = __webpack_require__(417); var _resolveMediaQueriesPlugin2 = _interopRequireDefault(_resolveMediaQueriesPlugin); -var _visitedPlugin = __webpack_require__(267); +var _visitedPlugin = __webpack_require__(418); var _visitedPlugin2 = _interopRequireDefault(_visitedPlugin); @@ -4590,7 +6135,7 @@ exports.default = { module.exports = exports['default']; /***/ }), -/* 115 */ +/* 165 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4604,33 +6149,33 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -var _appendImportantToEachValue = __webpack_require__(251); +var _appendImportantToEachValue = __webpack_require__(402); var _appendImportantToEachValue2 = _interopRequireDefault(_appendImportantToEachValue); -var _cssRuleSetToString = __webpack_require__(70); +var _cssRuleSetToString = __webpack_require__(102); var _cssRuleSetToString2 = _interopRequireDefault(_cssRuleSetToString); -var _getState = __webpack_require__(111); +var _getState = __webpack_require__(161); var _getState2 = _interopRequireDefault(_getState); -var _getStateKey = __webpack_require__(110); +var _getStateKey = __webpack_require__(160); var _getStateKey2 = _interopRequireDefault(_getStateKey); -var _hash = __webpack_require__(112); +var _hash = __webpack_require__(162); var _hash2 = _interopRequireDefault(_hash); -var _mergeStyles = __webpack_require__(258); +var _mergeStyles = __webpack_require__(409); -var _plugins = __webpack_require__(114); +var _plugins = __webpack_require__(164); var _plugins2 = _interopRequireDefault(_plugins); -var _exenv = __webpack_require__(202); +var _exenv = __webpack_require__(239); var _exenv2 = _interopRequireDefault(_exenv); @@ -4957,7 +6502,7 @@ module.exports = exports['default']; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }), -/* 116 */ +/* 166 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -4965,7 +6510,7 @@ module.exports = exports['default']; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prop_types__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_prop_types__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_invariant__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_invariant__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_invariant___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_invariant__); var _extends = Object.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; }; @@ -5067,30 +6612,30 @@ Link.contextTypes = { /* harmony default export */ __webpack_exports__["a"] = (Link); /***/ }), -/* 117 */ +/* 167 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react_router_es_Route__ = __webpack_require__(118); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react_router_es_Route__ = __webpack_require__(168); // Written in this round about way for babel-transform-imports /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0_react_router_es_Route__["a" /* default */]); /***/ }), -/* 118 */ +/* 168 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_warning__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_warning___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_warning__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_invariant__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_invariant__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_invariant___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_invariant__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_react__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_prop_types__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_prop_types__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__matchPath__ = __webpack_require__(76); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__matchPath__ = __webpack_require__(107); var _extends = Object.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; }; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -5227,14 +6772,14 @@ Route.childContextTypes = { /* harmony default export */ __webpack_exports__["a"] = (Route); /***/ }), -/* 119 */ +/* 169 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = getTabsCount; /* harmony export (immutable) */ __webpack_exports__["b"] = getPanelsCount; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_childrenDeepMap__ = __webpack_require__(77); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__elementTypes__ = __webpack_require__(47); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_childrenDeepMap__ = __webpack_require__(108); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__elementTypes__ = __webpack_require__(60); function getTabsCount(children) { @@ -5253,17 +6798,15 @@ function getPanelsCount(children) { } /***/ }), -/* 120 */ +/* 170 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = childrenPropType; /* harmony export (immutable) */ __webpack_exports__["b"] = onSelectPropType; /* harmony export (immutable) */ __webpack_exports__["c"] = selectedIndexPropType; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_childrenDeepMap__ = __webpack_require__(77); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_elementTypes__ = __webpack_require__(47); -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__helpers_childrenDeepMap__ = __webpack_require__(108); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_elementTypes__ = __webpack_require__(60); function childrenPropType(props, propName, componentName) { @@ -5275,7 +6818,7 @@ function childrenPropType(props, propName, componentName) { var children = props[propName]; __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers_childrenDeepMap__["a" /* deepForEach */])(children, function (child) { if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__helpers_elementTypes__["a" /* isTabList */])(child)) { - if (child.props && child.props.children && _typeof(child.props.children) === 'object') { + if (child.props && child.props.children && typeof child.props.children === 'object') { __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers_childrenDeepMap__["a" /* deepForEach */])(child.props.children, function (listChild) { return listTabs.push(listChild); }); @@ -5290,7 +6833,7 @@ function childrenPropType(props, propName, componentName) { if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__helpers_elementTypes__["b" /* isTab */])(child)) { if (!tabListFound || listTabs.indexOf(child) === -1) { - error = new Error("Found a 'Tab' component outside of the 'TabList' component. 'Tab' components have to be inside the 'TabList' component."); + error = new Error("Found a 'Tab' component outside of the 'TabList' component. 'Tab' components " + "have to be inside the 'TabList' component."); } tabsCount++; @@ -5300,7 +6843,7 @@ function childrenPropType(props, propName, componentName) { }); if (!error && tabsCount !== panelsCount) { - error = new Error("There should be an equal number of 'Tab' and 'TabPanel' in `" + componentName + "`." + ("Received " + tabsCount + " 'Tab' and " + panelsCount + " 'TabPanel'.")); + error = new Error("There should be an equal number of 'Tab' and 'TabPanel' in `" + componentName + "`. " + ("Received " + tabsCount + " 'Tab' and " + panelsCount + " 'TabPanel'.")); } return error; @@ -5311,9 +6854,9 @@ function onSelectPropType(props, propName, componentName, location, propFullName var error = null; if (prop && typeof prop !== 'function') { - error = new Error("Invalid " + location + " `" + name + "` of type `" + _typeof(prop) + "` supplied to `" + componentName + "`, expected `function`."); + error = new Error("Invalid " + location + " `" + name + "` of type `" + typeof prop + "` supplied " + ("to `" + componentName + "`, expected `function`.")); } else if (props.selectedIndex != null && prop == null) { - error = new Error("The " + location + " `" + name + "` is marked as required in `" + componentName + "`, but its value is `undefined` or `null`.\n`onSelect` is required when `selectedIndex` is also set. Not doing so will make the tabs not do anything, as `selectedIndex` indicates that you want to handle the selected tab yourself.\nIf you only want to set the inital tab replace `selectedIndex` with `defaultIndex`."); + error = new Error("The " + location + " `" + name + "` is marked as required in `" + componentName + "`, but " + "its value is `undefined` or `null`.\n" + "`onSelect` is required when `selectedIndex` is also set. Not doing so will " + "make the tabs not do anything, as `selectedIndex` indicates that you want to " + "handle the selected tab yourself.\n" + "If you only want to set the inital tab replace `selectedIndex` with `defaultIndex`."); } return error; @@ -5324,16 +6867,16 @@ function selectedIndexPropType(props, propName, componentName, location, propFul var error = null; if (prop != null && typeof prop !== 'number') { - error = new Error("Invalid " + location + " `" + name + "` of type `" + _typeof(prop) + "` supplied to `" + componentName + "`, expected `number`."); + error = new Error("Invalid " + location + " `" + name + "` of type `" + typeof prop + "` supplied to " + ("`" + componentName + "`, expected `number`.")); } else if (props.defaultIndex != null && prop != null) { - return new Error("The " + location + " `" + name + "` cannot be used together with `defaultIndex` in `" + componentName + "`.\nEither remove `" + name + "` to let `" + componentName + "` handle the selected tab internally or remove `defaultIndex` to handle it yourself."); + return new Error("The " + location + " `" + name + "` cannot be used together with `defaultIndex` " + ("in `" + componentName + "`.\n") + ("Either remove `" + name + "` to let `" + componentName + "` handle the selected ") + "tab internally or remove `defaultIndex` to handle it yourself."); } return error; } /***/ }), -/* 121 */ +/* 171 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -5349,16 +6892,16 @@ function reset() { } /***/ }), -/* 122 */ +/* 172 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -module.exports = __webpack_require__(298); +module.exports = __webpack_require__(451); /***/ }), -/* 123 */ +/* 173 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5368,23 +6911,23 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _getPrototypeOf = __webpack_require__(33); +var _getPrototypeOf = __webpack_require__(36); var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); -var _classCallCheck2 = __webpack_require__(34); +var _classCallCheck2 = __webpack_require__(37); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -var _createClass2 = __webpack_require__(35); +var _createClass2 = __webpack_require__(38); var _createClass3 = _interopRequireDefault(_createClass2); -var _possibleConstructorReturn2 = __webpack_require__(37); +var _possibleConstructorReturn2 = __webpack_require__(40); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); -var _inherits2 = __webpack_require__(36); +var _inherits2 = __webpack_require__(39); var _inherits3 = _interopRequireDefault(_inherits2); @@ -5398,11 +6941,11 @@ var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); -var _radium = __webpack_require__(256); +var _radium = __webpack_require__(407); var _radium2 = _interopRequireDefault(_radium); -var _velocityReact = __webpack_require__(129); +var _velocityReact = __webpack_require__(179); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -5551,7 +7094,7 @@ exports.default = { }; /***/ }), -/* 124 */ +/* 174 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5584,7 +7127,7 @@ exports.default = { }; /***/ }), -/* 125 */ +/* 175 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5672,7 +7215,7 @@ exports.default = { }; /***/ }), -/* 126 */ +/* 176 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -5749,7 +7292,7 @@ function resolvePathname(to) { /* harmony default export */ __webpack_exports__["default"] = (resolvePathname); /***/ }), -/* 127 */ +/* 177 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5794,7 +7337,7 @@ exports.BreadCrumbs = (props) => { /***/ }), -/* 128 */ +/* 178 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -5839,7 +7382,7 @@ function valueEqual(a, b) { /* harmony default export */ __webpack_exports__["default"] = (valueEqual); /***/ }), -/* 129 */ +/* 179 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5860,489 +7403,40 @@ function valueEqual(a, b) { // require('velocity-animate/velocity.ui'); module.exports = { - VelocityComponent: __webpack_require__(352), - VelocityTransitionGroup: __webpack_require__(354), - velocityHelpers: __webpack_require__(353) + VelocityComponent: __webpack_require__(458), + VelocityTransitionGroup: __webpack_require__(460), + velocityHelpers: __webpack_require__(459) }; /***/ }), -/* 130 */ -/***/ (function(module, exports) { - -/** Used as the `TypeError` message for "Functions" methods. */ -var FUNC_ERROR_TEXT = 'Expected a function'; - -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max; - -/** - * Creates a function that invokes `func` with the `this` binding of the - * created function and arguments from `start` and beyond provided as an array. - * - * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters). - * - * @static - * @memberOf _ - * @category Function - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - * @example - * - * var say = _.restParam(function(what, names) { - * return what + ' ' + _.initial(names).join(', ') + - * (_.size(names) > 1 ? ', & ' : '') + _.last(names); - * }); - * - * say('hello', 'fred', 'barney', 'pebbles'); - * // => 'hello fred, barney, & pebbles' - */ -function restParam(func, start) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - rest = Array(length); - - while (++index < length) { - rest[index] = args[start + index]; - } - switch (start) { - case 0: return func.call(this, rest); - case 1: return func.call(this, args[0], rest); - case 2: return func.call(this, args[0], args[1], rest); - } - var otherArgs = Array(start + 1); - index = -1; - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = rest; - return func.apply(this, otherArgs); - }; -} - -module.exports = restParam; - - -/***/ }), -/* 131 */ -/***/ (function(module, exports) { - -/** - * A specialized version of `_.map` for arrays without support for callback - * shorthands and `this` binding. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ -function arrayMap(array, iteratee) { - var index = -1, - length = array.length, - result = Array(length); - - while (++index < length) { - result[index] = iteratee(array[index], index, array); - } - return result; -} - -module.exports = arrayMap; - - -/***/ }), -/* 132 */ -/***/ (function(module, exports, __webpack_require__) { - -var baseForOwn = __webpack_require__(320), - createBaseEach = __webpack_require__(333); - -/** - * The base implementation of `_.forEach` without support for callback - * shorthands and `this` binding. - * - * @private - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object|string} Returns `collection`. - */ -var baseEach = createBaseEach(baseForOwn); - -module.exports = baseEach; - - -/***/ }), -/* 133 */ -/***/ (function(module, exports, __webpack_require__) { - -var createBaseFor = __webpack_require__(334); - -/** - * The base implementation of `baseForIn` and `baseForOwn` which iterates - * over `object` properties returned by `keysFunc` invoking `iteratee` for - * each property. Iteratee functions may exit iteration early by explicitly - * returning `false`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ -var baseFor = createBaseFor(); - -module.exports = baseFor; - - -/***/ }), -/* 134 */ -/***/ (function(module, exports, __webpack_require__) { - -var toObject = __webpack_require__(8); - -/** - * The base implementation of `get` without support for string paths - * and default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array} path The path of the property to get. - * @param {string} [pathKey] The key representation of path. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path, pathKey) { - if (object == null) { - return; - } - if (pathKey !== undefined && pathKey in toObject(object)) { - path = [pathKey]; - } - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -module.exports = baseGet; - - -/***/ }), -/* 135 */ -/***/ (function(module, exports) { - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -module.exports = baseProperty; - - -/***/ }), -/* 136 */ -/***/ (function(module, exports, __webpack_require__) { - -var baseProperty = __webpack_require__(135); - -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * that affects Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -module.exports = getLength; - - -/***/ }), -/* 137 */ -/***/ (function(module, exports, __webpack_require__) { - -var isArray = __webpack_require__(9), - toObject = __webpack_require__(8); - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/; - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - var type = typeof value; - if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') { - return true; - } - if (isArray(value)) { - return false; - } - var result = !reIsDeepProp.test(value); - return result || (object != null && value in toObject(object)); -} - -module.exports = isKey; - - -/***/ }), -/* 138 */ -/***/ (function(module, exports, __webpack_require__) { - -var isObject = __webpack_require__(6); - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -module.exports = isStrictComparable; - - -/***/ }), -/* 139 */ -/***/ (function(module, exports, __webpack_require__) { - -var baseToString = __webpack_require__(329), - isArray = __webpack_require__(9); - -/** Used to match property names within property paths. */ -var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * Converts `value` to property path array if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function toPath(value) { - if (isArray(value)) { - return value; - } - var result = []; - baseToString(value).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -module.exports = toPath; - - -/***/ }), -/* 140 */ -/***/ (function(module, exports, __webpack_require__) { - -var baseIsEqual = __webpack_require__(80), - bindCallback = __webpack_require__(31); - -/** - * Performs a deep comparison between two values to determine if they are - * equivalent. If `customizer` is provided it's invoked to compare values. - * If `customizer` returns `undefined` comparisons are handled by the method - * instead. The `customizer` is bound to `thisArg` and invoked with up to - * three arguments: (value, other [, index|key]). - * - * **Note:** This method supports comparing arrays, booleans, `Date` objects, - * numbers, `Object` objects, regexes, and strings. Objects are compared by - * their own, not inherited, enumerable properties. Functions and DOM nodes - * are **not** supported. Provide a customizer function to extend support - * for comparing other values. - * - * @static - * @memberOf _ - * @alias eq - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {Function} [customizer] The function to customize value comparisons. - * @param {*} [thisArg] The `this` binding of `customizer`. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'user': 'fred' }; - * var other = { 'user': 'fred' }; - * - * object == other; - * // => false - * - * _.isEqual(object, other); - * // => true - * - * // using a customizer callback - * var array = ['hello', 'goodbye']; - * var other = ['hi', 'goodbye']; - * - * _.isEqual(array, other, function(value, other) { - * if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) { - * return true; - * } - * }); - * // => true - */ -function isEqual(value, other, customizer, thisArg) { - customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined; - var result = customizer ? customizer(value, other) : undefined; - return result === undefined ? baseIsEqual(value, other, customizer) : !!result; -} - -module.exports = isEqual; - - -/***/ }), -/* 141 */ -/***/ (function(module, exports, __webpack_require__) { - -var arrayMap = __webpack_require__(131), - baseDifference = __webpack_require__(317), - baseFlatten = __webpack_require__(318), - bindCallback = __webpack_require__(31), - keysIn = __webpack_require__(83), - pickByArray = __webpack_require__(343), - pickByCallback = __webpack_require__(344), - restParam = __webpack_require__(130); - -/** - * The opposite of `_.pick`; this method creates an object composed of the - * own and inherited enumerable properties of `object` that are not omitted. - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {Function|...(string|string[])} [predicate] The function invoked per - * iteration or property names to omit, specified as individual property - * names or arrays of property names. - * @param {*} [thisArg] The `this` binding of `predicate`. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'user': 'fred', 'age': 40 }; - * - * _.omit(object, 'age'); - * // => { 'user': 'fred' } - * - * _.omit(object, _.isNumber); - * // => { 'user': 'fred' } - */ -var omit = restParam(function(object, props) { - if (object == null) { - return {}; - } - if (typeof props[0] != 'function') { - var props = arrayMap(baseFlatten(props), String); - return pickByArray(object, baseDifference(keysIn(object), props)); - } - var predicate = bindCallback(props[0], props[1], 3); - return pickByCallback(object, function(value, key, object) { - return !predicate(value, key, object); - }); -}); - -module.exports = omit; - - -/***/ }), -/* 142 */ +/* 180 */ /***/ (function(module, exports) { -/** - * This method returns the first argument provided to it. - * - * @static - * @memberOf _ - * @category Utility - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -module.exports = identity; - - -/***/ }), -/* 143 */ -/***/ (function(module, exports, __webpack_require__) { - -var baseProperty = __webpack_require__(135), - basePropertyDeep = __webpack_require__(327), - isKey = __webpack_require__(137); - -/** - * Creates a function that returns the property value at `path` on a - * given object. - * - * @static - * @memberOf _ - * @category Utility - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - -module.exports = property; +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; /***/ }), -/* 144 */ +/* 181 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6361,19 +7455,19 @@ var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); -var _reactDom = __webpack_require__(73); +var _reactDom = __webpack_require__(59); var _reactDom2 = _interopRequireDefault(_reactDom); -var _reactRouterDom = __webpack_require__(278); +var _reactRouterDom = __webpack_require__(429); -var _utils = __webpack_require__(23); +var _utils = __webpack_require__(28); -var _sidebar = __webpack_require__(149); +var _sidebar = __webpack_require__(187); -var _symbolPanel = __webpack_require__(85); +var _symbolPanel = __webpack_require__(111); -var _contentPanel = __webpack_require__(145); +var _contentPanel = __webpack_require__(182); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6536,7 +7630,7 @@ function renderApp() { } /***/ }), -/* 145 */ +/* 182 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6553,11 +7647,11 @@ var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); -var _dirView = __webpack_require__(302); +var _dirView = __webpack_require__(455); -var _srcView = __webpack_require__(150); +var _srcView = __webpack_require__(188); -var _utils = __webpack_require__(23); +var _utils = __webpack_require__(28); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6669,7 +7763,112 @@ var ContentPanel = exports.ContentPanel = function (_React$Component) { }(_react2.default.Component); /***/ }), -/* 146 */ +/* 183 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Highlight = undefined; + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var Highlight = exports.Highlight = function Highlight(props) { + var src_line_prefix = 'src_line_'; + var highlight = props.highlight; + var is_valid_highlight = validate_highlight(highlight); + + if (!is_valid_highlight) { + return null; + } + + var lhs = highlight.column_start - 1; + var rhs = highlight.column_end - 1; + var highlight_specs = make_highlight(src_line_prefix, highlight.line_start, lhs, rhs); + if (highlight_specs) { + var top = highlight_specs.top, + left = highlight_specs.left, + width = highlight_specs.width; + + var style = { + top: top, + left: left, + width: width + }; + return _react2.default.createElement( + 'div', + { className: 'selected floating_highlight', key: highlight.line_start, style: style }, + '\xA0' + ); + } + + return null; +}; // Copyright 2018 The Rustw Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +function make_highlight(src_line_prefix, line_number, left, right) { + var line_div = $("#" + src_line_prefix + line_number); + + // TODO: get adjust variable as prop through diffIndent in FileResult + // if Highlight component is to be used in the SearchResults component + // const adjust = line_div.data('adjust'); + // if (adjust) { + // left -= adjust; + // right -= adjust; + // } + + left *= CHAR_WIDTH; + right *= CHAR_WIDTH; + if (right === 0) { + right = line_div.width(); + } + + var width = right - left; + var paddingLeft = parseInt(line_div.css("padding-left")); + var paddingTop = parseInt(line_div.css("padding-top")); + if (left >= 0) { + left -= paddingLeft; + } else { + width += paddingLeft; + } + + var position = line_div.position(); + if (position) { + position.left += left; + position.top += paddingTop; + return { top: position.top, left: position.left, width: width }; + } + // If no position, don't render the highlight + return null; +} + +// TODO: this could maybe be validated in app.js, at srcHighlight declaration +function validate_highlight(highlight) { + var required_keys = ['line_start', 'line_end', 'column_start', 'column_end']; + var has_keys = required_keys.reduce(function (acc, k) { + return acc && highlight[k] !== undefined; + }, true); + + if (!has_keys || highlight.column_start <= 0) { + return false; + } + return true; +} + +/***/ }), +/* 184 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6839,7 +8038,7 @@ var MenuHost = exports.MenuHost = function (_React$Component2) { }(_react2.default.Component); /***/ }), -/* 147 */ +/* 185 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6858,7 +8057,7 @@ var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); -var _utils = __webpack_require__(23); +var _utils = __webpack_require__(28); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -7155,7 +8354,7 @@ function SearchContext(props) { } /***/ }), -/* 148 */ +/* 186 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7172,7 +8371,7 @@ var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); -var _search = __webpack_require__(147); +var _search = __webpack_require__(185); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -7232,7 +8431,7 @@ function SearchBox(props) { } /***/ }), -/* 149 */ +/* 187 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7251,13 +8450,13 @@ var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); -var _reactTabs = __webpack_require__(292); +var _reactTabs = __webpack_require__(443); -var _searchPanel = __webpack_require__(148); +var _searchPanel = __webpack_require__(186); -var _treePanel = __webpack_require__(151); +var _treePanel = __webpack_require__(189); -var _symbolPanel = __webpack_require__(85); +var _symbolPanel = __webpack_require__(111); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -7398,7 +8597,7 @@ var StatusBar = function (_React$Component2) { }(_react2.default.Component); /***/ }), -/* 150 */ +/* 188 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7423,13 +8622,15 @@ var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); -var _utils = __webpack_require__(23); +var _utils = __webpack_require__(28); var utils = _interopRequireWildcard(_utils); -var _breadCrumbs = __webpack_require__(127); +var _breadCrumbs = __webpack_require__(177); + +var _menus = __webpack_require__(184); -var _menus = __webpack_require__(146); +var _highlight = __webpack_require__(183); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } @@ -7593,12 +8794,6 @@ var SourceView = exports.SourceView = function (_React$Component) { value: function componentDidUpdate() { var _this2 = this; - if (this.props.highlight) { - utils.highlight_spans(this.props.highlight, "src_line_number_", "src_line_", "selected", this.node); - } else { - utils.unHighlight("selected", this.node); - } - // Make source links active. var linkables = $("#div_src_view").find(".src_link"); linkables.off("click"); @@ -7638,12 +8833,18 @@ var SourceView = exports.SourceView = function (_React$Component) { var _this3 = this; var path = this.props.path.join('/'); + var highlight_start = this.props.highlight && this.props.highlight.line_start || false; var count = 0, numbers = [], lines = this.props.lines.map(function (l) { count += 1; - numbers.push(_react2.default.createElement(LineNumber, { count: count, path: path, key: "num-" + count })); - return _react2.default.createElement(Line, { count: count, line: l, key: "line-" + count }); + numbers.push(_react2.default.createElement(LineNumber, { count: count, + path: path, + key: "num-" + count, + is_highlighted: highlight_start === count })); + return _react2.default.createElement(Line, { count: count, + line: l, + key: "line-" + count }); }); var refMenu = null; @@ -7678,6 +8879,7 @@ var SourceView = exports.SourceView = function (_React$Component) { lines ) ), + this.props.highlight ? _react2.default.createElement(_highlight.Highlight, { highlight: this.props.highlight }) : null, refMenu ) ); @@ -7714,7 +8916,7 @@ var LineNumber = function (_MenuHost) { var link = this.props.path + ":" + this.props.count; return _react2.default.createElement( 'div', - { className: 'div_src_line_number hand_cursor', id: numId, 'data-link': link }, + { className: 'div_src_line_number hand_cursor ' + (this.props.is_highlighted ? 'selected' : ''), id: numId, 'data-link': link }, this.props.count ); } @@ -7730,7 +8932,7 @@ function Line(props) { } /***/ }), -/* 151 */ +/* 189 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7747,7 +8949,7 @@ var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); -var _reactTreebeard = __webpack_require__(122); +var _reactTreebeard = __webpack_require__(172); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -7906,43 +9108,43 @@ var style = { }; /***/ }), -/* 152 */ +/* 190 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(161), __esModule: true }; +module.exports = { "default": __webpack_require__(199), __esModule: true }; /***/ }), -/* 153 */ +/* 191 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(162), __esModule: true }; +module.exports = { "default": __webpack_require__(200), __esModule: true }; /***/ }), -/* 154 */ +/* 192 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(164), __esModule: true }; +module.exports = { "default": __webpack_require__(202), __esModule: true }; /***/ }), -/* 155 */ +/* 193 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(165), __esModule: true }; +module.exports = { "default": __webpack_require__(203), __esModule: true }; /***/ }), -/* 156 */ +/* 194 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(166), __esModule: true }; +module.exports = { "default": __webpack_require__(204), __esModule: true }; /***/ }), -/* 157 */ +/* 195 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(167), __esModule: true }; +module.exports = { "default": __webpack_require__(205), __esModule: true }; /***/ }), -/* 158 */ +/* 196 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7950,7 +9152,7 @@ module.exports = { "default": __webpack_require__(167), __esModule: true }; exports.__esModule = true; -var _assign = __webpack_require__(49); +var _assign = __webpack_require__(61); var _assign2 = _interopRequireDefault(_assign); @@ -7971,7 +9173,7 @@ exports.default = _assign2.default || function (target) { }; /***/ }), -/* 159 */ +/* 197 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7992,18 +9194,18 @@ exports.default = function (obj, keys) { }; /***/ }), -/* 160 */ +/* 198 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(185); +__webpack_require__(223); module.exports = __webpack_require__(5).Object.assign; /***/ }), -/* 161 */ +/* 199 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(186); +__webpack_require__(224); var $Object = __webpack_require__(5).Object; module.exports = function create(P, D) { return $Object.create(P, D); @@ -8011,10 +9213,10 @@ module.exports = function create(P, D) { /***/ }), -/* 162 */ +/* 200 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(187); +__webpack_require__(225); var $Object = __webpack_require__(5).Object; module.exports = function defineProperty(it, key, desc) { return $Object.defineProperty(it, key, desc); @@ -8022,51 +9224,51 @@ module.exports = function defineProperty(it, key, desc) { /***/ }), -/* 163 */ +/* 201 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(188); +__webpack_require__(226); module.exports = __webpack_require__(5).Object.getPrototypeOf; /***/ }), -/* 164 */ +/* 202 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(189); +__webpack_require__(227); module.exports = __webpack_require__(5).Object.keys; /***/ }), -/* 165 */ +/* 203 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(190); +__webpack_require__(228); module.exports = __webpack_require__(5).Object.setPrototypeOf; /***/ }), -/* 166 */ +/* 204 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(193); -__webpack_require__(191); -__webpack_require__(194); -__webpack_require__(195); +__webpack_require__(231); +__webpack_require__(229); +__webpack_require__(232); +__webpack_require__(233); module.exports = __webpack_require__(5).Symbol; /***/ }), -/* 167 */ +/* 205 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(192); -__webpack_require__(196); -module.exports = __webpack_require__(62).f('iterator'); +__webpack_require__(230); +__webpack_require__(234); +module.exports = __webpack_require__(73).f('iterator'); /***/ }), -/* 168 */ +/* 206 */ /***/ (function(module, exports) { module.exports = function (it) { @@ -8076,21 +9278,21 @@ module.exports = function (it) { /***/ }), -/* 169 */ +/* 207 */ /***/ (function(module, exports) { module.exports = function () { /* empty */ }; /***/ }), -/* 170 */ +/* 208 */ /***/ (function(module, exports, __webpack_require__) { // false -> Array#indexOf // true -> Array#includes -var toIObject = __webpack_require__(19); -var toLength = __webpack_require__(183); -var toAbsoluteIndex = __webpack_require__(182); +var toIObject = __webpack_require__(23); +var toLength = __webpack_require__(221); +var toAbsoluteIndex = __webpack_require__(220); module.exports = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIObject($this); @@ -8112,13 +9314,13 @@ module.exports = function (IS_INCLUDES) { /***/ }), -/* 171 */ +/* 209 */ /***/ (function(module, exports, __webpack_require__) { // all enumerable object keys, includes symbols -var getKeys = __webpack_require__(26); -var gOPS = __webpack_require__(55); -var pIE = __webpack_require__(38); +var getKeys = __webpack_require__(30); +var gOPS = __webpack_require__(66); +var pIE = __webpack_require__(42); module.exports = function (it) { var result = getKeys(it); var getSymbols = gOPS.f; @@ -8133,37 +9335,37 @@ module.exports = function (it) { /***/ }), -/* 172 */ +/* 210 */ /***/ (function(module, exports, __webpack_require__) { -var document = __webpack_require__(10).document; +var document = __webpack_require__(9).document; module.exports = document && document.documentElement; /***/ }), -/* 173 */ +/* 211 */ /***/ (function(module, exports, __webpack_require__) { // 7.2.2 IsArray(argument) -var cof = __webpack_require__(87); +var cof = __webpack_require__(113); module.exports = Array.isArray || function isArray(arg) { return cof(arg) == 'Array'; }; /***/ }), -/* 174 */ +/* 212 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var create = __webpack_require__(54); -var descriptor = __webpack_require__(39); -var setToStringTag = __webpack_require__(56); +var create = __webpack_require__(65); +var descriptor = __webpack_require__(43); +var setToStringTag = __webpack_require__(67); var IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() -__webpack_require__(18)(IteratorPrototype, __webpack_require__(20)('iterator'), function () { return this; }); +__webpack_require__(21)(IteratorPrototype, __webpack_require__(24)('iterator'), function () { return this; }); module.exports = function (Constructor, NAME, next) { Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); @@ -8172,7 +9374,7 @@ module.exports = function (Constructor, NAME, next) { /***/ }), -/* 175 */ +/* 213 */ /***/ (function(module, exports) { module.exports = function (done, value) { @@ -8181,18 +9383,18 @@ module.exports = function (done, value) { /***/ }), -/* 176 */ +/* 214 */ /***/ (function(module, exports, __webpack_require__) { -var META = __webpack_require__(41)('meta'); -var isObject = __webpack_require__(25); -var has = __webpack_require__(13); -var setDesc = __webpack_require__(14).f; +var META = __webpack_require__(45)('meta'); +var isObject = __webpack_require__(22); +var has = __webpack_require__(14); +var setDesc = __webpack_require__(15).f; var id = 0; var isExtensible = Object.isExtensible || function () { return true; }; -var FREEZE = !__webpack_require__(17)(function () { +var FREEZE = !__webpack_require__(20)(function () { return isExtensible(Object.preventExtensions({})); }); var setMeta = function (it) { @@ -8240,21 +9442,21 @@ var meta = module.exports = { /***/ }), -/* 177 */ +/* 215 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 19.1.2.1 Object.assign(target, source, ...) -var getKeys = __webpack_require__(26); -var gOPS = __webpack_require__(55); -var pIE = __webpack_require__(38); -var toObject = __webpack_require__(40); -var IObject = __webpack_require__(91); +var getKeys = __webpack_require__(30); +var gOPS = __webpack_require__(66); +var pIE = __webpack_require__(42); +var toObject = __webpack_require__(44); +var IObject = __webpack_require__(117); var $assign = Object.assign; // should work with symbols and should have deterministic property order (V8 bug) -module.exports = !$assign || __webpack_require__(17)(function () { +module.exports = !$assign || __webpack_require__(20)(function () { var A = {}; var B = {}; // eslint-disable-next-line no-undef @@ -8281,14 +9483,14 @@ module.exports = !$assign || __webpack_require__(17)(function () { /***/ }), -/* 178 */ +/* 216 */ /***/ (function(module, exports, __webpack_require__) { -var dP = __webpack_require__(14); -var anObject = __webpack_require__(24); -var getKeys = __webpack_require__(26); +var dP = __webpack_require__(15); +var anObject = __webpack_require__(29); +var getKeys = __webpack_require__(30); -module.exports = __webpack_require__(11) ? Object.defineProperties : function defineProperties(O, Properties) { +module.exports = __webpack_require__(12) ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var keys = getKeys(Properties); var length = keys.length; @@ -8300,12 +9502,12 @@ module.exports = __webpack_require__(11) ? Object.defineProperties : function de /***/ }), -/* 179 */ +/* 217 */ /***/ (function(module, exports, __webpack_require__) { // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window -var toIObject = __webpack_require__(19); -var gOPN = __webpack_require__(94).f; +var toIObject = __webpack_require__(23); +var gOPN = __webpack_require__(120).f; var toString = {}.toString; var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames @@ -8325,13 +9527,13 @@ module.exports.f = function getOwnPropertyNames(it) { /***/ }), -/* 180 */ +/* 218 */ /***/ (function(module, exports, __webpack_require__) { // Works with __proto__ only. Old v8 can't work with null proto objects. /* eslint-disable no-proto */ -var isObject = __webpack_require__(25); -var anObject = __webpack_require__(24); +var isObject = __webpack_require__(22); +var anObject = __webpack_require__(29); var check = function (O, proto) { anObject(O); if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); @@ -8340,7 +9542,7 @@ module.exports = { set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line function (test, buggy, set) { try { - set = __webpack_require__(88)(Function.call, __webpack_require__(93).f(Object.prototype, '__proto__').set, 2); + set = __webpack_require__(114)(Function.call, __webpack_require__(119).f(Object.prototype, '__proto__').set, 2); set(test, []); buggy = !(test instanceof Array); } catch (e) { buggy = true; } @@ -8356,11 +9558,11 @@ module.exports = { /***/ }), -/* 181 */ +/* 219 */ /***/ (function(module, exports, __webpack_require__) { -var toInteger = __webpack_require__(59); -var defined = __webpack_require__(50); +var toInteger = __webpack_require__(70); +var defined = __webpack_require__(62); // true -> String#at // false -> String#codePointAt module.exports = function (TO_STRING) { @@ -8379,10 +9581,10 @@ module.exports = function (TO_STRING) { /***/ }), -/* 182 */ +/* 220 */ /***/ (function(module, exports, __webpack_require__) { -var toInteger = __webpack_require__(59); +var toInteger = __webpack_require__(70); var max = Math.max; var min = Math.min; module.exports = function (index, length) { @@ -8392,11 +9594,11 @@ module.exports = function (index, length) { /***/ }), -/* 183 */ +/* 221 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.15 ToLength -var toInteger = __webpack_require__(59); +var toInteger = __webpack_require__(70); var min = Math.min; module.exports = function (it) { return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 @@ -8404,21 +9606,21 @@ module.exports = function (it) { /***/ }), -/* 184 */ +/* 222 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var addToUnscopables = __webpack_require__(169); -var step = __webpack_require__(175); -var Iterators = __webpack_require__(52); -var toIObject = __webpack_require__(19); +var addToUnscopables = __webpack_require__(207); +var step = __webpack_require__(213); +var Iterators = __webpack_require__(64); +var toIObject = __webpack_require__(23); // 22.1.3.4 Array.prototype.entries() // 22.1.3.13 Array.prototype.keys() // 22.1.3.29 Array.prototype.values() // 22.1.3.30 Array.prototype[@@iterator]() -module.exports = __webpack_require__(92)(Array, 'Array', function (iterated, kind) { +module.exports = __webpack_require__(118)(Array, 'Array', function (iterated, kind) { this._t = toIObject(iterated); // target this._i = 0; // next index this._k = kind; // kind @@ -8445,42 +9647,42 @@ addToUnscopables('entries'); /***/ }), -/* 185 */ +/* 223 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.3.1 Object.assign(target, source) -var $export = __webpack_require__(12); +var $export = __webpack_require__(13); -$export($export.S + $export.F, 'Object', { assign: __webpack_require__(177) }); +$export($export.S + $export.F, 'Object', { assign: __webpack_require__(215) }); /***/ }), -/* 186 */ +/* 224 */ /***/ (function(module, exports, __webpack_require__) { -var $export = __webpack_require__(12); +var $export = __webpack_require__(13); // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) -$export($export.S, 'Object', { create: __webpack_require__(54) }); +$export($export.S, 'Object', { create: __webpack_require__(65) }); /***/ }), -/* 187 */ +/* 225 */ /***/ (function(module, exports, __webpack_require__) { -var $export = __webpack_require__(12); +var $export = __webpack_require__(13); // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) -$export($export.S + $export.F * !__webpack_require__(11), 'Object', { defineProperty: __webpack_require__(14).f }); +$export($export.S + $export.F * !__webpack_require__(12), 'Object', { defineProperty: __webpack_require__(15).f }); /***/ }), -/* 188 */ +/* 226 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.9 Object.getPrototypeOf(O) -var toObject = __webpack_require__(40); -var $getPrototypeOf = __webpack_require__(95); +var toObject = __webpack_require__(44); +var $getPrototypeOf = __webpack_require__(121); -__webpack_require__(97)('getPrototypeOf', function () { +__webpack_require__(123)('getPrototypeOf', function () { return function getPrototypeOf(it) { return $getPrototypeOf(toObject(it)); }; @@ -8488,14 +9690,14 @@ __webpack_require__(97)('getPrototypeOf', function () { /***/ }), -/* 189 */ +/* 227 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.14 Object.keys(O) -var toObject = __webpack_require__(40); -var $keys = __webpack_require__(26); +var toObject = __webpack_require__(44); +var $keys = __webpack_require__(30); -__webpack_require__(97)('keys', function () { +__webpack_require__(123)('keys', function () { return function keys(it) { return $keys(toObject(it)); }; @@ -8503,30 +9705,30 @@ __webpack_require__(97)('keys', function () { /***/ }), -/* 190 */ +/* 228 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.3.19 Object.setPrototypeOf(O, proto) -var $export = __webpack_require__(12); -$export($export.S, 'Object', { setPrototypeOf: __webpack_require__(180).set }); +var $export = __webpack_require__(13); +$export($export.S, 'Object', { setPrototypeOf: __webpack_require__(218).set }); /***/ }), -/* 191 */ +/* 229 */ /***/ (function(module, exports) { /***/ }), -/* 192 */ +/* 230 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var $at = __webpack_require__(181)(true); +var $at = __webpack_require__(219)(true); // 21.1.3.27 String.prototype[@@iterator]() -__webpack_require__(92)(String, 'String', function (iterated) { +__webpack_require__(118)(String, 'String', function (iterated) { this._t = String(iterated); // target this._i = 0; // next index // 21.1.5.2.1 %StringIteratorPrototype%.next() @@ -8542,36 +9744,37 @@ __webpack_require__(92)(String, 'String', function (iterated) { /***/ }), -/* 193 */ +/* 231 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // ECMAScript 6 symbols shim -var global = __webpack_require__(10); -var has = __webpack_require__(13); -var DESCRIPTORS = __webpack_require__(11); -var $export = __webpack_require__(12); -var redefine = __webpack_require__(98); -var META = __webpack_require__(176).KEY; -var $fails = __webpack_require__(17); -var shared = __webpack_require__(58); -var setToStringTag = __webpack_require__(56); -var uid = __webpack_require__(41); -var wks = __webpack_require__(20); -var wksExt = __webpack_require__(62); -var wksDefine = __webpack_require__(61); -var enumKeys = __webpack_require__(171); -var isArray = __webpack_require__(173); -var anObject = __webpack_require__(24); -var toIObject = __webpack_require__(19); -var toPrimitive = __webpack_require__(60); -var createDesc = __webpack_require__(39); -var _create = __webpack_require__(54); -var gOPNExt = __webpack_require__(179); -var $GOPD = __webpack_require__(93); -var $DP = __webpack_require__(14); -var $keys = __webpack_require__(26); +var global = __webpack_require__(9); +var has = __webpack_require__(14); +var DESCRIPTORS = __webpack_require__(12); +var $export = __webpack_require__(13); +var redefine = __webpack_require__(124); +var META = __webpack_require__(214).KEY; +var $fails = __webpack_require__(20); +var shared = __webpack_require__(69); +var setToStringTag = __webpack_require__(67); +var uid = __webpack_require__(45); +var wks = __webpack_require__(24); +var wksExt = __webpack_require__(73); +var wksDefine = __webpack_require__(72); +var enumKeys = __webpack_require__(209); +var isArray = __webpack_require__(211); +var anObject = __webpack_require__(29); +var isObject = __webpack_require__(22); +var toIObject = __webpack_require__(23); +var toPrimitive = __webpack_require__(71); +var createDesc = __webpack_require__(43); +var _create = __webpack_require__(65); +var gOPNExt = __webpack_require__(217); +var $GOPD = __webpack_require__(119); +var $DP = __webpack_require__(15); +var $keys = __webpack_require__(30); var gOPD = $GOPD.f; var dP = $DP.f; var gOPN = gOPNExt.f; @@ -8694,11 +9897,11 @@ if (!USE_NATIVE) { $GOPD.f = $getOwnPropertyDescriptor; $DP.f = $defineProperty; - __webpack_require__(94).f = gOPNExt.f = $getOwnPropertyNames; - __webpack_require__(38).f = $propertyIsEnumerable; - __webpack_require__(55).f = $getOwnPropertySymbols; + __webpack_require__(120).f = gOPNExt.f = $getOwnPropertyNames; + __webpack_require__(42).f = $propertyIsEnumerable; + __webpack_require__(66).f = $getOwnPropertySymbols; - if (DESCRIPTORS && !__webpack_require__(53)) { + if (DESCRIPTORS && !__webpack_require__(41)) { redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); } @@ -8756,15 +9959,14 @@ $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () { return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; })), 'JSON', { stringify: function stringify(it) { - if (it === undefined || isSymbol(it)) return; // IE8 returns string on undefined var args = [it]; var i = 1; var replacer, $replacer; while (arguments.length > i) args.push(arguments[i++]); - replacer = args[1]; - if (typeof replacer == 'function') $replacer = replacer; - if ($replacer || !isArray(replacer)) replacer = function (key, value) { - if ($replacer) value = $replacer.call(this, key, value); + $replacer = replacer = args[1]; + if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined + if (!isArray(replacer)) replacer = function (key, value) { + if (typeof $replacer == 'function') value = $replacer.call(this, key, value); if (!isSymbol(value)) return value; }; args[1] = replacer; @@ -8773,7 +9975,7 @@ $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () { }); // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) -$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(18)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); +$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(21)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); // 19.4.3.5 Symbol.prototype[@@toStringTag] setToStringTag($Symbol, 'Symbol'); // 20.2.1.9 Math[@@toStringTag] @@ -8783,28 +9985,28 @@ setToStringTag(global.JSON, 'JSON', true); /***/ }), -/* 194 */ +/* 232 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(61)('asyncIterator'); +__webpack_require__(72)('asyncIterator'); /***/ }), -/* 195 */ +/* 233 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(61)('observable'); +__webpack_require__(72)('observable'); /***/ }), -/* 196 */ +/* 234 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(184); -var global = __webpack_require__(10); -var hide = __webpack_require__(18); -var Iterators = __webpack_require__(52); -var TO_STRING_TAG = __webpack_require__(20)('toStringTag'); +__webpack_require__(222); +var global = __webpack_require__(9); +var hide = __webpack_require__(21); +var Iterators = __webpack_require__(64); +var TO_STRING_TAG = __webpack_require__(24)('toStringTag'); var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' + 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' + @@ -8822,7 +10024,7 @@ for (var i = 0; i < DOMIterables.length; i++) { /***/ }), -/* 197 */ +/* 235 */ /***/ (function(module, exports, __webpack_require__) { /*! @@ -8833,7 +10035,7 @@ for (var i = 0; i < DOMIterables.length; i++) { !function (root, name, definition) { if (typeof module != 'undefined' && module.exports) module.exports = definition() - else if (true) __webpack_require__(355)(name, definition) + else if (true) __webpack_require__(461)(name, definition) else root[name] = definition() }(this, 'bowser', function () { /** @@ -9448,38 +10650,12 @@ for (var i = 0; i < DOMIterables.length; i++) { /***/ }), -/* 198 */ -/***/ (function(module, exports) { - - -module.exports = function chain(){ - var len = arguments.length - var args = []; - - for (var i = 0; i < len; i++) - args[i] = arguments[i] - - args = args.filter(function(fn){ return fn != null }) - - if (args.length === 0) return undefined - if (args.length === 1) return args[0] - - return args.reduce(function(current, next){ - return function chainedFunction() { - current.apply(this, arguments); - next.apply(this, arguments); - }; - }) -} - - -/***/ }), -/* 199 */ +/* 236 */ /***/ (function(module, exports, __webpack_require__) { var pSlice = Array.prototype.slice; -var objectKeys = __webpack_require__(201); -var isArguments = __webpack_require__(200); +var objectKeys = __webpack_require__(238); +var isArguments = __webpack_require__(237); var deepEqual = module.exports = function (actual, expected, opts) { if (!opts) opts = {}; @@ -9574,7 +10750,7 @@ function objEquiv(a, b, opts) { /***/ }), -/* 200 */ +/* 237 */ /***/ (function(module, exports) { var supportsArgumentsClass = (function(){ @@ -9600,7 +10776,7 @@ function unsupported(object){ /***/ }), -/* 201 */ +/* 238 */ /***/ (function(module, exports) { exports = module.exports = typeof Object.keys === 'function' @@ -9615,7 +10791,7 @@ function shim (obj) { /***/ }), -/* 202 */ +/* 239 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/*! @@ -9662,7 +10838,7 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/*! /***/ }), -/* 203 */ +/* 240 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9697,7 +10873,7 @@ function camelize(string) { module.exports = camelize; /***/ }), -/* 204 */ +/* 241 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9712,7 +10888,7 @@ module.exports = camelize; -var camelize = __webpack_require__(203); +var camelize = __webpack_require__(240); var msPattern = /^-ms-/; @@ -9740,7 +10916,7 @@ function camelizeStyleName(string) { module.exports = camelizeStyleName; /***/ }), -/* 205 */ +/* 242 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9776,7 +10952,7 @@ function hyphenate(string) { module.exports = hyphenate; /***/ }), -/* 206 */ +/* 243 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9791,7 +10967,7 @@ module.exports = hyphenate; -var hyphenate = __webpack_require__(205); +var hyphenate = __webpack_require__(242); var msPattern = /^ms-/; @@ -9818,7 +10994,7 @@ function hyphenateStyleName(string) { module.exports = hyphenateStyleName; /***/ }), -/* 207 */ +/* 244 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9846,7 +11022,7 @@ function isNode(object) { module.exports = isNode; /***/ }), -/* 208 */ +/* 245 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9861,7 +11037,7 @@ module.exports = isNode; * @typechecks */ -var isNode = __webpack_require__(207); +var isNode = __webpack_require__(244); /** * @param {*} object The object to check. @@ -9874,7 +11050,7 @@ function isTextNode(object) { module.exports = isTextNode; /***/ }), -/* 209 */ +/* 246 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9890,19 +11066,19 @@ var _warning = __webpack_require__(3); var _warning2 = _interopRequireDefault(_warning); -var _invariant = __webpack_require__(4); +var _invariant = __webpack_require__(6); var _invariant2 = _interopRequireDefault(_invariant); -var _LocationUtils = __webpack_require__(63); +var _LocationUtils = __webpack_require__(74); -var _PathUtils = __webpack_require__(28); +var _PathUtils = __webpack_require__(31); -var _createTransitionManager = __webpack_require__(64); +var _createTransitionManager = __webpack_require__(75); var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager); -var _DOMUtils = __webpack_require__(103); +var _DOMUtils = __webpack_require__(129); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -10187,7 +11363,7 @@ var createBrowserHistory = function createBrowserHistory() { exports.default = createBrowserHistory; /***/ }), -/* 210 */ +/* 247 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10201,19 +11377,19 @@ var _warning = __webpack_require__(3); var _warning2 = _interopRequireDefault(_warning); -var _invariant = __webpack_require__(4); +var _invariant = __webpack_require__(6); var _invariant2 = _interopRequireDefault(_invariant); -var _LocationUtils = __webpack_require__(63); +var _LocationUtils = __webpack_require__(74); -var _PathUtils = __webpack_require__(28); +var _PathUtils = __webpack_require__(31); -var _createTransitionManager = __webpack_require__(64); +var _createTransitionManager = __webpack_require__(75); var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager); -var _DOMUtils = __webpack_require__(103); +var _DOMUtils = __webpack_require__(129); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -10517,7 +11693,7 @@ var createHashHistory = function createHashHistory() { exports.default = createHashHistory; /***/ }), -/* 211 */ +/* 248 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10533,11 +11709,11 @@ var _warning = __webpack_require__(3); var _warning2 = _interopRequireDefault(_warning); -var _PathUtils = __webpack_require__(28); +var _PathUtils = __webpack_require__(31); -var _LocationUtils = __webpack_require__(63); +var _LocationUtils = __webpack_require__(74); -var _createTransitionManager = __webpack_require__(64); +var _createTransitionManager = __webpack_require__(75); var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager); @@ -10693,18 +11869,18 @@ var createMemoryHistory = function createMemoryHistory() { exports.default = createMemoryHistory; /***/ }), -/* 212 */ +/* 249 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_warning__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_warning___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_warning__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_invariant__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_invariant__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_invariant___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_invariant__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__LocationUtils__ = __webpack_require__(45); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__PathUtils__ = __webpack_require__(29); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__createTransitionManager__ = __webpack_require__(65); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__DOMUtils__ = __webpack_require__(104); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__LocationUtils__ = __webpack_require__(49); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__PathUtils__ = __webpack_require__(32); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__createTransitionManager__ = __webpack_require__(76); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__DOMUtils__ = __webpack_require__(130); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _extends = Object.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; }; @@ -10997,18 +12173,18 @@ var createBrowserHistory = function createBrowserHistory() { /* unused harmony default export */ var _unused_webpack_default_export = (createBrowserHistory); /***/ }), -/* 213 */ +/* 250 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_warning__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_warning___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_warning__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_invariant__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_invariant__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_invariant___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_invariant__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__LocationUtils__ = __webpack_require__(45); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__PathUtils__ = __webpack_require__(29); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__createTransitionManager__ = __webpack_require__(65); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__DOMUtils__ = __webpack_require__(104); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__LocationUtils__ = __webpack_require__(49); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__PathUtils__ = __webpack_require__(32); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__createTransitionManager__ = __webpack_require__(76); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__DOMUtils__ = __webpack_require__(130); var _extends = Object.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; }; @@ -11318,15 +12494,15 @@ var createHashHistory = function createHashHistory() { /* unused harmony default export */ var _unused_webpack_default_export = (createHashHistory); /***/ }), -/* 214 */ +/* 251 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_warning__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_warning___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_warning__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__PathUtils__ = __webpack_require__(29); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__LocationUtils__ = __webpack_require__(45); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__createTransitionManager__ = __webpack_require__(65); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__PathUtils__ = __webpack_require__(32); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__LocationUtils__ = __webpack_require__(49); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__createTransitionManager__ = __webpack_require__(76); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _extends = Object.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; }; @@ -11486,20 +12662,20 @@ var createMemoryHistory = function createMemoryHistory() { /* unused harmony default export */ var _unused_webpack_default_export = (createMemoryHistory); /***/ }), -/* 215 */ +/* 252 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createBrowserHistory__ = __webpack_require__(212); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createBrowserHistory__ = __webpack_require__(249); /* unused harmony reexport createBrowserHistory */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createHashHistory__ = __webpack_require__(213); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createHashHistory__ = __webpack_require__(250); /* unused harmony reexport createHashHistory */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__createMemoryHistory__ = __webpack_require__(214); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__createMemoryHistory__ = __webpack_require__(251); /* unused harmony reexport createMemoryHistory */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__LocationUtils__ = __webpack_require__(45); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__LocationUtils__ = __webpack_require__(49); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_3__LocationUtils__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_3__LocationUtils__["b"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__PathUtils__ = __webpack_require__(29); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__PathUtils__ = __webpack_require__(32); /* unused harmony reexport parsePath */ /* unused harmony reexport createPath */ @@ -11513,79 +12689,85 @@ var createMemoryHistory = function createMemoryHistory() { /***/ }), -/* 216 */ +/* 253 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; /** * Copyright 2015, Yahoo! Inc. * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. */ - - -var REACT_STATICS = { - childContextTypes: true, - contextTypes: true, - defaultProps: true, - displayName: true, - getDefaultProps: true, - mixins: true, - propTypes: true, - type: true -}; - -var KNOWN_STATICS = { - name: true, - length: true, - prototype: true, - caller: true, - callee: true, - arguments: true, - arity: true -}; - -var defineProperty = Object.defineProperty; -var getOwnPropertyNames = Object.getOwnPropertyNames; -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; -var getPrototypeOf = Object.getPrototypeOf; -var objectPrototype = getPrototypeOf && getPrototypeOf(Object); - -module.exports = function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { - if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components - - if (objectPrototype) { - var inheritedComponent = getPrototypeOf(sourceComponent); - if (inheritedComponent && inheritedComponent !== objectPrototype) { - hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); +(function (global, factory) { + true ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.hoistNonReactStatics = factory()); +}(this, (function () { + 'use strict'; + + var REACT_STATICS = { + childContextTypes: true, + contextTypes: true, + defaultProps: true, + displayName: true, + getDefaultProps: true, + getDerivedStateFromProps: true, + mixins: true, + propTypes: true, + type: true + }; + + var KNOWN_STATICS = { + name: true, + length: true, + prototype: true, + caller: true, + callee: true, + arguments: true, + arity: true + }; + + var defineProperty = Object.defineProperty; + var getOwnPropertyNames = Object.getOwnPropertyNames; + var getOwnPropertySymbols = Object.getOwnPropertySymbols; + var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + var getPrototypeOf = Object.getPrototypeOf; + var objectPrototype = getPrototypeOf && getPrototypeOf(Object); + + return function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { + if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components + + if (objectPrototype) { + var inheritedComponent = getPrototypeOf(sourceComponent); + if (inheritedComponent && inheritedComponent !== objectPrototype) { + hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); + } } - } - - var keys = getOwnPropertyNames(sourceComponent); - - if (getOwnPropertySymbols) { - keys = keys.concat(getOwnPropertySymbols(sourceComponent)); - } - - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) { - var descriptor = getOwnPropertyDescriptor(sourceComponent, key); - try { // Avoid failures from read-only properties - defineProperty(targetComponent, key, descriptor); - } catch (e) {} + + var keys = getOwnPropertyNames(sourceComponent); + + if (getOwnPropertySymbols) { + keys = keys.concat(getOwnPropertySymbols(sourceComponent)); + } + + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) { + var descriptor = getOwnPropertyDescriptor(sourceComponent, key); + try { // Avoid failures from read-only properties + defineProperty(targetComponent, key, descriptor); + } catch (e) {} + } } + + return targetComponent; } - + return targetComponent; - } - - return targetComponent; -}; + }; +}))); /***/ }), -/* 217 */ +/* 254 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11599,67 +12781,67 @@ var _createClass = function () { function defineProperties(target, props) { for // special flexbox specifications -var _prefixAll2 = __webpack_require__(238); +var _prefixAll2 = __webpack_require__(275); var _prefixAll3 = _interopRequireDefault(_prefixAll2); -var _getBrowserInformation = __webpack_require__(239); +var _getBrowserInformation = __webpack_require__(276); var _getBrowserInformation2 = _interopRequireDefault(_getBrowserInformation); -var _getPrefixedKeyframes = __webpack_require__(240); +var _getPrefixedKeyframes = __webpack_require__(277); var _getPrefixedKeyframes2 = _interopRequireDefault(_getPrefixedKeyframes); -var _capitalizeString = __webpack_require__(66); +var _capitalizeString = __webpack_require__(77); var _capitalizeString2 = _interopRequireDefault(_capitalizeString); -var _sortPrefixedStyle = __webpack_require__(107); +var _sortPrefixedStyle = __webpack_require__(133); var _sortPrefixedStyle2 = _interopRequireDefault(_sortPrefixedStyle); -var _prefixProps = __webpack_require__(228); +var _prefixProps = __webpack_require__(265); var _prefixProps2 = _interopRequireDefault(_prefixProps); -var _position = __webpack_require__(224); +var _position = __webpack_require__(261); var _position2 = _interopRequireDefault(_position); -var _calc = __webpack_require__(218); +var _calc = __webpack_require__(255); var _calc2 = _interopRequireDefault(_calc); -var _zoomCursor = __webpack_require__(227); +var _zoomCursor = __webpack_require__(264); var _zoomCursor2 = _interopRequireDefault(_zoomCursor); -var _grabCursor = __webpack_require__(222); +var _grabCursor = __webpack_require__(259); var _grabCursor2 = _interopRequireDefault(_grabCursor); -var _flex = __webpack_require__(219); +var _flex = __webpack_require__(256); var _flex2 = _interopRequireDefault(_flex); -var _sizing = __webpack_require__(225); +var _sizing = __webpack_require__(262); var _sizing2 = _interopRequireDefault(_sizing); -var _gradient = __webpack_require__(223); +var _gradient = __webpack_require__(260); var _gradient2 = _interopRequireDefault(_gradient); -var _transition = __webpack_require__(226); +var _transition = __webpack_require__(263); var _transition2 = _interopRequireDefault(_transition); -var _flexboxIE = __webpack_require__(220); +var _flexboxIE = __webpack_require__(257); var _flexboxIE2 = _interopRequireDefault(_flexboxIE); -var _flexboxOld = __webpack_require__(221); +var _flexboxOld = __webpack_require__(258); var _flexboxOld2 = _interopRequireDefault(_flexboxOld); @@ -11820,7 +13002,7 @@ function assignStyles(base) { module.exports = exports['default']; /***/ }), -/* 218 */ +/* 255 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11831,7 +13013,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = calc; -var _getPrefixedValue = __webpack_require__(7); +var _getPrefixedValue = __webpack_require__(8); var _getPrefixedValue2 = _interopRequireDefault(_getPrefixedValue); @@ -11855,7 +13037,7 @@ function calc(_ref) { module.exports = exports['default']; /***/ }), -/* 219 */ +/* 256 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11866,7 +13048,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = flex; -var _getPrefixedValue = __webpack_require__(7); +var _getPrefixedValue = __webpack_require__(8); var _getPrefixedValue2 = _interopRequireDefault(_getPrefixedValue); @@ -11892,7 +13074,7 @@ function flex(_ref) { module.exports = exports['default']; /***/ }), -/* 220 */ +/* 257 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11903,7 +13085,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = flexboxIE; -var _getPrefixedValue = __webpack_require__(7); +var _getPrefixedValue = __webpack_require__(8); var _getPrefixedValue2 = _interopRequireDefault(_getPrefixedValue); @@ -11957,7 +13139,7 @@ function flexboxIE(_ref) { module.exports = exports['default']; /***/ }), -/* 221 */ +/* 258 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11968,7 +13150,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = flexboxOld; -var _getPrefixedValue = __webpack_require__(7); +var _getPrefixedValue = __webpack_require__(8); var _getPrefixedValue2 = _interopRequireDefault(_getPrefixedValue); @@ -12029,7 +13211,7 @@ function flexboxOld(_ref) { module.exports = exports['default']; /***/ }), -/* 222 */ +/* 259 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12040,7 +13222,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = grabCursor; -var _getPrefixedValue = __webpack_require__(7); +var _getPrefixedValue = __webpack_require__(8); var _getPrefixedValue2 = _interopRequireDefault(_getPrefixedValue); @@ -12065,7 +13247,7 @@ function grabCursor(_ref) { module.exports = exports['default']; /***/ }), -/* 223 */ +/* 260 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12076,7 +13258,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = gradient; -var _getPrefixedValue = __webpack_require__(7); +var _getPrefixedValue = __webpack_require__(8); var _getPrefixedValue2 = _interopRequireDefault(_getPrefixedValue); @@ -12102,7 +13284,7 @@ function gradient(_ref) { module.exports = exports['default']; /***/ }), -/* 224 */ +/* 261 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12113,7 +13295,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = position; -var _getPrefixedValue = __webpack_require__(7); +var _getPrefixedValue = __webpack_require__(8); var _getPrefixedValue2 = _interopRequireDefault(_getPrefixedValue); @@ -12135,7 +13317,7 @@ function position(_ref) { module.exports = exports['default']; /***/ }), -/* 225 */ +/* 262 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12146,7 +13328,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = sizing; -var _getPrefixedValue = __webpack_require__(7); +var _getPrefixedValue = __webpack_require__(8); var _getPrefixedValue2 = _interopRequireDefault(_getPrefixedValue); @@ -12186,7 +13368,7 @@ function sizing(_ref) { module.exports = exports['default']; /***/ }), -/* 226 */ +/* 263 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12200,11 +13382,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol exports.default = transition; -var _hyphenateStyleName = __webpack_require__(105); +var _hyphenateStyleName = __webpack_require__(131); var _hyphenateStyleName2 = _interopRequireDefault(_hyphenateStyleName); -var _unprefixProperty = __webpack_require__(242); +var _unprefixProperty = __webpack_require__(279); var _unprefixProperty2 = _interopRequireDefault(_unprefixProperty); @@ -12253,7 +13435,7 @@ function transition(_ref) { module.exports = exports['default']; /***/ }), -/* 227 */ +/* 264 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12264,7 +13446,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = zoomCursor; -var _getPrefixedValue = __webpack_require__(7); +var _getPrefixedValue = __webpack_require__(8); var _getPrefixedValue2 = _interopRequireDefault(_getPrefixedValue); @@ -12290,7 +13472,7 @@ function zoomCursor(_ref) { module.exports = exports['default']; /***/ }), -/* 228 */ +/* 265 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12303,7 +13485,7 @@ exports.default = { "chrome": { "transform": 35, "transformOrigin": 35, "transfo module.exports = exports["default"]; /***/ }), -/* 229 */ +/* 266 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12314,11 +13496,11 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = calc; -var _joinPrefixedValue = __webpack_require__(46); +var _joinPrefixedValue = __webpack_require__(50); var _joinPrefixedValue2 = _interopRequireDefault(_joinPrefixedValue); -var _isPrefixedValue = __webpack_require__(67); +var _isPrefixedValue = __webpack_require__(78); var _isPrefixedValue2 = _interopRequireDefault(_isPrefixedValue); @@ -12334,7 +13516,7 @@ function calc(property, value) { module.exports = exports['default']; /***/ }), -/* 230 */ +/* 267 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12345,7 +13527,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = cursor; -var _joinPrefixedValue = __webpack_require__(46); +var _joinPrefixedValue = __webpack_require__(50); var _joinPrefixedValue2 = _interopRequireDefault(_joinPrefixedValue); @@ -12366,7 +13548,7 @@ function cursor(property, value) { module.exports = exports['default']; /***/ }), -/* 231 */ +/* 268 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12388,7 +13570,7 @@ function flex(property, value) { module.exports = exports['default']; /***/ }), -/* 232 */ +/* 269 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12426,7 +13608,7 @@ function flexboxIE(property, value) { module.exports = exports['default']; /***/ }), -/* 233 */ +/* 270 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12468,7 +13650,7 @@ function flexboxOld(property, value) { module.exports = exports['default']; /***/ }), -/* 234 */ +/* 271 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12479,11 +13661,11 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = gradient; -var _joinPrefixedValue = __webpack_require__(46); +var _joinPrefixedValue = __webpack_require__(50); var _joinPrefixedValue2 = _interopRequireDefault(_joinPrefixedValue); -var _isPrefixedValue = __webpack_require__(67); +var _isPrefixedValue = __webpack_require__(78); var _isPrefixedValue2 = _interopRequireDefault(_isPrefixedValue); @@ -12499,7 +13681,7 @@ function gradient(property, value) { module.exports = exports['default']; /***/ }), -/* 235 */ +/* 272 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12517,7 +13699,7 @@ function position(property, value) { module.exports = exports['default']; /***/ }), -/* 236 */ +/* 273 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12528,7 +13710,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = sizing; -var _joinPrefixedValue = __webpack_require__(46); +var _joinPrefixedValue = __webpack_require__(50); var _joinPrefixedValue2 = _interopRequireDefault(_joinPrefixedValue); @@ -12559,7 +13741,7 @@ function sizing(property, value) { module.exports = exports['default']; /***/ }), -/* 237 */ +/* 274 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12570,19 +13752,19 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = transition; -var _hyphenateStyleName = __webpack_require__(105); +var _hyphenateStyleName = __webpack_require__(131); var _hyphenateStyleName2 = _interopRequireDefault(_hyphenateStyleName); -var _capitalizeString = __webpack_require__(66); +var _capitalizeString = __webpack_require__(77); var _capitalizeString2 = _interopRequireDefault(_capitalizeString); -var _isPrefixedValue = __webpack_require__(67); +var _isPrefixedValue = __webpack_require__(78); var _isPrefixedValue2 = _interopRequireDefault(_isPrefixedValue); -var _prefixProps = __webpack_require__(106); +var _prefixProps = __webpack_require__(132); var _prefixProps2 = _interopRequireDefault(_prefixProps); @@ -12647,7 +13829,7 @@ function prefixValue(value) { module.exports = exports['default']; /***/ }), -/* 238 */ +/* 275 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12658,51 +13840,51 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = prefixAll; -var _prefixProps = __webpack_require__(106); +var _prefixProps = __webpack_require__(132); var _prefixProps2 = _interopRequireDefault(_prefixProps); -var _capitalizeString = __webpack_require__(66); +var _capitalizeString = __webpack_require__(77); var _capitalizeString2 = _interopRequireDefault(_capitalizeString); -var _sortPrefixedStyle = __webpack_require__(107); +var _sortPrefixedStyle = __webpack_require__(133); var _sortPrefixedStyle2 = _interopRequireDefault(_sortPrefixedStyle); -var _position = __webpack_require__(235); +var _position = __webpack_require__(272); var _position2 = _interopRequireDefault(_position); -var _calc = __webpack_require__(229); +var _calc = __webpack_require__(266); var _calc2 = _interopRequireDefault(_calc); -var _cursor = __webpack_require__(230); +var _cursor = __webpack_require__(267); var _cursor2 = _interopRequireDefault(_cursor); -var _flex = __webpack_require__(231); +var _flex = __webpack_require__(268); var _flex2 = _interopRequireDefault(_flex); -var _sizing = __webpack_require__(236); +var _sizing = __webpack_require__(273); var _sizing2 = _interopRequireDefault(_sizing); -var _gradient = __webpack_require__(234); +var _gradient = __webpack_require__(271); var _gradient2 = _interopRequireDefault(_gradient); -var _transition = __webpack_require__(237); +var _transition = __webpack_require__(274); var _transition2 = _interopRequireDefault(_transition); -var _flexboxIE = __webpack_require__(232); +var _flexboxIE = __webpack_require__(269); var _flexboxIE2 = _interopRequireDefault(_flexboxIE); -var _flexboxOld = __webpack_require__(233); +var _flexboxOld = __webpack_require__(270); var _flexboxOld2 = _interopRequireDefault(_flexboxOld); @@ -12768,7 +13950,7 @@ function assignStyles(base) { module.exports = exports['default']; /***/ }), -/* 239 */ +/* 276 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12778,7 +13960,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _bowser = __webpack_require__(197); +var _bowser = __webpack_require__(235); var _bowser2 = _interopRequireDefault(_bowser); @@ -12882,7 +14064,7 @@ exports.default = function (userAgent) { module.exports = exports['default']; /***/ }), -/* 240 */ +/* 277 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12908,7 +14090,7 @@ exports.default = function (_ref) { module.exports = exports['default']; /***/ }), -/* 241 */ +/* 278 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12925,7 +14107,7 @@ exports.default = function (property) { module.exports = exports["default"]; /***/ }), -/* 242 */ +/* 279 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12943,389 +14125,20 @@ exports.default = function (property) { module.exports = exports['default']; /***/ }), -/* 243 */ -/***/ (function(module, exports) { - -/** - * lodash 3.9.1 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** `Object#toString` result references. */ -var funcTag = '[object Function]'; - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** - * Checks if `value` is object-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to resolve the decompiled source of functions. */ -var fnToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; -} - -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in older versions of Chrome and Safari which return 'function' for regexes - // and Safari 8 equivalents which return 'object' for typed array constructors. - return isObject(value) && objToString.call(value) == funcTag; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(fnToString.call(value)); - } - return isObjectLike(value) && reIsHostCtor.test(value); -} - -module.exports = getNative; - - -/***/ }), -/* 244 */ +/* 280 */ /***/ (function(module, exports) { -/** - * lodash (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ - -/** Used as references for various `Number` constants. */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Built-in value references. */ -var propertyIsEnumerable = objectProto.propertyIsEnumerable; - -/** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ -function isArguments(value) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. - return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && - (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); -} - -/** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ -function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); -} - -/** - * This method is like `_.isArrayLike` except that it also checks if `value` - * is an object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, - * else `false`. - * @example - * - * _.isArrayLikeObject([1, 2, 3]); - * // => true - * - * _.isArrayLikeObject(document.body.children); - * // => true - * - * _.isArrayLikeObject('abc'); - * // => false - * - * _.isArrayLikeObject(_.noop); - * // => false - */ -function isArrayLikeObject(value) { - return isObjectLike(value) && isArrayLike(value); -} - -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8-9 which returns 'object' for typed array and other constructors. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; -} - -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ -function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - -/** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -module.exports = isArguments; +module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; +}; /***/ }), -/* 245 */ +/* 281 */ /***/ (function(module, exports) { /** - * lodash 3.0.4 (Custom Build) + * lodash 3.9.1 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -13334,8 +14147,386 @@ module.exports = isArguments; */ /** `Object#toString` result references. */ -var arrayTag = '[object Array]', - funcTag = '[object Function]'; +var funcTag = '[object Function]'; + +/** Used to detect host constructors (Safari > 5). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var fnToString = Function.prototype.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = object == null ? undefined : object[key]; + return isNative(value) ? value : undefined; +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in older versions of Chrome and Safari which return 'function' for regexes + // and Safari 8 equivalents which return 'object' for typed array constructors. + return isObject(value) && objToString.call(value) == funcTag; +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ +function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ +function isNative(value) { + if (value == null) { + return false; + } + if (isFunction(value)) { + return reIsNative.test(fnToString.call(value)); + } + return isObjectLike(value) && reIsHostCtor.test(value); +} + +module.exports = getNative; + + +/***/ }), +/* 282 */ +/***/ (function(module, exports) { + +/** + * lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright jQuery Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8-9 which returns 'object' for typed array and other constructors. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +module.exports = isArguments; + + +/***/ }), +/* 283 */ +/***/ (function(module, exports) { + +/** + * lodash 3.0.4 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** `Object#toString` result references. */ +var arrayTag = '[object Array]', + funcTag = '[object Function]'; /** Used to detect host constructors (Safari > 5). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; @@ -13507,7 +14698,7 @@ module.exports = isArray; /***/ }), -/* 246 */ +/* 284 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -13518,9 +14709,9 @@ module.exports = isArray; * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var getNative = __webpack_require__(243), - isArguments = __webpack_require__(244), - isArray = __webpack_require__(245); +var getNative = __webpack_require__(281), + isArguments = __webpack_require__(282), + isArray = __webpack_require__(283); /** Used to detect unsigned integer values. */ var reIsUint = /^\d+$/; @@ -13749,20740 +14940,23161 @@ module.exports = keys; /***/ }), -/* 247 */ +/* 285 */ /***/ (function(module, exports, __webpack_require__) { -var isarray = __webpack_require__(248) +var getNative = __webpack_require__(18), + root = __webpack_require__(7); -/** - * Expose `pathToRegexp`. - */ -module.exports = pathToRegexp -module.exports.parse = parse -module.exports.compile = compile -module.exports.tokensToFunction = tokensToFunction -module.exports.tokensToRegExp = tokensToRegExp +/* Built-in method references that are verified to be native. */ +var DataView = getNative(root, 'DataView'); -/** - * The main path matching regexp utility. - * - * @type {RegExp} - */ -var PATH_REGEXP = new RegExp([ - // Match escaped characters that would otherwise appear in future matches. - // This allows the user to escape special characters that won't transform. - '(\\\\.)', - // Match Express-style parameters and un-named parameters with a prefix - // and optional suffixes. Matches appear as: - // - // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined] - // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined] - // "/*" => ["/", undefined, undefined, undefined, undefined, "*"] - '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))' -].join('|'), 'g') +module.exports = DataView; + + +/***/ }), +/* 286 */ +/***/ (function(module, exports, __webpack_require__) { + +var hashClear = __webpack_require__(345), + hashDelete = __webpack_require__(346), + hashGet = __webpack_require__(347), + hashHas = __webpack_require__(348), + hashSet = __webpack_require__(349); /** - * Parse a string for the raw tokens. + * Creates a hash object. * - * @param {string} str - * @param {Object=} options - * @return {!Array} + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. */ -function parse (str, options) { - var tokens = [] - var key = 0 - var index = 0 - var path = '' - var defaultDelimiter = options && options.delimiter || '/' - var res +function Hash(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; - while ((res = PATH_REGEXP.exec(str)) != null) { - var m = res[0] - var escaped = res[1] - var offset = res.index - path += str.slice(index, offset) - index = offset + m.length + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} - // Ignore already escaped sequences. - if (escaped) { - path += escaped[1] - continue - } +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; - var next = str[index] - var prefix = res[2] - var name = res[3] - var capture = res[4] - var group = res[5] - var modifier = res[6] - var asterisk = res[7] +module.exports = Hash; - // Push the current path onto the tokens. - if (path) { - tokens.push(path) - path = '' - } - var partial = prefix != null && next != null && next !== prefix - var repeat = modifier === '+' || modifier === '*' - var optional = modifier === '?' || modifier === '*' - var delimiter = res[2] || defaultDelimiter - var pattern = capture || group +/***/ }), +/* 287 */ +/***/ (function(module, exports, __webpack_require__) { - tokens.push({ - name: name || key++, - prefix: prefix || '', - delimiter: delimiter, - optional: optional, - repeat: repeat, - partial: partial, - asterisk: !!asterisk, - pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?') - }) - } +var getNative = __webpack_require__(18), + root = __webpack_require__(7); - // Match any characters still remaining. - if (index < str.length) { - path += str.substr(index) - } +/* Built-in method references that are verified to be native. */ +var Promise = getNative(root, 'Promise'); - // If the path exists, push it onto the end. - if (path) { - tokens.push(path) - } +module.exports = Promise; - return tokens -} + +/***/ }), +/* 288 */ +/***/ (function(module, exports, __webpack_require__) { + +var getNative = __webpack_require__(18), + root = __webpack_require__(7); + +/* Built-in method references that are verified to be native. */ +var Set = getNative(root, 'Set'); + +module.exports = Set; + + +/***/ }), +/* 289 */ +/***/ (function(module, exports, __webpack_require__) { + +var MapCache = __webpack_require__(80), + setCacheAdd = __webpack_require__(373), + setCacheHas = __webpack_require__(374); /** - * Compile a string to a template function for the path. * - * @param {string} str - * @param {Object=} options - * @return {!function(Object=, Object=)} + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. */ -function compile (str, options) { - return tokensToFunction(parse(str, options)) +function SetCache(values) { + var index = -1, + length = values == null ? 0 : values.length; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } } -/** - * Prettier encoding of URI path segments. - * - * @param {string} - * @return {string} - */ -function encodeURIComponentPretty (str) { - return encodeURI(str).replace(/[\/?#]/g, function (c) { - return '%' + c.charCodeAt(0).toString(16).toUpperCase() - }) -} +// Add methods to `SetCache`. +SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; +SetCache.prototype.has = setCacheHas; -/** - * Encode the asterisk parameter. Similar to `pretty`, but allows slashes. - * - * @param {string} - * @return {string} - */ -function encodeAsterisk (str) { - return encodeURI(str).replace(/[?#]/g, function (c) { - return '%' + c.charCodeAt(0).toString(16).toUpperCase() - }) -} +module.exports = SetCache; -/** - * Expose a method for transforming tokens into the path function. - */ -function tokensToFunction (tokens) { - // Compile all the tokens into regexps. - var matches = new Array(tokens.length) - // Compile all the patterns before compilation. - for (var i = 0; i < tokens.length; i++) { - if (typeof tokens[i] === 'object') { - matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$') - } - } +/***/ }), +/* 290 */ +/***/ (function(module, exports, __webpack_require__) { - return function (obj, opts) { - var path = '' - var data = obj || {} - var options = opts || {} - var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent +var getNative = __webpack_require__(18), + root = __webpack_require__(7); - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i] +/* Built-in method references that are verified to be native. */ +var WeakMap = getNative(root, 'WeakMap'); - if (typeof token === 'string') { - path += token +module.exports = WeakMap; - continue - } - var value = data[token.name] - var segment +/***/ }), +/* 291 */ +/***/ (function(module, exports) { - if (value == null) { - if (token.optional) { - // Prepend partial segment prefixes. - if (token.partial) { - path += token.prefix - } +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} - continue - } else { - throw new TypeError('Expected "' + token.name + '" to be defined') - } - } +module.exports = apply; - if (isarray(value)) { - if (!token.repeat) { - throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`') - } - if (value.length === 0) { - if (token.optional) { - continue - } else { - throw new TypeError('Expected "' + token.name + '" to not be empty') - } - } +/***/ }), +/* 292 */ +/***/ (function(module, exports) { - for (var j = 0; j < value.length; j++) { - segment = encode(value[j]) +/** + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ +function arrayFilter(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length, + resIndex = 0, + result = []; - if (!matches[i].test(segment)) { - throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`') - } + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[resIndex++] = value; + } + } + return result; +} - path += (j === 0 ? token.prefix : token.delimiter) + segment - } +module.exports = arrayFilter; - continue - } - segment = token.asterisk ? encodeAsterisk(value) : encode(value) +/***/ }), +/* 293 */ +/***/ (function(module, exports) { - if (!matches[i].test(segment)) { - throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"') - } +/** + * A specialized version of `_.some` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ +function arraySome(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length; - path += token.prefix + segment + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; } - - return path } + return false; } -/** - * Escape a regular expression string. - * - * @param {string} str - * @return {string} - */ -function escapeString (str) { - return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1') -} +module.exports = arraySome; -/** - * Escape the capturing group by escaping special characters and meaning. - * - * @param {string} group - * @return {string} - */ -function escapeGroup (group) { - return group.replace(/([=!:$\/()])/g, '\\$1') -} + +/***/ }), +/* 294 */ +/***/ (function(module, exports, __webpack_require__) { + +var copyObject = __webpack_require__(27), + keys = __webpack_require__(19); /** - * Attach the keys as a property of the regexp. + * The base implementation of `_.assign` without support for multiple sources + * or `customizer` functions. * - * @param {!RegExp} re - * @param {Array} keys - * @return {!RegExp} + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. */ -function attachKeys (re, keys) { - re.keys = keys - return re +function baseAssign(object, source) { + return object && copyObject(source, keys(source), object); } +module.exports = baseAssign; + + +/***/ }), +/* 295 */ +/***/ (function(module, exports, __webpack_require__) { + +var copyObject = __webpack_require__(27), + keysIn = __webpack_require__(99); + /** - * Get the flags for a regexp from the options. + * The base implementation of `_.assignIn` without support for multiple sources + * or `customizer` functions. * - * @param {Object} options - * @return {string} + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. */ -function flags (options) { - return options.sensitive ? '' : 'i' +function baseAssignIn(object, source) { + return object && copyObject(source, keysIn(source), object); } -/** - * Pull out keys from a regexp. +module.exports = baseAssignIn; + + +/***/ }), +/* 296 */ +/***/ (function(module, exports, __webpack_require__) { + +var Stack = __webpack_require__(81), + arrayEach = __webpack_require__(135), + assignValue = __webpack_require__(137), + baseAssign = __webpack_require__(294), + baseAssignIn = __webpack_require__(295), + cloneBuffer = __webpack_require__(325), + copyArray = __webpack_require__(330), + copySymbols = __webpack_require__(331), + copySymbolsIn = __webpack_require__(332), + getAllKeys = __webpack_require__(144), + getAllKeysIn = __webpack_require__(145), + getTag = __webpack_require__(55), + initCloneArray = __webpack_require__(350), + initCloneByTag = __webpack_require__(351), + initCloneObject = __webpack_require__(352), + isArray = __webpack_require__(4), + isBuffer = __webpack_require__(96), + isMap = __webpack_require__(390), + isObject = __webpack_require__(10), + isSet = __webpack_require__(392), + keys = __webpack_require__(19); + +/** Used to compose bitmasks for cloning. */ +var CLONE_DEEP_FLAG = 1, + CLONE_FLAT_FLAG = 2, + CLONE_SYMBOLS_FLAG = 4; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]', + weakMapTag = '[object WeakMap]'; + +var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + +/** Used to identify `toStringTag` values supported by `_.clone`. */ +var cloneableTags = {}; +cloneableTags[argsTag] = cloneableTags[arrayTag] = +cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = +cloneableTags[boolTag] = cloneableTags[dateTag] = +cloneableTags[float32Tag] = cloneableTags[float64Tag] = +cloneableTags[int8Tag] = cloneableTags[int16Tag] = +cloneableTags[int32Tag] = cloneableTags[mapTag] = +cloneableTags[numberTag] = cloneableTags[objectTag] = +cloneableTags[regexpTag] = cloneableTags[setTag] = +cloneableTags[stringTag] = cloneableTags[symbolTag] = +cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = +cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; +cloneableTags[errorTag] = cloneableTags[funcTag] = +cloneableTags[weakMapTag] = false; + +/** + * The base implementation of `_.clone` and `_.cloneDeep` which tracks + * traversed objects. * - * @param {!RegExp} path - * @param {!Array} keys - * @return {!RegExp} - */ -function regexpToRegexp (path, keys) { - // Use a negative lookahead to match only capturing groups. - var groups = path.source.match(/\((?!\?)/g) + * @private + * @param {*} value The value to clone. + * @param {boolean} bitmask The bitmask flags. + * 1 - Deep clone + * 2 - Flatten inherited properties + * 4 - Clone symbols + * @param {Function} [customizer] The function to customize cloning. + * @param {string} [key] The key of `value`. + * @param {Object} [object] The parent object of `value`. + * @param {Object} [stack] Tracks traversed objects and their clone counterparts. + * @returns {*} Returns the cloned value. + */ +function baseClone(value, bitmask, customizer, key, object, stack) { + var result, + isDeep = bitmask & CLONE_DEEP_FLAG, + isFlat = bitmask & CLONE_FLAT_FLAG, + isFull = bitmask & CLONE_SYMBOLS_FLAG; + + if (customizer) { + result = object ? customizer(value, key, object, stack) : customizer(value); + } + if (result !== undefined) { + return result; + } + if (!isObject(value)) { + return value; + } + var isArr = isArray(value); + if (isArr) { + result = initCloneArray(value); + if (!isDeep) { + return copyArray(value, result); + } + } else { + var tag = getTag(value), + isFunc = tag == funcTag || tag == genTag; - if (groups) { - for (var i = 0; i < groups.length; i++) { - keys.push({ - name: i, - prefix: null, - delimiter: null, - optional: false, - repeat: false, - partial: false, - asterisk: false, - pattern: null - }) + if (isBuffer(value)) { + return cloneBuffer(value, isDeep); + } + if (tag == objectTag || tag == argsTag || (isFunc && !object)) { + result = (isFlat || isFunc) ? {} : initCloneObject(value); + if (!isDeep) { + return isFlat + ? copySymbolsIn(value, baseAssignIn(result, value)) + : copySymbols(value, baseAssign(result, value)); + } + } else { + if (!cloneableTags[tag]) { + return object ? value : {}; + } + result = initCloneByTag(value, tag, isDeep); } } + // Check for circular references and return its corresponding clone. + stack || (stack = new Stack); + var stacked = stack.get(value); + if (stacked) { + return stacked; + } + stack.set(value, result); - return attachKeys(path, keys) -} + if (isSet(value)) { + value.forEach(function(subValue) { + result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); + }); -/** - * Transform an array into a regexp. - * - * @param {!Array} path - * @param {Array} keys - * @param {!Object} options - * @return {!RegExp} - */ -function arrayToRegexp (path, keys, options) { - var parts = [] + return result; + } - for (var i = 0; i < path.length; i++) { - parts.push(pathToRegexp(path[i], keys, options).source) + if (isMap(value)) { + value.forEach(function(subValue, key) { + result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + + return result; } - var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options)) + var keysFunc = isFull + ? (isFlat ? getAllKeysIn : getAllKeys) + : (isFlat ? keysIn : keys); - return attachKeys(regexp, keys) + var props = isArr ? undefined : keysFunc(value); + arrayEach(props || value, function(subValue, key) { + if (props) { + key = subValue; + subValue = value[key]; + } + // Recursively populate clone (susceptible to call stack limits). + assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + return result; } -/** - * Create a path regexp from string input. - * - * @param {string} path - * @param {!Array} keys - * @param {!Object} options - * @return {!RegExp} - */ -function stringToRegexp (path, keys, options) { - return tokensToRegExp(parse(path, options), keys, options) -} +module.exports = baseClone; + + +/***/ }), +/* 297 */ +/***/ (function(module, exports, __webpack_require__) { + +var isObject = __webpack_require__(10); + +/** Built-in value references. */ +var objectCreate = Object.create; /** - * Expose a function for taking tokens and returning a RegExp. + * The base implementation of `_.create` without support for assigning + * properties to the created object. * - * @param {!Array} tokens - * @param {(Array|Object)=} keys - * @param {Object=} options - * @return {!RegExp} + * @private + * @param {Object} proto The object to inherit from. + * @returns {Object} Returns the new object. */ -function tokensToRegExp (tokens, keys, options) { - if (!isarray(keys)) { - options = /** @type {!Object} */ (keys || options) - keys = [] - } +var baseCreate = (function() { + function object() {} + return function(proto) { + if (!isObject(proto)) { + return {}; + } + if (objectCreate) { + return objectCreate(proto); + } + object.prototype = proto; + var result = new object; + object.prototype = undefined; + return result; + }; +}()); - options = options || {} +module.exports = baseCreate; - var strict = options.strict - var end = options.end !== false - var route = '' - // Iterate over the tokens and create our regexp string. - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i] +/***/ }), +/* 298 */ +/***/ (function(module, exports, __webpack_require__) { - if (typeof token === 'string') { - route += escapeString(token) - } else { - var prefix = escapeString(token.prefix) - var capture = '(?:' + token.pattern + ')' +var arrayPush = __webpack_require__(83), + isFlattenable = __webpack_require__(353); - keys.push(token) +/** + * The base implementation of `_.flatten` with support for restricting flattening. + * + * @private + * @param {Array} array The array to flatten. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. + */ +function baseFlatten(array, depth, predicate, isStrict, result) { + var index = -1, + length = array.length; - if (token.repeat) { - capture += '(?:' + prefix + capture + ')*' - } + predicate || (predicate = isFlattenable); + result || (result = []); - if (token.optional) { - if (!token.partial) { - capture = '(?:' + prefix + '(' + capture + '))?' - } else { - capture = prefix + '(' + capture + ')?' - } + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten(value, depth - 1, predicate, isStrict, result); } else { - capture = prefix + '(' + capture + ')' + arrayPush(result, value); } - - route += capture + } else if (!isStrict) { + result[result.length] = value; } } + return result; +} - var delimiter = escapeString(options.delimiter || '/') - var endsWithDelimiter = route.slice(-delimiter.length) === delimiter +module.exports = baseFlatten; - // In non-strict mode we allow a slash at the end of match. If the path to - // match already ends with a slash, we remove it for consistency. The slash - // is valid at the end of a path match, not in the middle. This is important - // in non-ending mode, where "/test/" shouldn't match "/test//route". - if (!strict) { - route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?' - } - if (end) { - route += '$' - } else { - // In non-ending mode, we need the capturing groups to match as much as - // possible by using a positive lookahead to the end or next path segment. - route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)' - } +/***/ }), +/* 299 */ +/***/ (function(module, exports, __webpack_require__) { - return attachKeys(new RegExp('^' + route, flags(options)), keys) -} +var createBaseFor = __webpack_require__(336); /** - * Normalize the given path string, returning a regular expression. - * - * An empty array can be passed in for the keys, which will hold the - * placeholder key descriptions. For example, using `/user/:id`, `keys` will - * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`. + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. * - * @param {(string|RegExp|Array)} path - * @param {(Array|Object)=} keys - * @param {Object=} options - * @return {!RegExp} + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. */ -function pathToRegexp (path, keys, options) { - if (!isarray(keys)) { - options = /** @type {!Object} */ (keys || options) - keys = [] - } - - options = options || {} +var baseFor = createBaseFor(); - if (path instanceof RegExp) { - return regexpToRegexp(path, /** @type {!Array} */ (keys)) - } +module.exports = baseFor; - if (isarray(path)) { - return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options) - } - return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options) -} +/***/ }), +/* 300 */ +/***/ (function(module, exports, __webpack_require__) { +var baseFor = __webpack_require__(299), + keys = __webpack_require__(19); -/***/ }), -/* 248 */ -/***/ (function(module, exports) { +/** + * The base implementation of `_.forOwn` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ +function baseForOwn(object, iteratee) { + return object && baseFor(object, iteratee, keys); +} -module.exports = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]'; -}; +module.exports = baseForOwn; /***/ }), -/* 249 */ -/***/ (function(module, exports, __webpack_require__) { +/* 301 */ +/***/ (function(module, exports) { -"use strict"; /** - * Copyright (c) 2013-present, Facebook, Inc. + * The base implementation of `_.hasIn` without support for deep paths. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. */ +function baseHasIn(object, key) { + return object != null && key in Object(object); +} +module.exports = baseHasIn; -var emptyFunction = __webpack_require__(15); -var invariant = __webpack_require__(27); -var ReactPropTypesSecret = __webpack_require__(69); +/***/ }), +/* 302 */ +/***/ (function(module, exports, __webpack_require__) { -module.exports = function() { - function shim(props, propName, componentName, location, propFullName, secret) { - if (secret === ReactPropTypesSecret) { - // It is still safe when called from React. - return; - } - invariant( - false, - 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + - 'Use PropTypes.checkPropTypes() to call them. ' + - 'Read more at http://fb.me/use-check-prop-types' - ); - }; - shim.isRequired = shim; - function getShim() { - return shim; - }; - // Important! - // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. - var ReactPropTypes = { - array: shim, - bool: shim, - func: shim, - number: shim, - object: shim, - string: shim, - symbol: shim, +var baseGetTag = __webpack_require__(26), + isObjectLike = __webpack_require__(11); - any: shim, - arrayOf: getShim, - element: shim, - instanceOf: getShim, - node: shim, - objectOf: getShim, - oneOf: getShim, - oneOfType: getShim, - shape: getShim, - exact: getShim - }; +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]'; - ReactPropTypes.checkPropTypes = emptyFunction; - ReactPropTypes.PropTypes = ReactPropTypes; +/** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ +function baseIsArguments(value) { + return isObjectLike(value) && baseGetTag(value) == argsTag; +} - return ReactPropTypes; -}; +module.exports = baseIsArguments; /***/ }), -/* 250 */ +/* 303 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ +var Stack = __webpack_require__(81), + equalArrays = __webpack_require__(142), + equalByTag = __webpack_require__(338), + equalObjects = __webpack_require__(339), + getTag = __webpack_require__(55), + isArray = __webpack_require__(4), + isBuffer = __webpack_require__(96), + isTypedArray = __webpack_require__(155); +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG = 1; +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + objectTag = '[object Object]'; -var emptyFunction = __webpack_require__(15); -var invariant = __webpack_require__(27); -var warning = __webpack_require__(44); -var assign = __webpack_require__(30); +/** Used for built-in method references. */ +var objectProto = Object.prototype; -var ReactPropTypesSecret = __webpack_require__(69); -var checkPropTypes = __webpack_require__(68); +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; -module.exports = function(isValidElement, throwOnDirectAccess) { - /* global Symbol */ - var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; - var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. - - /** - * Returns the iterator method function contained on the iterable object. - * - * Be sure to invoke the function with the iterable as context: - * - * var iteratorFn = getIteratorFn(myIterable); - * if (iteratorFn) { - * var iterator = iteratorFn.call(myIterable); - * ... - * } - * - * @param {?object} maybeIterable - * @return {?function} - */ - function getIteratorFn(maybeIterable) { - var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); - if (typeof iteratorFn === 'function') { - return iteratorFn; - } - } +/** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = objIsArr ? arrayTag : getTag(object), + othTag = othIsArr ? arrayTag : getTag(other); - /** - * Collection of methods that allow declaration and validation of props that are - * supplied to React components. Example usage: - * - * var Props = require('ReactPropTypes'); - * var MyArticle = React.createClass({ - * propTypes: { - * // An optional string prop named "description". - * description: Props.string, - * - * // A required enum prop named "category". - * category: Props.oneOf(['News','Photos']).isRequired, - * - * // A prop named "dialog" that requires an instance of Dialog. - * dialog: Props.instanceOf(Dialog).isRequired - * }, - * render: function() { ... } - * }); - * - * A more formal specification of how these methods are used: - * - * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) - * decl := ReactPropTypes.{type}(.isRequired)? - * - * Each and every declaration produces a function with the same signature. This - * allows the creation of custom validation functions. For example: - * - * var MyLink = React.createClass({ - * propTypes: { - * // An optional string or URI prop named "href". - * href: function(props, propName, componentName) { - * var propValue = props[propName]; - * if (propValue != null && typeof propValue !== 'string' && - * !(propValue instanceof URI)) { - * return new Error( - * 'Expected a string or an URI for ' + propName + ' in ' + - * componentName - * ); - * } - * } - * }, - * render: function() {...} - * }); - * - * @internal - */ + objTag = objTag == argsTag ? objectTag : objTag; + othTag = othTag == argsTag ? objectTag : othTag; - var ANONYMOUS = '<>'; + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, + isSameTag = objTag == othTag; - // Important! - // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. - var ReactPropTypes = { - array: createPrimitiveTypeChecker('array'), - bool: createPrimitiveTypeChecker('boolean'), - func: createPrimitiveTypeChecker('function'), - number: createPrimitiveTypeChecker('number'), - object: createPrimitiveTypeChecker('object'), - string: createPrimitiveTypeChecker('string'), - symbol: createPrimitiveTypeChecker('symbol'), + if (isSameTag && isBuffer(object)) { + if (!isBuffer(other)) { + return false; + } + objIsArr = true; + objIsObj = false; + } + if (isSameTag && !objIsObj) { + stack || (stack = new Stack); + return (objIsArr || isTypedArray(object)) + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + } + if (!(bitmask & COMPARE_PARTIAL_FLAG)) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - any: createAnyTypeChecker(), - arrayOf: createArrayOfTypeChecker, - element: createElementTypeChecker(), - instanceOf: createInstanceTypeChecker, - node: createNodeChecker(), - objectOf: createObjectOfTypeChecker, - oneOf: createEnumTypeChecker, - oneOfType: createUnionTypeChecker, - shape: createShapeTypeChecker, - exact: createStrictShapeTypeChecker, - }; + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, + othUnwrapped = othIsWrapped ? other.value() : other; - /** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ - /*eslint-disable no-self-compare*/ - function is(x, y) { - // SameValue algorithm - if (x === y) { - // Steps 1-5, 7-10 - // Steps 6.b-6.e: +0 != -0 - return x !== 0 || 1 / x === 1 / y; - } else { - // Step 6.a: NaN == NaN - return x !== x && y !== y; + stack || (stack = new Stack); + return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); } } - /*eslint-enable no-self-compare*/ - - /** - * We use an Error-like object for backward compatibility as people may call - * PropTypes directly and inspect their output. However, we don't use real - * Errors anymore. We don't inspect their stack anyway, and creating them - * is prohibitively expensive if they are created too often, such as what - * happens in oneOfType() for any type before the one that matched. - */ - function PropTypeError(message) { - this.message = message; - this.stack = ''; + if (!isSameTag) { + return false; } - // Make `instanceof Error` still work for returned errors. - PropTypeError.prototype = Error.prototype; + stack || (stack = new Stack); + return equalObjects(object, other, bitmask, customizer, equalFunc, stack); +} - function createChainableTypeChecker(validate) { - if (process.env.NODE_ENV !== 'production') { - var manualPropTypeCallCache = {}; - var manualPropTypeWarningCount = 0; - } - function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { - componentName = componentName || ANONYMOUS; - propFullName = propFullName || propName; +module.exports = baseIsEqualDeep; - if (secret !== ReactPropTypesSecret) { - if (throwOnDirectAccess) { - // New behavior only for users of `prop-types` package - invariant( - false, - 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + - 'Use `PropTypes.checkPropTypes()` to call them. ' + - 'Read more at http://fb.me/use-check-prop-types' - ); - } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { - // Old behavior for people using React.PropTypes - var cacheKey = componentName + ':' + propName; - if ( - !manualPropTypeCallCache[cacheKey] && - // Avoid spamming the console because they are often not actionable except for lib authors - manualPropTypeWarningCount < 3 - ) { - warning( - false, - 'You are manually calling a React.PropTypes validation ' + - 'function for the `%s` prop on `%s`. This is deprecated ' + - 'and will throw in the standalone `prop-types` package. ' + - 'You may be seeing this warning due to a third-party PropTypes ' + - 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', - propFullName, - componentName - ); - manualPropTypeCallCache[cacheKey] = true; - manualPropTypeWarningCount++; - } - } - } - if (props[propName] == null) { - if (isRequired) { - if (props[propName] === null) { - return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); - } - return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); - } - return null; - } else { - return validate(props, propName, componentName, location, propFullName); - } - } - var chainedCheckType = checkType.bind(null, false); - chainedCheckType.isRequired = checkType.bind(null, true); +/***/ }), +/* 304 */ +/***/ (function(module, exports, __webpack_require__) { - return chainedCheckType; - } +var getTag = __webpack_require__(55), + isObjectLike = __webpack_require__(11); - function createPrimitiveTypeChecker(expectedType) { - function validate(props, propName, componentName, location, propFullName, secret) { - var propValue = props[propName]; - var propType = getPropType(propValue); - if (propType !== expectedType) { - // `propValue` being instance of, say, date/regexp, pass the 'object' - // check, but we can offer a more precise error message here rather than - // 'of type `object`'. - var preciseType = getPreciseType(propValue); +/** `Object#toString` result references. */ +var mapTag = '[object Map]'; - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); - } - return null; - } - return createChainableTypeChecker(validate); - } +/** + * The base implementation of `_.isMap` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a map, else `false`. + */ +function baseIsMap(value) { + return isObjectLike(value) && getTag(value) == mapTag; +} - function createAnyTypeChecker() { - return createChainableTypeChecker(emptyFunction.thatReturnsNull); - } +module.exports = baseIsMap; - function createArrayOfTypeChecker(typeChecker) { - function validate(props, propName, componentName, location, propFullName) { - if (typeof typeChecker !== 'function') { - return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); - } - var propValue = props[propName]; - if (!Array.isArray(propValue)) { - var propType = getPropType(propValue); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); - } - for (var i = 0; i < propValue.length; i++) { - var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); - if (error instanceof Error) { - return error; - } - } - return null; - } - return createChainableTypeChecker(validate); - } - function createElementTypeChecker() { - function validate(props, propName, componentName, location, propFullName) { - var propValue = props[propName]; - if (!isValidElement(propValue)) { - var propType = getPropType(propValue); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); - } - return null; - } - return createChainableTypeChecker(validate); - } +/***/ }), +/* 305 */ +/***/ (function(module, exports, __webpack_require__) { - function createInstanceTypeChecker(expectedClass) { - function validate(props, propName, componentName, location, propFullName) { - if (!(props[propName] instanceof expectedClass)) { - var expectedClassName = expectedClass.name || ANONYMOUS; - var actualClassName = getClassName(props[propName]); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); - } - return null; - } - return createChainableTypeChecker(validate); - } +var Stack = __webpack_require__(81), + baseIsEqual = __webpack_require__(85); - function createEnumTypeChecker(expectedValues) { - if (!Array.isArray(expectedValues)) { - process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; - return emptyFunction.thatReturnsNull; - } +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; - function validate(props, propName, componentName, location, propFullName) { - var propValue = props[propName]; - for (var i = 0; i < expectedValues.length; i++) { - if (is(propValue, expectedValues[i])) { - return null; - } - } +/** + * The base implementation of `_.isMatch` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Array} matchData The property names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ +function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; - var valuesString = JSON.stringify(expectedValues); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + if (object == null) { + return !length; + } + object = Object(object); + while (index--) { + var data = matchData[index]; + if ((noCustomizer && data[2]) + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { + return false; } - return createChainableTypeChecker(validate); } + while (++index < length) { + data = matchData[index]; + var key = data[0], + objValue = object[key], + srcValue = data[1]; - function createObjectOfTypeChecker(typeChecker) { - function validate(props, propName, componentName, location, propFullName) { - if (typeof typeChecker !== 'function') { - return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); - } - var propValue = props[propName]; - var propType = getPropType(propValue); - if (propType !== 'object') { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; } - for (var key in propValue) { - if (propValue.hasOwnProperty(key)) { - var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); - if (error instanceof Error) { - return error; - } - } + } else { + var stack = new Stack; + if (customizer) { + var result = customizer(objValue, srcValue, key, object, source, stack); + } + if (!(result === undefined + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { + return false; } - return null; } - return createChainableTypeChecker(validate); } + return true; +} - function createUnionTypeChecker(arrayOfTypeCheckers) { - if (!Array.isArray(arrayOfTypeCheckers)) { - process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; - return emptyFunction.thatReturnsNull; - } +module.exports = baseIsMatch; - for (var i = 0; i < arrayOfTypeCheckers.length; i++) { - var checker = arrayOfTypeCheckers[i]; - if (typeof checker !== 'function') { - warning( - false, - 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + - 'received %s at index %s.', - getPostfixForTypeWarning(checker), - i - ); - return emptyFunction.thatReturnsNull; - } - } - function validate(props, propName, componentName, location, propFullName) { - for (var i = 0; i < arrayOfTypeCheckers.length; i++) { - var checker = arrayOfTypeCheckers[i]; - if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { - return null; - } - } +/***/ }), +/* 306 */ +/***/ (function(module, exports, __webpack_require__) { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); - } - return createChainableTypeChecker(validate); - } +var isFunction = __webpack_require__(154), + isMasked = __webpack_require__(356), + isObject = __webpack_require__(10), + toSource = __webpack_require__(152); - function createNodeChecker() { - function validate(props, propName, componentName, location, propFullName) { - if (!isNode(props[propName])) { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); - } - return null; - } - return createChainableTypeChecker(validate); - } +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - function createShapeTypeChecker(shapeTypes) { - function validate(props, propName, componentName, location, propFullName) { - var propValue = props[propName]; - var propType = getPropType(propValue); - if (propType !== 'object') { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); - } - for (var key in shapeTypes) { - var checker = shapeTypes[key]; - if (!checker) { - continue; - } - var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); - if (error) { - return error; - } - } - return null; - } - return createChainableTypeChecker(validate); - } +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; - function createStrictShapeTypeChecker(shapeTypes) { - function validate(props, propName, componentName, location, propFullName) { - var propValue = props[propName]; - var propType = getPropType(propValue); - if (propType !== 'object') { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); - } - // We need to check all keys in case some are required but missing from - // props. - var allKeys = assign({}, props[propName], shapeTypes); - for (var key in allKeys) { - var checker = shapeTypes[key]; - if (!checker) { - return new PropTypeError( - 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + - '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + - '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') - ); - } - var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); - if (error) { - return error; - } - } - return null; - } +/** Used for built-in method references. */ +var funcProto = Function.prototype, + objectProto = Object.prototype; - return createChainableTypeChecker(validate); - } +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; - function isNode(propValue) { - switch (typeof propValue) { - case 'number': - case 'string': - case 'undefined': - return true; - case 'boolean': - return !propValue; - case 'object': - if (Array.isArray(propValue)) { - return propValue.every(isNode); - } - if (propValue === null || isValidElement(propValue)) { - return true; - } +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; - var iteratorFn = getIteratorFn(propValue); - if (iteratorFn) { - var iterator = iteratorFn.call(propValue); - var step; - if (iteratorFn !== propValue.entries) { - while (!(step = iterator.next()).done) { - if (!isNode(step.value)) { - return false; - } - } - } else { - // Iterator will provide entry [k,v] tuples rather than values. - while (!(step = iterator.next()).done) { - var entry = step.value; - if (entry) { - if (!isNode(entry[1])) { - return false; - } - } - } - } - } else { - return false; - } +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); - return true; - default: - return false; - } +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} - function isSymbol(propType, propValue) { - // Native Symbol. - if (propType === 'symbol') { - return true; - } +module.exports = baseIsNative; - // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' - if (propValue['@@toStringTag'] === 'Symbol') { - return true; - } - // Fallback for non-spec compliant Symbols which are polyfilled. - if (typeof Symbol === 'function' && propValue instanceof Symbol) { - return true; - } +/***/ }), +/* 307 */ +/***/ (function(module, exports, __webpack_require__) { - return false; - } +var getTag = __webpack_require__(55), + isObjectLike = __webpack_require__(11); - // Equivalent of `typeof` but with special handling for array and regexp. - function getPropType(propValue) { - var propType = typeof propValue; - if (Array.isArray(propValue)) { - return 'array'; - } - if (propValue instanceof RegExp) { - // Old webkits (at least until Android 4.0) return 'function' rather than - // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ - // passes PropTypes.object. - return 'object'; - } - if (isSymbol(propType, propValue)) { - return 'symbol'; - } - return propType; - } +/** `Object#toString` result references. */ +var setTag = '[object Set]'; - // This handles more types than `getPropType`. Only used for error messages. - // See `createPrimitiveTypeChecker`. - function getPreciseType(propValue) { - if (typeof propValue === 'undefined' || propValue === null) { - return '' + propValue; - } - var propType = getPropType(propValue); - if (propType === 'object') { - if (propValue instanceof Date) { - return 'date'; - } else if (propValue instanceof RegExp) { - return 'regexp'; - } - } - return propType; - } +/** + * The base implementation of `_.isSet` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a set, else `false`. + */ +function baseIsSet(value) { + return isObjectLike(value) && getTag(value) == setTag; +} - // Returns a string that is postfixed to a warning about an invalid type. - // For example, "undefined" or "of type array" - function getPostfixForTypeWarning(value) { - var type = getPreciseType(value); - switch (type) { - case 'array': - case 'object': - return 'an ' + type; - case 'boolean': - case 'date': - case 'regexp': - return 'a ' + type; - default: - return type; - } - } +module.exports = baseIsSet; - // Returns class name of the object, if any. - function getClassName(propValue) { - if (!propValue.constructor || !propValue.constructor.name) { - return ANONYMOUS; - } - return propValue.constructor.name; - } - ReactPropTypes.checkPropTypes = checkPropTypes; - ReactPropTypes.PropTypes = ReactPropTypes; +/***/ }), +/* 308 */ +/***/ (function(module, exports, __webpack_require__) { - return ReactPropTypes; -}; +var baseGetTag = __webpack_require__(26), + isLength = __webpack_require__(97), + isObjectLike = __webpack_require__(11); + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + weakMapTag = '[object WeakMap]'; + +var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + +/** Used to identify `toStringTag` values of typed arrays. */ +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = +typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = +typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = +typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = +typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag] = typedArrayTags[arrayTag] = +typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = +typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = +typedArrayTags[errorTag] = typedArrayTags[funcTag] = +typedArrayTags[mapTag] = typedArrayTags[numberTag] = +typedArrayTags[objectTag] = typedArrayTags[regexpTag] = +typedArrayTags[setTag] = typedArrayTags[stringTag] = +typedArrayTags[weakMapTag] = false; + +/** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ +function baseIsTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; +} + +module.exports = baseIsTypedArray; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }), -/* 251 */ +/* 309 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +var baseMatches = __webpack_require__(313), + baseMatchesProperty = __webpack_require__(314), + identity = __webpack_require__(58), + isArray = __webpack_require__(4), + property = __webpack_require__(396); +/** + * The base implementation of `_.iteratee`. + * + * @private + * @param {*} [value=_.identity] The value to convert to an iteratee. + * @returns {Function} Returns the iteratee. + */ +function baseIteratee(value) { + // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. + // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. + if (typeof value == 'function') { + return value; + } + if (value == null) { + return identity; + } + if (typeof value == 'object') { + return isArray(value) + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); + } + return property(value); +} -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = appendImportantToEachValue; +module.exports = baseIteratee; -var _appendPxIfNeeded = __webpack_require__(108); -var _appendPxIfNeeded2 = _interopRequireDefault(_appendPxIfNeeded); +/***/ }), +/* 310 */ +/***/ (function(module, exports, __webpack_require__) { -var _mapObject = __webpack_require__(113); +var isPrototype = __webpack_require__(92), + nativeKeys = __webpack_require__(369); -var _mapObject2 = _interopRequireDefault(_mapObject); +/** Used for built-in method references. */ +var objectProto = Object.prototype; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; -function appendImportantToEachValue(style) { - return (0, _mapObject2.default)(style, function (result, key) { - return (0, _appendPxIfNeeded2.default)(key, style[key]) + ' !important'; - }); +/** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; } -module.exports = exports['default']; -/***/ }), -/* 252 */ -/***/ (function(module, exports, __webpack_require__) { +module.exports = baseKeys; -"use strict"; +/***/ }), +/* 311 */ +/***/ (function(module, exports, __webpack_require__) { -Object.defineProperty(exports, "__esModule", { - value: true -}); -var _camelCaseRegex = /([a-z])?([A-Z])/g; +var isObject = __webpack_require__(10), + isPrototype = __webpack_require__(92), + nativeKeysIn = __webpack_require__(370); -var _camelCaseReplacer = function _camelCaseReplacer(match, p1, p2) { - return (p1 || '') + '-' + p2.toLowerCase(); -}; +/** Used for built-in method references. */ +var objectProto = Object.prototype; -var _camelCaseToDashCase = function _camelCaseToDashCase(s) { - return s.replace(_camelCaseRegex, _camelCaseReplacer); -}; +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; -var camelCasePropsToDashCase = function camelCasePropsToDashCase(prefixedStyle) { - // Since prefix is expected to work on inline style objects, we must - // translate the keys to dash case for rendering to CSS. - return Object.keys(prefixedStyle).reduce(function (result, key) { - var dashCaseKey = _camelCaseToDashCase(key); +/** + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeysIn(object) { + if (!isObject(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), + result = []; - // Fix IE vendor prefix - if (/^ms-/.test(dashCaseKey)) { - dashCaseKey = '-' + dashCaseKey; + for (var key in object) { + if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); } + } + return result; +} - result[dashCaseKey] = prefixedStyle[key]; - return result; - }, {}); -}; +module.exports = baseKeysIn; -exports.default = camelCasePropsToDashCase; -module.exports = exports['default']; /***/ }), -/* 253 */ +/* 312 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); +var baseEach = __webpack_require__(139), + isArrayLike = __webpack_require__(34); -var _react = __webpack_require__(0); +/** + * The base implementation of `_.map` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function baseMap(collection, iteratee) { + var index = -1, + result = isArrayLike(collection) ? Array(collection.length) : []; -var _react2 = _interopRequireDefault(_react); + baseEach(collection, function(value, key, collection) { + result[++index] = iteratee(value, key, collection); + }); + return result; +} -var _propTypes = __webpack_require__(1); +module.exports = baseMap; -var _propTypes2 = _interopRequireDefault(_propTypes); -var _enhancer = __webpack_require__(109); +/***/ }), +/* 313 */ +/***/ (function(module, exports, __webpack_require__) { -var _enhancer2 = _interopRequireDefault(_enhancer); +var baseIsMatch = __webpack_require__(305), + getMatchData = __webpack_require__(341), + matchesStrictComparable = __webpack_require__(148); -var _styleKeeper = __webpack_require__(72); +/** + * The base implementation of `_.matches` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new spec function. + */ +function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable(matchData[0][0], matchData[0][1]); + } + return function(object) { + return object === source || baseIsMatch(object, source, matchData); + }; +} -var _styleKeeper2 = _interopRequireDefault(_styleKeeper); +module.exports = baseMatches; -var _styleSheet = __webpack_require__(254); -var _styleSheet2 = _interopRequireDefault(_styleSheet); +/***/ }), +/* 314 */ +/***/ (function(module, exports, __webpack_require__) { -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var baseIsEqual = __webpack_require__(85), + get = __webpack_require__(388), + hasIn = __webpack_require__(389), + isKey = __webpack_require__(91), + isStrictComparable = __webpack_require__(147), + matchesStrictComparable = __webpack_require__(148), + toKey = __webpack_require__(33); -function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +/** + * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ +function baseMatchesProperty(path, srcValue) { + if (isKey(path) && isStrictComparable(srcValue)) { + return matchesStrictComparable(toKey(path), srcValue); + } + return function(object) { + var objValue = get(object, path); + return (objValue === undefined && objValue === srcValue) + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + }; +} -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +module.exports = baseMatchesProperty; -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } -function _getStyleKeeper(instance) { - if (!instance._radiumStyleKeeper) { - var userAgent = instance.props.radiumConfig && instance.props.radiumConfig.userAgent || instance.context._radiumConfig && instance.context._radiumConfig.userAgent; - instance._radiumStyleKeeper = new _styleKeeper2.default(userAgent); - } +/***/ }), +/* 315 */ +/***/ (function(module, exports) { - return instance._radiumStyleKeeper; +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; } -var StyleRoot = function (_PureComponent) { - _inherits(StyleRoot, _PureComponent); +module.exports = baseProperty; - function StyleRoot() { - _classCallCheck(this, StyleRoot); - var _this = _possibleConstructorReturn(this, _PureComponent.apply(this, arguments)); +/***/ }), +/* 316 */ +/***/ (function(module, exports, __webpack_require__) { - _getStyleKeeper(_this); - return _this; - } +var baseGet = __webpack_require__(84); - StyleRoot.prototype.getChildContext = function getChildContext() { - return { _radiumStyleKeeper: _getStyleKeeper(this) }; +/** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function basePropertyDeep(path) { + return function(object) { + return baseGet(object, path); }; +} - StyleRoot.prototype.render = function render() { - /* eslint-disable no-unused-vars */ - // Pass down all props except config to the rendered div. - var _props = this.props, - radiumConfig = _props.radiumConfig, - otherProps = _objectWithoutProperties(_props, ['radiumConfig']); - /* eslint-enable no-unused-vars */ +module.exports = basePropertyDeep; - return _react2.default.createElement( - 'div', - otherProps, - this.props.children, - _react2.default.createElement(_styleSheet2.default, null) - ); - }; - return StyleRoot; -}(_react.PureComponent); +/***/ }), +/* 317 */ +/***/ (function(module, exports, __webpack_require__) { -StyleRoot.contextTypes = { - _radiumConfig: _propTypes2.default.object, - _radiumStyleKeeper: _propTypes2.default.instanceOf(_styleKeeper2.default) -}; +var identity = __webpack_require__(58), + overRest = __webpack_require__(150), + setToString = __webpack_require__(151); -StyleRoot.childContextTypes = { - _radiumStyleKeeper: _propTypes2.default.instanceOf(_styleKeeper2.default) -}; +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + return setToString(overRest(func, start, identity), func + ''); +} -StyleRoot = (0, _enhancer2.default)(StyleRoot); +module.exports = baseRest; -exports.default = StyleRoot; -module.exports = exports['default']; /***/ }), -/* 254 */ +/* 318 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = undefined; +var constant = __webpack_require__(384), + defineProperty = __webpack_require__(141), + identity = __webpack_require__(58); -var _class, _temp; +/** + * The base implementation of `setToString` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var baseSetToString = !defineProperty ? identity : function(func, string) { + return defineProperty(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true + }); +}; -var _react = __webpack_require__(0); +module.exports = baseSetToString; -var _react2 = _interopRequireDefault(_react); -var _propTypes = __webpack_require__(1); +/***/ }), +/* 319 */ +/***/ (function(module, exports) { -var _propTypes2 = _interopRequireDefault(_propTypes); +/** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ +function baseSlice(array, start, end) { + var index = -1, + length = array.length; -var _styleKeeper = __webpack_require__(72); + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; -var _styleKeeper2 = _interopRequireDefault(_styleKeeper); + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; +} -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +module.exports = baseSlice; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +/***/ }), +/* 320 */ +/***/ (function(module, exports) { -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); -var StyleSheet = (_temp = _class = function (_PureComponent) { - _inherits(StyleSheet, _PureComponent); + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} - function StyleSheet() { - _classCallCheck(this, StyleSheet); +module.exports = baseTimes; - var _this = _possibleConstructorReturn(this, _PureComponent.apply(this, arguments)); - _this._onChange = function () { - setTimeout(function () { - _this._isMounted && _this.setState(_this._getCSSState()); - }, 0); - }; +/***/ }), +/* 321 */ +/***/ (function(module, exports, __webpack_require__) { - _this.state = _this._getCSSState(); - return _this; - } +var Symbol = __webpack_require__(25), + arrayMap = __webpack_require__(82), + isArray = __webpack_require__(4), + isSymbol = __webpack_require__(98); - StyleSheet.prototype.componentDidMount = function componentDidMount() { - this._isMounted = true; - this._subscription = this.context._radiumStyleKeeper.subscribe(this._onChange); - this._onChange(); - }; +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; - StyleSheet.prototype.componentWillUnmount = function componentWillUnmount() { - this._isMounted = false; - if (this._subscription) { - this._subscription.remove(); - } - }; +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; - StyleSheet.prototype._getCSSState = function _getCSSState() { - return { css: this.context._radiumStyleKeeper.getCSS() }; - }; +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} - StyleSheet.prototype.render = function render() { - return _react2.default.createElement('style', { dangerouslySetInnerHTML: { __html: this.state.css } }); - }; +module.exports = baseToString; - return StyleSheet; -}(_react.PureComponent), _class.contextTypes = { - _radiumStyleKeeper: _propTypes2.default.instanceOf(_styleKeeper2.default) -}, _temp); -exports.default = StyleSheet; -module.exports = exports['default']; /***/ }), -/* 255 */ +/* 322 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +var castPath = __webpack_require__(53), + last = __webpack_require__(393), + parent = __webpack_require__(372), + toKey = __webpack_require__(33); +/** + * The base implementation of `_.unset`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The property path to unset. + * @returns {boolean} Returns `true` if the property is deleted, else `false`. + */ +function baseUnset(object, path) { + path = castPath(path, object); + object = parent(object, path); + return object == null || delete object[toKey(last(path))]; +} -Object.defineProperty(exports, "__esModule", { - value: true -}); +module.exports = baseUnset; -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -var _class, _temp; +/***/ }), +/* 323 */ +/***/ (function(module, exports) { -var _cssRuleSetToString = __webpack_require__(70); +/** + * Checks if a `cache` value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function cacheHas(cache, key) { + return cache.has(key); +} -var _cssRuleSetToString2 = _interopRequireDefault(_cssRuleSetToString); +module.exports = cacheHas; -var _react = __webpack_require__(0); -var _react2 = _interopRequireDefault(_react); +/***/ }), +/* 324 */ +/***/ (function(module, exports, __webpack_require__) { -var _propTypes = __webpack_require__(1); +var identity = __webpack_require__(58); -var _propTypes2 = _interopRequireDefault(_propTypes); +/** + * Casts `value` to `identity` if it's not a function. + * + * @private + * @param {*} value The value to inspect. + * @returns {Function} Returns cast function. + */ +function castFunction(value) { + return typeof value == 'function' ? value : identity; +} -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +module.exports = castFunction; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +/***/ }), +/* 325 */ +/***/ (function(module, exports, __webpack_require__) { -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } +/* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(7); -var Style = (_temp = _class = function (_PureComponent) { - _inherits(Style, _PureComponent); +/** Detect free variable `exports`. */ +var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - function Style() { - _classCallCheck(this, Style); +/** Detect free variable `module`. */ +var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - return _possibleConstructorReturn(this, _PureComponent.apply(this, arguments)); +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports = freeModule && freeModule.exports === freeExports; + +/** Built-in value references. */ +var Buffer = moduleExports ? root.Buffer : undefined, + allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined; + +/** + * Creates a clone of `buffer`. + * + * @private + * @param {Buffer} buffer The buffer to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Buffer} Returns the cloned buffer. + */ +function cloneBuffer(buffer, isDeep) { + if (isDeep) { + return buffer.slice(); } + var length = buffer.length, + result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); - Style.prototype._buildStyles = function _buildStyles(styles) { - var _this2 = this; + buffer.copy(result); + return result; +} - var userAgent = this.props.radiumConfig && this.props.radiumConfig.userAgent || this.context && this.context._radiumConfig && this.context._radiumConfig.userAgent; +module.exports = cloneBuffer; - var scopeSelector = this.props.scopeSelector; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(110)(module))) - var rootRules = Object.keys(styles).reduce(function (accumulator, selector) { - if (_typeof(styles[selector]) !== 'object') { - accumulator[selector] = styles[selector]; - } +/***/ }), +/* 326 */ +/***/ (function(module, exports, __webpack_require__) { - return accumulator; - }, {}); - var rootStyles = Object.keys(rootRules).length ? (0, _cssRuleSetToString2.default)(scopeSelector || '', rootRules, userAgent) : ''; +var cloneArrayBuffer = __webpack_require__(87); - return rootStyles + Object.keys(styles).reduce(function (accumulator, selector) { - var rules = styles[selector]; +/** + * Creates a clone of `dataView`. + * + * @private + * @param {Object} dataView The data view to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned data view. + */ +function cloneDataView(dataView, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; + return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); +} - if (selector === 'mediaQueries') { - accumulator += _this2._buildMediaQueryString(rules); - } else if (_typeof(styles[selector]) === 'object') { - var completeSelector = scopeSelector ? selector.split(',').map(function (part) { - return scopeSelector + ' ' + part.trim(); - }).join(',') : selector; +module.exports = cloneDataView; - accumulator += (0, _cssRuleSetToString2.default)(completeSelector, rules, userAgent); - } - return accumulator; - }, ''); - }; +/***/ }), +/* 327 */ +/***/ (function(module, exports) { - Style.prototype._buildMediaQueryString = function _buildMediaQueryString(stylesByMediaQuery) { - var _this3 = this; +/** Used to match `RegExp` flags from their coerced string values. */ +var reFlags = /\w*$/; - var mediaQueryString = ''; +/** + * Creates a clone of `regexp`. + * + * @private + * @param {Object} regexp The regexp to clone. + * @returns {Object} Returns the cloned regexp. + */ +function cloneRegExp(regexp) { + var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); + result.lastIndex = regexp.lastIndex; + return result; +} - Object.keys(stylesByMediaQuery).forEach(function (query) { - mediaQueryString += '@media ' + query + '{' + _this3._buildStyles(stylesByMediaQuery[query]) + '}'; - }); +module.exports = cloneRegExp; - return mediaQueryString; - }; - Style.prototype.render = function render() { - if (!this.props.rules) { - return null; - } +/***/ }), +/* 328 */ +/***/ (function(module, exports, __webpack_require__) { - var styles = this._buildStyles(this.props.rules); +var Symbol = __webpack_require__(25); - return _react2.default.createElement('style', { dangerouslySetInnerHTML: { __html: styles } }); - }; +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; + +/** + * Creates a clone of the `symbol` object. + * + * @private + * @param {Object} symbol The symbol object to clone. + * @returns {Object} Returns the cloned symbol object. + */ +function cloneSymbol(symbol) { + return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; +} + +module.exports = cloneSymbol; - return Style; -}(_react.PureComponent), _class.propTypes = { - radiumConfig: _propTypes2.default.object, - rules: _propTypes2.default.object, - scopeSelector: _propTypes2.default.string -}, _class.contextTypes = { - _radiumConfig: _propTypes2.default.object -}, _class.defaultProps = { - scopeSelector: '' -}, _temp); -exports.default = Style; -module.exports = exports['default']; /***/ }), -/* 256 */ +/* 329 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) { +var cloneArrayBuffer = __webpack_require__(87); -Object.defineProperty(exports, "__esModule", { - value: true -}); +/** + * Creates a clone of `typedArray`. + * + * @private + * @param {Object} typedArray The typed array to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned typed array. + */ +function cloneTypedArray(typedArray, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; + return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); +} -var _enhancer = __webpack_require__(109); +module.exports = cloneTypedArray; -var _enhancer2 = _interopRequireDefault(_enhancer); -var _plugins = __webpack_require__(114); +/***/ }), +/* 330 */ +/***/ (function(module, exports) { -var _plugins2 = _interopRequireDefault(_plugins); +/** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ +function copyArray(source, array) { + var index = -1, + length = source.length; -var _style = __webpack_require__(255); + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; +} -var _style2 = _interopRequireDefault(_style); +module.exports = copyArray; -var _styleRoot = __webpack_require__(253); -var _styleRoot2 = _interopRequireDefault(_styleRoot); +/***/ }), +/* 331 */ +/***/ (function(module, exports, __webpack_require__) { -var _getState = __webpack_require__(111); +var copyObject = __webpack_require__(27), + getSymbols = __webpack_require__(89); -var _getState2 = _interopRequireDefault(_getState); +/** + * Copies own symbols of `source` to `object`. + * + * @private + * @param {Object} source The object to copy symbols from. + * @param {Object} [object={}] The object to copy symbols to. + * @returns {Object} Returns `object`. + */ +function copySymbols(source, object) { + return copyObject(source, getSymbols(source), object); +} -var _keyframes = __webpack_require__(257); +module.exports = copySymbols; -var _keyframes2 = _interopRequireDefault(_keyframes); -var _resolveStyles = __webpack_require__(115); +/***/ }), +/* 332 */ +/***/ (function(module, exports, __webpack_require__) { -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var copyObject = __webpack_require__(27), + getSymbolsIn = __webpack_require__(146); -function Radium(ComposedComponent) { - return (0, _enhancer2.default)(ComposedComponent); +/** + * Copies own and inherited symbols of `source` to `object`. + * + * @private + * @param {Object} source The object to copy symbols from. + * @param {Object} [object={}] The object to copy symbols to. + * @returns {Object} Returns `object`. + */ +function copySymbolsIn(source, object) { + return copyObject(source, getSymbolsIn(source), object); } -Radium.Plugins = _plugins2.default; -Radium.Style = _style2.default; -Radium.StyleRoot = _styleRoot2.default; -Radium.getState = _getState2.default; -Radium.keyframes = _keyframes2.default; - -if (process.env.NODE_ENV !== 'production') { - Radium.TestMode = { - clearState: _resolveStyles.__clearStateForTests, - disable: _resolveStyles.__setTestMode.bind(null, false), - enable: _resolveStyles.__setTestMode.bind(null, true) - }; -} +module.exports = copySymbolsIn; -exports.default = Radium; -module.exports = exports['default']; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }), -/* 257 */ +/* 333 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - +var root = __webpack_require__(7); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = keyframes; +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; -var _cssRuleSetToString = __webpack_require__(70); +module.exports = coreJsData; -var _cssRuleSetToString2 = _interopRequireDefault(_cssRuleSetToString); -var _hash = __webpack_require__(112); +/***/ }), +/* 334 */ +/***/ (function(module, exports, __webpack_require__) { -var _hash2 = _interopRequireDefault(_hash); +var baseRest = __webpack_require__(317), + isIterateeCall = __webpack_require__(354); -var _prefixer = __webpack_require__(71); +/** + * Creates a function like `_.assign`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ +function createAssigner(assigner) { + return baseRest(function(object, sources) { + var index = -1, + length = sources.length, + customizer = length > 1 ? sources[length - 1] : undefined, + guard = length > 2 ? sources[2] : undefined; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + customizer = (assigner.length > 3 && typeof customizer == 'function') + ? (length--, customizer) + : undefined; -function keyframes(keyframeRules, name) { - return { - __radiumKeyframes: true, - __process: function __process(userAgent) { - var keyframesPrefixed = (0, _prefixer.getPrefixedKeyframes)(userAgent); - var rules = Object.keys(keyframeRules).map(function (percentage) { - return (0, _cssRuleSetToString2.default)(percentage, keyframeRules[percentage], userAgent); - }).join('\n'); - var animationName = (name ? name + '-' : '') + 'radium-animation-' + (0, _hash2.default)(rules); - var css = '@' + keyframesPrefixed + ' ' + animationName + ' {\n' + rules + '\n}\n'; - return { css: css, animationName: animationName }; + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; } - }; + object = Object(object); + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, index, customizer); + } + } + return object; + }); } -module.exports = exports['default']; +module.exports = createAssigner; + /***/ }), -/* 258 */ +/* 335 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +var isArrayLike = __webpack_require__(34); +/** + * Creates a `baseEach` or `baseEachRight` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseEach(eachFunc, fromRight) { + return function(collection, iteratee) { + if (collection == null) { + return collection; + } + if (!isArrayLike(collection)) { + return eachFunc(collection, iteratee); + } + var length = collection.length, + index = fromRight ? length : -1, + iterable = Object(collection); -Object.defineProperty(exports, "__esModule", { - value: true -}); + while ((fromRight ? index-- : ++index < length)) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection; + }; +} -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +module.exports = createBaseEach; -exports.isNestedStyle = isNestedStyle; -exports.mergeStyles = mergeStyles; -function isNestedStyle(value) { - // Don't merge objects overriding toString, since they should be converted - // to string values. - return value && value.constructor === Object && value.toString === Object.prototype.toString; -} -// Merge style objects. Deep merge plain object values. -function mergeStyles(styles) { - var result = {}; +/***/ }), +/* 336 */ +/***/ (function(module, exports) { - styles.forEach(function (style) { - if (!style || (typeof style === 'undefined' ? 'undefined' : _typeof(style)) !== 'object') { - return; - } +/** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; - if (Array.isArray(style)) { - style = mergeStyles(style); + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } } + return object; + }; +} - Object.keys(style).forEach(function (key) { - // Simple case, nothing nested - if (!isNestedStyle(style[key]) || !isNestedStyle(result[key])) { - result[key] = style[key]; - return; - } +module.exports = createBaseFor; - // If nested media, don't merge the nested styles, append a space to the - // end (benign when converted to CSS). This way we don't end up merging - // media queries that appear later in the chain with those that appear - // earlier. - if (key.indexOf('@media') === 0) { - var newKey = key; - // eslint-disable-next-line no-constant-condition - while (true) { - newKey += ' '; - if (!result[newKey]) { - result[newKey] = style[key]; - return; - } - } - } - // Merge all other nested styles recursively - result[key] = mergeStyles([result[key], style[key]]); - }); - }); +/***/ }), +/* 337 */ +/***/ (function(module, exports, __webpack_require__) { - return result; +var isPlainObject = __webpack_require__(391); + +/** + * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain + * objects. + * + * @private + * @param {*} value The value to inspect. + * @param {string} key The key of the property to inspect. + * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. + */ +function customOmitClone(value) { + return isPlainObject(value) ? undefined : value; } +module.exports = customOmitClone; + + /***/ }), -/* 259 */ +/* 338 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) { +var Symbol = __webpack_require__(25), + Uint8Array = __webpack_require__(134), + eq = __webpack_require__(57), + equalArrays = __webpack_require__(142), + mapToArray = __webpack_require__(367), + setToArray = __webpack_require__(375); -Object.defineProperty(exports, "__esModule", { - value: true -}); +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; -var _extends = Object.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; }; +/** `Object#toString` result references. */ +var boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + mapTag = '[object Map]', + numberTag = '[object Number]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]'; -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]'; -var _checkProps = function checkProps() {}; +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; -if (process.env.NODE_ENV !== 'production') { - // Warn if you use longhand and shorthand properties in the same style - // object. - // https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties +/** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { + switch (tag) { + case dataViewTag: + if ((object.byteLength != other.byteLength) || + (object.byteOffset != other.byteOffset)) { + return false; + } + object = object.buffer; + other = other.buffer; - var shorthandPropertyExpansions = { - background: ['backgroundAttachment', 'backgroundBlendMode', 'backgroundClip', 'backgroundColor', 'backgroundImage', 'backgroundOrigin', 'backgroundPosition', 'backgroundPositionX', 'backgroundPositionY', 'backgroundRepeat', 'backgroundRepeatX', 'backgroundRepeatY', 'backgroundSize'], - border: ['borderBottom', 'borderBottomColor', 'borderBottomStyle', 'borderBottomWidth', 'borderColor', 'borderLeft', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRight', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderStyle', 'borderTop', 'borderTopColor', 'borderTopStyle', 'borderTopWidth', 'borderWidth'], - borderImage: ['borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth'], - borderRadius: ['borderBottomLeftRadius', 'borderBottomRightRadius', 'borderTopLeftRadius', 'borderTopRightRadius'], - font: ['fontFamily', 'fontKerning', 'fontSize', 'fontStretch', 'fontStyle', 'fontVariant', 'fontVariantLigatures', 'fontWeight', 'lineHeight'], - listStyle: ['listStyleImage', 'listStylePosition', 'listStyleType'], - margin: ['marginBottom', 'marginLeft', 'marginRight', 'marginTop'], - padding: ['paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop'], - transition: ['transitionDelay', 'transitionDuration', 'transitionProperty', 'transitionTimingFunction'] - }; + case arrayBufferTag: + if ((object.byteLength != other.byteLength) || + !equalFunc(new Uint8Array(object), new Uint8Array(other))) { + return false; + } + return true; - _checkProps = function checkProps(config) { - var componentName = config.componentName, - style = config.style; + case boolTag: + case dateTag: + case numberTag: + // Coerce booleans to `1` or `0` and dates to milliseconds. + // Invalid dates are coerced to `NaN`. + return eq(+object, +other); - if ((typeof style === 'undefined' ? 'undefined' : _typeof(style)) !== 'object' || !style) { - return; - } + case errorTag: + return object.name == other.name && object.message == other.message; - var styleKeys = Object.keys(style); - styleKeys.forEach(function (styleKey) { - if (Array.isArray(shorthandPropertyExpansions[styleKey]) && shorthandPropertyExpansions[styleKey].some(function (sp) { - return styleKeys.indexOf(sp) !== -1; - })) { - if (process.env.NODE_ENV !== 'production') { - /* eslint-disable no-console */ - console.warn('Radium: property "' + styleKey + '" in style object', style, ': do not mix longhand and ' + 'shorthand properties in the same style object. Check the render ' + 'method of ' + componentName + '.', 'See https://github.com/FormidableLabs/radium/issues/95 for more ' + 'information.'); - /* eslint-enable no-console */ - } + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring + // for more details. + return object == (other + ''); + + case mapTag: + var convert = mapToArray; + + case setTag: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG; + convert || (convert = setToArray); + + if (object.size != other.size && !isPartial) { + return false; } - }); + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + bitmask |= COMPARE_UNORDERED_FLAG; - styleKeys.forEach(function (k) { - return _checkProps(_extends({}, config, { style: style[k] })); - }); - return; - }; + // Recursively compare objects (susceptible to call stack limits). + stack.set(object, other); + var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); + stack['delete'](object); + return result; + + case symbolTag: + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } + } + return false; } -exports.default = _checkProps; -module.exports = exports['default']; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) +module.exports = equalByTag; + /***/ }), -/* 260 */ +/* 339 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +var getAllKeys = __webpack_require__(144); +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG = 1; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = keyframesPlugin; -function keyframesPlugin(_ref) { - var addCSS = _ref.addCSS, - config = _ref.config, - style = _ref.style; +/** Used for built-in method references. */ +var objectProto = Object.prototype; - var newStyle = Object.keys(style).reduce(function (newStyleInProgress, key) { - var value = style[key]; - if (key === 'animationName' && value && value.__radiumKeyframes) { - var keyframesValue = value; +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; - var _keyframesValue$__pro = keyframesValue.__process(config.userAgent), - animationName = _keyframesValue$__pro.animationName, - css = _keyframesValue$__pro.css; +/** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + objProps = getAllKeys(object), + objLength = objProps.length, + othProps = getAllKeys(other), + othLength = othProps.length; - addCSS(css); - value = animationName; + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { + return false; } + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked && stack.get(other)) { + return stacked == other; + } + var result = true; + stack.set(object, other); + stack.set(other, object); - newStyleInProgress[key] = value; - return newStyleInProgress; - }, {}); - return { style: newStyle }; -} -module.exports = exports['default']; + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key]; -/***/ }), -/* 261 */ -/***/ (function(module, exports, __webpack_require__) { + if (customizer) { + var compared = isPartial + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); + } + // Recursively compare objects (susceptible to call stack limits). + if (!(compared === undefined + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { + result = false; + break; + } + skipCtor || (skipCtor = key == 'constructor'); + } + if (result && !skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; -"use strict"; + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && + ('constructor' in object && 'constructor' in other) && + !(typeof objCtor == 'function' && objCtor instanceof objCtor && + typeof othCtor == 'function' && othCtor instanceof othCtor)) { + result = false; + } + } + stack['delete'](object); + stack['delete'](other); + return result; +} +module.exports = equalObjects; -Object.defineProperty(exports, "__esModule", { - value: true -}); +/***/ }), +/* 340 */ +/***/ (function(module, exports, __webpack_require__) { -// Convenient syntax for multiple styles: `style={[style1, style2, etc]}` -// Ignores non-objects, so you can do `this.state.isCool && styles.cool`. -var mergeStyleArrayPlugin = function mergeStyleArrayPlugin(_ref) { - var style = _ref.style, - mergeStyles = _ref.mergeStyles; +var flatten = __webpack_require__(387), + overRest = __webpack_require__(150), + setToString = __webpack_require__(151); - // eslint-disable-line no-shadow - var newStyle = Array.isArray(style) ? mergeStyles(style) : style; - return { style: newStyle }; -}; +/** + * A specialized version of `baseRest` which flattens the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ +function flatRest(func) { + return setToString(overRest(func, undefined, flatten), func + ''); +} + +module.exports = flatRest; -exports.default = mergeStyleArrayPlugin; -module.exports = exports['default']; /***/ }), -/* 262 */ +/* 341 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +var isStrictComparable = __webpack_require__(147), + keys = __webpack_require__(19); +/** + * Gets the property names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ +function getMatchData(object) { + var result = keys(object), + length = result.length; -Object.defineProperty(exports, "__esModule", { - value: true -}); -var _callbacks = []; -var _mouseUpListenerIsActive = false; + while (length--) { + var key = result[length], + value = object[key]; -function _handleMouseUp() { - _callbacks.forEach(function (callback) { - callback(); - }); + result[length] = [key, value, isStrictComparable(value)]; + } + return result; } -var subscribe = function subscribe(callback) { - if (_callbacks.indexOf(callback) === -1) { - _callbacks.push(callback); - } +module.exports = getMatchData; - if (!_mouseUpListenerIsActive) { - window.addEventListener('mouseup', _handleMouseUp); - _mouseUpListenerIsActive = true; - } - return { - remove: function remove() { - var index = _callbacks.indexOf(callback); - _callbacks.splice(index, 1); +/***/ }), +/* 342 */ +/***/ (function(module, exports, __webpack_require__) { - if (_callbacks.length === 0 && _mouseUpListenerIsActive) { - window.removeEventListener('mouseup', _handleMouseUp); - _mouseUpListenerIsActive = false; - } - } - }; -}; +var Symbol = __webpack_require__(25); -exports.default = { - subscribe: subscribe, - __triggerForTests: _handleMouseUp -}; -module.exports = exports['default']; +/** Used for built-in method references. */ +var objectProto = Object.prototype; -/***/ }), -/* 263 */ -/***/ (function(module, exports, __webpack_require__) { +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; -"use strict"; +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; +/** Built-in value references. */ +var symToStringTag = Symbol ? Symbol.toStringTag : undefined; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = prefixPlugin; +/** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ +function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), + tag = value[symToStringTag]; -var _prefixer = __webpack_require__(71); + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; +} -function prefixPlugin(_ref) { - var config = _ref.config, - style = _ref.style; +module.exports = getRawTag; - var newStyle = (0, _prefixer.getPrefixedStyle)(style, config.userAgent); - return { style: newStyle }; + +/***/ }), +/* 343 */ +/***/ (function(module, exports) { + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; } -module.exports = exports['default']; + +module.exports = getValue; + /***/ }), -/* 264 */ +/* 344 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +var castPath = __webpack_require__(53), + isArguments = __webpack_require__(95), + isArray = __webpack_require__(4), + isIndex = __webpack_require__(90), + isLength = __webpack_require__(97), + toKey = __webpack_require__(33); +/** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ +function hasPath(object, path, hasFunc) { + path = castPath(path, object); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = removeNestedStyles; -function removeNestedStyles(_ref) { - var isNestedStyle = _ref.isNestedStyle, - style = _ref.style; + var index = -1, + length = path.length, + result = false; - // eslint-disable-line no-shadow - var newStyle = Object.keys(style).reduce(function (newStyleInProgress, key) { - var value = style[key]; - if (!isNestedStyle(value)) { - newStyleInProgress[key] = value; + while (++index < length) { + var key = toKey(path[index]); + if (!(result = object != null && hasFunc(object, key))) { + break; } - return newStyleInProgress; - }, {}); - - return { - style: newStyle - }; + object = object[key]; + } + if (result || ++index != length) { + return result; + } + length = object == null ? 0 : object.length; + return !!length && isLength(length) && isIndex(key, length) && + (isArray(object) || isArguments(object)); } -module.exports = exports['default']; +module.exports = hasPath; + /***/ }), -/* 265 */ +/* 345 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - +var nativeCreate = __webpack_require__(56); -Object.defineProperty(exports, "__esModule", { - value: true -}); +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; +} -var _mouseUpListener = __webpack_require__(262); +module.exports = hashClear; -var _mouseUpListener2 = _interopRequireDefault(_mouseUpListener); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/***/ }), +/* 346 */ +/***/ (function(module, exports) { -var _isInteractiveStyleField = function _isInteractiveStyleField(styleFieldName) { - return styleFieldName === ':hover' || styleFieldName === ':active' || styleFieldName === ':focus'; -}; +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; +} -var resolveInteractionStyles = function resolveInteractionStyles(config) { - var ExecutionEnvironment = config.ExecutionEnvironment, - getComponentField = config.getComponentField, - getState = config.getState, - mergeStyles = config.mergeStyles, - props = config.props, - setState = config.setState, - style = config.style; +module.exports = hashDelete; - var newComponentFields = {}; - var newProps = {}; +/***/ }), +/* 347 */ +/***/ (function(module, exports, __webpack_require__) { - // Only add handlers if necessary - if (style[':hover']) { - // Always call the existing handler if one is already defined. - // This code, and the very similar ones below, could be abstracted a bit - // more, but it hurts readability IMO. - var existingOnMouseEnter = props.onMouseEnter; - newProps.onMouseEnter = function (e) { - existingOnMouseEnter && existingOnMouseEnter(e); - setState(':hover', true); - }; +var nativeCreate = __webpack_require__(56); - var existingOnMouseLeave = props.onMouseLeave; - newProps.onMouseLeave = function (e) { - existingOnMouseLeave && existingOnMouseLeave(e); - setState(':hover', false); - }; - } +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; - if (style[':active']) { - var existingOnMouseDown = props.onMouseDown; - newProps.onMouseDown = function (e) { - existingOnMouseDown && existingOnMouseDown(e); - newComponentFields._lastMouseDown = Date.now(); - setState(':active', 'viamousedown'); - }; +/** Used for built-in method references. */ +var objectProto = Object.prototype; - var existingOnKeyDown = props.onKeyDown; - newProps.onKeyDown = function (e) { - existingOnKeyDown && existingOnKeyDown(e); - if (e.key === ' ' || e.key === 'Enter') { - setState(':active', 'viakeydown'); - } - }; +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; - var existingOnKeyUp = props.onKeyUp; - newProps.onKeyUp = function (e) { - existingOnKeyUp && existingOnKeyUp(e); - if (e.key === ' ' || e.key === 'Enter') { - setState(':active', false); - } - }; +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} - if (style[':focus']) { - var existingOnFocus = props.onFocus; - newProps.onFocus = function (e) { - existingOnFocus && existingOnFocus(e); - setState(':focus', true); - }; +module.exports = hashGet; - var existingOnBlur = props.onBlur; - newProps.onBlur = function (e) { - existingOnBlur && existingOnBlur(e); - setState(':focus', false); - }; - } - if (style[':active'] && !getComponentField('_radiumMouseUpListener') && ExecutionEnvironment.canUseEventListeners) { - newComponentFields._radiumMouseUpListener = _mouseUpListener2.default.subscribe(function () { - Object.keys(getComponentField('state')._radiumStyleState).forEach(function (key) { - if (getState(':active', key) === 'viamousedown') { - setState(':active', false, key); - } - }); - }); - } +/***/ }), +/* 348 */ +/***/ (function(module, exports, __webpack_require__) { - // Merge the styles in the order they were defined - var interactionStyles = props.disabled ? [style[':disabled']] : Object.keys(style).filter(function (name) { - return _isInteractiveStyleField(name) && getState(name); - }).map(function (name) { - return style[name]; - }); +var nativeCreate = __webpack_require__(56); - var newStyle = mergeStyles([style].concat(interactionStyles)); +/** Used for built-in method references. */ +var objectProto = Object.prototype; - // Remove interactive styles - newStyle = Object.keys(newStyle).reduce(function (styleWithoutInteractions, name) { - if (!_isInteractiveStyleField(name) && name !== ':disabled') { - styleWithoutInteractions[name] = newStyle[name]; - } - return styleWithoutInteractions; - }, {}); +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; - return { - componentFields: newComponentFields, - props: newProps, - style: newStyle - }; -}; +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); +} + +module.exports = hashHas; -exports.default = resolveInteractionStyles; -module.exports = exports['default']; /***/ }), -/* 266 */ +/* 349 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +var nativeCreate = __webpack_require__(56); +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; -Object.defineProperty(exports, "__esModule", { - value: true -}); +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ +function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; +} -var _extends = Object.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; }; +module.exports = hashSet; -exports.default = resolveMediaQueries; -var _windowMatchMedia = void 0; -function _getWindowMatchMedia(ExecutionEnvironment) { - if (_windowMatchMedia === undefined) { - _windowMatchMedia = !!ExecutionEnvironment.canUseDOM && !!window && !!window.matchMedia && function (mediaQueryString) { - return window.matchMedia(mediaQueryString); - } || null; + +/***/ }), +/* 350 */ +/***/ (function(module, exports) { + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Initializes an array clone. + * + * @private + * @param {Array} array The array to clone. + * @returns {Array} Returns the initialized clone. + */ +function initCloneArray(array) { + var length = array.length, + result = new array.constructor(length); + + // Add properties assigned by `RegExp#exec`. + if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { + result.index = array.index; + result.input = array.input; } - return _windowMatchMedia; + return result; } -function _filterObject(obj, predicate) { - return Object.keys(obj).filter(function (key) { - return predicate(obj[key], key); - }).reduce(function (result, key) { - result[key] = obj[key]; - return result; - }, {}); -} +module.exports = initCloneArray; -function _removeMediaQueries(style) { - return Object.keys(style).reduce(function (styleWithoutMedia, key) { - if (key.indexOf('@media') !== 0) { - styleWithoutMedia[key] = style[key]; - } - return styleWithoutMedia; - }, {}); -} -function _topLevelRulesToCSS(_ref) { - var addCSS = _ref.addCSS, - appendImportantToEachValue = _ref.appendImportantToEachValue, - cssRuleSetToString = _ref.cssRuleSetToString, - hash = _ref.hash, - isNestedStyle = _ref.isNestedStyle, - style = _ref.style, - userAgent = _ref.userAgent; +/***/ }), +/* 351 */ +/***/ (function(module, exports, __webpack_require__) { - var className = ''; - Object.keys(style).filter(function (name) { - return name.indexOf('@media') === 0; - }).map(function (query) { - var topLevelRules = appendImportantToEachValue(_filterObject(style[query], function (value) { - return !isNestedStyle(value); - })); +var cloneArrayBuffer = __webpack_require__(87), + cloneDataView = __webpack_require__(326), + cloneRegExp = __webpack_require__(327), + cloneSymbol = __webpack_require__(328), + cloneTypedArray = __webpack_require__(329); - if (!Object.keys(topLevelRules).length) { - return; - } +/** `Object#toString` result references. */ +var boolTag = '[object Boolean]', + dateTag = '[object Date]', + mapTag = '[object Map]', + numberTag = '[object Number]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]'; - var ruleCSS = cssRuleSetToString('', topLevelRules, userAgent); +var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; - // CSS classes cannot start with a number - var mediaQueryClassName = 'rmq-' + hash(query + ruleCSS); - var css = query + '{ .' + mediaQueryClassName + ruleCSS + '}'; +/** + * Initializes an object clone based on its `toStringTag`. + * + * **Note:** This function only supports cloning values with tags of + * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. + * + * @private + * @param {Object} object The object to clone. + * @param {string} tag The `toStringTag` of the object to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the initialized clone. + */ +function initCloneByTag(object, tag, isDeep) { + var Ctor = object.constructor; + switch (tag) { + case arrayBufferTag: + return cloneArrayBuffer(object); - addCSS(css); + case boolTag: + case dateTag: + return new Ctor(+object); - className += (className ? ' ' : '') + mediaQueryClassName; - }); - return className; -} + case dataViewTag: + return cloneDataView(object, isDeep); -function _subscribeToMediaQuery(_ref2) { - var listener = _ref2.listener, - listenersByQuery = _ref2.listenersByQuery, - matchMedia = _ref2.matchMedia, - mediaQueryListsByQuery = _ref2.mediaQueryListsByQuery, - query = _ref2.query; + case float32Tag: case float64Tag: + case int8Tag: case int16Tag: case int32Tag: + case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: + return cloneTypedArray(object, isDeep); - query = query.replace('@media ', ''); + case mapTag: + return new Ctor; - var mql = mediaQueryListsByQuery[query]; - if (!mql && matchMedia) { - mediaQueryListsByQuery[query] = mql = matchMedia(query); - } + case numberTag: + case stringTag: + return new Ctor(object); - if (!listenersByQuery || !listenersByQuery[query]) { - mql.addListener(listener); + case regexpTag: + return cloneRegExp(object); - listenersByQuery[query] = { - remove: function remove() { - mql.removeListener(listener); - } - }; + case setTag: + return new Ctor; + + case symbolTag: + return cloneSymbol(object); } - return mql; } -function resolveMediaQueries(_ref3) { - var ExecutionEnvironment = _ref3.ExecutionEnvironment, - addCSS = _ref3.addCSS, - appendImportantToEachValue = _ref3.appendImportantToEachValue, - config = _ref3.config, - cssRuleSetToString = _ref3.cssRuleSetToString, - getComponentField = _ref3.getComponentField, - getGlobalState = _ref3.getGlobalState, - hash = _ref3.hash, - isNestedStyle = _ref3.isNestedStyle, - mergeStyles = _ref3.mergeStyles, - props = _ref3.props, - setState = _ref3.setState, - style = _ref3.style; +module.exports = initCloneByTag; - // eslint-disable-line no-shadow - var newStyle = _removeMediaQueries(style); - var mediaQueryClassNames = _topLevelRulesToCSS({ - addCSS: addCSS, - appendImportantToEachValue: appendImportantToEachValue, - cssRuleSetToString: cssRuleSetToString, - hash: hash, - isNestedStyle: isNestedStyle, - style: style, - userAgent: config.userAgent - }); - var newProps = mediaQueryClassNames ? { - className: mediaQueryClassNames + (props.className ? ' ' + props.className : '') - } : null; +/***/ }), +/* 352 */ +/***/ (function(module, exports, __webpack_require__) { - var matchMedia = config.matchMedia || _getWindowMatchMedia(ExecutionEnvironment); +var baseCreate = __webpack_require__(297), + getPrototype = __webpack_require__(88), + isPrototype = __webpack_require__(92); - if (!matchMedia) { - return { - props: newProps, - style: newStyle - }; - } +/** + * Initializes an object clone. + * + * @private + * @param {Object} object The object to clone. + * @returns {Object} Returns the initialized clone. + */ +function initCloneObject(object) { + return (typeof object.constructor == 'function' && !isPrototype(object)) + ? baseCreate(getPrototype(object)) + : {}; +} - var listenersByQuery = _extends({}, getComponentField('_radiumMediaQueryListenersByQuery')); - var mediaQueryListsByQuery = getGlobalState('mediaQueryListsByQuery') || {}; +module.exports = initCloneObject; - Object.keys(style).filter(function (name) { - return name.indexOf('@media') === 0; - }).map(function (query) { - var nestedRules = _filterObject(style[query], isNestedStyle); - if (!Object.keys(nestedRules).length) { - return; - } +/***/ }), +/* 353 */ +/***/ (function(module, exports, __webpack_require__) { - var mql = _subscribeToMediaQuery({ - listener: function listener() { - return setState(query, mql.matches, '_all'); - }, - listenersByQuery: listenersByQuery, - matchMedia: matchMedia, - mediaQueryListsByQuery: mediaQueryListsByQuery, - query: query - }); +var Symbol = __webpack_require__(25), + isArguments = __webpack_require__(95), + isArray = __webpack_require__(4); - // Apply media query states - if (mql.matches) { - newStyle = mergeStyles([newStyle, nestedRules]); - } - }); +/** Built-in value references. */ +var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; - return { - componentFields: { - _radiumMediaQueryListenersByQuery: listenersByQuery - }, - globalState: { mediaQueryListsByQuery: mediaQueryListsByQuery }, - props: newProps, - style: newStyle - }; +/** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ +function isFlattenable(value) { + return isArray(value) || isArguments(value) || + !!(spreadableSymbol && value && value[spreadableSymbol]); } -module.exports = exports['default']; + +module.exports = isFlattenable; + /***/ }), -/* 267 */ +/* 354 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +var eq = __webpack_require__(57), + isArrayLike = __webpack_require__(34), + isIndex = __webpack_require__(90), + isObject = __webpack_require__(10); +/** + * Checks if the given arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. + */ +function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { + return eq(object[index], value); + } + return false; +} -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = visited; -function visited(_ref) { - var addCSS = _ref.addCSS, - appendImportantToEachValue = _ref.appendImportantToEachValue, - config = _ref.config, - cssRuleSetToString = _ref.cssRuleSetToString, - hash = _ref.hash, - props = _ref.props, - style = _ref.style; - - // eslint-disable-line no-shadow - var className = props.className; - - var newStyle = Object.keys(style).reduce(function (newStyleInProgress, key) { - var value = style[key]; - if (key === ':visited') { - value = appendImportantToEachValue(value); - var ruleCSS = cssRuleSetToString('', value, config.userAgent); - var visitedClassName = 'rad-' + hash(ruleCSS); - var css = '.' + visitedClassName + ':visited' + ruleCSS; - - addCSS(css); - className = (className ? className + ' ' : '') + visitedClassName; - } else { - newStyleInProgress[key] = value; - } - - return newStyleInProgress; - }, {}); - - return { - props: className === props.className ? null : { className: className }, - style: newStyle - }; -} +module.exports = isIterateeCall; -module.exports = exports['default']; /***/ }), -/* 268 */ -/***/ (function(module, exports, __webpack_require__) { +/* 355 */ +/***/ (function(module, exports) { -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/** @license React v16.3.1 - * react-dom.development.js - * - * Copyright (c) 2013-present, Facebook, Inc. +/** + * Checks if `value` is suitable for use as unique object key. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ +function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); +} +module.exports = isKeyable; +/***/ }), +/* 356 */ +/***/ (function(module, exports, __webpack_require__) { +var coreJsData = __webpack_require__(333); -if (process.env.NODE_ENV !== "production") { - (function() { -'use strict'; +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); -var React = __webpack_require__(0); -var invariant = __webpack_require__(27); -var warning = __webpack_require__(44); -var ExecutionEnvironment = __webpack_require__(99); -var _assign = __webpack_require__(30); -var emptyFunction = __webpack_require__(15); -var checkPropTypes = __webpack_require__(68); -var getActiveElement = __webpack_require__(101); -var shallowEqual = __webpack_require__(102); -var containsNode = __webpack_require__(100); -var emptyObject = __webpack_require__(43); -var hyphenateStyleName = __webpack_require__(206); -var camelizeStyleName = __webpack_require__(204); - -/** - * WARNING: DO NOT manually require this module. - * This is a replacement for `invariant(...)` used by the error code system - * and will _only_ be required by the corresponding babel pass. - * It always throws. +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} -!React ? invariant(false, 'ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.') : void 0; - -var invokeGuardedCallback = function (name, func, context, a, b, c, d, e, f) { - this._hasCaughtError = false; - this._caughtError = null; - var funcArgs = Array.prototype.slice.call(arguments, 3); - try { - func.apply(context, funcArgs); - } catch (error) { - this._caughtError = error; - this._hasCaughtError = true; - } -}; - -{ - // In DEV mode, we swap out invokeGuardedCallback for a special version - // that plays more nicely with the browser's DevTools. The idea is to preserve - // "Pause on exceptions" behavior. Because React wraps all user-provided - // functions in invokeGuardedCallback, and the production version of - // invokeGuardedCallback uses a try-catch, all user exceptions are treated - // like caught exceptions, and the DevTools won't pause unless the developer - // takes the extra step of enabling pause on caught exceptions. This is - // untintuitive, though, because even though React has caught the error, from - // the developer's perspective, the error is uncaught. - // - // To preserve the expected "Pause on exceptions" behavior, we don't use a - // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake - // DOM node, and call the user-provided callback from inside an event handler - // for that fake event. If the callback throws, the error is "captured" using - // a global event handler. But because the error happens in a different - // event loop context, it does not interrupt the normal program flow. - // Effectively, this gives us try-catch behavior without actually using - // try-catch. Neat! - - // Check that the browser supports the APIs we need to implement our special - // DEV version of invokeGuardedCallback - if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { - var fakeNode = document.createElement('react'); +module.exports = isMasked; - var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) { - // If document doesn't exist we know for sure we will crash in this method - // when we call document.createEvent(). However this can cause confusing - // errors: https://github.com/facebookincubator/create-react-app/issues/3482 - // So we preemptively throw with a better message instead. - !(typeof document !== 'undefined') ? invariant(false, 'The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.') : void 0; - var evt = document.createEvent('Event'); - // Keeps track of whether the user-provided callback threw an error. We - // set this to true at the beginning, then set it to false right after - // calling the function. If the function errors, `didError` will never be - // set to false. This strategy works even if the browser is flaky and - // fails to call our global error handler, because it doesn't rely on - // the error event at all. - var didError = true; +/***/ }), +/* 357 */ +/***/ (function(module, exports) { - // Create an event handler for our fake event. We will synchronously - // dispatch our fake event using `dispatchEvent`. Inside the handler, we - // call the user-provided callback. - var funcArgs = Array.prototype.slice.call(arguments, 3); - function callCallback() { - // We immediately remove the callback from event listeners so that - // nested `invokeGuardedCallback` calls do not clash. Otherwise, a - // nested call would trigger the fake event handlers of any call higher - // in the stack. - fakeNode.removeEventListener(evtType, callCallback, false); - func.apply(context, funcArgs); - didError = false; - } +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; + this.size = 0; +} - // Create a global error event handler. We use this to capture the value - // that was thrown. It's possible that this error handler will fire more - // than once; for example, if non-React code also calls `dispatchEvent` - // and a handler for that event throws. We should be resilient to most of - // those cases. Even if our error event handler fires more than once, the - // last error event is always used. If the callback actually does error, - // we know that the last error event is the correct one, because it's not - // possible for anything else to have happened in between our callback - // erroring and the code that follows the `dispatchEvent` call below. If - // the callback doesn't error, but the error event was fired, we know to - // ignore it because `didError` will be false, as described above. - var error = void 0; - // Use this to track whether the error event is ever called. - var didSetError = false; - var isCrossOriginError = false; +module.exports = listCacheClear; - function onError(event) { - error = event.error; - didSetError = true; - if (error === null && event.colno === 0 && event.lineno === 0) { - isCrossOriginError = true; - } - } - // Create a fake event type. - var evtType = 'react-' + (name ? name : 'invokeguardedcallback'); +/***/ }), +/* 358 */ +/***/ (function(module, exports, __webpack_require__) { - // Attach our event handlers - window.addEventListener('error', onError); - fakeNode.addEventListener(evtType, callCallback, false); +var assocIndexOf = __webpack_require__(52); - // Synchronously dispatch our fake event. If the user-provided function - // errors, it will trigger our global error handler. - evt.initEvent(evtType, false, false); - fakeNode.dispatchEvent(evt); +/** Used for built-in method references. */ +var arrayProto = Array.prototype; - if (didError) { - if (!didSetError) { - // The callback errored, but the error event never fired. - error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.'); - } else if (isCrossOriginError) { - error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.'); - } - this._hasCaughtError = true; - this._caughtError = error; - } else { - this._hasCaughtError = false; - this._caughtError = null; - } +/** Built-in value references. */ +var splice = arrayProto.splice; - // Remove our event listeners - window.removeEventListener('error', onError); - }; +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); - invokeGuardedCallback = invokeGuardedCallbackDev; + if (index < 0) { + return false; } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; } -var invokeGuardedCallback$1 = invokeGuardedCallback; +module.exports = listCacheDelete; -var ReactErrorUtils = { - // Used by Fiber to simulate a try-catch. - _caughtError: null, - _hasCaughtError: false, - // Used by event system to capture/rethrow the first error. - _rethrowError: null, - _hasRethrowError: false, +/***/ }), +/* 359 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Call a function while guarding against errors that happens within it. - * Returns an error if it throws, otherwise null. - * - * In production, this is implemented using a try-catch. The reason we don't - * use a try-catch directly is so that we can swap out a different - * implementation in DEV mode. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - invokeGuardedCallback: function (name, func, context, a, b, c, d, e, f) { - invokeGuardedCallback$1.apply(ReactErrorUtils, arguments); - }, +var assocIndexOf = __webpack_require__(52); - /** - * Same as invokeGuardedCallback, but instead of returning an error, it stores - * it in a global so it can be rethrown by `rethrowCaughtError` later. - * TODO: See if _caughtError and _rethrowError can be unified. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - invokeGuardedCallbackAndCatchFirstError: function (name, func, context, a, b, c, d, e, f) { - ReactErrorUtils.invokeGuardedCallback.apply(this, arguments); - if (ReactErrorUtils.hasCaughtError()) { - var error = ReactErrorUtils.clearCaughtError(); - if (!ReactErrorUtils._hasRethrowError) { - ReactErrorUtils._hasRethrowError = true; - ReactErrorUtils._rethrowError = error; - } - } - }, +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); - /** - * During execution of guarded functions we will capture the first error which - * we will rethrow to be handled by the top level error handler. - */ - rethrowCaughtError: function () { - return rethrowCaughtError.apply(ReactErrorUtils, arguments); - }, + return index < 0 ? undefined : data[index][1]; +} - hasCaughtError: function () { - return ReactErrorUtils._hasCaughtError; - }, +module.exports = listCacheGet; - clearCaughtError: function () { - if (ReactErrorUtils._hasCaughtError) { - var error = ReactErrorUtils._caughtError; - ReactErrorUtils._caughtError = null; - ReactErrorUtils._hasCaughtError = false; - return error; - } else { - invariant(false, 'clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.'); - } - } -}; -var rethrowCaughtError = function () { - if (ReactErrorUtils._hasRethrowError) { - var error = ReactErrorUtils._rethrowError; - ReactErrorUtils._rethrowError = null; - ReactErrorUtils._hasRethrowError = false; - throw error; - } -}; +/***/ }), +/* 360 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * Injectable ordering of event plugins. - */ -var eventPluginOrder = null; +var assocIndexOf = __webpack_require__(52); /** - * Injectable mapping from names to event plugin modules. + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ -var namesToPlugins = {}; +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} + +module.exports = listCacheHas; + + +/***/ }), +/* 361 */ +/***/ (function(module, exports, __webpack_require__) { + +var assocIndexOf = __webpack_require__(52); /** - * Recomputes the plugin list using the injected plugins and plugin ordering. + * Sets the list cache `key` to `value`. * * @private - */ -function recomputePluginOrdering() { - if (!eventPluginOrder) { - // Wait until an `eventPluginOrder` is injected. - return; - } - for (var pluginName in namesToPlugins) { - var pluginModule = namesToPlugins[pluginName]; - var pluginIndex = eventPluginOrder.indexOf(pluginName); - !(pluginIndex > -1) ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : void 0; - if (plugins[pluginIndex]) { - continue; - } - !pluginModule.extractEvents ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : void 0; - plugins[pluginIndex] = pluginModule; - var publishedEvents = pluginModule.eventTypes; - for (var eventName in publishedEvents) { - !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : void 0; - } + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; } + return this; } +module.exports = listCacheSet; + + +/***/ }), +/* 362 */ +/***/ (function(module, exports, __webpack_require__) { + +var Hash = __webpack_require__(286), + ListCache = __webpack_require__(51), + Map = __webpack_require__(79); + /** - * Publishes an event so that it can be dispatched by the supplied plugin. + * Removes all key-value entries from the map. * - * @param {object} dispatchConfig Dispatch configuration for the event. - * @param {object} PluginModule Plugin publishing the event. - * @return {boolean} True if the event was successfully published. * @private + * @name clear + * @memberOf MapCache */ -function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { - !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0; - eventNameDispatchConfigs[eventName] = dispatchConfig; - - var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; - if (phasedRegistrationNames) { - for (var phaseName in phasedRegistrationNames) { - if (phasedRegistrationNames.hasOwnProperty(phaseName)) { - var phasedRegistrationName = phasedRegistrationNames[phaseName]; - publishRegistrationName(phasedRegistrationName, pluginModule, eventName); - } - } - return true; - } else if (dispatchConfig.registrationName) { - publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); - return true; - } - return false; +function mapCacheClear() { + this.size = 0; + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; } +module.exports = mapCacheClear; + + +/***/ }), +/* 363 */ +/***/ (function(module, exports, __webpack_require__) { + +var getMapData = __webpack_require__(54); + /** - * Publishes a registration name that is used to identify dispatched events. + * Removes `key` and its value from the map. * - * @param {string} registrationName Registration name to add. - * @param {object} PluginModule Plugin publishing the event. * @private - */ -function publishRegistrationName(registrationName, pluginModule, eventName) { - !!registrationNameModules[registrationName] ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : void 0; - registrationNameModules[registrationName] = pluginModule; - registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies; + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function mapCacheDelete(key) { + var result = getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; +} - { - var lowerCasedName = registrationName.toLowerCase(); - possibleRegistrationNames[lowerCasedName] = registrationName; +module.exports = mapCacheDelete; - if (registrationName === 'onDoubleClick') { - possibleRegistrationNames.ondblclick = registrationName; - } - } -} + +/***/ }), +/* 364 */ +/***/ (function(module, exports, __webpack_require__) { + +var getMapData = __webpack_require__(54); /** - * Registers plugins so that they can extract and dispatch events. + * Gets the map value for `key`. * - * @see {EventPluginHub} + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. */ +function mapCacheGet(key) { + return getMapData(this, key).get(key); +} -/** - * Ordered list of injected plugins. - */ -var plugins = []; +module.exports = mapCacheGet; -/** - * Mapping from event name to dispatch config - */ -var eventNameDispatchConfigs = {}; -/** - * Mapping from registration name to plugin module - */ -var registrationNameModules = {}; +/***/ }), +/* 365 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * Mapping from registration name to event name - */ -var registrationNameDependencies = {}; +var getMapData = __webpack_require__(54); /** - * Mapping from lowercase registration names to the properly cased version, - * used to warn in the case of missing event handlers. Available - * only in true. - * @type {Object} + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ -var possibleRegistrationNames = {}; -// Trust the developer to only use possibleRegistrationNames in true +function mapCacheHas(key) { + return getMapData(this, key).has(key); +} + +module.exports = mapCacheHas; + + +/***/ }), +/* 366 */ +/***/ (function(module, exports, __webpack_require__) { + +var getMapData = __webpack_require__(54); /** - * Injects an ordering of plugins (by plugin name). This allows the ordering - * to be decoupled from injection of the actual plugins so that ordering is - * always deterministic regardless of packaging, on-the-fly injection, etc. + * Sets the map `key` to `value`. * - * @param {array} InjectedEventPluginOrder - * @internal - * @see {EventPluginHub.injection.injectEventPluginOrder} - */ -function injectEventPluginOrder(injectedEventPluginOrder) { - !!eventPluginOrder ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : void 0; - // Clone the ordering so it cannot be dynamically mutated. - eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); - recomputePluginOrdering(); + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ +function mapCacheSet(key, value) { + var data = getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; } +module.exports = mapCacheSet; + + +/***/ }), +/* 367 */ +/***/ (function(module, exports) { + /** - * Injects plugins to be used by `EventPluginHub`. The plugin names must be - * in the ordering injected by `injectEventPluginOrder`. - * - * Plugins can be injected as part of page initialization or on-the-fly. + * Converts `map` to its key-value pairs. * - * @param {object} injectedNamesToPlugins Map from names to plugin modules. - * @internal - * @see {EventPluginHub.injection.injectEventPluginsByName} + * @private + * @param {Object} map The map to convert. + * @returns {Array} Returns the key-value pairs. */ -function injectEventPluginsByName(injectedNamesToPlugins) { - var isOrderingDirty = false; - for (var pluginName in injectedNamesToPlugins) { - if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { - continue; - } - var pluginModule = injectedNamesToPlugins[pluginName]; - if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { - !!namesToPlugins[pluginName] ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0; - namesToPlugins[pluginName] = pluginModule; - isOrderingDirty = true; - } - } - if (isOrderingDirty) { - recomputePluginOrdering(); - } +function mapToArray(map) { + var index = -1, + result = Array(map.size); + + map.forEach(function(value, key) { + result[++index] = [key, value]; + }); + return result; } -var EventPluginRegistry = Object.freeze({ - plugins: plugins, - eventNameDispatchConfigs: eventNameDispatchConfigs, - registrationNameModules: registrationNameModules, - registrationNameDependencies: registrationNameDependencies, - possibleRegistrationNames: possibleRegistrationNames, - injectEventPluginOrder: injectEventPluginOrder, - injectEventPluginsByName: injectEventPluginsByName -}); +module.exports = mapToArray; -var getFiberCurrentPropsFromNode = null; -var getInstanceFromNode = null; -var getNodeFromInstance = null; -var injection$1 = { - injectComponentTree: function (Injected) { - getFiberCurrentPropsFromNode = Injected.getFiberCurrentPropsFromNode; - getInstanceFromNode = Injected.getInstanceFromNode; - getNodeFromInstance = Injected.getNodeFromInstance; +/***/ }), +/* 368 */ +/***/ (function(module, exports, __webpack_require__) { - { - warning(getNodeFromInstance && getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.'); +var memoize = __webpack_require__(395); + +/** Used as the maximum memoize cache size. */ +var MAX_MEMOIZE_SIZE = 500; + +/** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ +function memoizeCapped(func) { + var result = memoize(func, function(key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); } - } -}; + return key; + }); + var cache = result.cache; + return result; +} +module.exports = memoizeCapped; +/***/ }), +/* 369 */ +/***/ (function(module, exports, __webpack_require__) { +var overArg = __webpack_require__(149); -var validateEventDispatches = void 0; -{ - validateEventDispatches = function (event) { - var dispatchListeners = event._dispatchListeners; - var dispatchInstances = event._dispatchInstances; +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeKeys = overArg(Object.keys, Object); - var listenersIsArr = Array.isArray(dispatchListeners); - var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; +module.exports = nativeKeys; - var instancesIsArr = Array.isArray(dispatchInstances); - var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; - warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.'); - }; -} +/***/ }), +/* 370 */ +/***/ (function(module, exports) { /** - * Dispatch the event to the listener. - * @param {SyntheticEvent} event SyntheticEvent to handle - * @param {boolean} simulated If the event is simulated (changes exn behavior) - * @param {function} listener Application-level callback - * @param {*} inst Internal component instance + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. */ -function executeDispatch(event, simulated, listener, inst) { - var type = event.type || 'unknown-event'; - event.currentTarget = getNodeFromInstance(inst); - ReactErrorUtils.invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event); - event.currentTarget = null; -} - -/** - * Standard/simple iteration through an event's collected dispatches. - */ -function executeDispatchesInOrder(event, simulated) { - var dispatchListeners = event._dispatchListeners; - var dispatchInstances = event._dispatchInstances; - { - validateEventDispatches(event); - } - if (Array.isArray(dispatchListeners)) { - for (var i = 0; i < dispatchListeners.length; i++) { - if (event.isPropagationStopped()) { - break; - } - // Listeners and Instances are two parallel arrays that are always in sync. - executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]); +function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); } - } else if (dispatchListeners) { - executeDispatch(event, simulated, dispatchListeners, dispatchInstances); } - event._dispatchListeners = null; - event._dispatchInstances = null; + return result; } -/** - * @see executeDispatchesInOrderStopAtTrueImpl - */ +module.exports = nativeKeysIn; -/** - * Execution of a "direct" dispatch - there must be at most one dispatch - * accumulated on the event or it is considered an error. It doesn't really make - * sense for an event with multiple dispatches (bubbled) to keep track of the - * return values at each dispatch execution, but it does tend to make sense when - * dealing with "direct" dispatches. - * - * @return {*} The return value of executing the single dispatch. - */ +/***/ }), +/* 371 */ +/***/ (function(module, exports) { +/** Used for built-in method references. */ +var objectProto = Object.prototype; /** - * @param {SyntheticEvent} event - * @return {boolean} True iff number of dispatches accumulated is greater than 0. + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. */ +var nativeObjectToString = objectProto.toString; /** - * Accumulates items that must not be null or undefined into the first one. This - * is used to conserve memory by avoiding array allocations, and thus sacrifices - * API cleanness. Since `current` can be null before being passed in and not - * null after this function, make sure to assign it back to `current`: - * - * `a = accumulateInto(a, b);` + * Converts `value` to a string using `Object.prototype.toString`. * - * This API should be sparingly used. Try `accumulate` for something cleaner. - * - * @return {*|array<*>} An accumulation of items. + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. */ +function objectToString(value) { + return nativeObjectToString.call(value); +} -function accumulateInto(current, next) { - !(next != null) ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : void 0; - - if (current == null) { - return next; - } +module.exports = objectToString; - // Both are not empty. Warning: Never call x.concat(y) when you are not - // certain that x is an Array (x could be a string with concat method). - if (Array.isArray(current)) { - if (Array.isArray(next)) { - current.push.apply(current, next); - return current; - } - current.push(next); - return current; - } - if (Array.isArray(next)) { - // A bit too dangerous to mutate `next`. - return [current].concat(next); - } +/***/ }), +/* 372 */ +/***/ (function(module, exports, __webpack_require__) { - return [current, next]; -} +var baseGet = __webpack_require__(84), + baseSlice = __webpack_require__(319); /** - * @param {array} arr an "accumulation" of items which is either an Array or - * a single item. Useful when paired with the `accumulate` module. This is a - * simple utility that allows us to reason about a collection of items, but - * handling the case when there is exactly one item (and we do not need to - * allocate an array). - * @param {function} cb Callback invoked with each element or a collection. - * @param {?} [scope] Scope used as `this` in a callback. + * Gets the parent value at `path` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path to get the parent value of. + * @returns {*} Returns the parent value. */ -function forEachAccumulated(arr, cb, scope) { - if (Array.isArray(arr)) { - arr.forEach(cb, scope); - } else if (arr) { - cb.call(scope, arr); - } +function parent(object, path) { + return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); } -/** - * Internal queue of events that have accumulated their dispatches and are - * waiting to have their dispatches executed. - */ -var eventQueue = null; +module.exports = parent; + + +/***/ }), +/* 373 */ +/***/ (function(module, exports) { + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** - * Dispatches an event and releases it back into the pool, unless persistent. + * Adds `value` to the array cache. * - * @param {?object} event Synthetic event to be dispatched. - * @param {boolean} simulated If the event is simulated (changes exn behavior) * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. */ -var executeDispatchesAndRelease = function (event, simulated) { - if (event) { - executeDispatchesInOrder(event, simulated); +function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; +} - if (!event.isPersistent()) { - event.constructor.release(event); - } - } -}; -var executeDispatchesAndReleaseSimulated = function (e) { - return executeDispatchesAndRelease(e, true); -}; -var executeDispatchesAndReleaseTopLevel = function (e) { - return executeDispatchesAndRelease(e, false); -}; +module.exports = setCacheAdd; -function isInteractive(tag) { - return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; -} -function shouldPreventMouseEvent(name, type, props) { - switch (name) { - case 'onClick': - case 'onClickCapture': - case 'onDoubleClick': - case 'onDoubleClickCapture': - case 'onMouseDown': - case 'onMouseDownCapture': - case 'onMouseMove': - case 'onMouseMoveCapture': - case 'onMouseUp': - case 'onMouseUpCapture': - return !!(props.disabled && isInteractive(type)); - default: - return false; - } -} +/***/ }), +/* 374 */ +/***/ (function(module, exports) { /** - * This is a unified interface for event plugins to be installed and configured. - * - * Event plugins can implement the following properties: - * - * `extractEvents` {function(string, DOMEventTarget, string, object): *} - * Required. When a top-level event is fired, this method is expected to - * extract synthetic events that will in turn be queued and dispatched. - * - * `eventTypes` {object} - * Optional, plugins that fire events must publish a mapping of registration - * names that are used to register listeners. Values of this mapping must - * be objects that contain `registrationName` or `phasedRegistrationNames`. - * - * `executeDispatch` {function(object, function, string)} - * Optional, allows plugins to override how an event gets dispatched. By - * default, the listener is simply invoked. - * - * Each plugin that is injected into `EventsPluginHub` is immediately operable. + * Checks if `value` is in the array cache. * - * @public + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. */ +function setCacheHas(value) { + return this.__data__.has(value); +} -/** - * Methods for injecting dependencies. - */ -var injection = { - /** - * @param {array} InjectedEventPluginOrder - * @public - */ - injectEventPluginOrder: injectEventPluginOrder, +module.exports = setCacheHas; - /** - * @param {object} injectedNamesToPlugins Map from names to plugin modules. - */ - injectEventPluginsByName: injectEventPluginsByName -}; + +/***/ }), +/* 375 */ +/***/ (function(module, exports) { /** - * @param {object} inst The instance, which is the source of events. - * @param {string} registrationName Name of listener (e.g. `onClick`). - * @return {?function} The stored callback. + * Converts `set` to an array of its values. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. */ -function getListener(inst, registrationName) { - var listener = void 0; +function setToArray(set) { + var index = -1, + result = Array(set.size); - // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not - // live here; needs to be moved to a better place soon - var stateNode = inst.stateNode; - if (!stateNode) { - // Work in progress (ex: onload events in incremental mode). - return null; - } - var props = getFiberCurrentPropsFromNode(stateNode); - if (!props) { - // Work in progress. - return null; - } - listener = props[registrationName]; - if (shouldPreventMouseEvent(registrationName, inst.type, props)) { - return null; - } - !(!listener || typeof listener === 'function') ? invariant(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener) : void 0; - return listener; + set.forEach(function(value) { + result[++index] = value; + }); + return result; } +module.exports = setToArray; + + +/***/ }), +/* 376 */ +/***/ (function(module, exports) { + +/** Used to detect hot functions by number of calls within a span of milliseconds. */ +var HOT_COUNT = 800, + HOT_SPAN = 16; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeNow = Date.now; + /** - * Allows registered plugins an opportunity to extract events from top-level - * native browser events. + * Creates a function that'll short out and invoke `identity` instead + * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` + * milliseconds. * - * @return {*} An accumulation of synthetic events. - * @internal + * @private + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new shortable function. */ -function extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget) { - var events = null; - for (var i = 0; i < plugins.length; i++) { - // Not every plugin in the ordering may be loaded at runtime. - var possiblePlugin = plugins[i]; - if (possiblePlugin) { - var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); - if (extractedEvents) { - events = accumulateInto(events, extractedEvents); +function shortOut(func) { + var count = 0, + lastCalled = 0; + + return function() { + var stamp = nativeNow(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; } + } else { + count = 0; } - } - return events; + return func.apply(undefined, arguments); + }; } -function runEventsInBatch(events, simulated) { - if (events !== null) { - eventQueue = accumulateInto(eventQueue, events); - } +module.exports = shortOut; - // Set `eventQueue` to null before processing it so that we can tell if more - // events get enqueued while processing. - var processingEventQueue = eventQueue; - eventQueue = null; - if (!processingEventQueue) { - return; - } +/***/ }), +/* 377 */ +/***/ (function(module, exports, __webpack_require__) { - if (simulated) { - forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated); - } else { - forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); - } - !!eventQueue ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : void 0; - // This would be a good time to rethrow if any of the event handlers threw. - ReactErrorUtils.rethrowCaughtError(); -} +var ListCache = __webpack_require__(51); -function runExtractedEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget) { - var events = extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); - runEventsInBatch(events, false); +/** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ +function stackClear() { + this.__data__ = new ListCache; + this.size = 0; } -var EventPluginHub = Object.freeze({ - injection: injection, - getListener: getListener, - runEventsInBatch: runEventsInBatch, - runExtractedEventsInBatch: runExtractedEventsInBatch -}); - -var IndeterminateComponent = 0; // Before we know whether it is functional or class -var FunctionalComponent = 1; -var ClassComponent = 2; -var HostRoot = 3; // Root of a host tree. Could be nested inside another node. -var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. -var HostComponent = 5; -var HostText = 6; -var CallComponent = 7; -var CallHandlerPhase = 8; -var ReturnComponent = 9; -var Fragment = 10; -var Mode = 11; -var ContextConsumer = 12; -var ContextProvider = 13; -var ForwardRef = 14; +module.exports = stackClear; -var randomKey = Math.random().toString(36).slice(2); -var internalInstanceKey = '__reactInternalInstance$' + randomKey; -var internalEventHandlersKey = '__reactEventHandlers$' + randomKey; -function precacheFiberNode$1(hostInst, node) { - node[internalInstanceKey] = hostInst; -} +/***/ }), +/* 378 */ +/***/ (function(module, exports) { /** - * Given a DOM node, return the closest ReactDOMComponent or - * ReactDOMTextComponent instance ancestor. + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ -function getClosestInstanceFromNode(node) { - if (node[internalInstanceKey]) { - return node[internalInstanceKey]; - } +function stackDelete(key) { + var data = this.__data__, + result = data['delete'](key); - while (!node[internalInstanceKey]) { - if (node.parentNode) { - node = node.parentNode; - } else { - // Top of the tree. This node must not be part of a React tree (or is - // unmounted, potentially). - return null; - } - } + this.size = data.size; + return result; +} - var inst = node[internalInstanceKey]; - if (inst.tag === HostComponent || inst.tag === HostText) { - // In Fiber, this will always be the deepest root. - return inst; - } +module.exports = stackDelete; - return null; -} + +/***/ }), +/* 379 */ +/***/ (function(module, exports) { /** - * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent - * instance, or null if the node was not rendered by this React. + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. */ -function getInstanceFromNode$1(node) { - var inst = node[internalInstanceKey]; - if (inst) { - if (inst.tag === HostComponent || inst.tag === HostText) { - return inst; - } else { - return null; - } - } - return null; +function stackGet(key) { + return this.__data__.get(key); } +module.exports = stackGet; + + +/***/ }), +/* 380 */ +/***/ (function(module, exports) { + /** - * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding - * DOM node. + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ -function getNodeFromInstance$1(inst) { - if (inst.tag === HostComponent || inst.tag === HostText) { - // In Fiber this, is just the state node right now. We assume it will be - // a host component or host text. - return inst.stateNode; - } - - // Without this first invariant, passing a non-DOM-component triggers the next - // invariant for a missing parent, which is super confusing. - invariant(false, 'getNodeFromInstance: Invalid argument.'); +function stackHas(key) { + return this.__data__.has(key); } -function getFiberCurrentPropsFromNode$1(node) { - return node[internalEventHandlersKey] || null; -} +module.exports = stackHas; -function updateFiberProps$1(node, props) { - node[internalEventHandlersKey] = props; -} -var ReactDOMComponentTree = Object.freeze({ - precacheFiberNode: precacheFiberNode$1, - getClosestInstanceFromNode: getClosestInstanceFromNode, - getInstanceFromNode: getInstanceFromNode$1, - getNodeFromInstance: getNodeFromInstance$1, - getFiberCurrentPropsFromNode: getFiberCurrentPropsFromNode$1, - updateFiberProps: updateFiberProps$1 -}); +/***/ }), +/* 381 */ +/***/ (function(module, exports, __webpack_require__) { -function getParent(inst) { - do { - inst = inst['return']; - // TODO: If this is a HostRoot we might want to bail out. - // That is depending on if we want nested subtrees (layers) to bubble - // events to their parent. We could also go through parentNode on the - // host node but that wouldn't work for React Native and doesn't let us - // do the portal feature. - } while (inst && inst.tag !== HostComponent); - if (inst) { - return inst; - } - return null; +var ListCache = __webpack_require__(51), + Map = __webpack_require__(79), + MapCache = __webpack_require__(80); + +/** Used as the size to enable large array optimizations. */ +var LARGE_ARRAY_SIZE = 200; + +/** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ +function stackSet(key, value) { + var data = this.__data__; + if (data instanceof ListCache) { + var pairs = data.__data__; + if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { + pairs.push([key, value]); + this.size = ++data.size; + return this; + } + data = this.__data__ = new MapCache(pairs); + } + data.set(key, value); + this.size = data.size; + return this; } +module.exports = stackSet; + + +/***/ }), +/* 382 */ +/***/ (function(module, exports, __webpack_require__) { + +var memoizeCapped = __webpack_require__(368); + +/** Used to match property names within property paths. */ +var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + +/** Used to match backslashes in property paths. */ +var reEscapeChar = /\\(\\)?/g; + /** - * Return the lowest common ancestor of A and B, or null if they are in - * different trees. + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. */ -function getLowestCommonAncestor(instA, instB) { - var depthA = 0; - for (var tempA = instA; tempA; tempA = getParent(tempA)) { - depthA++; - } - var depthB = 0; - for (var tempB = instB; tempB; tempB = getParent(tempB)) { - depthB++; +var stringToPath = memoizeCapped(function(string) { + var result = []; + if (string.charCodeAt(0) === 46 /* . */) { + result.push(''); } + string.replace(rePropName, function(match, number, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; +}); - // If A is deeper, crawl up. - while (depthA - depthB > 0) { - instA = getParent(instA); - depthA--; - } +module.exports = stringToPath; - // If B is deeper, crawl up. - while (depthB - depthA > 0) { - instB = getParent(instB); - depthB--; - } - // Walk in lockstep until we find a match. - var depth = depthA; - while (depth--) { - if (instA === instB || instA === instB.alternate) { - return instA; - } - instA = getParent(instA); - instB = getParent(instB); - } - return null; -} +/***/ }), +/* 383 */ +/***/ (function(module, exports, __webpack_require__) { + +var copyObject = __webpack_require__(27), + createAssigner = __webpack_require__(334), + keysIn = __webpack_require__(99); /** - * Return if A is an ancestor of B. + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extend + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assign + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assignIn({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } */ +var assignIn = createAssigner(function(object, source) { + copyObject(source, keysIn(source), object); +}); +module.exports = assignIn; -/** - * Return the parent instance of the passed-in instance. - */ -function getParentInstance(inst) { - return getParent(inst); -} -/** - * Simulates the traversal of a two-phase, capture/bubble event dispatch. - */ -function traverseTwoPhase(inst, fn, arg) { - var path = []; - while (inst) { - path.push(inst); - inst = getParent(inst); - } - var i = void 0; - for (i = path.length; i-- > 0;) { - fn(path[i], 'captured', arg); - } - for (i = 0; i < path.length; i++) { - fn(path[i], 'bubbled', arg); - } -} +/***/ }), +/* 384 */ +/***/ (function(module, exports) { /** - * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that - * should would receive a `mouseEnter` or `mouseLeave` event. + * Creates a function that returns `value`. * - * Does not invoke the callback on the nearest common ancestor because nothing - * "entered" or "left" that element. - */ -function traverseEnterLeave(from, to, fn, argFrom, argTo) { - var common = from && to ? getLowestCommonAncestor(from, to) : null; - var pathFrom = []; - while (true) { - if (!from) { - break; - } - if (from === common) { - break; - } - var alternate = from.alternate; - if (alternate !== null && alternate === common) { - break; - } - pathFrom.push(from); - from = getParent(from); - } - var pathTo = []; - while (true) { - if (!to) { - break; - } - if (to === common) { - break; - } - var _alternate = to.alternate; - if (_alternate !== null && _alternate === common) { - break; - } - pathTo.push(to); - to = getParent(to); - } - for (var i = 0; i < pathFrom.length; i++) { - fn(pathFrom[i], 'bubbled', argFrom); - } - for (var _i = pathTo.length; _i-- > 0;) { - fn(pathTo[_i], 'captured', argTo); - } -} - -/** - * Some event types have a notion of different registration names for different - * "phases" of propagation. This finds listeners by a given phase. + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new constant function. + * @example + * + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); + * // => true */ -function listenerAtPhase(inst, event, propagationPhase) { - var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; - return getListener(inst, registrationName); +function constant(value) { + return function() { + return value; + }; } -/** - * A small set of propagation patterns, each of which will accept a small amount - * of information, and generate a set of "dispatch ready event objects" - which - * are sets of events that have already been annotated with a set of dispatched - * listener functions/ids. The API is designed this way to discourage these - * propagation strategies from actually executing the dispatches, since we - * always want to collect the entire set of dispatches before executing even a - * single one. - */ +module.exports = constant; -/** - * Tags a `SyntheticEvent` with dispatched listeners. Creating this function - * here, allows us to not have to bind or create functions for each event. - * Mutating the event's members allows us to not have to create a wrapping - * "dispatch" object that pairs the event with the listener. - */ -function accumulateDirectionalDispatches(inst, phase, event) { - { - warning(inst, 'Dispatching inst must not be null'); - } - var listener = listenerAtPhase(inst, event, phase); - if (listener) { - event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); - event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); - } -} + +/***/ }), +/* 385 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(94); + + +/***/ }), +/* 386 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(383); + + +/***/ }), +/* 387 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseFlatten = __webpack_require__(298); /** - * Collect dispatches (must be entirely collected before dispatching - see unit - * tests). Lazily allocate the array to conserve memory. We must loop through - * each event and perform the traversal for each one. We cannot perform a - * single traversal for the entire collection of events because each event may - * have a different target. + * Flattens `array` a single level deep. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flatten([1, [2, [3, [4]], 5]]); + * // => [1, 2, [3, [4]], 5] */ -function accumulateTwoPhaseDispatchesSingle(event) { - if (event && event.dispatchConfig.phasedRegistrationNames) { - traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); - } +function flatten(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, 1) : []; } +module.exports = flatten; + + +/***/ }), +/* 388 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseGet = __webpack_require__(84); + /** - * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' */ -function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { - if (event && event.dispatchConfig.phasedRegistrationNames) { - var targetInst = event._targetInst; - var parentInst = targetInst ? getParentInstance(targetInst) : null; - traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event); - } +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; } +module.exports = get; + + +/***/ }), +/* 389 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseHasIn = __webpack_require__(301), + hasPath = __webpack_require__(344); + /** - * Accumulates without regard to direction, does not look for phased - * registration names. Same as `accumulateDirectDispatchesSingle` but without - * requiring that the `dispatchMarker` be the same as the dispatched ID. + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b'); + * // => true + * + * _.hasIn(object, ['a', 'b']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false */ -function accumulateDispatches(inst, ignoredDirection, event) { - if (inst && event && event.dispatchConfig.registrationName) { - var registrationName = event.dispatchConfig.registrationName; - var listener = getListener(inst, registrationName); - if (listener) { - event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); - event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); - } - } +function hasIn(object, path) { + return object != null && hasPath(object, path, baseHasIn); } +module.exports = hasIn; + + +/***/ }), +/* 390 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseIsMap = __webpack_require__(304), + baseUnary = __webpack_require__(86), + nodeUtil = __webpack_require__(93); + +/* Node.js helper references. */ +var nodeIsMap = nodeUtil && nodeUtil.isMap; + /** - * Accumulates dispatches on an `SyntheticEvent`, but only for the - * `dispatchMarker`. - * @param {SyntheticEvent} event + * Checks if `value` is classified as a `Map` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a map, else `false`. + * @example + * + * _.isMap(new Map); + * // => true + * + * _.isMap(new WeakMap); + * // => false */ -function accumulateDirectDispatchesSingle(event) { - if (event && event.dispatchConfig.registrationName) { - accumulateDispatches(event._targetInst, null, event); - } -} +var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; -function accumulateTwoPhaseDispatches(events) { - forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); -} +module.exports = isMap; -function accumulateTwoPhaseDispatchesSkipTarget(events) { - forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); -} -function accumulateEnterLeaveDispatches(leave, enter, from, to) { - traverseEnterLeave(from, to, accumulateDispatches, leave, enter); -} +/***/ }), +/* 391 */ +/***/ (function(module, exports, __webpack_require__) { -function accumulateDirectDispatches(events) { - forEachAccumulated(events, accumulateDirectDispatchesSingle); -} +var baseGetTag = __webpack_require__(26), + getPrototype = __webpack_require__(88), + isObjectLike = __webpack_require__(11); -var EventPropagators = Object.freeze({ - accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches, - accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget, - accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches, - accumulateDirectDispatches: accumulateDirectDispatches -}); +/** `Object#toString` result references. */ +var objectTag = '[object Object]'; -var contentKey = null; +/** Used for built-in method references. */ +var funcProto = Function.prototype, + objectProto = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Used to infer the `Object` constructor. */ +var objectCtorString = funcToString.call(Object); /** - * Gets the key used to access text content on a DOM node. + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. * - * @return {?string} Key used to access text content. - * @internal + * @static + * @memberOf _ + * @since 0.8.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * _.isPlainObject(new Foo); + * // => false + * + * _.isPlainObject([1, 2, 3]); + * // => false + * + * _.isPlainObject({ 'x': 0, 'y': 0 }); + * // => true + * + * _.isPlainObject(Object.create(null)); + * // => true */ -function getTextContentAccessor() { - if (!contentKey && ExecutionEnvironment.canUseDOM) { - // Prefer textContent to innerText because many browsers support both but - // SVG elements don't support innerText even when
does. - contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText'; +function isPlainObject(value) { + if (!isObjectLike(value) || baseGetTag(value) != objectTag) { + return false; } - return contentKey; + var proto = getPrototype(value); + if (proto === null) { + return true; + } + var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; + return typeof Ctor == 'function' && Ctor instanceof Ctor && + funcToString.call(Ctor) == objectCtorString; } +module.exports = isPlainObject; + + +/***/ }), +/* 392 */ +/***/ (function(module, exports, __webpack_require__) { + +var baseIsSet = __webpack_require__(307), + baseUnary = __webpack_require__(86), + nodeUtil = __webpack_require__(93); + +/* Node.js helper references. */ +var nodeIsSet = nodeUtil && nodeUtil.isSet; + /** - * This helper object stores information about text content of a target node, - * allowing comparison of content before and after a given event. + * Checks if `value` is classified as a `Set` object. * - * Identify the node where selection currently begins, then observe - * both its text content and its current position in the DOM. Since the - * browser may natively replace the target node during composition, we can - * use its position to find its replacement. + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a set, else `false`. + * @example * + * _.isSet(new Set); + * // => true * + * _.isSet(new WeakSet); + * // => false */ -var compositionState = { - _root: null, - _startText: null, - _fallbackText: null -}; +var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; -function initialize(nativeEventTarget) { - compositionState._root = nativeEventTarget; - compositionState._startText = getText(); - return true; -} +module.exports = isSet; -function reset() { - compositionState._root = null; - compositionState._startText = null; - compositionState._fallbackText = null; + +/***/ }), +/* 393 */ +/***/ (function(module, exports) { + +/** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ +function last(array) { + var length = array == null ? 0 : array.length; + return length ? array[length - 1] : undefined; } -function getData() { - if (compositionState._fallbackText) { - return compositionState._fallbackText; - } +module.exports = last; - var start = void 0; - var startValue = compositionState._startText; - var startLength = startValue.length; - var end = void 0; - var endValue = getText(); - var endLength = endValue.length; - for (start = 0; start < startLength; start++) { - if (startValue[start] !== endValue[start]) { - break; - } - } +/***/ }), +/* 394 */ +/***/ (function(module, exports, __webpack_require__) { - var minEnd = startLength - start; - for (end = 1; end <= minEnd; end++) { - if (startValue[startLength - end] !== endValue[endLength - end]) { - break; - } - } +var arrayMap = __webpack_require__(82), + baseIteratee = __webpack_require__(309), + baseMap = __webpack_require__(312), + isArray = __webpack_require__(4); - var sliceTail = end > 1 ? 1 - end : undefined; - compositionState._fallbackText = endValue.slice(start, sliceTail); - return compositionState._fallbackText; +/** + * Creates an array of values by running each element in `collection` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, + * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, + * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, + * `template`, `trim`, `trimEnd`, `trimStart`, and `words` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + * @example + * + * function square(n) { + * return n * n; + * } + * + * _.map([4, 8], square); + * // => [16, 64] + * + * _.map({ 'a': 4, 'b': 8 }, square); + * // => [16, 64] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // The `_.property` iteratee shorthand. + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */ +function map(collection, iteratee) { + var func = isArray(collection) ? arrayMap : baseMap; + return func(collection, baseIteratee(iteratee, 3)); } -function getText() { - if ('value' in compositionState._root) { - return compositionState._root.value; - } - return compositionState._root[getTextContentAccessor()]; -} +module.exports = map; -/* eslint valid-typeof: 0 */ -var didWarnForAddedNewProperty = false; -var EVENT_POOL_SIZE = 10; +/***/ }), +/* 395 */ +/***/ (function(module, exports, __webpack_require__) { -var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances']; +var MapCache = __webpack_require__(80); -/** - * @interface Event - * @see http://www.w3.org/TR/DOM-Level-3-Events/ - */ -var EventInterface = { - type: null, - target: null, - // currentTarget is set when dispatching; no use in copying it here - currentTarget: emptyFunction.thatReturnsNull, - eventPhase: null, - bubbles: null, - cancelable: null, - timeStamp: function (event) { - return event.timeStamp || Date.now(); - }, - defaultPrevented: null, - isTrusted: null -}; +/** Error message constants. */ +var FUNC_ERROR_TEXT = 'Expected a function'; /** - * Synthetic events are dispatched by event plugins, typically in response to a - * top-level event delegation handler. + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. * - * These systems should generally use pooling to reduce the frequency of garbage - * collection. The system should check `isPersistent` to determine whether the - * event should be released into the pool after being dispatched. Users that - * need a persisted event should invoke `persist`. + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `clear`, `delete`, `get`, `has`, and `set`. * - * Synthetic events (and subclasses) implement the DOM Level 3 Events API by - * normalizing browser quirks. Subclasses do not necessarily have to implement a - * DOM interface; custom application-specific events can also subclass this. + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example * - * @param {object} dispatchConfig Configuration used to dispatch this event. - * @param {*} targetInst Marker identifying the event target. - * @param {object} nativeEvent Native browser event. - * @param {DOMEventTarget} nativeEventTarget Target node. + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; */ -function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) { - { - // these have a getter/setter for warnings - delete this.nativeEvent; - delete this.preventDefault; - delete this.stopPropagation; +function memoize(func, resolver) { + if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { + throw new TypeError(FUNC_ERROR_TEXT); } + var memoized = function() { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; - this.dispatchConfig = dispatchConfig; - this._targetInst = targetInst; - this.nativeEvent = nativeEvent; - - var Interface = this.constructor.Interface; - for (var propName in Interface) { - if (!Interface.hasOwnProperty(propName)) { - continue; - } - { - delete this[propName]; // this has a getter/setter for warnings - } - var normalize = Interface[propName]; - if (normalize) { - this[propName] = normalize(nativeEvent); - } else { - if (propName === 'target') { - this.target = nativeEventTarget; - } else { - this[propName] = nativeEvent[propName]; - } + if (cache.has(key)) { + return cache.get(key); } - } - - var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; - if (defaultPrevented) { - this.isDefaultPrevented = emptyFunction.thatReturnsTrue; - } else { - this.isDefaultPrevented = emptyFunction.thatReturnsFalse; - } - this.isPropagationStopped = emptyFunction.thatReturnsFalse; - return this; + var result = func.apply(this, args); + memoized.cache = cache.set(key, result) || cache; + return result; + }; + memoized.cache = new (memoize.Cache || MapCache); + return memoized; } -_assign(SyntheticEvent.prototype, { - preventDefault: function () { - this.defaultPrevented = true; - var event = this.nativeEvent; - if (!event) { - return; - } - - if (event.preventDefault) { - event.preventDefault(); - } else if (typeof event.returnValue !== 'unknown') { - event.returnValue = false; - } - this.isDefaultPrevented = emptyFunction.thatReturnsTrue; - }, - - stopPropagation: function () { - var event = this.nativeEvent; - if (!event) { - return; - } +// Expose `MapCache`. +memoize.Cache = MapCache; - if (event.stopPropagation) { - event.stopPropagation(); - } else if (typeof event.cancelBubble !== 'unknown') { - // The ChangeEventPlugin registers a "propertychange" event for - // IE. This event does not support bubbling or cancelling, and - // any references to cancelBubble throw "Member not found". A - // typeof check of "unknown" circumvents this issue (and is also - // IE specific). - event.cancelBubble = true; - } +module.exports = memoize; - this.isPropagationStopped = emptyFunction.thatReturnsTrue; - }, - /** - * We release all dispatched `SyntheticEvent`s after each event loop, adding - * them back into the pool. This allows a way to hold onto a reference that - * won't be added back into the pool. - */ - persist: function () { - this.isPersistent = emptyFunction.thatReturnsTrue; - }, +/***/ }), +/* 396 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Checks if this event should be released back into the pool. - * - * @return {boolean} True if this should not be released, false otherwise. - */ - isPersistent: emptyFunction.thatReturnsFalse, - - /** - * `PooledClass` looks for `destructor` on each instance it releases. - */ - destructor: function () { - var Interface = this.constructor.Interface; - for (var propName in Interface) { - { - Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName])); - } - } - for (var i = 0; i < shouldBeReleasedProperties.length; i++) { - this[shouldBeReleasedProperties[i]] = null; - } - { - Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null)); - Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction)); - Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction)); - } - } -}); - -SyntheticEvent.Interface = EventInterface; +var baseProperty = __webpack_require__(315), + basePropertyDeep = __webpack_require__(316), + isKey = __webpack_require__(91), + toKey = __webpack_require__(33); /** - * Helper to reduce boilerplate when creating subclasses. + * Creates a function that returns the value at `path` of a given object. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + * @example + * + * var objects = [ + * { 'a': { 'b': 2 } }, + * { 'a': { 'b': 1 } } + * ]; + * + * _.map(objects, _.property('a.b')); + * // => [2, 1] + * + * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); + * // => [1, 2] */ -SyntheticEvent.extend = function (Interface) { - var Super = this; - - var E = function () {}; - E.prototype = Super.prototype; - var prototype = new E(); +function property(path) { + return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); +} - function Class() { - return Super.apply(this, arguments); - } - _assign(prototype, Class.prototype); - Class.prototype = prototype; - Class.prototype.constructor = Class; +module.exports = property; - Class.Interface = _assign({}, Super.Interface, Interface); - Class.extend = Super.extend; - addEventPoolingTo(Class); - return Class; -}; +/***/ }), +/* 397 */ +/***/ (function(module, exports) { -/** Proxying after everything set on SyntheticEvent - * to resolve Proxy issue on some WebKit browsers - * in which some Event properties are set to undefined (GH#10010) +/** + * This method returns `false`. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {boolean} Returns `false`. + * @example + * + * _.times(2, _.stubFalse); + * // => [false, false] */ -{ - var isProxySupported = typeof Proxy === 'function' && - // https://github.com/facebook/react/issues/12011 - !Object.isSealed(new Proxy({}, {})); - - if (isProxySupported) { - /*eslint-disable no-func-assign */ - SyntheticEvent = new Proxy(SyntheticEvent, { - construct: function (target, args) { - return this.apply(target, Object.create(target.prototype), args); - }, - apply: function (constructor, that, args) { - return new Proxy(constructor.apply(that, args), { - set: function (target, prop, value) { - if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) { - 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.'); - didWarnForAddedNewProperty = true; - } - target[prop] = value; - return true; - } - }); - } - }); - /*eslint-enable no-func-assign */ - } +function stubFalse() { + return false; } -addEventPoolingTo(SyntheticEvent); +module.exports = stubFalse; -/** - * Helper to nullify syntheticEvent instance properties when destructing - * - * @param {String} propName - * @param {?object} getVal - * @return {object} defineProperty object - */ -function getPooledWarningPropertyDefinition(propName, getVal) { - var isFunction = typeof getVal === 'function'; - return { - configurable: true, - set: set, - get: get - }; - function set(val) { - var action = isFunction ? 'setting the method' : 'setting the property'; - warn(action, 'This is effectively a no-op'); - return val; - } +/***/ }), +/* 398 */ +/***/ (function(module, exports, __webpack_require__) { - function get() { - var action = isFunction ? 'accessing the method' : 'accessing the property'; - var result = isFunction ? 'This is a no-op function' : 'This is set to null'; - warn(action, result); - return getVal; - } +var baseToString = __webpack_require__(321); - function warn(action, result) { - var warningCondition = false; - 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); - } +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); } -function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { - var EventConstructor = this; - if (EventConstructor.eventPool.length) { - var instance = EventConstructor.eventPool.pop(); - EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst); - return instance; - } - return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst); -} +module.exports = toString; -function releasePooledEvent(event) { - var EventConstructor = this; - !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0; - event.destructor(); - if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) { - EventConstructor.eventPool.push(event); - } -} -function addEventPoolingTo(EventConstructor) { - EventConstructor.eventPool = []; - EventConstructor.getPooled = getPooledEvent; - EventConstructor.release = releasePooledEvent; -} +/***/ }), +/* 399 */ +/***/ (function(module, exports, __webpack_require__) { -var SyntheticEvent$1 = SyntheticEvent; +var isarray = __webpack_require__(280) /** - * @interface Event - * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents + * Expose `pathToRegexp`. */ -var SyntheticCompositionEvent = SyntheticEvent$1.extend({ - data: null -}); +module.exports = pathToRegexp +module.exports.parse = parse +module.exports.compile = compile +module.exports.tokensToFunction = tokensToFunction +module.exports.tokensToRegExp = tokensToRegExp /** - * @interface Event - * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 - * /#events-inputevents + * The main path matching regexp utility. + * + * @type {RegExp} */ -var SyntheticInputEvent = SyntheticEvent$1.extend({ - data: null -}); +var PATH_REGEXP = new RegExp([ + // Match escaped characters that would otherwise appear in future matches. + // This allows the user to escape special characters that won't transform. + '(\\\\.)', + // Match Express-style parameters and un-named parameters with a prefix + // and optional suffixes. Matches appear as: + // + // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined] + // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined] + // "/*" => ["/", undefined, undefined, undefined, undefined, "*"] + '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))' +].join('|'), 'g') -var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space -var START_KEYCODE = 229; +/** + * Parse a string for the raw tokens. + * + * @param {string} str + * @param {Object=} options + * @return {!Array} + */ +function parse (str, options) { + var tokens = [] + var key = 0 + var index = 0 + var path = '' + var defaultDelimiter = options && options.delimiter || '/' + var res -var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window; + while ((res = PATH_REGEXP.exec(str)) != null) { + var m = res[0] + var escaped = res[1] + var offset = res.index + path += str.slice(index, offset) + index = offset + m.length -var documentMode = null; -if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) { - documentMode = document.documentMode; -} + // Ignore already escaped sequences. + if (escaped) { + path += escaped[1] + continue + } -// Webkit offers a very useful `textInput` event that can be used to -// directly represent `beforeInput`. The IE `textinput` event is not as -// useful, so we don't use it. -var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode; + var next = str[index] + var prefix = res[2] + var name = res[3] + var capture = res[4] + var group = res[5] + var modifier = res[6] + var asterisk = res[7] -// In IE9+, we have access to composition events, but the data supplied -// by the native compositionend event may be incorrect. Japanese ideographic -// spaces, for instance (\u3000) are not recorded correctly. -var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); + // Push the current path onto the tokens. + if (path) { + tokens.push(path) + path = '' + } -var SPACEBAR_CODE = 32; -var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); + var partial = prefix != null && next != null && next !== prefix + var repeat = modifier === '+' || modifier === '*' + var optional = modifier === '?' || modifier === '*' + var delimiter = res[2] || defaultDelimiter + var pattern = capture || group -// Events and their corresponding property names. -var eventTypes = { - beforeInput: { - phasedRegistrationNames: { - bubbled: 'onBeforeInput', - captured: 'onBeforeInputCapture' - }, - dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste'] - }, - compositionEnd: { - phasedRegistrationNames: { - bubbled: 'onCompositionEnd', - captured: 'onCompositionEndCapture' - }, - dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] - }, - compositionStart: { - phasedRegistrationNames: { - bubbled: 'onCompositionStart', - captured: 'onCompositionStartCapture' - }, - dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] - }, - compositionUpdate: { - phasedRegistrationNames: { - bubbled: 'onCompositionUpdate', - captured: 'onCompositionUpdateCapture' - }, - dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] + tokens.push({ + name: name || key++, + prefix: prefix || '', + delimiter: delimiter, + optional: optional, + repeat: repeat, + partial: partial, + asterisk: !!asterisk, + pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?') + }) } -}; - -// Track whether we've ever handled a keypress on the space key. -var hasSpaceKeypress = false; -/** - * Return whether a native keypress event is assumed to be a command. - * This is required because Firefox fires `keypress` events for key commands - * (cut, copy, select-all, etc.) even though no character is inserted. - */ -function isKeypressCommand(nativeEvent) { - return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && - // ctrlKey && altKey is equivalent to AltGr, and is not a command. - !(nativeEvent.ctrlKey && nativeEvent.altKey); -} + // Match any characters still remaining. + if (index < str.length) { + path += str.substr(index) + } -/** - * Translate native top level events into event types. - * - * @param {string} topLevelType - * @return {object} - */ -function getCompositionEventType(topLevelType) { - switch (topLevelType) { - case 'topCompositionStart': - return eventTypes.compositionStart; - case 'topCompositionEnd': - return eventTypes.compositionEnd; - case 'topCompositionUpdate': - return eventTypes.compositionUpdate; + // If the path exists, push it onto the end. + if (path) { + tokens.push(path) } + + return tokens } /** - * Does our fallback best-guess model think this event signifies that - * composition has begun? + * Compile a string to a template function for the path. * - * @param {string} topLevelType - * @param {object} nativeEvent - * @return {boolean} + * @param {string} str + * @param {Object=} options + * @return {!function(Object=, Object=)} */ -function isFallbackCompositionStart(topLevelType, nativeEvent) { - return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE; +function compile (str, options) { + return tokensToFunction(parse(str, options)) } /** - * Does our fallback mode think that this event is the end of composition? + * Prettier encoding of URI path segments. * - * @param {string} topLevelType - * @param {object} nativeEvent - * @return {boolean} + * @param {string} + * @return {string} */ -function isFallbackCompositionEnd(topLevelType, nativeEvent) { - switch (topLevelType) { - case 'topKeyUp': - // Command keys insert or clear IME input. - return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; - case 'topKeyDown': - // Expect IME keyCode on each keydown. If we get any other - // code we must have exited earlier. - return nativeEvent.keyCode !== START_KEYCODE; - case 'topKeyPress': - case 'topMouseDown': - case 'topBlur': - // Events are not possible without cancelling IME. - return true; - default: - return false; - } +function encodeURIComponentPretty (str) { + return encodeURI(str).replace(/[\/?#]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase() + }) } /** - * Google Input Tools provides composition data via a CustomEvent, - * with the `data` property populated in the `detail` object. If this - * is available on the event object, use it. If not, this is a plain - * composition event and we have nothing special to extract. + * Encode the asterisk parameter. Similar to `pretty`, but allows slashes. * - * @param {object} nativeEvent - * @return {?string} + * @param {string} + * @return {string} */ -function getDataFromCustomEvent(nativeEvent) { - var detail = nativeEvent.detail; - if (typeof detail === 'object' && 'data' in detail) { - return detail.data; - } - return null; +function encodeAsterisk (str) { + return encodeURI(str).replace(/[?#]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase() + }) } -// Track the current IME composition status, if any. -var isComposing = false; - /** - * @return {?object} A SyntheticCompositionEvent. + * Expose a method for transforming tokens into the path function. */ -function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { - var eventType = void 0; - var fallbackData = void 0; +function tokensToFunction (tokens) { + // Compile all the tokens into regexps. + var matches = new Array(tokens.length) - if (canUseCompositionEvent) { - eventType = getCompositionEventType(topLevelType); - } else if (!isComposing) { - if (isFallbackCompositionStart(topLevelType, nativeEvent)) { - eventType = eventTypes.compositionStart; + // Compile all the patterns before compilation. + for (var i = 0; i < tokens.length; i++) { + if (typeof tokens[i] === 'object') { + matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$') } - } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { - eventType = eventTypes.compositionEnd; } - if (!eventType) { - return null; - } + return function (obj, opts) { + var path = '' + var data = obj || {} + var options = opts || {} + var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent - if (useFallbackCompositionData) { - // The current composition is stored statically and must not be - // overwritten while composition continues. - if (!isComposing && eventType === eventTypes.compositionStart) { - isComposing = initialize(nativeEventTarget); - } else if (eventType === eventTypes.compositionEnd) { - if (isComposing) { - fallbackData = getData(); + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i] + + if (typeof token === 'string') { + path += token + + continue } - } - } - var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget); + var value = data[token.name] + var segment - if (fallbackData) { - // Inject data generated from fallback path into the synthetic event. - // This matches the property of native CompositionEventInterface. - event.data = fallbackData; - } else { - var customData = getDataFromCustomEvent(nativeEvent); - if (customData !== null) { - event.data = customData; + if (value == null) { + if (token.optional) { + // Prepend partial segment prefixes. + if (token.partial) { + path += token.prefix + } + + continue + } else { + throw new TypeError('Expected "' + token.name + '" to be defined') + } + } + + if (isarray(value)) { + if (!token.repeat) { + throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`') + } + + if (value.length === 0) { + if (token.optional) { + continue + } else { + throw new TypeError('Expected "' + token.name + '" to not be empty') + } + } + + for (var j = 0; j < value.length; j++) { + segment = encode(value[j]) + + if (!matches[i].test(segment)) { + throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`') + } + + path += (j === 0 ? token.prefix : token.delimiter) + segment + } + + continue + } + + segment = token.asterisk ? encodeAsterisk(value) : encode(value) + + if (!matches[i].test(segment)) { + throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"') + } + + path += token.prefix + segment } + + return path } +} - accumulateTwoPhaseDispatches(event); - return event; +/** + * Escape a regular expression string. + * + * @param {string} str + * @return {string} + */ +function escapeString (str) { + return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1') } /** - * @param {TopLevelTypes} topLevelType Record from `BrowserEventConstants`. - * @param {object} nativeEvent Native browser event. - * @return {?string} The string corresponding to this `beforeInput` event. + * Escape the capturing group by escaping special characters and meaning. + * + * @param {string} group + * @return {string} */ -function getNativeBeforeInputChars(topLevelType, nativeEvent) { - switch (topLevelType) { - case 'topCompositionEnd': - return getDataFromCustomEvent(nativeEvent); - case 'topKeyPress': - /** - * If native `textInput` events are available, our goal is to make - * use of them. However, there is a special case: the spacebar key. - * In Webkit, preventing default on a spacebar `textInput` event - * cancels character insertion, but it *also* causes the browser - * to fall back to its default spacebar behavior of scrolling the - * page. - * - * Tracking at: - * https://code.google.com/p/chromium/issues/detail?id=355103 - * - * To avoid this issue, use the keypress event as if no `textInput` - * event is available. - */ - var which = nativeEvent.which; - if (which !== SPACEBAR_CODE) { - return null; - } - - hasSpaceKeypress = true; - return SPACEBAR_CHAR; - - case 'topTextInput': - // Record the characters to be added to the DOM. - var chars = nativeEvent.data; - - // If it's a spacebar character, assume that we have already handled - // it at the keypress level and bail immediately. Android Chrome - // doesn't give us keycodes, so we need to blacklist it. - if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { - return null; - } +function escapeGroup (group) { + return group.replace(/([=!:$\/()])/g, '\\$1') +} - return chars; +/** + * Attach the keys as a property of the regexp. + * + * @param {!RegExp} re + * @param {Array} keys + * @return {!RegExp} + */ +function attachKeys (re, keys) { + re.keys = keys + return re +} - default: - // For other native event types, do nothing. - return null; - } +/** + * Get the flags for a regexp from the options. + * + * @param {Object} options + * @return {string} + */ +function flags (options) { + return options.sensitive ? '' : 'i' } /** - * For browsers that do not provide the `textInput` event, extract the - * appropriate string to use for SyntheticInputEvent. + * Pull out keys from a regexp. * - * @param {string} topLevelType Record from `BrowserEventConstants`. - * @param {object} nativeEvent Native browser event. - * @return {?string} The fallback string for this `beforeInput` event. + * @param {!RegExp} path + * @param {!Array} keys + * @return {!RegExp} */ -function getFallbackBeforeInputChars(topLevelType, nativeEvent) { - // If we are currently composing (IME) and using a fallback to do so, - // try to extract the composed characters from the fallback object. - // If composition event is available, we extract a string only at - // compositionevent, otherwise extract it at fallback events. - if (isComposing) { - if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) { - var chars = getData(); - reset(); - isComposing = false; - return chars; +function regexpToRegexp (path, keys) { + // Use a negative lookahead to match only capturing groups. + var groups = path.source.match(/\((?!\?)/g) + + if (groups) { + for (var i = 0; i < groups.length; i++) { + keys.push({ + name: i, + prefix: null, + delimiter: null, + optional: false, + repeat: false, + partial: false, + asterisk: false, + pattern: null + }) } - return null; } - switch (topLevelType) { - case 'topPaste': - // If a paste event occurs after a keypress, throw out the input - // chars. Paste events should not lead to BeforeInput events. - return null; - case 'topKeyPress': - /** - * As of v27, Firefox may fire keypress events even when no character - * will be inserted. A few possibilities: - * - * - `which` is `0`. Arrow keys, Esc key, etc. - * - * - `which` is the pressed key code, but no char is available. - * Ex: 'AltGr + d` in Polish. There is no modified character for - * this key combination and no character is inserted into the - * document, but FF fires the keypress for char code `100` anyway. - * No `input` event will occur. - * - * - `which` is the pressed key code, but a command combination is - * being used. Ex: `Cmd+C`. No character is inserted, and no - * `input` event will occur. - */ - if (!isKeypressCommand(nativeEvent)) { - // IE fires the `keypress` event when a user types an emoji via - // Touch keyboard of Windows. In such a case, the `char` property - // holds an emoji character like `\uD83D\uDE0A`. Because its length - // is 2, the property `which` does not represent an emoji correctly. - // In such a case, we directly return the `char` property instead of - // using `which`. - if (nativeEvent.char && nativeEvent.char.length > 1) { - return nativeEvent.char; - } else if (nativeEvent.which) { - return String.fromCharCode(nativeEvent.which); - } - } - return null; - case 'topCompositionEnd': - return useFallbackCompositionData ? null : nativeEvent.data; - default: - return null; - } + return attachKeys(path, keys) } /** - * Extract a SyntheticInputEvent for `beforeInput`, based on either native - * `textInput` or fallback behavior. + * Transform an array into a regexp. * - * @return {?object} A SyntheticInputEvent. + * @param {!Array} path + * @param {Array} keys + * @param {!Object} options + * @return {!RegExp} */ -function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { - var chars = void 0; - - if (canUseTextInputEvent) { - chars = getNativeBeforeInputChars(topLevelType, nativeEvent); - } else { - chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); - } +function arrayToRegexp (path, keys, options) { + var parts = [] - // If no characters are being inserted, no BeforeInput event should - // be fired. - if (!chars) { - return null; + for (var i = 0; i < path.length; i++) { + parts.push(pathToRegexp(path[i], keys, options).source) } - var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget); + var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options)) - event.data = chars; - accumulateTwoPhaseDispatches(event); - return event; + return attachKeys(regexp, keys) } /** - * Create an `onBeforeInput` event to match - * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. - * - * This event plugin is based on the native `textInput` event - * available in Chrome, Safari, Opera, and IE. This event fires after - * `onKeyPress` and `onCompositionEnd`, but before `onInput`. + * Create a path regexp from string input. * - * `beforeInput` is spec'd but not implemented in any browsers, and - * the `input` event does not provide any useful information about what has - * actually been added, contrary to the spec. Thus, `textInput` is the best - * available event to identify the characters that have actually been inserted - * into the target node. + * @param {string} path + * @param {!Array} keys + * @param {!Object} options + * @return {!RegExp} + */ +function stringToRegexp (path, keys, options) { + return tokensToRegExp(parse(path, options), keys, options) +} + +/** + * Expose a function for taking tokens and returning a RegExp. * - * This plugin is also responsible for emitting `composition` events, thus - * allowing us to share composition fallback code for both `beforeInput` and - * `composition` event types. + * @param {!Array} tokens + * @param {(Array|Object)=} keys + * @param {Object=} options + * @return {!RegExp} */ -var BeforeInputEventPlugin = { - eventTypes: eventTypes, +function tokensToRegExp (tokens, keys, options) { + if (!isarray(keys)) { + options = /** @type {!Object} */ (keys || options) + keys = [] + } - extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { - var composition = extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget); + options = options || {} - var beforeInput = extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget); + var strict = options.strict + var end = options.end !== false + var route = '' - if (composition === null) { - return beforeInput; - } + // Iterate over the tokens and create our regexp string. + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i] - if (beforeInput === null) { - return composition; - } + if (typeof token === 'string') { + route += escapeString(token) + } else { + var prefix = escapeString(token.prefix) + var capture = '(?:' + token.pattern + ')' - return [composition, beforeInput]; - } -}; + keys.push(token) -// Use to restore controlled state after a change event has fired. + if (token.repeat) { + capture += '(?:' + prefix + capture + ')*' + } -var fiberHostComponent = null; + if (token.optional) { + if (!token.partial) { + capture = '(?:' + prefix + '(' + capture + '))?' + } else { + capture = prefix + '(' + capture + ')?' + } + } else { + capture = prefix + '(' + capture + ')' + } -var ReactControlledComponentInjection = { - injectFiberControlledHostComponent: function (hostComponentImpl) { - // The fiber implementation doesn't use dynamic dispatch so we need to - // inject the implementation. - fiberHostComponent = hostComponentImpl; + route += capture + } } -}; -var restoreTarget = null; -var restoreQueue = null; + var delimiter = escapeString(options.delimiter || '/') + var endsWithDelimiter = route.slice(-delimiter.length) === delimiter -function restoreStateOfTarget(target) { - // We perform this translation at the end of the event loop so that we - // always receive the correct fiber here - var internalInstance = getInstanceFromNode(target); - if (!internalInstance) { - // Unmounted - return; + // In non-strict mode we allow a slash at the end of match. If the path to + // match already ends with a slash, we remove it for consistency. The slash + // is valid at the end of a path match, not in the middle. This is important + // in non-ending mode, where "/test/" shouldn't match "/test//route". + if (!strict) { + route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?' } - !(fiberHostComponent && typeof fiberHostComponent.restoreControlledState === 'function') ? invariant(false, 'Fiber needs to be injected to handle a fiber target for controlled events. This error is likely caused by a bug in React. Please file an issue.') : void 0; - var props = getFiberCurrentPropsFromNode(internalInstance.stateNode); - fiberHostComponent.restoreControlledState(internalInstance.stateNode, internalInstance.type, props); -} -var injection$2 = ReactControlledComponentInjection; - -function enqueueStateRestore(target) { - if (restoreTarget) { - if (restoreQueue) { - restoreQueue.push(target); - } else { - restoreQueue = [target]; - } + if (end) { + route += '$' } else { - restoreTarget = target; + // In non-ending mode, we need the capturing groups to match as much as + // possible by using a positive lookahead to the end or next path segment. + route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)' } -} -function needsStateRestore() { - return restoreTarget !== null || restoreQueue !== null; + return attachKeys(new RegExp('^' + route, flags(options)), keys) } -function restoreStateIfNeeded() { - if (!restoreTarget) { - return; - } - var target = restoreTarget; - var queuedTargets = restoreQueue; - restoreTarget = null; - restoreQueue = null; - - restoreStateOfTarget(target); - if (queuedTargets) { - for (var i = 0; i < queuedTargets.length; i++) { - restoreStateOfTarget(queuedTargets[i]); - } +/** + * Normalize the given path string, returning a regular expression. + * + * An empty array can be passed in for the keys, which will hold the + * placeholder key descriptions. For example, using `/user/:id`, `keys` will + * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`. + * + * @param {(string|RegExp|Array)} path + * @param {(Array|Object)=} keys + * @param {Object=} options + * @return {!RegExp} + */ +function pathToRegexp (path, keys, options) { + if (!isarray(keys)) { + options = /** @type {!Object} */ (keys || options) + keys = [] } -} - -var ReactControlledComponent = Object.freeze({ - injection: injection$2, - enqueueStateRestore: enqueueStateRestore, - needsStateRestore: needsStateRestore, - restoreStateIfNeeded: restoreStateIfNeeded -}); - -// Used as a way to call batchedUpdates when we don't have a reference to -// the renderer. Such as when we're dispatching events or if third party -// libraries need to call batchedUpdates. Eventually, this API will go away when -// everything is batched by default. We'll then have a similar API to opt-out of -// scheduled work and instead do synchronous work. -// Defaults -var _batchedUpdates = function (fn, bookkeeping) { - return fn(bookkeeping); -}; -var _interactiveUpdates = function (fn, a, b) { - return fn(a, b); -}; -var _flushInteractiveUpdates = function () {}; + options = options || {} -var isBatching = false; -function batchedUpdates(fn, bookkeeping) { - if (isBatching) { - // If we are currently inside another batch, we need to wait until it - // fully completes before restoring state. - return fn(bookkeeping); + if (path instanceof RegExp) { + return regexpToRegexp(path, /** @type {!Array} */ (keys)) } - isBatching = true; - try { - return _batchedUpdates(fn, bookkeeping); - } finally { - // Here we wait until all updates have propagated, which is important - // when using controlled components within layers: - // https://github.com/facebook/react/issues/1698 - // Then we restore state of any controlled component. - isBatching = false; - var controlledComponentsHavePendingUpdates = needsStateRestore(); - if (controlledComponentsHavePendingUpdates) { - // If a controlled event was fired, we may need to restore the state of - // the DOM node back to the controlled value. This is necessary when React - // bails out of the update without touching the DOM. - _flushInteractiveUpdates(); - restoreStateIfNeeded(); - } + + if (isarray(path)) { + return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options) } -} -function interactiveUpdates(fn, a, b) { - return _interactiveUpdates(fn, a, b); + return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options) } +/***/ }), +/* 400 */ +/***/ (function(module, exports, __webpack_require__) { -var injection$3 = { - injectRenderer: function (renderer) { - _batchedUpdates = renderer.batchedUpdates; - _interactiveUpdates = renderer.interactiveUpdates; - _flushInteractiveUpdates = renderer.flushInteractiveUpdates; - } -}; - +"use strict"; /** - * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ -var supportedInputTypes = { - color: true, - date: true, - datetime: true, - 'datetime-local': true, - email: true, - month: true, - number: true, - password: true, - range: true, - search: true, - tel: true, - text: true, - time: true, - url: true, - week: true -}; -function isTextInputElement(elem) { - var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); - if (nodeName === 'input') { - return !!supportedInputTypes[elem.type]; - } - if (nodeName === 'textarea') { - return true; - } +var emptyFunction = __webpack_require__(16); +var invariant = __webpack_require__(17); +var ReactPropTypesSecret = __webpack_require__(101); - return false; -} +module.exports = function() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === ReactPropTypesSecret) { + // It is still safe when called from React. + return; + } + invariant( + false, + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use PropTypes.checkPropTypes() to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + }; + shim.isRequired = shim; + function getShim() { + return shim; + }; + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. + var ReactPropTypes = { + array: shim, + bool: shim, + func: shim, + number: shim, + object: shim, + string: shim, + symbol: shim, -/** - * HTML nodeType values that represent the type of the node - */ + any: shim, + arrayOf: getShim, + element: shim, + instanceOf: getShim, + node: shim, + objectOf: getShim, + oneOf: getShim, + oneOfType: getShim, + shape: getShim, + exact: getShim + }; -var ELEMENT_NODE = 1; -var TEXT_NODE = 3; -var COMMENT_NODE = 8; -var DOCUMENT_NODE = 9; -var DOCUMENT_FRAGMENT_NODE = 11; + ReactPropTypes.checkPropTypes = emptyFunction; + ReactPropTypes.PropTypes = ReactPropTypes; -/** - * Gets the target node from a native browser event by accounting for - * inconsistencies in browser DOM APIs. - * - * @param {object} nativeEvent Native browser event. - * @return {DOMEventTarget} Target node. - */ -function getEventTarget(nativeEvent) { - var target = nativeEvent.target || window; + return ReactPropTypes; +}; - // Normalize SVG element events #4963 - if (target.correspondingUseElement) { - target = target.correspondingUseElement; - } - // Safari may fire events on text nodes (Node.TEXT_NODE is 3). - // @see http://www.quirksmode.org/js/events_properties.html - return target.nodeType === TEXT_NODE ? target.parentNode : target; -} +/***/ }), +/* 401 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * Checks if an event is supported in the current execution environment. - * - * NOTE: This will not work correctly for non-generic events such as `change`, - * `reset`, `load`, `error`, and `select`. - * - * Borrows from Modernizr. +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright (c) 2013-present, Facebook, Inc. * - * @param {string} eventNameSuffix Event name, e.g. "click". - * @param {?boolean} capture Check if the capture phase is supported. - * @return {boolean} True if the event is supported. - * @internal - * @license Modernizr 3.0.0pre (Custom Build) | MIT + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ -function isEventSupported(eventNameSuffix, capture) { - if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { - return false; - } - - var eventName = 'on' + eventNameSuffix; - var isSupported = eventName in document; - if (!isSupported) { - var element = document.createElement('div'); - element.setAttribute(eventName, 'return;'); - isSupported = typeof element[eventName] === 'function'; - } - return isSupported; -} -function isCheckable(elem) { - var type = elem.type; - var nodeName = elem.nodeName; - return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio'); -} +var emptyFunction = __webpack_require__(16); +var invariant = __webpack_require__(17); +var warning = __webpack_require__(48); +var assign = __webpack_require__(35); -function getTracker(node) { - return node._valueTracker; -} +var ReactPropTypesSecret = __webpack_require__(101); +var checkPropTypes = __webpack_require__(100); -function detachTracker(node) { - node._valueTracker = null; -} +module.exports = function(isValidElement, throwOnDirectAccess) { + /* global Symbol */ + var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. -function getValueFromNode(node) { - var value = ''; - if (!node) { - return value; + /** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ + function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === 'function') { + return iteratorFn; + } } - if (isCheckable(node)) { - value = node.checked ? 'true' : 'false'; - } else { - value = node.value; - } + /** + * Collection of methods that allow declaration and validation of props that are + * supplied to React components. Example usage: + * + * var Props = require('ReactPropTypes'); + * var MyArticle = React.createClass({ + * propTypes: { + * // An optional string prop named "description". + * description: Props.string, + * + * // A required enum prop named "category". + * category: Props.oneOf(['News','Photos']).isRequired, + * + * // A prop named "dialog" that requires an instance of Dialog. + * dialog: Props.instanceOf(Dialog).isRequired + * }, + * render: function() { ... } + * }); + * + * A more formal specification of how these methods are used: + * + * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) + * decl := ReactPropTypes.{type}(.isRequired)? + * + * Each and every declaration produces a function with the same signature. This + * allows the creation of custom validation functions. For example: + * + * var MyLink = React.createClass({ + * propTypes: { + * // An optional string or URI prop named "href". + * href: function(props, propName, componentName) { + * var propValue = props[propName]; + * if (propValue != null && typeof propValue !== 'string' && + * !(propValue instanceof URI)) { + * return new Error( + * 'Expected a string or an URI for ' + propName + ' in ' + + * componentName + * ); + * } + * } + * }, + * render: function() {...} + * }); + * + * @internal + */ - return value; -} + var ANONYMOUS = '<>'; -function trackValueOnNode(node) { - var valueField = isCheckable(node) ? 'checked' : 'value'; - var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField); + // Important! + // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. + var ReactPropTypes = { + array: createPrimitiveTypeChecker('array'), + bool: createPrimitiveTypeChecker('boolean'), + func: createPrimitiveTypeChecker('function'), + number: createPrimitiveTypeChecker('number'), + object: createPrimitiveTypeChecker('object'), + string: createPrimitiveTypeChecker('string'), + symbol: createPrimitiveTypeChecker('symbol'), - var currentValue = '' + node[valueField]; + any: createAnyTypeChecker(), + arrayOf: createArrayOfTypeChecker, + element: createElementTypeChecker(), + instanceOf: createInstanceTypeChecker, + node: createNodeChecker(), + objectOf: createObjectOfTypeChecker, + oneOf: createEnumTypeChecker, + oneOfType: createUnionTypeChecker, + shape: createShapeTypeChecker, + exact: createStrictShapeTypeChecker, + }; - // if someone has already defined a value or Safari, then bail - // and don't track value will cause over reporting of changes, - // but it's better then a hard failure - // (needed for certain tests that spyOn input values and Safari) - if (node.hasOwnProperty(valueField) || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') { - return; + /** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ + /*eslint-disable no-self-compare*/ + function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return x !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } } + /*eslint-enable no-self-compare*/ - Object.defineProperty(node, valueField, { - configurable: true, - get: function () { - return descriptor.get.call(this); - }, - set: function (value) { - currentValue = '' + value; - descriptor.set.call(this, value); + /** + * We use an Error-like object for backward compatibility as people may call + * PropTypes directly and inspect their output. However, we don't use real + * Errors anymore. We don't inspect their stack anyway, and creating them + * is prohibitively expensive if they are created too often, such as what + * happens in oneOfType() for any type before the one that matched. + */ + function PropTypeError(message) { + this.message = message; + this.stack = ''; + } + // Make `instanceof Error` still work for returned errors. + PropTypeError.prototype = Error.prototype; + + function createChainableTypeChecker(validate) { + if (process.env.NODE_ENV !== 'production') { + var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; } - }); - // We could've passed this the first time - // but it triggers a bug in IE11 and Edge 14/15. - // Calling defineProperty() again should be equivalent. - // https://github.com/facebook/react/issues/11768 - Object.defineProperty(node, valueField, { - enumerable: descriptor.enumerable - }); + function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { + componentName = componentName || ANONYMOUS; + propFullName = propFullName || propName; - var tracker = { - getValue: function () { - return currentValue; - }, - setValue: function (value) { - currentValue = '' + value; - }, - stopTracking: function () { - detachTracker(node); - delete node[valueField]; + if (secret !== ReactPropTypesSecret) { + if (throwOnDirectAccess) { + // New behavior only for users of `prop-types` package + invariant( + false, + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use `PropTypes.checkPropTypes()` to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { + // Old behavior for people using React.PropTypes + var cacheKey = componentName + ':' + propName; + if ( + !manualPropTypeCallCache[cacheKey] && + // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3 + ) { + warning( + false, + 'You are manually calling a React.PropTypes validation ' + + 'function for the `%s` prop on `%s`. This is deprecated ' + + 'and will throw in the standalone `prop-types` package. ' + + 'You may be seeing this warning due to a third-party PropTypes ' + + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', + propFullName, + componentName + ); + manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; + } + } + } + if (props[propName] == null) { + if (isRequired) { + if (props[propName] === null) { + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); + } + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); + } + return null; + } else { + return validate(props, propName, componentName, location, propFullName); + } } - }; - return tracker; -} -function track(node) { - if (getTracker(node)) { - return; + var chainedCheckType = checkType.bind(null, false); + chainedCheckType.isRequired = checkType.bind(null, true); + + return chainedCheckType; } - // TODO: Once it's just Fiber we can move this to node._wrapperState - node._valueTracker = trackValueOnNode(node); -} + function createPrimitiveTypeChecker(expectedType) { + function validate(props, propName, componentName, location, propFullName, secret) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== expectedType) { + // `propValue` being instance of, say, date/regexp, pass the 'object' + // check, but we can offer a more precise error message here rather than + // 'of type `object`'. + var preciseType = getPreciseType(propValue); -function updateValueIfChanged(node) { - if (!node) { - return false; + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); } - var tracker = getTracker(node); - // if there is no tracker at this point it's unlikely - // that trying again will succeed - if (!tracker) { - return true; + function createAnyTypeChecker() { + return createChainableTypeChecker(emptyFunction.thatReturnsNull); } - var lastValue = tracker.getValue(); - var nextValue = getValueFromNode(node); - if (nextValue !== lastValue) { - tracker.setValue(nextValue); - return true; + function createArrayOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); + } + var propValue = props[propName]; + if (!Array.isArray(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); + } + for (var i = 0; i < propValue.length; i++) { + var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); } - return false; -} - -var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - -var ReactCurrentOwner = ReactInternals.ReactCurrentOwner; -var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame; - -var describeComponentFrame = function (name, source, ownerName) { - return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); -}; - -// The Symbol used to tag the ReactElement-like types. If there is no native Symbol -// nor polyfill, then a plain number is used for performance. -var hasSymbol = typeof Symbol === 'function' && Symbol['for']; - -var REACT_ELEMENT_TYPE = hasSymbol ? Symbol['for']('react.element') : 0xeac7; -var REACT_CALL_TYPE = hasSymbol ? Symbol['for']('react.call') : 0xeac8; -var REACT_RETURN_TYPE = hasSymbol ? Symbol['for']('react.return') : 0xeac9; -var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca; -var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb; -var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol['for']('react.strict_mode') : 0xeacc; -var REACT_PROVIDER_TYPE = hasSymbol ? Symbol['for']('react.provider') : 0xeacd; -var REACT_CONTEXT_TYPE = hasSymbol ? Symbol['for']('react.context') : 0xeace; -var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol['for']('react.async_mode') : 0xeacf; -var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol['for']('react.forward_ref') : 0xead0; - -var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; -var FAUX_ITERATOR_SYMBOL = '@@iterator'; -function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable === 'undefined') { - return null; + function createElementTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!isValidElement(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); + } + return null; + } + return createChainableTypeChecker(validate); } - var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; - if (typeof maybeIterator === 'function') { - return maybeIterator; + + function createInstanceTypeChecker(expectedClass) { + function validate(props, propName, componentName, location, propFullName) { + if (!(props[propName] instanceof expectedClass)) { + var expectedClassName = expectedClass.name || ANONYMOUS; + var actualClassName = getClassName(props[propName]); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); } - return null; -} -function getComponentName(fiber) { - var type = fiber.type; + function createEnumTypeChecker(expectedValues) { + if (!Array.isArray(expectedValues)) { + process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; + return emptyFunction.thatReturnsNull; + } - if (typeof type === 'function') { - return type.displayName || type.name; - } - if (typeof type === 'string') { - return type; - } - switch (type) { - case REACT_FRAGMENT_TYPE: - return 'ReactFragment'; - case REACT_PORTAL_TYPE: - return 'ReactPortal'; - case REACT_CALL_TYPE: - return 'ReactCall'; - case REACT_RETURN_TYPE: - return 'ReactReturn'; + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; + } + } + + var valuesString = JSON.stringify(expectedValues); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + } + return createChainableTypeChecker(validate); } - return null; -} -function describeFiber(fiber) { - switch (fiber.tag) { - case IndeterminateComponent: - case FunctionalComponent: - case ClassComponent: - case HostComponent: - var owner = fiber._debugOwner; - var source = fiber._debugSource; - var name = getComponentName(fiber); - var ownerName = null; - if (owner) { - ownerName = getComponentName(owner); + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); } - return describeComponentFrame(name, source, ownerName); - default: - return ''; + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (propValue.hasOwnProperty(key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + } + return null; + } + return createChainableTypeChecker(validate); } -} -// This function can only be called with a work-in-progress fiber and -// only during begin or complete phase. Do not call it under any other -// circumstances. -function getStackAddendumByWorkInProgressFiber(workInProgress) { - var info = ''; - var node = workInProgress; - do { - info += describeFiber(node); - // Otherwise this return pointer might point to the wrong tree: - node = node['return']; - } while (node); - return info; -} + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; + return emptyFunction.thatReturnsNull; + } -function getCurrentFiberOwnerName$1() { - { - var fiber = ReactDebugCurrentFiber.current; - if (fiber === null) { - return null; + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + warning( + false, + 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + + 'received %s at index %s.', + getPostfixForTypeWarning(checker), + i + ); + return emptyFunction.thatReturnsNull; + } } - var owner = fiber._debugOwner; - if (owner !== null && typeof owner !== 'undefined') { - return getComponentName(owner); + + function validate(props, propName, componentName, location, propFullName) { + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { + return null; + } + } + + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); } + return createChainableTypeChecker(validate); } - return null; -} -function getCurrentFiberStackAddendum$1() { - { - var fiber = ReactDebugCurrentFiber.current; - if (fiber === null) { + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } return null; } - // Safe because if current fiber exists, we are reconciling, - // and it is guaranteed to be the work-in-progress version. - return getStackAddendumByWorkInProgressFiber(fiber); + return createChainableTypeChecker(validate); } - return null; -} - -function resetCurrentFiber() { - ReactDebugCurrentFrame.getCurrentStack = null; - ReactDebugCurrentFiber.current = null; - ReactDebugCurrentFiber.phase = null; -} - -function setCurrentFiber(fiber) { - ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackAddendum$1; - ReactDebugCurrentFiber.current = fiber; - ReactDebugCurrentFiber.phase = null; -} -function setCurrentPhase(phase) { - ReactDebugCurrentFiber.phase = phase; -} - -var ReactDebugCurrentFiber = { - current: null, - phase: null, - resetCurrentFiber: resetCurrentFiber, - setCurrentFiber: setCurrentFiber, - setCurrentPhase: setCurrentPhase, - getCurrentFiberOwnerName: getCurrentFiberOwnerName$1, - getCurrentFiberStackAddendum: getCurrentFiberStackAddendum$1 -}; - -// A reserved attribute. -// It is handled by React separately and shouldn't be written to the DOM. -var RESERVED = 0; - -// A simple string attribute. -// Attributes that aren't in the whitelist are presumed to have this type. -var STRING = 1; - -// A string attribute that accepts booleans in React. In HTML, these are called -// "enumerated" attributes with "true" and "false" as possible values. -// When true, it should be set to a "true" string. -// When false, it should be set to a "false" string. -var BOOLEANISH_STRING = 2; + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (!checker) { + continue; + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } -// A real boolean attribute. -// When true, it should be present (set either to an empty string or its name). -// When false, it should be omitted. -var BOOLEAN = 3; + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + // We need to check all keys in case some are required but missing from + // props. + var allKeys = assign({}, props[propName], shapeTypes); + for (var key in allKeys) { + var checker = shapeTypes[key]; + if (!checker) { + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') + ); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } -// An attribute that can be used as a flag as well as with a value. -// When true, it should be present (set either to an empty string or its name). -// When false, it should be omitted. -// For any other value, should be present with that value. -var OVERLOADED_BOOLEAN = 4; + return createChainableTypeChecker(validate); + } -// An attribute that must be numeric or parse as a numeric. -// When falsy, it should be removed. -var NUMERIC = 5; + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } -// An attribute that must be positive numeric or parse as a positive numeric. -// When falsy, it should be removed. -var POSITIVE_NUMERIC = 6; + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; + } + } + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } + } + } + } else { + return false; + } -/* eslint-disable max-len */ -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'; -/* eslint-enable max-len */ -var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040'; + return true; + default: + return false; + } + } + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + return true; + } -var ROOT_ATTRIBUTE_NAME = 'data-reactroot'; -var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$'); + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue['@@toStringTag'] === 'Symbol') { + return true; + } -var illegalAttributeNameCache = {}; -var validatedAttributeNameCache = {}; + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; + } -function isAttributeNameSafe(attributeName) { - if (validatedAttributeNameCache.hasOwnProperty(attributeName)) { - return true; - } - if (illegalAttributeNameCache.hasOwnProperty(attributeName)) { return false; } - if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { - validatedAttributeNameCache[attributeName] = true; - return true; - } - illegalAttributeNameCache[attributeName] = true; - { - warning(false, 'Invalid attribute name: `%s`', attributeName); - } - return false; -} -function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) { - if (propertyInfo !== null) { - return propertyInfo.type === RESERVED; - } - if (isCustomComponentTag) { - return false; - } - if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) { - return true; + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; + } + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; + } + if (isSymbol(propType, propValue)) { + return 'symbol'; + } + return propType; } - return false; -} -function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) { - if (propertyInfo !== null && propertyInfo.type === RESERVED) { - return false; - } - switch (typeof value) { - case 'function': - // $FlowIssue symbol is perfectly valid here - case 'symbol': - // eslint-disable-line - return true; - case 'boolean': - { - if (isCustomComponentTag) { - return false; - } - if (propertyInfo !== null) { - return !propertyInfo.acceptsBooleans; - } else { - var prefix = name.toLowerCase().slice(0, 5); - return prefix !== 'data-' && prefix !== 'aria-'; - } + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; } - default: - return false; + } + return propType; } -} -function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) { - if (value === null || typeof value === 'undefined') { - return true; - } - if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) { - return true; + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } } - if (propertyInfo !== null) { - switch (propertyInfo.type) { - case BOOLEAN: - return !value; - case OVERLOADED_BOOLEAN: - return value === false; - case NUMERIC: - return isNaN(value); - case POSITIVE_NUMERIC: - return isNaN(value) || value < 1; + + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; } + return propValue.constructor.name; } - return false; -} -function getPropertyInfo(name) { - return properties.hasOwnProperty(name) ? properties[name] : null; -} + ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.PropTypes = ReactPropTypes; -function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace) { - this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN; - this.attributeName = attributeName; - this.attributeNamespace = attributeNamespace; - this.mustUseProperty = mustUseProperty; - this.propertyName = name; - this.type = type; -} + return ReactPropTypes; +}; -// When adding attributes to this list, be sure to also add them to -// the `possibleStandardNames` module to ensure casing and incorrect -// name warnings. -var properties = {}; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) -// These props are reserved by React. They shouldn't be written to the DOM. -['children', 'dangerouslySetInnerHTML', -// TODO: This prevents the assignment of defaultValue to regular -// elements (not just inputs). Now that ReactDOMInput assigns to the -// defaultValue property -- do we need this? -'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) { - properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty - name, // attributeName - null); -}); +/***/ }), +/* 402 */ +/***/ (function(module, exports, __webpack_require__) { -// A few React string attributes have a different name. -// This is a mapping from React prop names to the attribute names. -[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) { - var name = _ref[0], - attributeName = _ref[1]; +"use strict"; - properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty - attributeName, // attributeName - null); -}); -// These are "enumerated" HTML attributes that accept "true" and "false". -// In React, we let users pass `true` and `false` even though technically -// these aren't boolean attributes (they are coerced to strings). -['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) { - properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty - name.toLowerCase(), // attributeName - null); +Object.defineProperty(exports, "__esModule", { + value: true }); +exports.default = appendImportantToEachValue; -// These are "enumerated" SVG attributes that accept "true" and "false". -// In React, we let users pass `true` and `false` even though technically -// these aren't boolean attributes (they are coerced to strings). -// Since these are SVG attributes, their attribute names are case-sensitive. -['autoReverse', 'externalResourcesRequired', 'preserveAlpha'].forEach(function (name) { - properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty - name, // attributeName - null); -}); +var _appendPxIfNeeded = __webpack_require__(158); -// These are HTML boolean attributes. -['allowFullScreen', 'async', -// Note: there is a special case that prevents it from being written to the DOM -// on the client side because the browsers are inconsistent. Instead we call focus(). -'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', -// Microdata -'itemScope'].forEach(function (name) { - properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty - name.toLowerCase(), // attributeName - null); -}); +var _appendPxIfNeeded2 = _interopRequireDefault(_appendPxIfNeeded); -// These are the few React props that we set as DOM properties -// rather than attributes. These are all booleans. -['checked', -// Note: `option.selected` is not updated if `select.multiple` is -// disabled with `removeAttribute`. We have special logic for handling this. -'multiple', 'muted', 'selected'].forEach(function (name) { - properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty - name.toLowerCase(), // attributeName - null); -}); +var _mapObject = __webpack_require__(163); -// These are HTML attributes that are "overloaded booleans": they behave like -// booleans, but can also accept a string value. -['capture', 'download'].forEach(function (name) { - properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty - name.toLowerCase(), // attributeName - null); -}); +var _mapObject2 = _interopRequireDefault(_mapObject); -// These are HTML attributes that must be positive numbers. -['cols', 'rows', 'size', 'span'].forEach(function (name) { - properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty - name.toLowerCase(), // attributeName - null); -}); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -// These are HTML attributes that must be numbers. -['rowSpan', 'start'].forEach(function (name) { - properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty - name.toLowerCase(), // attributeName - null); +function appendImportantToEachValue(style) { + return (0, _mapObject2.default)(style, function (result, key) { + return (0, _appendPxIfNeeded2.default)(key, style[key]) + ' !important'; + }); +} +module.exports = exports['default']; + +/***/ }), +/* 403 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true }); +var _camelCaseRegex = /([a-z])?([A-Z])/g; -var CAMELIZE = /[\-\:]([a-z])/g; -var capitalize = function (token) { - return token[1].toUpperCase(); +var _camelCaseReplacer = function _camelCaseReplacer(match, p1, p2) { + return (p1 || '') + '-' + p2.toLowerCase(); }; -// This is a list of all SVG attributes that need special casing, namespacing, -// or boolean value assignment. Regular attributes that just accept strings -// and have the same names are omitted, just like in the HTML whitelist. -// Some of these attributes can be hard to find. This list was created by -// scrapping the MDN documentation. -['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (attributeName) { - var name = attributeName.replace(CAMELIZE, capitalize); - properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty - attributeName, null); -}); +var _camelCaseToDashCase = function _camelCaseToDashCase(s) { + return s.replace(_camelCaseRegex, _camelCaseReplacer); +}; -// String SVG attributes with the xlink namespace. -['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) { - var name = attributeName.replace(CAMELIZE, capitalize); - properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty - attributeName, 'http://www.w3.org/1999/xlink'); -}); +var camelCasePropsToDashCase = function camelCasePropsToDashCase(prefixedStyle) { + // Since prefix is expected to work on inline style objects, we must + // translate the keys to dash case for rendering to CSS. + return Object.keys(prefixedStyle).reduce(function (result, key) { + var dashCaseKey = _camelCaseToDashCase(key); -// String SVG attributes with the xml namespace. -['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) { - var name = attributeName.replace(CAMELIZE, capitalize); - properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty - attributeName, 'http://www.w3.org/XML/1998/namespace'); + // Fix IE vendor prefix + if (/^ms-/.test(dashCaseKey)) { + dashCaseKey = '-' + dashCaseKey; + } + + result[dashCaseKey] = prefixedStyle[key]; + return result; + }, {}); +}; + +exports.default = camelCasePropsToDashCase; +module.exports = exports['default']; + +/***/ }), +/* 404 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true }); -// Special case: this attribute exists both in HTML and SVG. -// Its "tabindex" attribute name is case-sensitive in SVG so we can't just use -// its React `tabIndex` name, like we do for attributes that exist only in HTML. -properties.tabIndex = new PropertyInfoRecord('tabIndex', STRING, false, // mustUseProperty -'tabindex', // attributeName -null); +var _react = __webpack_require__(0); -/** - * Get the value for a property on a node. Only used in DEV for SSR validation. - * The "expected" argument is used as a hint of what the expected value is. - * Some properties have multiple equivalent values. - */ -function getValueForProperty(node, name, expected, propertyInfo) { - { - if (propertyInfo.mustUseProperty) { - var propertyName = propertyInfo.propertyName; +var _react2 = _interopRequireDefault(_react); - return node[propertyName]; - } else { - var attributeName = propertyInfo.attributeName; +var _propTypes = __webpack_require__(1); - var stringValue = null; +var _propTypes2 = _interopRequireDefault(_propTypes); - if (propertyInfo.type === OVERLOADED_BOOLEAN) { - if (node.hasAttribute(attributeName)) { - var value = node.getAttribute(attributeName); - if (value === '') { - return true; - } - if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { - return value; - } - if (value === '' + expected) { - return expected; - } - return value; - } - } else if (node.hasAttribute(attributeName)) { - if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { - // We had an attribute but shouldn't have had one, so read it - // for the error message. - return node.getAttribute(attributeName); - } - if (propertyInfo.type === BOOLEAN) { - // If this was a boolean, it doesn't matter what the value is - // the fact that we have it is the same as the expected. - return expected; - } - // Even if this property uses a namespace we use getAttribute - // because we assume its namespaced name is the same as our config. - // To use getAttributeNS we need the local name which we don't have - // in our config atm. - stringValue = node.getAttribute(attributeName); - } +var _enhancer = __webpack_require__(159); - if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { - return stringValue === null ? expected : stringValue; - } else if (stringValue === '' + expected) { - return expected; - } else { - return stringValue; - } - } - } -} +var _enhancer2 = _interopRequireDefault(_enhancer); -/** - * Get the value for a attribute on a node. Only used in DEV for SSR validation. - * The third argument is used as a hint of what the expected value is. Some - * attributes have multiple equivalent values. - */ -function getValueForAttribute(node, name, expected) { - { - if (!isAttributeNameSafe(name)) { - return; - } - if (!node.hasAttribute(name)) { - return expected === undefined ? undefined : null; - } - var value = node.getAttribute(name); - if (value === '' + expected) { - return expected; - } - return value; - } -} +var _styleKeeper = __webpack_require__(104); -/** - * Sets the value for a property on a node. - * - * @param {DOMElement} node - * @param {string} name - * @param {*} value - */ -function setValueForProperty(node, name, value, isCustomComponentTag) { - var propertyInfo = getPropertyInfo(name); - if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) { - return; - } - if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) { - value = null; - } - // If the prop isn't in the special list, treat it as a simple attribute. - if (isCustomComponentTag || propertyInfo === null) { - if (isAttributeNameSafe(name)) { - var _attributeName = name; - if (value === null) { - node.removeAttribute(_attributeName); - } else { - node.setAttribute(_attributeName, '' + value); - } - } - return; - } - var mustUseProperty = propertyInfo.mustUseProperty; +var _styleKeeper2 = _interopRequireDefault(_styleKeeper); - if (mustUseProperty) { - var propertyName = propertyInfo.propertyName; +var _styleSheet = __webpack_require__(405); - if (value === null) { - var type = propertyInfo.type; +var _styleSheet2 = _interopRequireDefault(_styleSheet); - node[propertyName] = type === BOOLEAN ? false : ''; - } else { - // Contrary to `setAttribute`, object properties are properly - // `toString`ed by IE8/9. - node[propertyName] = value; - } - return; - } - // The rest are treated as attributes with special cases. - var attributeName = propertyInfo.attributeName, - attributeNamespace = propertyInfo.attributeNamespace; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - if (value === null) { - node.removeAttribute(attributeName); - } else { - var _type = propertyInfo.type; +function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } - var attributeValue = void 0; - if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) { - attributeValue = ''; - } else { - // `setAttribute` with objects becomes only `[object]` in IE8/9, - // ('' + value) makes it output the correct toString()-value. - attributeValue = '' + value; - } - if (attributeNamespace) { - node.setAttributeNS(attributeNamespace, attributeName, attributeValue); - } else { - node.setAttribute(attributeName, attributeValue); - } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +function _getStyleKeeper(instance) { + if (!instance._radiumStyleKeeper) { + var userAgent = instance.props.radiumConfig && instance.props.radiumConfig.userAgent || instance.context._radiumConfig && instance.context._radiumConfig.userAgent; + instance._radiumStyleKeeper = new _styleKeeper2.default(userAgent); } + + return instance._radiumStyleKeeper; } -var ReactControlledValuePropTypes = { - checkPropTypes: null -}; +var StyleRoot = function (_PureComponent) { + _inherits(StyleRoot, _PureComponent); -{ - var hasReadOnlyValue = { - button: true, - checkbox: true, - image: true, - hidden: true, - radio: true, - reset: true, - submit: true - }; + function StyleRoot() { + _classCallCheck(this, StyleRoot); - var propTypes = { - value: function (props, propName, componentName) { - if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) { - return null; - } - 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`.'); - }, - checked: function (props, propName, componentName) { - if (!props[propName] || props.onChange || props.readOnly || props.disabled) { - return null; - } - 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`.'); - } + var _this = _possibleConstructorReturn(this, _PureComponent.apply(this, arguments)); + + _getStyleKeeper(_this); + return _this; + } + + StyleRoot.prototype.getChildContext = function getChildContext() { + return { _radiumStyleKeeper: _getStyleKeeper(this) }; }; - /** - * Provide a linked `value` attribute for controlled forms. You should not use - * this outside of the ReactDOM controlled form components. - */ - ReactControlledValuePropTypes.checkPropTypes = function (tagName, props, getStack) { - checkPropTypes(propTypes, props, 'prop', tagName, getStack); + StyleRoot.prototype.render = function render() { + /* eslint-disable no-unused-vars */ + // Pass down all props except config to the rendered div. + var _props = this.props, + radiumConfig = _props.radiumConfig, + otherProps = _objectWithoutProperties(_props, ['radiumConfig']); + /* eslint-enable no-unused-vars */ + + return _react2.default.createElement( + 'div', + otherProps, + this.props.children, + _react2.default.createElement(_styleSheet2.default, null) + ); }; -} -// TODO: direct imports like some-package/src/* are bad. Fix me. -var getCurrentFiberOwnerName = ReactDebugCurrentFiber.getCurrentFiberOwnerName; -var getCurrentFiberStackAddendum = ReactDebugCurrentFiber.getCurrentFiberStackAddendum; + return StyleRoot; +}(_react.PureComponent); -var didWarnValueDefaultValue = false; -var didWarnCheckedDefaultChecked = false; -var didWarnControlledToUncontrolled = false; -var didWarnUncontrolledToControlled = false; +StyleRoot.contextTypes = { + _radiumConfig: _propTypes2.default.object, + _radiumStyleKeeper: _propTypes2.default.instanceOf(_styleKeeper2.default) +}; -function isControlled(props) { - var usesChecked = props.type === 'checkbox' || props.type === 'radio'; - return usesChecked ? props.checked != null : props.value != null; -} +StyleRoot.childContextTypes = { + _radiumStyleKeeper: _propTypes2.default.instanceOf(_styleKeeper2.default) +}; -/** - * Implements an host component that allows setting these optional - * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. - * - * If `checked` or `value` are not supplied (or null/undefined), user actions - * that affect the checked state or value will trigger updates to the element. - * - * If they are supplied (and not null/undefined), the rendered element will not - * trigger updates to the element. Instead, the props must change in order for - * the rendered element to be updated. - * - * The rendered element will be initialized as unchecked (or `defaultChecked`) - * with an empty value (or `defaultValue`). - * - * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html - */ +StyleRoot = (0, _enhancer2.default)(StyleRoot); -function getHostProps(element, props) { - var node = element; - var checked = props.checked; +exports.default = StyleRoot; +module.exports = exports['default']; - var hostProps = _assign({}, props, { - defaultChecked: undefined, - defaultValue: undefined, - value: undefined, - checked: checked != null ? checked : node._wrapperState.initialChecked - }); +/***/ }), +/* 405 */ +/***/ (function(module, exports, __webpack_require__) { - return hostProps; -} +"use strict"; -function initWrapperState(element, props) { - { - ReactControlledValuePropTypes.checkPropTypes('input', props, getCurrentFiberStackAddendum); - if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) { - 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', getCurrentFiberOwnerName() || 'A component', props.type); - didWarnCheckedDefaultChecked = true; - } - if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { - 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', getCurrentFiberOwnerName() || 'A component', props.type); - didWarnValueDefaultValue = true; - } - } +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = undefined; - var node = element; - var defaultValue = props.defaultValue == null ? '' : props.defaultValue; +var _class, _temp; - node._wrapperState = { - initialChecked: props.checked != null ? props.checked : props.defaultChecked, - initialValue: getSafeValue(props.value != null ? props.value : defaultValue), - controlled: isControlled(props) - }; -} +var _react = __webpack_require__(0); -function updateChecked(element, props) { - var node = element; - var checked = props.checked; - if (checked != null) { - setValueForProperty(node, 'checked', checked, false); - } -} +var _react2 = _interopRequireDefault(_react); -function updateWrapper(element, props) { - var node = element; - { - var _controlled = isControlled(props); +var _propTypes = __webpack_require__(1); - if (!node._wrapperState.controlled && _controlled && !didWarnUncontrolledToControlled) { - warning(false, 'A component 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%s', props.type, getCurrentFiberStackAddendum()); - didWarnUncontrolledToControlled = true; - } - if (node._wrapperState.controlled && !_controlled && !didWarnControlledToUncontrolled) { - warning(false, 'A component 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%s', props.type, getCurrentFiberStackAddendum()); - didWarnControlledToUncontrolled = true; - } - } +var _propTypes2 = _interopRequireDefault(_propTypes); - updateChecked(element, props); +var _styleKeeper = __webpack_require__(104); - var value = getSafeValue(props.value); +var _styleKeeper2 = _interopRequireDefault(_styleKeeper); - if (value != null) { - if (props.type === 'number') { - if (value === 0 && node.value === '' || - // eslint-disable-next-line - node.value != value) { - node.value = '' + value; - } - } else if (node.value !== '' + value) { - node.value = '' + value; - } - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - if (props.hasOwnProperty('value')) { - setDefaultValue(node, props.type, value); - } else if (props.hasOwnProperty('defaultValue')) { - setDefaultValue(node, props.type, getSafeValue(props.defaultValue)); - } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - if (props.checked == null && props.defaultChecked != null) { - node.defaultChecked = !!props.defaultChecked; - } -} +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } -function postMountWrapper(element, props) { - var node = element; +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) { - // Do not assign value if it is already set. This prevents user text input - // from being lost during SSR hydration. - if (node.value === '') { - node.value = '' + node._wrapperState.initialValue; - } +var StyleSheet = (_temp = _class = function (_PureComponent) { + _inherits(StyleSheet, _PureComponent); - // value must be assigned before defaultValue. This fixes an issue where the - // visually displayed value of date inputs disappears on mobile Safari and Chrome: - // https://github.com/facebook/react/issues/7233 - node.defaultValue = '' + node._wrapperState.initialValue; - } + function StyleSheet() { + _classCallCheck(this, StyleSheet); - // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug - // this is needed to work around a chrome bug where setting defaultChecked - // will sometimes influence the value of checked (even after detachment). - // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416 - // We need to temporarily unset name to avoid disrupting radio button groups. - var name = node.name; - if (name !== '') { - node.name = ''; - } - node.defaultChecked = !node.defaultChecked; - node.defaultChecked = !node.defaultChecked; - if (name !== '') { - node.name = name; - } -} + var _this = _possibleConstructorReturn(this, _PureComponent.apply(this, arguments)); -function restoreControlledState(element, props) { - var node = element; - updateWrapper(node, props); - updateNamedCousins(node, props); -} + _this._onChange = function () { + setTimeout(function () { + _this._isMounted && _this.setState(_this._getCSSState()); + }, 0); + }; -function updateNamedCousins(rootNode, props) { - var name = props.name; - if (props.type === 'radio' && name != null) { - var queryRoot = rootNode; + _this.state = _this._getCSSState(); + return _this; + } - while (queryRoot.parentNode) { - queryRoot = queryRoot.parentNode; + StyleSheet.prototype.componentDidMount = function componentDidMount() { + this._isMounted = true; + this._subscription = this.context._radiumStyleKeeper.subscribe(this._onChange); + this._onChange(); + }; + + StyleSheet.prototype.componentWillUnmount = function componentWillUnmount() { + this._isMounted = false; + if (this._subscription) { + this._subscription.remove(); } + }; - // If `rootNode.form` was non-null, then we could try `form.elements`, - // but that sometimes behaves strangely in IE8. We could also try using - // `form.getElementsByName`, but that will only return direct children - // and won't include inputs that use the HTML5 `form=` attribute. Since - // the input might not even be in a form. It might not even be in the - // document. Let's just use the local `querySelectorAll` to ensure we don't - // miss anything. - var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]'); + StyleSheet.prototype._getCSSState = function _getCSSState() { + return { css: this.context._radiumStyleKeeper.getCSS() }; + }; - for (var i = 0; i < group.length; i++) { - var otherNode = group[i]; - if (otherNode === rootNode || otherNode.form !== rootNode.form) { - continue; - } - // This will throw if radio buttons rendered by different copies of React - // and the same name are rendered into the same form (same as #1939). - // That's probably okay; we don't support it just as we don't support - // mixing React radio buttons with non-React ones. - var otherProps = getFiberCurrentPropsFromNode$1(otherNode); - !otherProps ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : void 0; + StyleSheet.prototype.render = function render() { + return _react2.default.createElement('style', { dangerouslySetInnerHTML: { __html: this.state.css } }); + }; - // We need update the tracked value on the named cousin since the value - // was changed but the input saw no event or value set - updateValueIfChanged(otherNode); + return StyleSheet; +}(_react.PureComponent), _class.contextTypes = { + _radiumStyleKeeper: _propTypes2.default.instanceOf(_styleKeeper2.default) +}, _temp); +exports.default = StyleSheet; +module.exports = exports['default']; - // If this is a controlled radio button group, forcing the input that - // was previously checked to update will cause it to be come re-checked - // as appropriate. - updateWrapper(otherNode, otherProps); - } - } -} +/***/ }), +/* 406 */ +/***/ (function(module, exports, __webpack_require__) { -// In Chrome, assigning defaultValue to certain input types triggers input validation. -// For number inputs, the display value loses trailing decimal points. For email inputs, -// Chrome raises "The specified value is not a valid email address". -// -// Here we check to see if the defaultValue has actually changed, avoiding these problems -// when the user is inputting text -// -// https://github.com/facebook/react/issues/7253 -function setDefaultValue(node, type, value) { - if ( - // Focused number inputs synchronize on blur. See ChangeEventPlugin.js - type !== 'number' || node.ownerDocument.activeElement !== node) { - if (value == null) { - node.defaultValue = '' + node._wrapperState.initialValue; - } else if (node.defaultValue !== '' + value) { - node.defaultValue = '' + value; - } - } -} +"use strict"; -function getSafeValue(value) { - switch (typeof value) { - case 'boolean': - case 'number': - case 'object': - case 'string': - case 'undefined': - return value; - default: - // function, symbol are assigned as empty strings - return ''; - } -} -var eventTypes$1 = { - change: { - phasedRegistrationNames: { - bubbled: 'onChange', - captured: 'onChangeCapture' - }, - dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange'] - } -}; +Object.defineProperty(exports, "__esModule", { + value: true +}); -function createAndAccumulateChangeEvent(inst, nativeEvent, target) { - var event = SyntheticEvent$1.getPooled(eventTypes$1.change, inst, nativeEvent, target); - event.type = 'change'; - // Flag this event loop as needing state restore. - enqueueStateRestore(target); - accumulateTwoPhaseDispatches(event); - return event; -} -/** - * For IE shims - */ -var activeElement = null; -var activeElementInst = null; +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -/** - * SECTION: handle `change` event - */ -function shouldUseChangeEvent(elem) { - var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); - return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; -} +var _class, _temp; -function manualDispatchChangeEvent(nativeEvent) { - var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent)); +var _cssRuleSetToString = __webpack_require__(102); - // If change and propertychange bubbled, we'd just bind to it like all the - // other events and have it go through ReactBrowserEventEmitter. Since it - // doesn't, we manually listen for the events and so we have to enqueue and - // process the abstract event manually. - // - // Batching is necessary here in order to ensure that all event handlers run - // before the next rerender (including event handlers attached to ancestor - // elements instead of directly on the input). Without this, controlled - // components don't work properly in conjunction with event bubbling because - // the component is rerendered and the value reverted before all the event - // handlers can run. See https://github.com/facebook/react/issues/708. - batchedUpdates(runEventInBatch, event); -} +var _cssRuleSetToString2 = _interopRequireDefault(_cssRuleSetToString); -function runEventInBatch(event) { - runEventsInBatch(event, false); -} +var _react = __webpack_require__(0); -function getInstIfValueChanged(targetInst) { - var targetNode = getNodeFromInstance$1(targetInst); - if (updateValueIfChanged(targetNode)) { - return targetInst; - } -} +var _react2 = _interopRequireDefault(_react); -function getTargetInstForChangeEvent(topLevelType, targetInst) { - if (topLevelType === 'topChange') { - return targetInst; - } -} +var _propTypes = __webpack_require__(1); -/** - * SECTION: handle `input` event - */ -var isInputEventSupported = false; -if (ExecutionEnvironment.canUseDOM) { - // IE9 claims to support the input event but fails to trigger it when - // deleting text, so we ignore its input events. - isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9); -} +var _propTypes2 = _interopRequireDefault(_propTypes); -/** - * (For IE <=9) Starts tracking propertychange events on the passed-in element - * and override the value property so that we can distinguish user events from - * value changes in JS. - */ -function startWatchingForValueChange(target, targetInst) { - activeElement = target; - activeElementInst = targetInst; - activeElement.attachEvent('onpropertychange', handlePropertyChange); -} +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -/** - * (For IE <=9) Removes the event listeners from the currently-tracked element, - * if any exists. - */ -function stopWatchingForValueChange() { - if (!activeElement) { - return; - } - activeElement.detachEvent('onpropertychange', handlePropertyChange); - activeElement = null; - activeElementInst = null; -} - -/** - * (For IE <=9) Handles a propertychange event, sending a `change` event if - * the value of the active element has changed. - */ -function handlePropertyChange(nativeEvent) { - if (nativeEvent.propertyName !== 'value') { - return; - } - if (getInstIfValueChanged(activeElementInst)) { - manualDispatchChangeEvent(nativeEvent); - } -} +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) { - if (topLevelType === 'topFocus') { - // In IE9, propertychange fires for most input events but is buggy and - // doesn't fire when text is deleted, but conveniently, selectionchange - // appears to fire in all of the remaining cases so we catch those and - // forward the event if the value has changed - // In either case, we don't want to call the event handler if the value - // is changed from JS so we redefine a setter for `.value` that updates - // our activeElementValue variable, allowing us to ignore those changes - // - // stopWatching() should be a noop here but we call it just in case we - // missed a blur event somehow. - stopWatchingForValueChange(); - startWatchingForValueChange(target, targetInst); - } else if (topLevelType === 'topBlur') { - stopWatchingForValueChange(); - } -} +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } -// For IE8 and IE9. -function getTargetInstForInputEventPolyfill(topLevelType, targetInst) { - if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') { - // On the selectionchange event, the target is just document which isn't - // helpful for us so just check activeElement instead. - // - // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire - // propertychange on the first input event after setting `value` from a - // script and fires only keydown, keypress, keyup. Catching keyup usually - // gets it and catching keydown lets us fire an event for the first - // keystroke if user does a key repeat (it'll be a little delayed: right - // before the second keystroke). Other input methods (e.g., paste) seem to - // fire selectionchange normally. - return getInstIfValueChanged(activeElementInst); - } -} +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } -/** - * SECTION: handle `click` event - */ -function shouldUseClickEvent(elem) { - // Use the `click` event to detect changes to checkbox and radio inputs. - // This approach works across all browsers, whereas `change` does not fire - // until `blur` in IE8. - var nodeName = elem.nodeName; - return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio'); -} +var Style = (_temp = _class = function (_PureComponent) { + _inherits(Style, _PureComponent); -function getTargetInstForClickEvent(topLevelType, targetInst) { - if (topLevelType === 'topClick') { - return getInstIfValueChanged(targetInst); - } -} + function Style() { + _classCallCheck(this, Style); -function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) { - if (topLevelType === 'topInput' || topLevelType === 'topChange') { - return getInstIfValueChanged(targetInst); + return _possibleConstructorReturn(this, _PureComponent.apply(this, arguments)); } -} -function handleControlledInputBlur(inst, node) { - // TODO: In IE, inst is occasionally null. Why? - if (inst == null) { - return; - } + Style.prototype._buildStyles = function _buildStyles(styles) { + var _this2 = this; - // Fiber and ReactDOM keep wrapper state in separate places - var state = inst._wrapperState || node._wrapperState; + var userAgent = this.props.radiumConfig && this.props.radiumConfig.userAgent || this.context && this.context._radiumConfig && this.context._radiumConfig.userAgent; - if (!state || !state.controlled || node.type !== 'number') { - return; - } + var scopeSelector = this.props.scopeSelector; - // If controlled, assign the value attribute to the current value on blur - setDefaultValue(node, 'number', node.value); -} + var rootRules = Object.keys(styles).reduce(function (accumulator, selector) { + if (_typeof(styles[selector]) !== 'object') { + accumulator[selector] = styles[selector]; + } -/** - * This plugin creates an `onChange` event that normalizes change events - * across form elements. This event fires at a time when it's possible to - * change the element's value without seeing a flicker. - * - * Supported elements are: - * - input (see `isTextInputElement`) - * - textarea - * - select - */ -var ChangeEventPlugin = { - eventTypes: eventTypes$1, + return accumulator; + }, {}); + var rootStyles = Object.keys(rootRules).length ? (0, _cssRuleSetToString2.default)(scopeSelector || '', rootRules, userAgent) : ''; - _isInputEventSupported: isInputEventSupported, + return rootStyles + Object.keys(styles).reduce(function (accumulator, selector) { + var rules = styles[selector]; - extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { - var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window; + if (selector === 'mediaQueries') { + accumulator += _this2._buildMediaQueryString(rules); + } else if (_typeof(styles[selector]) === 'object') { + var completeSelector = scopeSelector ? selector.split(',').map(function (part) { + return scopeSelector + ' ' + part.trim(); + }).join(',') : selector; - var getTargetInstFunc = void 0, - handleEventFunc = void 0; - if (shouldUseChangeEvent(targetNode)) { - getTargetInstFunc = getTargetInstForChangeEvent; - } else if (isTextInputElement(targetNode)) { - if (isInputEventSupported) { - getTargetInstFunc = getTargetInstForInputOrChangeEvent; - } else { - getTargetInstFunc = getTargetInstForInputEventPolyfill; - handleEventFunc = handleEventsForInputEventPolyfill; + accumulator += (0, _cssRuleSetToString2.default)(completeSelector, rules, userAgent); } - } else if (shouldUseClickEvent(targetNode)) { - getTargetInstFunc = getTargetInstForClickEvent; - } - if (getTargetInstFunc) { - var inst = getTargetInstFunc(topLevelType, targetInst); - if (inst) { - var event = createAndAccumulateChangeEvent(inst, nativeEvent, nativeEventTarget); - return event; - } - } + return accumulator; + }, ''); + }; - if (handleEventFunc) { - handleEventFunc(topLevelType, targetNode, targetInst); - } + Style.prototype._buildMediaQueryString = function _buildMediaQueryString(stylesByMediaQuery) { + var _this3 = this; - // When blurring, set the value attribute for number inputs - if (topLevelType === 'topBlur') { - handleControlledInputBlur(targetInst, targetNode); - } - } -}; + var mediaQueryString = ''; -/** - * Module that is injectable into `EventPluginHub`, that specifies a - * deterministic ordering of `EventPlugin`s. A convenient way to reason about - * plugins, without having to package every one of them. This is better than - * having plugins be ordered in the same order that they are injected because - * that ordering would be influenced by the packaging order. - * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that - * preventing default on events is convenient in `SimpleEventPlugin` handlers. - */ -var DOMEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin']; + Object.keys(stylesByMediaQuery).forEach(function (query) { + mediaQueryString += '@media ' + query + '{' + _this3._buildStyles(stylesByMediaQuery[query]) + '}'; + }); -var SyntheticUIEvent = SyntheticEvent$1.extend({ - view: null, - detail: null -}); + return mediaQueryString; + }; -/** - * Translation from modifier key to the associated property in the event. - * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers - */ + Style.prototype.render = function render() { + if (!this.props.rules) { + return null; + } -var modifierKeyToProp = { - Alt: 'altKey', - Control: 'ctrlKey', - Meta: 'metaKey', - Shift: 'shiftKey' -}; + var styles = this._buildStyles(this.props.rules); -// IE8 does not implement getModifierState so we simply map it to the only -// modifier keys exposed by the event itself, does not support Lock-keys. -// Currently, all major browsers except Chrome seems to support Lock-keys. -function modifierStateGetter(keyArg) { - var syntheticEvent = this; - var nativeEvent = syntheticEvent.nativeEvent; - if (nativeEvent.getModifierState) { - return nativeEvent.getModifierState(keyArg); - } - var keyProp = modifierKeyToProp[keyArg]; - return keyProp ? !!nativeEvent[keyProp] : false; -} + return _react2.default.createElement('style', { dangerouslySetInnerHTML: { __html: styles } }); + }; -function getEventModifierState(nativeEvent) { - return modifierStateGetter; -} + return Style; +}(_react.PureComponent), _class.propTypes = { + radiumConfig: _propTypes2.default.object, + rules: _propTypes2.default.object, + scopeSelector: _propTypes2.default.string +}, _class.contextTypes = { + _radiumConfig: _propTypes2.default.object +}, _class.defaultProps = { + scopeSelector: '' +}, _temp); +exports.default = Style; +module.exports = exports['default']; -/** - * @interface MouseEvent - * @see http://www.w3.org/TR/DOM-Level-3-Events/ - */ -var SyntheticMouseEvent = SyntheticUIEvent.extend({ - screenX: null, - screenY: null, - clientX: null, - clientY: null, - pageX: null, - pageY: null, - ctrlKey: null, - shiftKey: null, - altKey: null, - metaKey: null, - getModifierState: getEventModifierState, - button: null, - buttons: null, - relatedTarget: function (event) { - return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement); - } +/***/ }), +/* 407 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) { + +Object.defineProperty(exports, "__esModule", { + value: true }); -var eventTypes$2 = { - mouseEnter: { - registrationName: 'onMouseEnter', - dependencies: ['topMouseOut', 'topMouseOver'] - }, - mouseLeave: { - registrationName: 'onMouseLeave', - dependencies: ['topMouseOut', 'topMouseOver'] - } -}; +var _enhancer = __webpack_require__(159); -var EnterLeaveEventPlugin = { - eventTypes: eventTypes$2, +var _enhancer2 = _interopRequireDefault(_enhancer); - /** - * For almost every interaction we care about, there will be both a top-level - * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that - * we do not extract duplicate events. However, moving the mouse into the - * browser from outside will not fire a `mouseout` event. In this case, we use - * the `mouseover` top-level event. - */ - extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { - if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) { - return null; - } - if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') { - // Must not be a mouse in or mouse out - ignoring. - return null; - } +var _plugins = __webpack_require__(164); - var win = void 0; - if (nativeEventTarget.window === nativeEventTarget) { - // `nativeEventTarget` is probably a window object. - win = nativeEventTarget; - } else { - // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. - var doc = nativeEventTarget.ownerDocument; - if (doc) { - win = doc.defaultView || doc.parentWindow; - } else { - win = window; - } - } +var _plugins2 = _interopRequireDefault(_plugins); - var from = void 0; - var to = void 0; - if (topLevelType === 'topMouseOut') { - from = targetInst; - var related = nativeEvent.relatedTarget || nativeEvent.toElement; - to = related ? getClosestInstanceFromNode(related) : null; - } else { - // Moving to a node from outside the window. - from = null; - to = targetInst; - } +var _style = __webpack_require__(406); - if (from === to) { - // Nothing pertains to our managed components. - return null; - } +var _style2 = _interopRequireDefault(_style); - var fromNode = from == null ? win : getNodeFromInstance$1(from); - var toNode = to == null ? win : getNodeFromInstance$1(to); +var _styleRoot = __webpack_require__(404); - var leave = SyntheticMouseEvent.getPooled(eventTypes$2.mouseLeave, from, nativeEvent, nativeEventTarget); - leave.type = 'mouseleave'; - leave.target = fromNode; - leave.relatedTarget = toNode; +var _styleRoot2 = _interopRequireDefault(_styleRoot); - var enter = SyntheticMouseEvent.getPooled(eventTypes$2.mouseEnter, to, nativeEvent, nativeEventTarget); - enter.type = 'mouseenter'; - enter.target = toNode; - enter.relatedTarget = fromNode; +var _getState = __webpack_require__(161); - accumulateEnterLeaveDispatches(leave, enter, from, to); +var _getState2 = _interopRequireDefault(_getState); - return [leave, enter]; - } -}; +var _keyframes = __webpack_require__(408); -/** - * `ReactInstanceMap` maintains a mapping from a public facing stateful - * instance (key) and the internal representation (value). This allows public - * methods to accept the user facing instance as an argument and map them back - * to internal methods. - * - * Note that this module is currently shared and assumed to be stateless. - * If this becomes an actual Map, that will break. - */ +var _keyframes2 = _interopRequireDefault(_keyframes); -/** - * This API should be called `delete` but we'd have to make sure to always - * transform these to strings for IE support. When this transform is fully - * supported we can rename it. - */ +var _resolveStyles = __webpack_require__(165); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function get(key) { - return key._reactInternalFiber; +function Radium(ComposedComponent) { + return (0, _enhancer2.default)(ComposedComponent); } -function has(key) { - return key._reactInternalFiber !== undefined; -} +Radium.Plugins = _plugins2.default; +Radium.Style = _style2.default; +Radium.StyleRoot = _styleRoot2.default; +Radium.getState = _getState2.default; +Radium.keyframes = _keyframes2.default; -function set(key, value) { - key._reactInternalFiber = value; +if (process.env.NODE_ENV !== 'production') { + Radium.TestMode = { + clearState: _resolveStyles.__clearStateForTests, + disable: _resolveStyles.__setTestMode.bind(null, false), + enable: _resolveStyles.__setTestMode.bind(null, true) + }; } -// Don't change these two values. They're used by React Dev Tools. -var NoEffect = /* */0; -var PerformedWork = /* */1; +exports.default = Radium; +module.exports = exports['default']; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) -// You can change the rest (and add more). -var Placement = /* */2; -var Update = /* */4; -var PlacementAndUpdate = /* */6; -var Deletion = /* */8; -var ContentReset = /* */16; -var Callback = /* */32; -var DidCapture = /* */64; -var Ref = /* */128; -var ErrLog = /* */256; -var Snapshot = /* */2048; +/***/ }), +/* 408 */ +/***/ (function(module, exports, __webpack_require__) { -// Union of all host effects -var HostEffectMask = /* */2559; +"use strict"; -var Incomplete = /* */512; -var ShouldCapture = /* */1024; -var MOUNTING = 1; -var MOUNTED = 2; -var UNMOUNTED = 3; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = keyframes; -function isFiberMountedImpl(fiber) { - var node = fiber; - if (!fiber.alternate) { - // If there is no alternate, this might be a new tree that isn't inserted - // yet. If it is, then it will have a pending insertion effect on it. - if ((node.effectTag & Placement) !== NoEffect) { - return MOUNTING; - } - while (node['return']) { - node = node['return']; - if ((node.effectTag & Placement) !== NoEffect) { - return MOUNTING; - } - } - } else { - while (node['return']) { - node = node['return']; +var _cssRuleSetToString = __webpack_require__(102); + +var _cssRuleSetToString2 = _interopRequireDefault(_cssRuleSetToString); + +var _hash = __webpack_require__(162); + +var _hash2 = _interopRequireDefault(_hash); + +var _prefixer = __webpack_require__(103); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function keyframes(keyframeRules, name) { + return { + __radiumKeyframes: true, + __process: function __process(userAgent) { + var keyframesPrefixed = (0, _prefixer.getPrefixedKeyframes)(userAgent); + var rules = Object.keys(keyframeRules).map(function (percentage) { + return (0, _cssRuleSetToString2.default)(percentage, keyframeRules[percentage], userAgent); + }).join('\n'); + var animationName = (name ? name + '-' : '') + 'radium-animation-' + (0, _hash2.default)(rules); + var css = '@' + keyframesPrefixed + ' ' + animationName + ' {\n' + rules + '\n}\n'; + return { css: css, animationName: animationName }; } - } - if (node.tag === HostRoot) { - // TODO: Check if this was a nested HostRoot when used with - // renderContainerIntoSubtree. - return MOUNTED; - } - // If we didn't hit the root, that means that we're in an disconnected tree - // that has been unmounted. - return UNMOUNTED; + }; } -function isFiberMounted(fiber) { - return isFiberMountedImpl(fiber) === MOUNTED; -} +module.exports = exports['default']; -function isMounted(component) { - { - var owner = ReactCurrentOwner.current; - if (owner !== null && owner.tag === ClassComponent) { - var ownerFiber = owner; - var instance = ownerFiber.stateNode; - warning(instance._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.', getComponentName(ownerFiber) || 'A component'); - instance._warnedAboutRefsInRender = true; - } - } +/***/ }), +/* 409 */ +/***/ (function(module, exports, __webpack_require__) { - var fiber = get(component); - if (!fiber) { - return false; - } - return isFiberMountedImpl(fiber) === MOUNTED; -} +"use strict"; -function assertIsMounted(fiber) { - !(isFiberMountedImpl(fiber) === MOUNTED) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +exports.isNestedStyle = isNestedStyle; +exports.mergeStyles = mergeStyles; +function isNestedStyle(value) { + // Don't merge objects overriding toString, since they should be converted + // to string values. + return value && value.constructor === Object && value.toString === Object.prototype.toString; } -function findCurrentFiberUsingSlowPath(fiber) { - var alternate = fiber.alternate; - if (!alternate) { - // If there is no alternate, then we only need to check if it is mounted. - var state = isFiberMountedImpl(fiber); - !(state !== UNMOUNTED) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0; - if (state === MOUNTING) { - return null; - } - return fiber; - } - // If we have two possible branches, we'll walk backwards up to the root - // to see what path the root points to. On the way we may hit one of the - // special cases and we'll deal with them. - var a = fiber; - var b = alternate; - while (true) { - var parentA = a['return']; - var parentB = parentA ? parentA.alternate : null; - if (!parentA || !parentB) { - // We're at the root. - break; - } +// Merge style objects. Deep merge plain object values. +function mergeStyles(styles) { + var result = {}; - // If both copies of the parent fiber point to the same child, we can - // assume that the child is current. This happens when we bailout on low - // priority: the bailed out fiber's child reuses the current child. - if (parentA.child === parentB.child) { - var child = parentA.child; - while (child) { - if (child === a) { - // We've determined that A is the current branch. - assertIsMounted(parentA); - return fiber; - } - if (child === b) { - // We've determined that B is the current branch. - assertIsMounted(parentA); - return alternate; - } - child = child.sibling; - } - // We should never have an alternate for any mounting node. So the only - // way this could possibly happen is if this was unmounted, if at all. - invariant(false, 'Unable to find node on an unmounted component.'); + styles.forEach(function (style) { + if (!style || (typeof style === 'undefined' ? 'undefined' : _typeof(style)) !== 'object') { + return; } - if (a['return'] !== b['return']) { - // The return pointer of A and the return pointer of B point to different - // fibers. We assume that return pointers never criss-cross, so A must - // belong to the child set of A.return, and B must belong to the child - // set of B.return. - a = parentA; - b = parentB; - } else { - // The return pointers point to the same fiber. We'll have to use the - // default, slow path: scan the child sets of each parent alternate to see - // which child belongs to which set. - // - // Search parent A's child set - var didFindChild = false; - var _child = parentA.child; - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentA; - b = parentB; - break; - } - if (_child === b) { - didFindChild = true; - b = parentA; - a = parentB; - break; - } - _child = _child.sibling; + if (Array.isArray(style)) { + style = mergeStyles(style); + } + + Object.keys(style).forEach(function (key) { + // Simple case, nothing nested + if (!isNestedStyle(style[key]) || !isNestedStyle(result[key])) { + result[key] = style[key]; + return; } - if (!didFindChild) { - // Search parent B's child set - _child = parentB.child; - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentB; - b = parentA; - break; - } - if (_child === b) { - didFindChild = true; - b = parentB; - a = parentA; - break; + + // If nested media, don't merge the nested styles, append a space to the + // end (benign when converted to CSS). This way we don't end up merging + // media queries that appear later in the chain with those that appear + // earlier. + if (key.indexOf('@media') === 0) { + var newKey = key; + // eslint-disable-next-line no-constant-condition + while (true) { + newKey += ' '; + if (!result[newKey]) { + result[newKey] = style[key]; + return; } - _child = _child.sibling; } - !didFindChild ? invariant(false, 'Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.') : void 0; } - } - !(a.alternate === b) ? invariant(false, 'Return fibers should always be each others\' alternates. This error is likely caused by a bug in React. Please file an issue.') : void 0; - } - // If the root is not a host container, we're in a disconnected tree. I.e. - // unmounted. - !(a.tag === HostRoot) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0; - if (a.stateNode.current === a) { - // We've determined that A is the current branch. - return fiber; - } - // Otherwise B has to be current branch. - return alternate; + // Merge all other nested styles recursively + result[key] = mergeStyles([result[key], style[key]]); + }); + }); + + return result; } -function findCurrentHostFiber(parent) { - var currentParent = findCurrentFiberUsingSlowPath(parent); - if (!currentParent) { - return null; - } +/***/ }), +/* 410 */ +/***/ (function(module, exports, __webpack_require__) { - // Next we'll drill down this component to find the first HostComponent/Text. - var node = currentParent; - while (true) { - if (node.tag === HostComponent || node.tag === HostText) { - return node; - } else if (node.child) { - node.child['return'] = node; - node = node.child; - continue; - } - if (node === currentParent) { - return null; +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.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; }; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _checkProps = function checkProps() {}; + +if (process.env.NODE_ENV !== 'production') { + // Warn if you use longhand and shorthand properties in the same style + // object. + // https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties + + var shorthandPropertyExpansions = { + background: ['backgroundAttachment', 'backgroundBlendMode', 'backgroundClip', 'backgroundColor', 'backgroundImage', 'backgroundOrigin', 'backgroundPosition', 'backgroundPositionX', 'backgroundPositionY', 'backgroundRepeat', 'backgroundRepeatX', 'backgroundRepeatY', 'backgroundSize'], + border: ['borderBottom', 'borderBottomColor', 'borderBottomStyle', 'borderBottomWidth', 'borderColor', 'borderLeft', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRight', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderStyle', 'borderTop', 'borderTopColor', 'borderTopStyle', 'borderTopWidth', 'borderWidth'], + borderImage: ['borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth'], + borderRadius: ['borderBottomLeftRadius', 'borderBottomRightRadius', 'borderTopLeftRadius', 'borderTopRightRadius'], + font: ['fontFamily', 'fontKerning', 'fontSize', 'fontStretch', 'fontStyle', 'fontVariant', 'fontVariantLigatures', 'fontWeight', 'lineHeight'], + listStyle: ['listStyleImage', 'listStylePosition', 'listStyleType'], + margin: ['marginBottom', 'marginLeft', 'marginRight', 'marginTop'], + padding: ['paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop'], + transition: ['transitionDelay', 'transitionDuration', 'transitionProperty', 'transitionTimingFunction'] + }; + + _checkProps = function checkProps(config) { + var componentName = config.componentName, + style = config.style; + + if ((typeof style === 'undefined' ? 'undefined' : _typeof(style)) !== 'object' || !style) { + return; } - while (!node.sibling) { - if (!node['return'] || node['return'] === currentParent) { - return null; + + var styleKeys = Object.keys(style); + styleKeys.forEach(function (styleKey) { + if (Array.isArray(shorthandPropertyExpansions[styleKey]) && shorthandPropertyExpansions[styleKey].some(function (sp) { + return styleKeys.indexOf(sp) !== -1; + })) { + if (process.env.NODE_ENV !== 'production') { + /* eslint-disable no-console */ + console.warn('Radium: property "' + styleKey + '" in style object', style, ': do not mix longhand and ' + 'shorthand properties in the same style object. Check the render ' + 'method of ' + componentName + '.', 'See https://github.com/FormidableLabs/radium/issues/95 for more ' + 'information.'); + /* eslint-enable no-console */ + } } - node = node['return']; - } - node.sibling['return'] = node['return']; - node = node.sibling; - } - // Flow needs the return null here, but ESLint complains about it. - // eslint-disable-next-line no-unreachable - return null; + }); + + styleKeys.forEach(function (k) { + return _checkProps(_extends({}, config, { style: style[k] })); + }); + return; + }; } -function findCurrentHostFiberWithNoPortals(parent) { - var currentParent = findCurrentFiberUsingSlowPath(parent); - if (!currentParent) { - return null; - } +exports.default = _checkProps; +module.exports = exports['default']; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) - // Next we'll drill down this component to find the first HostComponent/Text. - var node = currentParent; - while (true) { - if (node.tag === HostComponent || node.tag === HostText) { - return node; - } else if (node.child && node.tag !== HostPortal) { - node.child['return'] = node; - node = node.child; - continue; - } - if (node === currentParent) { - return null; - } - while (!node.sibling) { - if (!node['return'] || node['return'] === currentParent) { - return null; - } - node = node['return']; +/***/ }), +/* 411 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = keyframesPlugin; +function keyframesPlugin(_ref) { + var addCSS = _ref.addCSS, + config = _ref.config, + style = _ref.style; + + var newStyle = Object.keys(style).reduce(function (newStyleInProgress, key) { + var value = style[key]; + if (key === 'animationName' && value && value.__radiumKeyframes) { + var keyframesValue = value; + + var _keyframesValue$__pro = keyframesValue.__process(config.userAgent), + animationName = _keyframesValue$__pro.animationName, + css = _keyframesValue$__pro.css; + + addCSS(css); + value = animationName; } - node.sibling['return'] = node['return']; - node = node.sibling; - } - // Flow needs the return null here, but ESLint complains about it. - // eslint-disable-next-line no-unreachable - return null; -} -function addEventBubbleListener(element, eventType, listener) { - element.addEventListener(eventType, listener, false); + newStyleInProgress[key] = value; + return newStyleInProgress; + }, {}); + return { style: newStyle }; } +module.exports = exports['default']; -function addEventCaptureListener(element, eventType, listener) { - element.addEventListener(eventType, listener, true); -} +/***/ }), +/* 412 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * @interface Event - * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface - * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent - */ -var SyntheticAnimationEvent = SyntheticEvent$1.extend({ - animationName: null, - elapsedTime: null, - pseudoElement: null -}); +"use strict"; -/** - * @interface Event - * @see http://www.w3.org/TR/clipboard-apis/ - */ -var SyntheticClipboardEvent = SyntheticEvent$1.extend({ - clipboardData: function (event) { - return 'clipboardData' in event ? event.clipboardData : window.clipboardData; - } -}); -/** - * @interface FocusEvent - * @see http://www.w3.org/TR/DOM-Level-3-Events/ - */ -var SyntheticFocusEvent = SyntheticUIEvent.extend({ - relatedTarget: null +Object.defineProperty(exports, "__esModule", { + value: true }); -/** - * `charCode` represents the actual "character code" and is safe to use with - * `String.fromCharCode`. As such, only keys that correspond to printable - * characters produce a valid `charCode`, the only exception to this is Enter. - * The Tab-key is considered non-printable and does not have a `charCode`, - * presumably because it does not produce a tab-character in browsers. - * - * @param {object} nativeEvent Native browser event. - * @return {number} Normalized `charCode` property. - */ -function getEventCharCode(nativeEvent) { - var charCode = void 0; - var keyCode = nativeEvent.keyCode; - if ('charCode' in nativeEvent) { - charCode = nativeEvent.charCode; +// Convenient syntax for multiple styles: `style={[style1, style2, etc]}` +// Ignores non-objects, so you can do `this.state.isCool && styles.cool`. +var mergeStyleArrayPlugin = function mergeStyleArrayPlugin(_ref) { + var style = _ref.style, + mergeStyles = _ref.mergeStyles; - // FF does not set `charCode` for the Enter-key, check against `keyCode`. - if (charCode === 0 && keyCode === 13) { - charCode = 13; - } - } else { - // IE8 does not implement `charCode`, but `keyCode` has the correct value. - charCode = keyCode; - } + // eslint-disable-line no-shadow + var newStyle = Array.isArray(style) ? mergeStyles(style) : style; + return { style: newStyle }; +}; - // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux) - // report Enter as charCode 10 when ctrl is pressed. - if (charCode === 10) { - charCode = 13; +exports.default = mergeStyleArrayPlugin; +module.exports = exports['default']; + +/***/ }), +/* 413 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var _callbacks = []; +var _mouseUpListenerIsActive = false; + +function _handleMouseUp() { + _callbacks.forEach(function (callback) { + callback(); + }); +} + +var subscribe = function subscribe(callback) { + if (_callbacks.indexOf(callback) === -1) { + _callbacks.push(callback); } - // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. - // Must not discard the (non-)printable Enter-key. - if (charCode >= 32 || charCode === 13) { - return charCode; + if (!_mouseUpListenerIsActive) { + window.addEventListener('mouseup', _handleMouseUp); + _mouseUpListenerIsActive = true; } - return 0; -} + return { + remove: function remove() { + var index = _callbacks.indexOf(callback); + _callbacks.splice(index, 1); -/** - * Normalization of deprecated HTML5 `key` values - * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names - */ -var normalizeKey = { - Esc: 'Escape', - Spacebar: ' ', - Left: 'ArrowLeft', - Up: 'ArrowUp', - Right: 'ArrowRight', - Down: 'ArrowDown', - Del: 'Delete', - Win: 'OS', - Menu: 'ContextMenu', - Apps: 'ContextMenu', - Scroll: 'ScrollLock', - MozPrintableKey: 'Unidentified' + if (_callbacks.length === 0 && _mouseUpListenerIsActive) { + window.removeEventListener('mouseup', _handleMouseUp); + _mouseUpListenerIsActive = false; + } + } + }; }; -/** - * Translation from legacy `keyCode` to HTML5 `key` - * Only special keys supported, all others depend on keyboard layout or browser - * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names - */ -var translateToKey = { - '8': 'Backspace', - '9': 'Tab', - '12': 'Clear', - '13': 'Enter', - '16': 'Shift', - '17': 'Control', - '18': 'Alt', - '19': 'Pause', - '20': 'CapsLock', - '27': 'Escape', - '32': ' ', - '33': 'PageUp', - '34': 'PageDown', - '35': 'End', - '36': 'Home', - '37': 'ArrowLeft', - '38': 'ArrowUp', - '39': 'ArrowRight', - '40': 'ArrowDown', - '45': 'Insert', - '46': 'Delete', - '112': 'F1', - '113': 'F2', - '114': 'F3', - '115': 'F4', - '116': 'F5', - '117': 'F6', - '118': 'F7', - '119': 'F8', - '120': 'F9', - '121': 'F10', - '122': 'F11', - '123': 'F12', - '144': 'NumLock', - '145': 'ScrollLock', - '224': 'Meta' +exports.default = { + subscribe: subscribe, + __triggerForTests: _handleMouseUp }; +module.exports = exports['default']; -/** - * @param {object} nativeEvent Native browser event. - * @return {string} Normalized `key` property. - */ -function getEventKey(nativeEvent) { - if (nativeEvent.key) { - // Normalize inconsistent values reported by browsers due to - // implementations of a working draft specification. +/***/ }), +/* 414 */ +/***/ (function(module, exports, __webpack_require__) { - // FireFox implements `key` but returns `MozPrintableKey` for all - // printable characters (normalized to `Unidentified`), ignore it. - var key = normalizeKey[nativeEvent.key] || nativeEvent.key; - if (key !== 'Unidentified') { - return key; - } - } +"use strict"; - // Browser does not implement `key`, polyfill as much of it as we can. - if (nativeEvent.type === 'keypress') { - var charCode = getEventCharCode(nativeEvent); - // The enter-key is technically both printable and non-printable and can - // thus be captured by `keypress`, no other non-printable key should. - return charCode === 13 ? 'Enter' : String.fromCharCode(charCode); - } - if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') { - // While user keyboard layout determines the actual meaning of each - // `keyCode` value, almost all function keys have a universal value. - return translateToKey[nativeEvent.keyCode] || 'Unidentified'; - } - return ''; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = prefixPlugin; + +var _prefixer = __webpack_require__(103); + +function prefixPlugin(_ref) { + var config = _ref.config, + style = _ref.style; + + var newStyle = (0, _prefixer.getPrefixedStyle)(style, config.userAgent); + return { style: newStyle }; } +module.exports = exports['default']; -/** - * @interface KeyboardEvent - * @see http://www.w3.org/TR/DOM-Level-3-Events/ - */ -var SyntheticKeyboardEvent = SyntheticUIEvent.extend({ - key: getEventKey, - location: null, - ctrlKey: null, - shiftKey: null, - altKey: null, - metaKey: null, - repeat: null, - locale: null, - getModifierState: getEventModifierState, - // Legacy Interface - charCode: function (event) { - // `charCode` is the result of a KeyPress event and represents the value of - // the actual printable character. +/***/ }), +/* 415 */ +/***/ (function(module, exports, __webpack_require__) { - // KeyPress is deprecated, but its replacement is not yet final and not - // implemented in any major browser. Only KeyPress has charCode. - if (event.type === 'keypress') { - return getEventCharCode(event); - } - return 0; - }, - keyCode: function (event) { - // `keyCode` is the result of a KeyDown/Up event and represents the value of - // physical keyboard key. +"use strict"; - // The actual meaning of the value depends on the users' keyboard layout - // which cannot be detected. Assuming that it is a US keyboard layout - // provides a surprisingly accurate mapping for US and European users. - // Due to this, it is left to the user to implement at this time. - if (event.type === 'keydown' || event.type === 'keyup') { - return event.keyCode; - } - return 0; - }, - which: function (event) { - // `which` is an alias for either `keyCode` or `charCode` depending on the - // type of the event. - if (event.type === 'keypress') { - return getEventCharCode(event); - } - if (event.type === 'keydown' || event.type === 'keyup') { - return event.keyCode; - } - return 0; - } -}); -/** - * @interface DragEvent - * @see http://www.w3.org/TR/DOM-Level-3-Events/ - */ -var SyntheticDragEvent = SyntheticMouseEvent.extend({ - dataTransfer: null +Object.defineProperty(exports, "__esModule", { + value: true }); +exports.default = removeNestedStyles; +function removeNestedStyles(_ref) { + var isNestedStyle = _ref.isNestedStyle, + style = _ref.style; -/** - * @interface TouchEvent - * @see http://www.w3.org/TR/touch-events/ - */ -var SyntheticTouchEvent = SyntheticUIEvent.extend({ - touches: null, - targetTouches: null, - changedTouches: null, - altKey: null, - metaKey: null, - ctrlKey: null, - shiftKey: null, - getModifierState: getEventModifierState -}); + // eslint-disable-line no-shadow + var newStyle = Object.keys(style).reduce(function (newStyleInProgress, key) { + var value = style[key]; + if (!isNestedStyle(value)) { + newStyleInProgress[key] = value; + } + return newStyleInProgress; + }, {}); -/** - * @interface Event - * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events- - * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent - */ -var SyntheticTransitionEvent = SyntheticEvent$1.extend({ - propertyName: null, - elapsedTime: null, - pseudoElement: null -}); + return { + style: newStyle + }; +} -/** - * @interface WheelEvent - * @see http://www.w3.org/TR/DOM-Level-3-Events/ - */ -var SyntheticWheelEvent = SyntheticMouseEvent.extend({ - deltaX: function (event) { - return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive). - 'wheelDeltaX' in event ? -event.wheelDeltaX : 0; - }, - deltaY: function (event) { - return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive). - 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive). - 'wheelDelta' in event ? -event.wheelDelta : 0; - }, +module.exports = exports['default']; - deltaZ: null, +/***/ }), +/* 416 */ +/***/ (function(module, exports, __webpack_require__) { - // Browsers without "deltaMode" is reporting in raw wheel delta where one - // notch on the scroll is always +/- 120, roughly equivalent to pixels. - // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or - // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size. - deltaMode: null -}); +"use strict"; -/** - * Turns - * ['abort', ...] - * into - * eventTypes = { - * 'abort': { - * phasedRegistrationNames: { - * bubbled: 'onAbort', - * captured: 'onAbortCapture', - * }, - * dependencies: ['topAbort'], - * }, - * ... - * }; - * topLevelEventsToDispatchConfig = { - * 'topAbort': { sameConfig } - * }; - */ -var interactiveEventTypeNames = ['blur', 'cancel', 'click', 'close', 'contextMenu', 'copy', 'cut', 'doubleClick', 'dragEnd', 'dragStart', 'drop', 'focus', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'mouseDown', 'mouseUp', 'paste', 'pause', 'play', 'rateChange', 'reset', 'seeked', 'submit', 'touchCancel', 'touchEnd', 'touchStart', 'volumeChange']; -var nonInteractiveEventTypeNames = ['abort', 'animationEnd', 'animationIteration', 'animationStart', 'canPlay', 'canPlayThrough', 'drag', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'mouseMove', 'mouseOut', 'mouseOver', 'playing', 'progress', 'scroll', 'seeking', 'stalled', 'suspend', 'timeUpdate', 'toggle', 'touchMove', 'transitionEnd', 'waiting', 'wheel']; -var eventTypes$4 = {}; -var topLevelEventsToDispatchConfig = {}; +Object.defineProperty(exports, "__esModule", { + value: true +}); -function addEventTypeNameToConfig(event, isInteractive) { - var capitalizedEvent = event[0].toUpperCase() + event.slice(1); - var onEvent = 'on' + capitalizedEvent; - var topEvent = 'top' + capitalizedEvent; +var _mouseUpListener = __webpack_require__(413); - var type = { - phasedRegistrationNames: { - bubbled: onEvent, - captured: onEvent + 'Capture' - }, - dependencies: [topEvent], - isInteractive: isInteractive - }; - eventTypes$4[event] = type; - topLevelEventsToDispatchConfig[topEvent] = type; -} +var _mouseUpListener2 = _interopRequireDefault(_mouseUpListener); -interactiveEventTypeNames.forEach(function (eventTypeName) { - addEventTypeNameToConfig(eventTypeName, true); -}); -nonInteractiveEventTypeNames.forEach(function (eventTypeName) { - addEventTypeNameToConfig(eventTypeName, false); -}); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -// Only used in DEV for exhaustiveness validation. -var knownHTMLTopLevelTypes = ['topAbort', 'topCancel', 'topCanPlay', 'topCanPlayThrough', 'topClose', 'topDurationChange', 'topEmptied', 'topEncrypted', 'topEnded', 'topError', 'topInput', 'topInvalid', 'topLoad', 'topLoadedData', 'topLoadedMetadata', 'topLoadStart', 'topPause', 'topPlay', 'topPlaying', 'topProgress', 'topRateChange', 'topReset', 'topSeeked', 'topSeeking', 'topStalled', 'topSubmit', 'topSuspend', 'topTimeUpdate', 'topToggle', 'topVolumeChange', 'topWaiting']; +var _isInteractiveStyleField = function _isInteractiveStyleField(styleFieldName) { + return styleFieldName === ':hover' || styleFieldName === ':active' || styleFieldName === ':focus'; +}; -var SimpleEventPlugin = { - eventTypes: eventTypes$4, +var resolveInteractionStyles = function resolveInteractionStyles(config) { + var ExecutionEnvironment = config.ExecutionEnvironment, + getComponentField = config.getComponentField, + getState = config.getState, + mergeStyles = config.mergeStyles, + props = config.props, + setState = config.setState, + style = config.style; - isInteractiveTopLevelEventType: function (topLevelType) { - var config = topLevelEventsToDispatchConfig[topLevelType]; - return config !== undefined && config.isInteractive === true; - }, + var newComponentFields = {}; + var newProps = {}; - extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { - var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType]; - if (!dispatchConfig) { - return null; - } - var EventConstructor = void 0; - switch (topLevelType) { - case 'topKeyPress': - // Firefox creates a keypress event for function keys too. This removes - // the unwanted keypress events. Enter is however both printable and - // non-printable. One would expect Tab to be as well (but it isn't). - if (getEventCharCode(nativeEvent) === 0) { - return null; - } - /* falls through */ - case 'topKeyDown': - case 'topKeyUp': - EventConstructor = SyntheticKeyboardEvent; - break; - case 'topBlur': - case 'topFocus': - EventConstructor = SyntheticFocusEvent; - break; - case 'topClick': - // Firefox creates a click event on right mouse clicks. This removes the - // unwanted click events. - if (nativeEvent.button === 2) { - return null; - } - /* falls through */ - case 'topDoubleClick': - case 'topMouseDown': - case 'topMouseMove': - case 'topMouseUp': - // TODO: Disabled elements should not respond to mouse events - /* falls through */ - case 'topMouseOut': - case 'topMouseOver': - case 'topContextMenu': - EventConstructor = SyntheticMouseEvent; - break; - case 'topDrag': - case 'topDragEnd': - case 'topDragEnter': - case 'topDragExit': - case 'topDragLeave': - case 'topDragOver': - case 'topDragStart': - case 'topDrop': - EventConstructor = SyntheticDragEvent; - break; - case 'topTouchCancel': - case 'topTouchEnd': - case 'topTouchMove': - case 'topTouchStart': - EventConstructor = SyntheticTouchEvent; - break; - case 'topAnimationEnd': - case 'topAnimationIteration': - case 'topAnimationStart': - EventConstructor = SyntheticAnimationEvent; - break; - case 'topTransitionEnd': - EventConstructor = SyntheticTransitionEvent; - break; - case 'topScroll': - EventConstructor = SyntheticUIEvent; - break; - case 'topWheel': - EventConstructor = SyntheticWheelEvent; - break; - case 'topCopy': - case 'topCut': - case 'topPaste': - EventConstructor = SyntheticClipboardEvent; - break; - default: - { - if (knownHTMLTopLevelTypes.indexOf(topLevelType) === -1) { - warning(false, 'SimpleEventPlugin: Unhandled event type, `%s`. This warning ' + 'is likely caused by a bug in React. Please file an issue.', topLevelType); - } - } - // HTML Events - // @see http://www.w3.org/TR/html5/index.html#events-0 - EventConstructor = SyntheticEvent$1; - break; - } - var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget); - accumulateTwoPhaseDispatches(event); - return event; - } -}; + // Only add handlers if necessary + if (style[':hover']) { + // Always call the existing handler if one is already defined. + // This code, and the very similar ones below, could be abstracted a bit + // more, but it hurts readability IMO. + var existingOnMouseEnter = props.onMouseEnter; + newProps.onMouseEnter = function (e) { + existingOnMouseEnter && existingOnMouseEnter(e); + setState(':hover', true); + }; -var isInteractiveTopLevelEventType = SimpleEventPlugin.isInteractiveTopLevelEventType; + var existingOnMouseLeave = props.onMouseLeave; + newProps.onMouseLeave = function (e) { + existingOnMouseLeave && existingOnMouseLeave(e); + setState(':hover', false); + }; + } + if (style[':active']) { + var existingOnMouseDown = props.onMouseDown; + newProps.onMouseDown = function (e) { + existingOnMouseDown && existingOnMouseDown(e); + newComponentFields._lastMouseDown = Date.now(); + setState(':active', 'viamousedown'); + }; -var CALLBACK_BOOKKEEPING_POOL_SIZE = 10; -var callbackBookkeepingPool = []; + var existingOnKeyDown = props.onKeyDown; + newProps.onKeyDown = function (e) { + existingOnKeyDown && existingOnKeyDown(e); + if (e.key === ' ' || e.key === 'Enter') { + setState(':active', 'viakeydown'); + } + }; -/** - * Find the deepest React component completely containing the root of the - * passed-in instance (for use when entire React trees are nested within each - * other). If React trees are not nested, returns null. - */ -function findRootContainerNode(inst) { - // TODO: It may be a good idea to cache this to prevent unnecessary DOM - // traversal, but caching is difficult to do correctly without using a - // mutation observer to listen for all DOM changes. - while (inst['return']) { - inst = inst['return']; - } - if (inst.tag !== HostRoot) { - // This can happen if we're in a detached tree. - return null; + var existingOnKeyUp = props.onKeyUp; + newProps.onKeyUp = function (e) { + existingOnKeyUp && existingOnKeyUp(e); + if (e.key === ' ' || e.key === 'Enter') { + setState(':active', false); + } + }; } - return inst.stateNode.containerInfo; -} -// Used to store ancestor hierarchy in top level callback -function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) { - if (callbackBookkeepingPool.length) { - var instance = callbackBookkeepingPool.pop(); - instance.topLevelType = topLevelType; - instance.nativeEvent = nativeEvent; - instance.targetInst = targetInst; - return instance; + if (style[':focus']) { + var existingOnFocus = props.onFocus; + newProps.onFocus = function (e) { + existingOnFocus && existingOnFocus(e); + setState(':focus', true); + }; + + var existingOnBlur = props.onBlur; + newProps.onBlur = function (e) { + existingOnBlur && existingOnBlur(e); + setState(':focus', false); + }; } - return { - topLevelType: topLevelType, - nativeEvent: nativeEvent, - targetInst: targetInst, - ancestors: [] - }; -} -function releaseTopLevelCallbackBookKeeping(instance) { - instance.topLevelType = null; - instance.nativeEvent = null; - instance.targetInst = null; - instance.ancestors.length = 0; - if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) { - callbackBookkeepingPool.push(instance); + if (style[':active'] && !getComponentField('_radiumMouseUpListener') && ExecutionEnvironment.canUseEventListeners) { + newComponentFields._radiumMouseUpListener = _mouseUpListener2.default.subscribe(function () { + Object.keys(getComponentField('state')._radiumStyleState).forEach(function (key) { + if (getState(':active', key) === 'viamousedown') { + setState(':active', false, key); + } + }); + }); } -} -function handleTopLevel(bookKeeping) { - var targetInst = bookKeeping.targetInst; + // Merge the styles in the order they were defined + var interactionStyles = props.disabled ? [style[':disabled']] : Object.keys(style).filter(function (name) { + return _isInteractiveStyleField(name) && getState(name); + }).map(function (name) { + return style[name]; + }); - // Loop through the hierarchy, in case there's any nested components. - // It's important that we build the array of ancestors before calling any - // event handlers, because event handlers can modify the DOM, leading to - // inconsistencies with ReactMount's node cache. See #1105. - var ancestor = targetInst; - do { - if (!ancestor) { - bookKeeping.ancestors.push(ancestor); - break; - } - var root = findRootContainerNode(ancestor); - if (!root) { - break; + var newStyle = mergeStyles([style].concat(interactionStyles)); + + // Remove interactive styles + newStyle = Object.keys(newStyle).reduce(function (styleWithoutInteractions, name) { + if (!_isInteractiveStyleField(name) && name !== ':disabled') { + styleWithoutInteractions[name] = newStyle[name]; } - bookKeeping.ancestors.push(ancestor); - ancestor = getClosestInstanceFromNode(root); - } while (ancestor); + return styleWithoutInteractions; + }, {}); - for (var i = 0; i < bookKeeping.ancestors.length; i++) { - targetInst = bookKeeping.ancestors[i]; - runExtractedEventsInBatch(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent)); - } -} + return { + componentFields: newComponentFields, + props: newProps, + style: newStyle + }; +}; -// TODO: can we stop exporting these? -var _enabled = true; +exports.default = resolveInteractionStyles; +module.exports = exports['default']; -function setEnabled(enabled) { - _enabled = !!enabled; -} +/***/ }), +/* 417 */ +/***/ (function(module, exports, __webpack_require__) { -function isEnabled() { - return _enabled; -} +"use strict"; -/** - * Traps top-level events by using event bubbling. - * - * @param {string} topLevelType Record from `BrowserEventConstants`. - * @param {string} handlerBaseName Event name (e.g. "click"). - * @param {object} element Element on which to attach listener. - * @return {?object} An object with a remove function which will forcefully - * remove the listener. - * @internal - */ -function trapBubbledEvent(topLevelType, handlerBaseName, element) { - if (!element) { - return null; - } - var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent; - addEventBubbleListener(element, handlerBaseName, - // Check if interactive and wrap in interactiveUpdates - dispatch.bind(null, topLevelType)); -} +Object.defineProperty(exports, "__esModule", { + value: true +}); -/** - * Traps a top-level event by using event capturing. - * - * @param {string} topLevelType Record from `BrowserEventConstants`. - * @param {string} handlerBaseName Event name (e.g. "click"). - * @param {object} element Element on which to attach listener. - * @return {?object} An object with a remove function which will forcefully - * remove the listener. - * @internal - */ -function trapCapturedEvent(topLevelType, handlerBaseName, element) { - if (!element) { - return null; +var _extends = Object.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; }; + +exports.default = resolveMediaQueries; +var _windowMatchMedia = void 0; +function _getWindowMatchMedia(ExecutionEnvironment) { + if (_windowMatchMedia === undefined) { + _windowMatchMedia = !!ExecutionEnvironment.canUseDOM && !!window && !!window.matchMedia && function (mediaQueryString) { + return window.matchMedia(mediaQueryString); + } || null; } - var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent; + return _windowMatchMedia; +} - addEventCaptureListener(element, handlerBaseName, - // Check if interactive and wrap in interactiveUpdates - dispatch.bind(null, topLevelType)); +function _filterObject(obj, predicate) { + return Object.keys(obj).filter(function (key) { + return predicate(obj[key], key); + }).reduce(function (result, key) { + result[key] = obj[key]; + return result; + }, {}); } -function dispatchInteractiveEvent(topLevelType, nativeEvent) { - interactiveUpdates(dispatchEvent, topLevelType, nativeEvent); +function _removeMediaQueries(style) { + return Object.keys(style).reduce(function (styleWithoutMedia, key) { + if (key.indexOf('@media') !== 0) { + styleWithoutMedia[key] = style[key]; + } + return styleWithoutMedia; + }, {}); } -function dispatchEvent(topLevelType, nativeEvent) { - if (!_enabled) { - return; - } +function _topLevelRulesToCSS(_ref) { + var addCSS = _ref.addCSS, + appendImportantToEachValue = _ref.appendImportantToEachValue, + cssRuleSetToString = _ref.cssRuleSetToString, + hash = _ref.hash, + isNestedStyle = _ref.isNestedStyle, + style = _ref.style, + userAgent = _ref.userAgent; - var nativeEventTarget = getEventTarget(nativeEvent); - var targetInst = getClosestInstanceFromNode(nativeEventTarget); - if (targetInst !== null && typeof targetInst.tag === 'number' && !isFiberMounted(targetInst)) { - // If we get an event (ex: img onload) before committing that - // component's mount, ignore it for now (that is, treat it as if it was an - // event on a non-React tree). We might also consider queueing events and - // dispatching them after the mount. - targetInst = null; - } + var className = ''; + Object.keys(style).filter(function (name) { + return name.indexOf('@media') === 0; + }).map(function (query) { + var topLevelRules = appendImportantToEachValue(_filterObject(style[query], function (value) { + return !isNestedStyle(value); + })); - var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst); + if (!Object.keys(topLevelRules).length) { + return; + } - try { - // Event queue being processed in the same cycle allows - // `preventDefault`. - batchedUpdates(handleTopLevel, bookKeeping); - } finally { - releaseTopLevelCallbackBookKeeping(bookKeeping); - } + var ruleCSS = cssRuleSetToString('', topLevelRules, userAgent); + + // CSS classes cannot start with a number + var mediaQueryClassName = 'rmq-' + hash(query + ruleCSS); + var css = query + '{ .' + mediaQueryClassName + ruleCSS + '}'; + + addCSS(css); + + className += (className ? ' ' : '') + mediaQueryClassName; + }); + return className; } -var ReactDOMEventListener = Object.freeze({ - get _enabled () { return _enabled; }, - setEnabled: setEnabled, - isEnabled: isEnabled, - trapBubbledEvent: trapBubbledEvent, - trapCapturedEvent: trapCapturedEvent, - dispatchEvent: dispatchEvent -}); +function _subscribeToMediaQuery(_ref2) { + var listener = _ref2.listener, + listenersByQuery = _ref2.listenersByQuery, + matchMedia = _ref2.matchMedia, + mediaQueryListsByQuery = _ref2.mediaQueryListsByQuery, + query = _ref2.query; -/** - * Generate a mapping of standard vendor prefixes using the defined style property and event name. - * - * @param {string} styleProp - * @param {string} eventName - * @returns {object} - */ -function makePrefixMap(styleProp, eventName) { - var prefixes = {}; + query = query.replace('@media ', ''); - prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); - prefixes['Webkit' + styleProp] = 'webkit' + eventName; - prefixes['Moz' + styleProp] = 'moz' + eventName; - prefixes['ms' + styleProp] = 'MS' + eventName; - prefixes['O' + styleProp] = 'o' + eventName.toLowerCase(); + var mql = mediaQueryListsByQuery[query]; + if (!mql && matchMedia) { + mediaQueryListsByQuery[query] = mql = matchMedia(query); + } - return prefixes; + if (!listenersByQuery || !listenersByQuery[query]) { + mql.addListener(listener); + + listenersByQuery[query] = { + remove: function remove() { + mql.removeListener(listener); + } + }; + } + return mql; } -/** - * A list of event names to a configurable list of vendor prefixes. - */ -var vendorPrefixes = { - animationend: makePrefixMap('Animation', 'AnimationEnd'), - animationiteration: makePrefixMap('Animation', 'AnimationIteration'), - animationstart: makePrefixMap('Animation', 'AnimationStart'), - transitionend: makePrefixMap('Transition', 'TransitionEnd') -}; +function resolveMediaQueries(_ref3) { + var ExecutionEnvironment = _ref3.ExecutionEnvironment, + addCSS = _ref3.addCSS, + appendImportantToEachValue = _ref3.appendImportantToEachValue, + config = _ref3.config, + cssRuleSetToString = _ref3.cssRuleSetToString, + getComponentField = _ref3.getComponentField, + getGlobalState = _ref3.getGlobalState, + hash = _ref3.hash, + isNestedStyle = _ref3.isNestedStyle, + mergeStyles = _ref3.mergeStyles, + props = _ref3.props, + setState = _ref3.setState, + style = _ref3.style; -/** - * Event names that have already been detected and prefixed (if applicable). - */ -var prefixedEventNames = {}; + // eslint-disable-line no-shadow + var newStyle = _removeMediaQueries(style); + var mediaQueryClassNames = _topLevelRulesToCSS({ + addCSS: addCSS, + appendImportantToEachValue: appendImportantToEachValue, + cssRuleSetToString: cssRuleSetToString, + hash: hash, + isNestedStyle: isNestedStyle, + style: style, + userAgent: config.userAgent + }); -/** - * Element to check for prefixes on. - */ -var style = {}; + var newProps = mediaQueryClassNames ? { + className: mediaQueryClassNames + (props.className ? ' ' + props.className : '') + } : null; -/** - * Bootstrap if a DOM exists. - */ -if (ExecutionEnvironment.canUseDOM) { - style = document.createElement('div').style; + var matchMedia = config.matchMedia || _getWindowMatchMedia(ExecutionEnvironment); - // On some platforms, in particular some releases of Android 4.x, - // the un-prefixed "animation" and "transition" properties are defined on the - // style object but the events that fire will still be prefixed, so we need - // to check if the un-prefixed events are usable, and if not remove them from the map. - if (!('AnimationEvent' in window)) { - delete vendorPrefixes.animationend.animation; - delete vendorPrefixes.animationiteration.animation; - delete vendorPrefixes.animationstart.animation; + if (!matchMedia) { + return { + props: newProps, + style: newStyle + }; } - // Same as above - if (!('TransitionEvent' in window)) { - delete vendorPrefixes.transitionend.transition; - } -} + var listenersByQuery = _extends({}, getComponentField('_radiumMediaQueryListenersByQuery')); + var mediaQueryListsByQuery = getGlobalState('mediaQueryListsByQuery') || {}; -/** - * Attempts to determine the correct vendor prefixed event name. - * - * @param {string} eventName - * @returns {string} - */ -function getVendorPrefixedEventName(eventName) { - if (prefixedEventNames[eventName]) { - return prefixedEventNames[eventName]; - } else if (!vendorPrefixes[eventName]) { - return eventName; - } + Object.keys(style).filter(function (name) { + return name.indexOf('@media') === 0; + }).map(function (query) { + var nestedRules = _filterObject(style[query], isNestedStyle); - var prefixMap = vendorPrefixes[eventName]; + if (!Object.keys(nestedRules).length) { + return; + } - for (var styleProp in prefixMap) { - if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) { - return prefixedEventNames[eventName] = prefixMap[styleProp]; + var mql = _subscribeToMediaQuery({ + listener: function listener() { + return setState(query, mql.matches, '_all'); + }, + listenersByQuery: listenersByQuery, + matchMedia: matchMedia, + mediaQueryListsByQuery: mediaQueryListsByQuery, + query: query + }); + + // Apply media query states + if (mql.matches) { + newStyle = mergeStyles([newStyle, nestedRules]); } - } + }); - return eventName; + return { + componentFields: { + _radiumMediaQueryListenersByQuery: listenersByQuery + }, + globalState: { mediaQueryListsByQuery: mediaQueryListsByQuery }, + props: newProps, + style: newStyle + }; } +module.exports = exports['default']; -/** - * Types of raw signals from the browser caught at the top level. - * - * For events like 'submit' or audio/video events which don't consistently - * bubble (which we trap at a lower node than `document`), binding - * at `document` would cause duplicate events so we don't include them here. - */ -var topLevelTypes = { - topAnimationEnd: getVendorPrefixedEventName('animationend'), - topAnimationIteration: getVendorPrefixedEventName('animationiteration'), - topAnimationStart: getVendorPrefixedEventName('animationstart'), - topBlur: 'blur', - topCancel: 'cancel', - topChange: 'change', - topClick: 'click', - topClose: 'close', - topCompositionEnd: 'compositionend', - topCompositionStart: 'compositionstart', - topCompositionUpdate: 'compositionupdate', - topContextMenu: 'contextmenu', - topCopy: 'copy', - topCut: 'cut', - topDoubleClick: 'dblclick', - topDrag: 'drag', - topDragEnd: 'dragend', - topDragEnter: 'dragenter', - topDragExit: 'dragexit', - topDragLeave: 'dragleave', - topDragOver: 'dragover', - topDragStart: 'dragstart', - topDrop: 'drop', - topFocus: 'focus', - topInput: 'input', - topKeyDown: 'keydown', - topKeyPress: 'keypress', - topKeyUp: 'keyup', - topLoad: 'load', - topLoadStart: 'loadstart', - topMouseDown: 'mousedown', - topMouseMove: 'mousemove', - topMouseOut: 'mouseout', - topMouseOver: 'mouseover', - topMouseUp: 'mouseup', - topPaste: 'paste', - topScroll: 'scroll', - topSelectionChange: 'selectionchange', - topTextInput: 'textInput', - topToggle: 'toggle', - topTouchCancel: 'touchcancel', - topTouchEnd: 'touchend', - topTouchMove: 'touchmove', - topTouchStart: 'touchstart', - topTransitionEnd: getVendorPrefixedEventName('transitionend'), - topWheel: 'wheel' -}; - -// There are so many media events, it makes sense to just -// maintain a list of them. Note these aren't technically -// "top-level" since they don't bubble. We should come up -// with a better naming convention if we come to refactoring -// the event system. -var mediaEventTypes = { - topAbort: 'abort', - topCanPlay: 'canplay', - topCanPlayThrough: 'canplaythrough', - topDurationChange: 'durationchange', - topEmptied: 'emptied', - topEncrypted: 'encrypted', - topEnded: 'ended', - topError: 'error', - topLoadedData: 'loadeddata', - topLoadedMetadata: 'loadedmetadata', - topLoadStart: 'loadstart', - topPause: 'pause', - topPlay: 'play', - topPlaying: 'playing', - topProgress: 'progress', - topRateChange: 'ratechange', - topSeeked: 'seeked', - topSeeking: 'seeking', - topStalled: 'stalled', - topSuspend: 'suspend', - topTimeUpdate: 'timeupdate', - topVolumeChange: 'volumechange', - topWaiting: 'waiting' -}; +/***/ }), +/* 418 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * Summary of `ReactBrowserEventEmitter` event handling: - * - * - Top-level delegation is used to trap most native browser events. This - * may only occur in the main thread and is the responsibility of - * ReactDOMEventListener, which is injected and can therefore support - * pluggable event sources. This is the only work that occurs in the main - * thread. - * - * - We normalize and de-duplicate events to account for browser quirks. This - * may be done in the worker thread. - * - * - Forward these native events (with the associated top-level type used to - * trap it) to `EventPluginHub`, which in turn will ask plugins if they want - * to extract any synthetic events. - * - * - The `EventPluginHub` will then process each event by annotating them with - * "dispatches", a sequence of listeners and IDs that care about that event. - * - * - The `EventPluginHub` then dispatches the events. - * - * Overview of React and the event system: - * - * +------------+ . - * | DOM | . - * +------------+ . - * | . - * v . - * +------------+ . - * | ReactEvent | . - * | Listener | . - * +------------+ . +-----------+ - * | . +--------+|SimpleEvent| - * | . | |Plugin | - * +-----|------+ . v +-----------+ - * | | | . +--------------+ +------------+ - * | +-----------.--->|EventPluginHub| | Event | - * | | . | | +-----------+ | Propagators| - * | ReactEvent | . | | |TapEvent | |------------| - * | Emitter | . | |<---+|Plugin | |other plugin| - * | | . | | +-----------+ | utilities | - * | +-----------.--->| | +------------+ - * | | | . +--------------+ - * +-----|------+ . ^ +-----------+ - * | . | |Enter/Leave| - * + . +-------+|Plugin | - * +-------------+ . +-----------+ - * | application | . - * |-------------| . - * | | . - * | | . - * +-------------+ . - * . - * React Core . General Purpose Event Plugin System - */ +"use strict"; -var alreadyListeningTo = {}; -var reactTopListenersCounter = 0; -/** - * To ensure no conflicts with other potential React instances on the page - */ -var topListenersIDKey = '_reactListenersID' + ('' + Math.random()).slice(2); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = visited; +function visited(_ref) { + var addCSS = _ref.addCSS, + appendImportantToEachValue = _ref.appendImportantToEachValue, + config = _ref.config, + cssRuleSetToString = _ref.cssRuleSetToString, + hash = _ref.hash, + props = _ref.props, + style = _ref.style; -function getListeningForDocument(mountAt) { - // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` - // directly. - if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { - mountAt[topListenersIDKey] = reactTopListenersCounter++; - alreadyListeningTo[mountAt[topListenersIDKey]] = {}; - } - return alreadyListeningTo[mountAt[topListenersIDKey]]; -} + // eslint-disable-line no-shadow + var className = props.className; -/** - * We listen for bubbled touch events on the document object. - * - * Firefox v8.01 (and possibly others) exhibited strange behavior when - * mounting `onmousemove` events at some node that was not the document - * element. The symptoms were that if your mouse is not moving over something - * contained within that mount point (for example on the background) the - * top-level listeners for `onmousemove` won't be called. However, if you - * register the `mousemove` on the document object, then it will of course - * catch all `mousemove`s. This along with iOS quirks, justifies restricting - * top-level listeners to the document object only, at least for these - * movement types of events and possibly all events. - * - * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html - * - * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but - * they bubble to document. - * - * @param {string} registrationName Name of listener (e.g. `onClick`). - * @param {object} contentDocumentHandle Document which owns the container - */ -function listenTo(registrationName, contentDocumentHandle) { - var mountAt = contentDocumentHandle; - var isListening = getListeningForDocument(mountAt); - var dependencies = registrationNameDependencies[registrationName]; + var newStyle = Object.keys(style).reduce(function (newStyleInProgress, key) { + var value = style[key]; + if (key === ':visited') { + value = appendImportantToEachValue(value); + var ruleCSS = cssRuleSetToString('', value, config.userAgent); + var visitedClassName = 'rad-' + hash(ruleCSS); + var css = '.' + visitedClassName + ':visited' + ruleCSS; - for (var i = 0; i < dependencies.length; i++) { - var dependency = dependencies[i]; - if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { - if (dependency === 'topScroll') { - trapCapturedEvent('topScroll', 'scroll', mountAt); - } else if (dependency === 'topFocus' || dependency === 'topBlur') { - trapCapturedEvent('topFocus', 'focus', mountAt); - trapCapturedEvent('topBlur', 'blur', mountAt); + addCSS(css); + className = (className ? className + ' ' : '') + visitedClassName; + } else { + newStyleInProgress[key] = value; + } - // to make sure blur and focus event listeners are only attached once - isListening.topBlur = true; - isListening.topFocus = true; - } else if (dependency === 'topCancel') { - if (isEventSupported('cancel', true)) { - trapCapturedEvent('topCancel', 'cancel', mountAt); - } - isListening.topCancel = true; - } else if (dependency === 'topClose') { - if (isEventSupported('close', true)) { - trapCapturedEvent('topClose', 'close', mountAt); - } - isListening.topClose = true; - } else if (topLevelTypes.hasOwnProperty(dependency)) { - trapBubbledEvent(dependency, topLevelTypes[dependency], mountAt); - } + return newStyleInProgress; + }, {}); - isListening[dependency] = true; - } - } + return { + props: className === props.className ? null : { className: className }, + style: newStyle + }; } -function isListeningToAllDependencies(registrationName, mountAt) { - var isListening = getListeningForDocument(mountAt); - var dependencies = registrationNameDependencies[registrationName]; - for (var i = 0; i < dependencies.length; i++) { - var dependency = dependencies[i]; - if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { - return false; - } - } - return true; -} +module.exports = exports['default']; -/** - * Given any node return the first leaf node without children. - * - * @param {DOMElement|DOMTextNode} node - * @return {DOMElement|DOMTextNode} - */ -function getLeafNode(node) { - while (node && node.firstChild) { - node = node.firstChild; - } - return node; -} +/***/ }), +/* 419 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * Get the next sibling within a container. This will walk up the - * DOM if a node's siblings have been exhausted. +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) {/** @license React v16.3.2 + * react-dom.development.js * - * @param {DOMElement|DOMTextNode} node - * @return {?DOMElement|DOMTextNode} - */ -function getSiblingNode(node) { - while (node) { - if (node.nextSibling) { - return node.nextSibling; - } - node = node.parentNode; - } -} - -/** - * Get object describing the nodes which contain characters at offset. + * Copyright (c) 2013-present, Facebook, Inc. * - * @param {DOMElement|DOMTextNode} root - * @param {number} offset - * @return {?object} + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ -function getNodeForCharacterOffset(root, offset) { - var node = getLeafNode(root); - var nodeStart = 0; - var nodeEnd = 0; - while (node) { - if (node.nodeType === TEXT_NODE) { - nodeEnd = nodeStart + node.textContent.length; - - if (nodeStart <= offset && nodeEnd >= offset) { - return { - node: node, - offset: offset - nodeStart - }; - } - nodeStart = nodeEnd; - } - node = getLeafNode(getSiblingNode(node)); - } -} -/** - * @param {DOMElement} outerNode - * @return {?object} - */ -function getOffsets(outerNode) { - var selection = window.getSelection && window.getSelection(); - if (!selection || selection.rangeCount === 0) { - return null; - } +if (process.env.NODE_ENV !== "production") { + (function() { +'use strict'; - var anchorNode = selection.anchorNode, - anchorOffset = selection.anchorOffset, - focusNode = selection.focusNode, - focusOffset = selection.focusOffset; +var invariant = __webpack_require__(17); +var React = __webpack_require__(0); +var warning = __webpack_require__(48); +var ExecutionEnvironment = __webpack_require__(125); +var _assign = __webpack_require__(35); +var emptyFunction = __webpack_require__(16); +var checkPropTypes = __webpack_require__(100); +var getActiveElement = __webpack_require__(127); +var shallowEqual = __webpack_require__(128); +var containsNode = __webpack_require__(126); +var emptyObject = __webpack_require__(47); +var hyphenateStyleName = __webpack_require__(243); +var camelizeStyleName = __webpack_require__(241); + +// Relying on the `invariant()` implementation lets us +// have preserve the format and params in the www builds. - // In Firefox, anchorNode and focusNode can be "anonymous divs", e.g. the - // up/down buttons on an . Anonymous divs do not seem to - // expose properties, triggering a "Permission denied error" if any of its - // properties are accessed. The only seemingly possible way to avoid erroring - // is to access a property that typically works for non-anonymous divs and - // catch any error that may otherwise arise. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=208427 +!React ? invariant(false, 'ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.') : void 0; +var invokeGuardedCallback = function (name, func, context, a, b, c, d, e, f) { + this._hasCaughtError = false; + this._caughtError = null; + var funcArgs = Array.prototype.slice.call(arguments, 3); try { - /* eslint-disable no-unused-expressions */ - anchorNode.nodeType; - focusNode.nodeType; - /* eslint-enable no-unused-expressions */ - } catch (e) { - return null; + func.apply(context, funcArgs); + } catch (error) { + this._caughtError = error; + this._hasCaughtError = true; } +}; - return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset); -} +{ + // In DEV mode, we swap out invokeGuardedCallback for a special version + // that plays more nicely with the browser's DevTools. The idea is to preserve + // "Pause on exceptions" behavior. Because React wraps all user-provided + // functions in invokeGuardedCallback, and the production version of + // invokeGuardedCallback uses a try-catch, all user exceptions are treated + // like caught exceptions, and the DevTools won't pause unless the developer + // takes the extra step of enabling pause on caught exceptions. This is + // untintuitive, though, because even though React has caught the error, from + // the developer's perspective, the error is uncaught. + // + // To preserve the expected "Pause on exceptions" behavior, we don't use a + // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake + // DOM node, and call the user-provided callback from inside an event handler + // for that fake event. If the callback throws, the error is "captured" using + // a global event handler. But because the error happens in a different + // event loop context, it does not interrupt the normal program flow. + // Effectively, this gives us try-catch behavior without actually using + // try-catch. Neat! -/** - * Returns {start, end} where `start` is the character/codepoint index of - * (anchorNode, anchorOffset) within the textContent of `outerNode`, and - * `end` is the index of (focusNode, focusOffset). - * - * Returns null if you pass in garbage input but we should probably just crash. - * - * Exported only for testing. - */ -function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) { - var length = 0; - var start = -1; - var end = -1; - var indexWithinAnchor = 0; - var indexWithinFocus = 0; - var node = outerNode; - var parentNode = null; + // Check that the browser supports the APIs we need to implement our special + // DEV version of invokeGuardedCallback + if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { + var fakeNode = document.createElement('react'); - outer: while (true) { - var next = null; + var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) { + // If document doesn't exist we know for sure we will crash in this method + // when we call document.createEvent(). However this can cause confusing + // errors: https://github.com/facebookincubator/create-react-app/issues/3482 + // So we preemptively throw with a better message instead. + !(typeof document !== 'undefined') ? invariant(false, 'The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.') : void 0; + var evt = document.createEvent('Event'); - while (true) { - if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) { - start = length + anchorOffset; - } - if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) { - end = length + focusOffset; - } + // Keeps track of whether the user-provided callback threw an error. We + // set this to true at the beginning, then set it to false right after + // calling the function. If the function errors, `didError` will never be + // set to false. This strategy works even if the browser is flaky and + // fails to call our global error handler, because it doesn't rely on + // the error event at all. + var didError = true; - if (node.nodeType === TEXT_NODE) { - length += node.nodeValue.length; + // Create an event handler for our fake event. We will synchronously + // dispatch our fake event using `dispatchEvent`. Inside the handler, we + // call the user-provided callback. + var funcArgs = Array.prototype.slice.call(arguments, 3); + function callCallback() { + // We immediately remove the callback from event listeners so that + // nested `invokeGuardedCallback` calls do not clash. Otherwise, a + // nested call would trigger the fake event handlers of any call higher + // in the stack. + fakeNode.removeEventListener(evtType, callCallback, false); + func.apply(context, funcArgs); + didError = false; } - if ((next = node.firstChild) === null) { - break; - } - // Moving from `node` to its first child `next`. - parentNode = node; - node = next; - } + // Create a global error event handler. We use this to capture the value + // that was thrown. It's possible that this error handler will fire more + // than once; for example, if non-React code also calls `dispatchEvent` + // and a handler for that event throws. We should be resilient to most of + // those cases. Even if our error event handler fires more than once, the + // last error event is always used. If the callback actually does error, + // we know that the last error event is the correct one, because it's not + // possible for anything else to have happened in between our callback + // erroring and the code that follows the `dispatchEvent` call below. If + // the callback doesn't error, but the error event was fired, we know to + // ignore it because `didError` will be false, as described above. + var error = void 0; + // Use this to track whether the error event is ever called. + var didSetError = false; + var isCrossOriginError = false; - while (true) { - if (node === outerNode) { - // If `outerNode` has children, this is always the second time visiting - // it. If it has no children, this is still the first loop, and the only - // valid selection is anchorNode and focusNode both equal to this node - // and both offsets 0, in which case we will have handled above. - break outer; - } - if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) { - start = length; - } - if (parentNode === focusNode && ++indexWithinFocus === focusOffset) { - end = length; + function onError(event) { + error = event.error; + didSetError = true; + if (error === null && event.colno === 0 && event.lineno === 0) { + isCrossOriginError = true; + } } - if ((next = node.nextSibling) !== null) { - break; + + // Create a fake event type. + var evtType = 'react-' + (name ? name : 'invokeguardedcallback'); + + // Attach our event handlers + window.addEventListener('error', onError); + fakeNode.addEventListener(evtType, callCallback, false); + + // Synchronously dispatch our fake event. If the user-provided function + // errors, it will trigger our global error handler. + evt.initEvent(evtType, false, false); + fakeNode.dispatchEvent(evt); + + if (didError) { + if (!didSetError) { + // The callback errored, but the error event never fired. + error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.'); + } else if (isCrossOriginError) { + error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.'); + } + this._hasCaughtError = true; + this._caughtError = error; + } else { + this._hasCaughtError = false; + this._caughtError = null; } - node = parentNode; - parentNode = node.parentNode; - } - // Moving from `node` to its next sibling `next`. - node = next; - } + // Remove our event listeners + window.removeEventListener('error', onError); + }; - if (start === -1 || end === -1) { - // This should never happen. (Would happen if the anchor/focus nodes aren't - // actually inside the passed-in node.) - return null; + invokeGuardedCallback = invokeGuardedCallbackDev; } - - return { - start: start, - end: end - }; } -/** - * In modern non-IE browsers, we can support both forward and backward - * selections. - * - * Note: IE10+ supports the Selection object, but it does not support - * the `extend` method, which means that even in modern IE, it's not possible - * to programmatically create a backward selection. Thus, for all IE - * versions, we use the old IE API to create our selections. - * - * @param {DOMElement|DOMTextNode} node - * @param {object} offsets - */ -function setOffsets(node, offsets) { - if (!window.getSelection) { - return; - } +var invokeGuardedCallback$1 = invokeGuardedCallback; - var selection = window.getSelection(); - var length = node[getTextContentAccessor()].length; - var start = Math.min(offsets.start, length); - var end = offsets.end === undefined ? start : Math.min(offsets.end, length); +var ReactErrorUtils = { + // Used by Fiber to simulate a try-catch. + _caughtError: null, + _hasCaughtError: false, - // IE 11 uses modern selection, but doesn't support the extend method. - // Flip backward selections, so we can set with a single range. - if (!selection.extend && start > end) { - var temp = end; - end = start; - start = temp; - } + // Used by event system to capture/rethrow the first error. + _rethrowError: null, + _hasRethrowError: false, - var startMarker = getNodeForCharacterOffset(node, start); - var endMarker = getNodeForCharacterOffset(node, end); + /** + * Call a function while guarding against errors that happens within it. + * Returns an error if it throws, otherwise null. + * + * In production, this is implemented using a try-catch. The reason we don't + * use a try-catch directly is so that we can swap out a different + * implementation in DEV mode. + * + * @param {String} name of the guard to use for logging or debugging + * @param {Function} func The function to invoke + * @param {*} context The context to use when calling the function + * @param {...*} args Arguments for function + */ + invokeGuardedCallback: function (name, func, context, a, b, c, d, e, f) { + invokeGuardedCallback$1.apply(ReactErrorUtils, arguments); + }, - if (startMarker && endMarker) { - if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) { - return; + /** + * Same as invokeGuardedCallback, but instead of returning an error, it stores + * it in a global so it can be rethrown by `rethrowCaughtError` later. + * TODO: See if _caughtError and _rethrowError can be unified. + * + * @param {String} name of the guard to use for logging or debugging + * @param {Function} func The function to invoke + * @param {*} context The context to use when calling the function + * @param {...*} args Arguments for function + */ + invokeGuardedCallbackAndCatchFirstError: function (name, func, context, a, b, c, d, e, f) { + ReactErrorUtils.invokeGuardedCallback.apply(this, arguments); + if (ReactErrorUtils.hasCaughtError()) { + var error = ReactErrorUtils.clearCaughtError(); + if (!ReactErrorUtils._hasRethrowError) { + ReactErrorUtils._hasRethrowError = true; + ReactErrorUtils._rethrowError = error; + } } - var range = document.createRange(); - range.setStart(startMarker.node, startMarker.offset); - selection.removeAllRanges(); + }, - if (start > end) { - selection.addRange(range); - selection.extend(endMarker.node, endMarker.offset); + /** + * During execution of guarded functions we will capture the first error which + * we will rethrow to be handled by the top level error handler. + */ + rethrowCaughtError: function () { + return rethrowCaughtError.apply(ReactErrorUtils, arguments); + }, + + hasCaughtError: function () { + return ReactErrorUtils._hasCaughtError; + }, + + clearCaughtError: function () { + if (ReactErrorUtils._hasCaughtError) { + var error = ReactErrorUtils._caughtError; + ReactErrorUtils._caughtError = null; + ReactErrorUtils._hasCaughtError = false; + return error; } else { - range.setEnd(endMarker.node, endMarker.offset); - selection.addRange(range); + invariant(false, 'clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.'); } } -} +}; -function isInDocument(node) { - return containsNode(document.documentElement, node); -} +var rethrowCaughtError = function () { + if (ReactErrorUtils._hasRethrowError) { + var error = ReactErrorUtils._rethrowError; + ReactErrorUtils._rethrowError = null; + ReactErrorUtils._hasRethrowError = false; + throw error; + } +}; /** - * @ReactInputSelection: React input selection module. Based on Selection.js, - * but modified to be suitable for react and has a couple of bug fixes (doesn't - * assume buttons have range selections allowed). - * Input selection module for React. + * Injectable ordering of event plugins. */ - -function hasSelectionCapabilities(elem) { - var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); - return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true'); -} - -function getSelectionInformation() { - var focusedElem = getActiveElement(); - return { - focusedElem: focusedElem, - selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection$1(focusedElem) : null - }; -} +var eventPluginOrder = null; /** - * @restoreSelection: If any selection information was potentially lost, - * restore it. This is useful when performing operations that could remove dom - * nodes and place them back in, resulting in focus being lost. + * Injectable mapping from names to event plugin modules. */ -function restoreSelection(priorSelectionInformation) { - var curFocusedElem = getActiveElement(); - var priorFocusedElem = priorSelectionInformation.focusedElem; - var priorSelectionRange = priorSelectionInformation.selectionRange; - if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { - if (hasSelectionCapabilities(priorFocusedElem)) { - setSelection(priorFocusedElem, priorSelectionRange); - } +var namesToPlugins = {}; - // Focusing a node can change the scroll position, which is undesirable - var ancestors = []; - var ancestor = priorFocusedElem; - while (ancestor = ancestor.parentNode) { - if (ancestor.nodeType === ELEMENT_NODE) { - ancestors.push({ - element: ancestor, - left: ancestor.scrollLeft, - top: ancestor.scrollTop - }); - } +/** + * Recomputes the plugin list using the injected plugins and plugin ordering. + * + * @private + */ +function recomputePluginOrdering() { + if (!eventPluginOrder) { + // Wait until an `eventPluginOrder` is injected. + return; + } + for (var pluginName in namesToPlugins) { + var pluginModule = namesToPlugins[pluginName]; + var pluginIndex = eventPluginOrder.indexOf(pluginName); + !(pluginIndex > -1) ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : void 0; + if (plugins[pluginIndex]) { + continue; } - - priorFocusedElem.focus(); - - for (var i = 0; i < ancestors.length; i++) { - var info = ancestors[i]; - info.element.scrollLeft = info.left; - info.element.scrollTop = info.top; + !pluginModule.extractEvents ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : void 0; + plugins[pluginIndex] = pluginModule; + var publishedEvents = pluginModule.eventTypes; + for (var eventName in publishedEvents) { + !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : void 0; } } } /** - * @getSelection: Gets the selection bounds of a focused textarea, input or - * contentEditable node. - * -@input: Look up selection bounds of this input - * -@return {start: selectionStart, end: selectionEnd} + * Publishes an event so that it can be dispatched by the supplied plugin. + * + * @param {object} dispatchConfig Dispatch configuration for the event. + * @param {object} PluginModule Plugin publishing the event. + * @return {boolean} True if the event was successfully published. + * @private */ -function getSelection$1(input) { - var selection = void 0; +function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { + !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0; + eventNameDispatchConfigs[eventName] = dispatchConfig; - if ('selectionStart' in input) { - // Modern browser with input or textarea. - selection = { - start: input.selectionStart, - end: input.selectionEnd - }; - } else { - // Content editable or old IE textarea. - selection = getOffsets(input); + var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; + if (phasedRegistrationNames) { + for (var phaseName in phasedRegistrationNames) { + if (phasedRegistrationNames.hasOwnProperty(phaseName)) { + var phasedRegistrationName = phasedRegistrationNames[phaseName]; + publishRegistrationName(phasedRegistrationName, pluginModule, eventName); + } + } + return true; + } else if (dispatchConfig.registrationName) { + publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); + return true; } - - return selection || { start: 0, end: 0 }; + return false; } /** - * @setSelection: Sets the selection bounds of a textarea or input and focuses - * the input. - * -@input Set selection bounds of this input or textarea - * -@offsets Object of same form that is returned from get* + * Publishes a registration name that is used to identify dispatched events. + * + * @param {string} registrationName Registration name to add. + * @param {object} PluginModule Plugin publishing the event. + * @private */ -function setSelection(input, offsets) { - var start = offsets.start, - end = offsets.end; +function publishRegistrationName(registrationName, pluginModule, eventName) { + !!registrationNameModules[registrationName] ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : void 0; + registrationNameModules[registrationName] = pluginModule; + registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies; - if (end === undefined) { - end = start; - } + { + var lowerCasedName = registrationName.toLowerCase(); + possibleRegistrationNames[lowerCasedName] = registrationName; - if ('selectionStart' in input) { - input.selectionStart = start; - input.selectionEnd = Math.min(end, input.value.length); - } else { - setOffsets(input, offsets); + if (registrationName === 'onDoubleClick') { + possibleRegistrationNames.ondblclick = registrationName; + } } } -var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11; - -var eventTypes$3 = { - select: { - phasedRegistrationNames: { - bubbled: 'onSelect', - captured: 'onSelectCapture' - }, - dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange'] - } -}; - -var activeElement$1 = null; -var activeElementInst$1 = null; -var lastSelection = null; -var mouseDown = false; - /** - * Get an object which is a unique representation of the current selection. - * - * The return value will not be consistent across nodes or browsers, but - * two identical selections on the same node will return identical objects. + * Registers plugins so that they can extract and dispatch events. * - * @param {DOMElement} node - * @return {object} + * @see {EventPluginHub} */ -function getSelection(node) { - if ('selectionStart' in node && hasSelectionCapabilities(node)) { - return { - start: node.selectionStart, - end: node.selectionEnd - }; - } else if (window.getSelection) { - var selection = window.getSelection(); - return { - anchorNode: selection.anchorNode, - anchorOffset: selection.anchorOffset, - focusNode: selection.focusNode, - focusOffset: selection.focusOffset - }; - } -} /** - * Poll selection to see whether it's changed. - * - * @param {object} nativeEvent - * @return {?SyntheticEvent} + * Ordered list of injected plugins. */ -function constructSelectEvent(nativeEvent, nativeEventTarget) { - // Ensure we have the right element, and that the user is not dragging a - // selection (this matches native `select` event behavior). In HTML5, select - // fires only on input and textarea thus if there's no focused element we - // won't dispatch. - if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement()) { - return null; - } - - // Only fire when selection has actually changed. - var currentSelection = getSelection(activeElement$1); - if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { - lastSelection = currentSelection; +var plugins = []; - var syntheticEvent = SyntheticEvent$1.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget); +/** + * Mapping from event name to dispatch config + */ +var eventNameDispatchConfigs = {}; - syntheticEvent.type = 'select'; - syntheticEvent.target = activeElement$1; +/** + * Mapping from registration name to plugin module + */ +var registrationNameModules = {}; - accumulateTwoPhaseDispatches(syntheticEvent); +/** + * Mapping from registration name to event name + */ +var registrationNameDependencies = {}; - return syntheticEvent; - } +/** + * Mapping from lowercase registration names to the properly cased version, + * used to warn in the case of missing event handlers. Available + * only in true. + * @type {Object} + */ +var possibleRegistrationNames = {}; +// Trust the developer to only use possibleRegistrationNames in true - return null; +/** + * Injects an ordering of plugins (by plugin name). This allows the ordering + * to be decoupled from injection of the actual plugins so that ordering is + * always deterministic regardless of packaging, on-the-fly injection, etc. + * + * @param {array} InjectedEventPluginOrder + * @internal + * @see {EventPluginHub.injection.injectEventPluginOrder} + */ +function injectEventPluginOrder(injectedEventPluginOrder) { + !!eventPluginOrder ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : void 0; + // Clone the ordering so it cannot be dynamically mutated. + eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); + recomputePluginOrdering(); } /** - * This plugin creates an `onSelect` event that normalizes select events - * across form elements. + * Injects plugins to be used by `EventPluginHub`. The plugin names must be + * in the ordering injected by `injectEventPluginOrder`. * - * Supported elements are: - * - input (see `isTextInputElement`) - * - textarea - * - contentEditable + * Plugins can be injected as part of page initialization or on-the-fly. * - * This differs from native browser implementations in the following ways: - * - Fires on contentEditable fields as well as inputs. - * - Fires for collapsed selection. - * - Fires after user input. + * @param {object} injectedNamesToPlugins Map from names to plugin modules. + * @internal + * @see {EventPluginHub.injection.injectEventPluginsByName} */ -var SelectEventPlugin = { - eventTypes: eventTypes$3, - - extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { - var doc = nativeEventTarget.window === nativeEventTarget ? nativeEventTarget.document : nativeEventTarget.nodeType === DOCUMENT_NODE ? nativeEventTarget : nativeEventTarget.ownerDocument; - // Track whether all listeners exists for this plugin. If none exist, we do - // not extract events. See #3639. - if (!doc || !isListeningToAllDependencies('onSelect', doc)) { - return null; +function injectEventPluginsByName(injectedNamesToPlugins) { + var isOrderingDirty = false; + for (var pluginName in injectedNamesToPlugins) { + if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { + continue; + } + var pluginModule = injectedNamesToPlugins[pluginName]; + if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { + !!namesToPlugins[pluginName] ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0; + namesToPlugins[pluginName] = pluginModule; + isOrderingDirty = true; } + } + if (isOrderingDirty) { + recomputePluginOrdering(); + } +} - var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window; +var EventPluginRegistry = Object.freeze({ + plugins: plugins, + eventNameDispatchConfigs: eventNameDispatchConfigs, + registrationNameModules: registrationNameModules, + registrationNameDependencies: registrationNameDependencies, + possibleRegistrationNames: possibleRegistrationNames, + injectEventPluginOrder: injectEventPluginOrder, + injectEventPluginsByName: injectEventPluginsByName +}); - switch (topLevelType) { - // Track the input node that has focus. - case 'topFocus': - if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') { - activeElement$1 = targetNode; - activeElementInst$1 = targetInst; - lastSelection = null; - } - break; - case 'topBlur': - activeElement$1 = null; - activeElementInst$1 = null; - lastSelection = null; - break; - // Don't fire the event while the user is dragging. This matches the - // semantics of the native select event. - case 'topMouseDown': - mouseDown = true; - break; - case 'topContextMenu': - case 'topMouseUp': - mouseDown = false; - return constructSelectEvent(nativeEvent, nativeEventTarget); - // Chrome and IE fire non-standard event when selection is changed (and - // sometimes when it hasn't). IE's event fires out of order with respect - // to key and input events on deletion, so we discard it. - // - // Firefox doesn't support selectionchange, so check selection status - // after each key entry. The selection changes after keydown and before - // keyup, but we check on keydown as well in the case of holding down a - // key, when multiple keydown events are fired but only one keyup is. - // This is also our approach for IE handling, for the reason above. - case 'topSelectionChange': - if (skipSelectionChangeEvent) { - break; - } - // falls through - case 'topKeyDown': - case 'topKeyUp': - return constructSelectEvent(nativeEvent, nativeEventTarget); - } +var getFiberCurrentPropsFromNode = null; +var getInstanceFromNode = null; +var getNodeFromInstance = null; - return null; +var injection$1 = { + injectComponentTree: function (Injected) { + getFiberCurrentPropsFromNode = Injected.getFiberCurrentPropsFromNode; + getInstanceFromNode = Injected.getInstanceFromNode; + getNodeFromInstance = Injected.getNodeFromInstance; + + { + !(getNodeFromInstance && getInstanceFromNode) ? warning(false, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0; + } } }; -/** - * Inject modules for resolving DOM hierarchy and plugin ordering. - */ -injection.injectEventPluginOrder(DOMEventPluginOrder); -injection$1.injectComponentTree(ReactDOMComponentTree); - -/** - * Some important event plugins included by default (without having to require - * them). - */ -injection.injectEventPluginsByName({ - SimpleEventPlugin: SimpleEventPlugin, - EnterLeaveEventPlugin: EnterLeaveEventPlugin, - ChangeEventPlugin: ChangeEventPlugin, - SelectEventPlugin: SelectEventPlugin, - BeforeInputEventPlugin: BeforeInputEventPlugin -}); -// Max 31 bit integer. The max integer size in V8 for 32-bit systems. -// Math.pow(2, 30) - 1 -// 0b111111111111111111111111111111 -var MAX_SIGNED_31_BIT_INT = 1073741823; -// TODO: Use an opaque type once ESLint et al support the syntax -var NoWork = 0; -var Sync = 1; -var Never = MAX_SIGNED_31_BIT_INT; -var UNIT_SIZE = 10; -var MAGIC_NUMBER_OFFSET = 2; +var validateEventDispatches = void 0; +{ + validateEventDispatches = function (event) { + var dispatchListeners = event._dispatchListeners; + var dispatchInstances = event._dispatchInstances; -// 1 unit of expiration time represents 10ms. -function msToExpirationTime(ms) { - // Always add an offset so that we don't clash with the magic number for NoWork. - return (ms / UNIT_SIZE | 0) + MAGIC_NUMBER_OFFSET; -} + var listenersIsArr = Array.isArray(dispatchListeners); + var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; -function expirationTimeToMs(expirationTime) { - return (expirationTime - MAGIC_NUMBER_OFFSET) * UNIT_SIZE; -} + var instancesIsArr = Array.isArray(dispatchInstances); + var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; -function ceiling(num, precision) { - return ((num / precision | 0) + 1) * precision; + !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warning(false, 'EventPluginUtils: Invalid `event`.') : void 0; + }; } -function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) { - return ceiling(currentTime + expirationInMs / UNIT_SIZE, bucketSizeMs / UNIT_SIZE); +/** + * Dispatch the event to the listener. + * @param {SyntheticEvent} event SyntheticEvent to handle + * @param {boolean} simulated If the event is simulated (changes exn behavior) + * @param {function} listener Application-level callback + * @param {*} inst Internal component instance + */ +function executeDispatch(event, simulated, listener, inst) { + var type = event.type || 'unknown-event'; + event.currentTarget = getNodeFromInstance(inst); + ReactErrorUtils.invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event); + event.currentTarget = null; } -var NoContext = 0; -var AsyncMode = 1; -var StrictMode = 2; - -var hasBadMapPolyfill = void 0; - -{ - hasBadMapPolyfill = false; - try { - var nonExtensibleObject = Object.preventExtensions({}); - var testMap = new Map([[nonExtensibleObject, null]]); - var testSet = new Set([nonExtensibleObject]); - // This is necessary for Rollup to not consider these unused. - // https://github.com/rollup/rollup/issues/1771 - // TODO: we can remove these if Rollup fixes the bug. - testMap.set(0, 0); - testSet.add(0); - } catch (e) { - // TODO: Consider warning about bad polyfills - hasBadMapPolyfill = true; +/** + * Standard/simple iteration through an event's collected dispatches. + */ +function executeDispatchesInOrder(event, simulated) { + var dispatchListeners = event._dispatchListeners; + var dispatchInstances = event._dispatchInstances; + { + validateEventDispatches(event); + } + if (Array.isArray(dispatchListeners)) { + for (var i = 0; i < dispatchListeners.length; i++) { + if (event.isPropagationStopped()) { + break; + } + // Listeners and Instances are two parallel arrays that are always in sync. + executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]); + } + } else if (dispatchListeners) { + executeDispatch(event, simulated, dispatchListeners, dispatchInstances); } + event._dispatchListeners = null; + event._dispatchInstances = null; } -// A Fiber is work on a Component that needs to be done or was done. There can -// be more than one per component. - - -var debugCounter = void 0; +/** + * @see executeDispatchesInOrderStopAtTrueImpl + */ -{ - debugCounter = 1; -} -function FiberNode(tag, pendingProps, key, mode) { - // Instance - this.tag = tag; - this.key = key; - this.type = null; - this.stateNode = null; +/** + * Execution of a "direct" dispatch - there must be at most one dispatch + * accumulated on the event or it is considered an error. It doesn't really make + * sense for an event with multiple dispatches (bubbled) to keep track of the + * return values at each dispatch execution, but it does tend to make sense when + * dealing with "direct" dispatches. + * + * @return {*} The return value of executing the single dispatch. + */ - // Fiber - this['return'] = null; - this.child = null; - this.sibling = null; - this.index = 0; - this.ref = null; +/** + * @param {SyntheticEvent} event + * @return {boolean} True iff number of dispatches accumulated is greater than 0. + */ - this.pendingProps = pendingProps; - this.memoizedProps = null; - this.updateQueue = null; - this.memoizedState = null; +/** + * Accumulates items that must not be null or undefined into the first one. This + * is used to conserve memory by avoiding array allocations, and thus sacrifices + * API cleanness. Since `current` can be null before being passed in and not + * null after this function, make sure to assign it back to `current`: + * + * `a = accumulateInto(a, b);` + * + * This API should be sparingly used. Try `accumulate` for something cleaner. + * + * @return {*|array<*>} An accumulation of items. + */ - this.mode = mode; +function accumulateInto(current, next) { + !(next != null) ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : void 0; - // Effects - this.effectTag = NoEffect; - this.nextEffect = null; + if (current == null) { + return next; + } - this.firstEffect = null; - this.lastEffect = null; + // Both are not empty. Warning: Never call x.concat(y) when you are not + // certain that x is an Array (x could be a string with concat method). + if (Array.isArray(current)) { + if (Array.isArray(next)) { + current.push.apply(current, next); + return current; + } + current.push(next); + return current; + } - this.expirationTime = NoWork; + if (Array.isArray(next)) { + // A bit too dangerous to mutate `next`. + return [current].concat(next); + } - this.alternate = null; + return [current, next]; +} - { - this._debugID = debugCounter++; - this._debugSource = null; - this._debugOwner = null; - this._debugIsCurrentlyTiming = false; - if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') { - Object.preventExtensions(this); - } +/** + * @param {array} arr an "accumulation" of items which is either an Array or + * a single item. Useful when paired with the `accumulate` module. This is a + * simple utility that allows us to reason about a collection of items, but + * handling the case when there is exactly one item (and we do not need to + * allocate an array). + * @param {function} cb Callback invoked with each element or a collection. + * @param {?} [scope] Scope used as `this` in a callback. + */ +function forEachAccumulated(arr, cb, scope) { + if (Array.isArray(arr)) { + arr.forEach(cb, scope); + } else if (arr) { + cb.call(scope, arr); } } -// This is a constructor function, rather than a POJO constructor, still -// please ensure we do the following: -// 1) Nobody should add any instance methods on this. Instance methods can be -// more difficult to predict when they get optimized and they are almost -// never inlined properly in static compilers. -// 2) Nobody should rely on `instanceof Fiber` for type testing. We should -// always know when it is a fiber. -// 3) We might want to experiment with using numeric keys since they are easier -// to optimize in a non-JIT environment. -// 4) We can easily go from a constructor to a createFiber object literal if that -// is faster. -// 5) It should be easy to port this to a C struct and keep a C implementation -// compatible. -var createFiber = function (tag, pendingProps, key, mode) { - // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors - return new FiberNode(tag, pendingProps, key, mode); -}; - -function shouldConstruct(Component) { - return !!(Component.prototype && Component.prototype.isReactComponent); -} +/** + * Internal queue of events that have accumulated their dispatches and are + * waiting to have their dispatches executed. + */ +var eventQueue = null; -// This is used to create an alternate fiber to do work on. -function createWorkInProgress(current, pendingProps, expirationTime) { - var workInProgress = current.alternate; - if (workInProgress === null) { - // We use a double buffering pooling technique because we know that we'll - // only ever need at most two versions of a tree. We pool the "other" unused - // node that we're free to reuse. This is lazily created to avoid allocating - // extra objects for things that are never updated. It also allow us to - // reclaim the extra memory if needed. - workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode); - workInProgress.type = current.type; - workInProgress.stateNode = current.stateNode; +/** + * Dispatches an event and releases it back into the pool, unless persistent. + * + * @param {?object} event Synthetic event to be dispatched. + * @param {boolean} simulated If the event is simulated (changes exn behavior) + * @private + */ +var executeDispatchesAndRelease = function (event, simulated) { + if (event) { + executeDispatchesInOrder(event, simulated); - { - // DEV-only fields - workInProgress._debugID = current._debugID; - workInProgress._debugSource = current._debugSource; - workInProgress._debugOwner = current._debugOwner; + if (!event.isPersistent()) { + event.constructor.release(event); } + } +}; +var executeDispatchesAndReleaseSimulated = function (e) { + return executeDispatchesAndRelease(e, true); +}; +var executeDispatchesAndReleaseTopLevel = function (e) { + return executeDispatchesAndRelease(e, false); +}; - workInProgress.alternate = current; - current.alternate = workInProgress; - } else { - workInProgress.pendingProps = pendingProps; - - // We already have an alternate. - // Reset the effect tag. - workInProgress.effectTag = NoEffect; +function isInteractive(tag) { + return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; +} - // The effect list is no longer valid. - workInProgress.nextEffect = null; - workInProgress.firstEffect = null; - workInProgress.lastEffect = null; +function shouldPreventMouseEvent(name, type, props) { + switch (name) { + case 'onClick': + case 'onClickCapture': + case 'onDoubleClick': + case 'onDoubleClickCapture': + case 'onMouseDown': + case 'onMouseDownCapture': + case 'onMouseMove': + case 'onMouseMoveCapture': + case 'onMouseUp': + case 'onMouseUpCapture': + return !!(props.disabled && isInteractive(type)); + default: + return false; } +} - workInProgress.expirationTime = expirationTime; - - workInProgress.child = current.child; - workInProgress.memoizedProps = current.memoizedProps; - workInProgress.memoizedState = current.memoizedState; - workInProgress.updateQueue = current.updateQueue; +/** + * This is a unified interface for event plugins to be installed and configured. + * + * Event plugins can implement the following properties: + * + * `extractEvents` {function(string, DOMEventTarget, string, object): *} + * Required. When a top-level event is fired, this method is expected to + * extract synthetic events that will in turn be queued and dispatched. + * + * `eventTypes` {object} + * Optional, plugins that fire events must publish a mapping of registration + * names that are used to register listeners. Values of this mapping must + * be objects that contain `registrationName` or `phasedRegistrationNames`. + * + * `executeDispatch` {function(object, function, string)} + * Optional, allows plugins to override how an event gets dispatched. By + * default, the listener is simply invoked. + * + * Each plugin that is injected into `EventsPluginHub` is immediately operable. + * + * @public + */ - // These will be overridden during the parent's reconciliation - workInProgress.sibling = current.sibling; - workInProgress.index = current.index; - workInProgress.ref = current.ref; +/** + * Methods for injecting dependencies. + */ +var injection = { + /** + * @param {array} InjectedEventPluginOrder + * @public + */ + injectEventPluginOrder: injectEventPluginOrder, - return workInProgress; -} + /** + * @param {object} injectedNamesToPlugins Map from names to plugin modules. + */ + injectEventPluginsByName: injectEventPluginsByName +}; -function createHostRootFiber(isAsync) { - var mode = isAsync ? AsyncMode | StrictMode : NoContext; - return createFiber(HostRoot, null, null, mode); -} +/** + * @param {object} inst The instance, which is the source of events. + * @param {string} registrationName Name of listener (e.g. `onClick`). + * @return {?function} The stored callback. + */ +function getListener(inst, registrationName) { + var listener = void 0; -function createFiberFromElement(element, mode, expirationTime) { - var owner = null; - { - owner = element._owner; + // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not + // live here; needs to be moved to a better place soon + var stateNode = inst.stateNode; + if (!stateNode) { + // Work in progress (ex: onload events in incremental mode). + return null; + } + var props = getFiberCurrentPropsFromNode(stateNode); + if (!props) { + // Work in progress. + return null; + } + listener = props[registrationName]; + if (shouldPreventMouseEvent(registrationName, inst.type, props)) { + return null; } + !(!listener || typeof listener === 'function') ? invariant(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener) : void 0; + return listener; +} - var fiber = void 0; - var type = element.type; - var key = element.key; - var pendingProps = element.props; - - var fiberTag = void 0; - if (typeof type === 'function') { - fiberTag = shouldConstruct(type) ? ClassComponent : IndeterminateComponent; - } else if (typeof type === 'string') { - fiberTag = HostComponent; - } else { - switch (type) { - case REACT_FRAGMENT_TYPE: - return createFiberFromFragment(pendingProps.children, mode, expirationTime, key); - case REACT_ASYNC_MODE_TYPE: - fiberTag = Mode; - mode |= AsyncMode | StrictMode; - break; - case REACT_STRICT_MODE_TYPE: - fiberTag = Mode; - mode |= StrictMode; - break; - case REACT_CALL_TYPE: - fiberTag = CallComponent; - break; - case REACT_RETURN_TYPE: - fiberTag = ReturnComponent; - break; - default: - { - if (typeof type === 'object' && type !== null) { - switch (type.$$typeof) { - case REACT_PROVIDER_TYPE: - fiberTag = ContextProvider; - break; - case REACT_CONTEXT_TYPE: - // This is a consumer - fiberTag = ContextConsumer; - break; - case REACT_FORWARD_REF_TYPE: - fiberTag = ForwardRef; - break; - default: - if (typeof type.tag === 'number') { - // Currently assumed to be a continuation and therefore is a - // fiber already. - // TODO: The yield system is currently broken for updates in - // some cases. The reified yield stores a fiber, but we don't - // know which fiber that is; the current or a workInProgress? - // When the continuation gets rendered here we don't know if we - // can reuse that fiber or if we need to clone it. There is - // probably a clever way to restructure this. - fiber = type; - fiber.pendingProps = pendingProps; - fiber.expirationTime = expirationTime; - return fiber; - } else { - throwOnInvalidElementType(type, owner); - } - break; - } - } else { - throwOnInvalidElementType(type, owner); - } - } +/** + * Allows registered plugins an opportunity to extract events from top-level + * native browser events. + * + * @return {*} An accumulation of synthetic events. + * @internal + */ +function extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var events = null; + for (var i = 0; i < plugins.length; i++) { + // Not every plugin in the ordering may be loaded at runtime. + var possiblePlugin = plugins[i]; + if (possiblePlugin) { + var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); + if (extractedEvents) { + events = accumulateInto(events, extractedEvents); + } } } + return events; +} - fiber = createFiber(fiberTag, pendingProps, key, mode); - fiber.type = type; - fiber.expirationTime = expirationTime; - - { - fiber._debugSource = element._source; - fiber._debugOwner = element._owner; +function runEventsInBatch(events, simulated) { + if (events !== null) { + eventQueue = accumulateInto(eventQueue, events); } - return fiber; -} + // Set `eventQueue` to null before processing it so that we can tell if more + // events get enqueued while processing. + var processingEventQueue = eventQueue; + eventQueue = null; -function throwOnInvalidElementType(type, owner) { - var info = ''; - { - if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; - } - var ownerName = owner ? getComponentName(owner) : null; - if (ownerName) { - info += '\n\nCheck the render method of `' + ownerName + '`.'; - } + if (!processingEventQueue) { + return; } - invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', type == null ? type : typeof type, info); -} -function createFiberFromFragment(elements, mode, expirationTime, key) { - var fiber = createFiber(Fragment, elements, key, mode); - fiber.expirationTime = expirationTime; - return fiber; + if (simulated) { + forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated); + } else { + forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); + } + !!eventQueue ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : void 0; + // This would be a good time to rethrow if any of the event handlers threw. + ReactErrorUtils.rethrowCaughtError(); } -function createFiberFromText(content, mode, expirationTime) { - var fiber = createFiber(HostText, content, null, mode); - fiber.expirationTime = expirationTime; - return fiber; +function runExtractedEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var events = extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); + runEventsInBatch(events, false); } -function createFiberFromHostInstanceForDeletion() { - var fiber = createFiber(HostComponent, null, null, NoContext); - fiber.type = 'DELETED'; - return fiber; -} +var EventPluginHub = Object.freeze({ + injection: injection, + getListener: getListener, + runEventsInBatch: runEventsInBatch, + runExtractedEventsInBatch: runExtractedEventsInBatch +}); -function createFiberFromPortal(portal, mode, expirationTime) { - var pendingProps = portal.children !== null ? portal.children : []; - var fiber = createFiber(HostPortal, pendingProps, portal.key, mode); - fiber.expirationTime = expirationTime; - fiber.stateNode = { - containerInfo: portal.containerInfo, - pendingChildren: null, // Used by persistent updates - implementation: portal.implementation - }; - return fiber; +var IndeterminateComponent = 0; // Before we know whether it is functional or class +var FunctionalComponent = 1; +var ClassComponent = 2; +var HostRoot = 3; // Root of a host tree. Could be nested inside another node. +var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. +var HostComponent = 5; +var HostText = 6; +var CallComponent = 7; +var CallHandlerPhase = 8; +var ReturnComponent = 9; +var Fragment = 10; +var Mode = 11; +var ContextConsumer = 12; +var ContextProvider = 13; +var ForwardRef = 14; + +var randomKey = Math.random().toString(36).slice(2); +var internalInstanceKey = '__reactInternalInstance$' + randomKey; +var internalEventHandlersKey = '__reactEventHandlers$' + randomKey; + +function precacheFiberNode$1(hostInst, node) { + node[internalInstanceKey] = hostInst; } -// Used for stashing WIP properties to replay failed work in DEV. -function assignFiberPropertiesInDEV(target, source) { - if (target === null) { - // This Fiber's initial properties will always be overwritten. - // We only use a Fiber to ensure the same hidden class so DEV isn't slow. - target = createFiber(IndeterminateComponent, null, null, NoContext); +/** + * Given a DOM node, return the closest ReactDOMComponent or + * ReactDOMTextComponent instance ancestor. + */ +function getClosestInstanceFromNode(node) { + if (node[internalInstanceKey]) { + return node[internalInstanceKey]; } - // This is intentionally written as a list of all properties. - // We tried to use Object.assign() instead but this is called in - // the hottest path, and Object.assign() was too slow: - // https://github.com/facebook/react/issues/12502 - // This code is DEV-only so size is not a concern. + while (!node[internalInstanceKey]) { + if (node.parentNode) { + node = node.parentNode; + } else { + // Top of the tree. This node must not be part of a React tree (or is + // unmounted, potentially). + return null; + } + } - target.tag = source.tag; - target.key = source.key; - target.type = source.type; - target.stateNode = source.stateNode; - target['return'] = source['return']; - target.child = source.child; - target.sibling = source.sibling; - target.index = source.index; - target.ref = source.ref; - target.pendingProps = source.pendingProps; - target.memoizedProps = source.memoizedProps; - target.updateQueue = source.updateQueue; - target.memoizedState = source.memoizedState; - target.mode = source.mode; - target.effectTag = source.effectTag; - target.nextEffect = source.nextEffect; - target.firstEffect = source.firstEffect; - target.lastEffect = source.lastEffect; - target.expirationTime = source.expirationTime; - target.alternate = source.alternate; - target._debugID = source._debugID; - target._debugSource = source._debugSource; - target._debugOwner = source._debugOwner; - target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming; - return target; + var inst = node[internalInstanceKey]; + if (inst.tag === HostComponent || inst.tag === HostText) { + // In Fiber, this will always be the deepest root. + return inst; + } + + return null; } -// TODO: This should be lifted into the renderer. +/** + * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent + * instance, or null if the node was not rendered by this React. + */ +function getInstanceFromNode$1(node) { + var inst = node[internalInstanceKey]; + if (inst) { + if (inst.tag === HostComponent || inst.tag === HostText) { + return inst; + } else { + return null; + } + } + return null; +} + +/** + * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding + * DOM node. + */ +function getNodeFromInstance$1(inst) { + if (inst.tag === HostComponent || inst.tag === HostText) { + // In Fiber this, is just the state node right now. We assume it will be + // a host component or host text. + return inst.stateNode; + } + // Without this first invariant, passing a non-DOM-component triggers the next + // invariant for a missing parent, which is super confusing. + invariant(false, 'getNodeFromInstance: Invalid argument.'); +} -function createFiberRoot(containerInfo, isAsync, hydrate) { - // Cyclic construction. This cheats the type system right now because - // stateNode is any. - var uninitializedFiber = createHostRootFiber(isAsync); - var root = { - current: uninitializedFiber, - containerInfo: containerInfo, - pendingChildren: null, - pendingCommitExpirationTime: NoWork, - finishedWork: null, - context: null, - pendingContext: null, - hydrate: hydrate, - remainingExpirationTime: NoWork, - firstBatch: null, - nextScheduledRoot: null - }; - uninitializedFiber.stateNode = root; - return root; +function getFiberCurrentPropsFromNode$1(node) { + return node[internalEventHandlersKey] || null; } -var onCommitFiberRoot = null; -var onCommitFiberUnmount = null; -var hasLoggedError = false; +function updateFiberProps$1(node, props) { + node[internalEventHandlersKey] = props; +} -function catchErrors(fn) { - return function (arg) { - try { - return fn(arg); - } catch (err) { - if (true && !hasLoggedError) { - hasLoggedError = true; - warning(false, 'React DevTools encountered an error: %s', err); - } - } - }; +var ReactDOMComponentTree = Object.freeze({ + precacheFiberNode: precacheFiberNode$1, + getClosestInstanceFromNode: getClosestInstanceFromNode, + getInstanceFromNode: getInstanceFromNode$1, + getNodeFromInstance: getNodeFromInstance$1, + getFiberCurrentPropsFromNode: getFiberCurrentPropsFromNode$1, + updateFiberProps: updateFiberProps$1 +}); + +function getParent(inst) { + do { + inst = inst['return']; + // TODO: If this is a HostRoot we might want to bail out. + // That is depending on if we want nested subtrees (layers) to bubble + // events to their parent. We could also go through parentNode on the + // host node but that wouldn't work for React Native and doesn't let us + // do the portal feature. + } while (inst && inst.tag !== HostComponent); + if (inst) { + return inst; + } + return null; } -function injectInternals(internals) { - if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { - // No DevTools - return false; +/** + * Return the lowest common ancestor of A and B, or null if they are in + * different trees. + */ +function getLowestCommonAncestor(instA, instB) { + var depthA = 0; + for (var tempA = instA; tempA; tempA = getParent(tempA)) { + depthA++; } - var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; - if (hook.isDisabled) { - // This isn't a real property on the hook, but it can be set to opt out - // of DevTools integration and associated warnings and logs. - // https://github.com/facebook/react/issues/3877 - return true; + var depthB = 0; + for (var tempB = instB; tempB; tempB = getParent(tempB)) { + depthB++; } - if (!hook.supportsFiber) { - { - warning(false, 'The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://fb.me/react-devtools'); - } - // DevTools exists, even though it doesn't support Fiber. - return true; + + // If A is deeper, crawl up. + while (depthA - depthB > 0) { + instA = getParent(instA); + depthA--; } - try { - var rendererID = hook.inject(internals); - // We have successfully injected, so now it is safe to set up hooks. - onCommitFiberRoot = catchErrors(function (root) { - return hook.onCommitFiberRoot(rendererID, root); - }); - onCommitFiberUnmount = catchErrors(function (fiber) { - return hook.onCommitFiberUnmount(rendererID, fiber); - }); - } catch (err) { - // Catch all errors because it is unsafe to throw during initialization. - { - warning(false, 'React DevTools encountered an error: %s.', err); + + // If B is deeper, crawl up. + while (depthB - depthA > 0) { + instB = getParent(instB); + depthB--; + } + + // Walk in lockstep until we find a match. + var depth = depthA; + while (depth--) { + if (instA === instB || instA === instB.alternate) { + return instA; } + instA = getParent(instA); + instB = getParent(instB); } - // DevTools exists - return true; + return null; } -function onCommitRoot(root) { - if (typeof onCommitFiberRoot === 'function') { - onCommitFiberRoot(root); - } +/** + * Return if A is an ancestor of B. + */ + + +/** + * Return the parent instance of the passed-in instance. + */ +function getParentInstance(inst) { + return getParent(inst); } -function onCommitUnmount(fiber) { - if (typeof onCommitFiberUnmount === 'function') { - onCommitFiberUnmount(fiber); +/** + * Simulates the traversal of a two-phase, capture/bubble event dispatch. + */ +function traverseTwoPhase(inst, fn, arg) { + var path = []; + while (inst) { + path.push(inst); + inst = getParent(inst); + } + var i = void 0; + for (i = path.length; i-- > 0;) { + fn(path[i], 'captured', arg); + } + for (i = 0; i < path.length; i++) { + fn(path[i], 'bubbled', arg); } } /** - * Forked from fbjs/warning: - * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js + * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that + * should would receive a `mouseEnter` or `mouseLeave` event. * - * Only change is we use console.warn instead of console.error, - * and do nothing when 'console' is not supported. - * This really simplifies the code. - * --- - * Similar to invariant but only logs a warning if the condition is not met. - * This can be used to log issues in development environments in critical - * paths. Removing the logging code for production environments will keep the - * same logic and follow the same code paths. + * Does not invoke the callback on the nearest common ancestor because nothing + * "entered" or "left" that element. */ - -var lowPriorityWarning = function () {}; - -{ - var printWarning = function (format) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; +function traverseEnterLeave(from, to, fn, argFrom, argTo) { + var common = from && to ? getLowestCommonAncestor(from, to) : null; + var pathFrom = []; + while (true) { + if (!from) { + break; } - - var argIndex = 0; - var message = 'Warning: ' + format.replace(/%s/g, function () { - return args[argIndex++]; - }); - if (typeof console !== 'undefined') { - console.warn(message); + if (from === common) { + break; } - try { - // --- Welcome to debugging React --- - // This error was thrown as a convenience so that you can use this stack - // to find the callsite that caused this warning to fire. - throw new Error(message); - } catch (x) {} - }; - - lowPriorityWarning = function (condition, format) { - if (format === undefined) { - throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); + var alternate = from.alternate; + if (alternate !== null && alternate === common) { + break; } - if (!condition) { - for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { - args[_key2 - 2] = arguments[_key2]; - } - - printWarning.apply(undefined, [format].concat(args)); + pathFrom.push(from); + from = getParent(from); + } + var pathTo = []; + while (true) { + if (!to) { + break; } - }; + if (to === common) { + break; + } + var _alternate = to.alternate; + if (_alternate !== null && _alternate === common) { + break; + } + pathTo.push(to); + to = getParent(to); + } + for (var i = 0; i < pathFrom.length; i++) { + fn(pathFrom[i], 'bubbled', argFrom); + } + for (var _i = pathTo.length; _i-- > 0;) { + fn(pathTo[_i], 'captured', argTo); + } } -var lowPriorityWarning$1 = lowPriorityWarning; +/** + * Some event types have a notion of different registration names for different + * "phases" of propagation. This finds listeners by a given phase. + */ +function listenerAtPhase(inst, event, propagationPhase) { + var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; + return getListener(inst, registrationName); +} -var ReactStrictModeWarnings = { - discardPendingWarnings: function () {}, - flushPendingDeprecationWarnings: function () {}, - flushPendingUnsafeLifecycleWarnings: function () {}, - recordDeprecationWarnings: function (fiber, instance) {}, - recordUnsafeLifecycleWarnings: function (fiber, instance) {} -}; - -{ - var LIFECYCLE_SUGGESTIONS = { - UNSAFE_componentWillMount: 'componentDidMount', - UNSAFE_componentWillReceiveProps: 'static getDerivedStateFromProps', - UNSAFE_componentWillUpdate: 'componentDidUpdate' - }; +/** + * A small set of propagation patterns, each of which will accept a small amount + * of information, and generate a set of "dispatch ready event objects" - which + * are sets of events that have already been annotated with a set of dispatched + * listener functions/ids. The API is designed this way to discourage these + * propagation strategies from actually executing the dispatches, since we + * always want to collect the entire set of dispatches before executing even a + * single one. + */ - var pendingComponentWillMountWarnings = []; - var pendingComponentWillReceivePropsWarnings = []; - var pendingComponentWillUpdateWarnings = []; - var pendingUnsafeLifecycleWarnings = new Map(); +/** + * Tags a `SyntheticEvent` with dispatched listeners. Creating this function + * here, allows us to not have to bind or create functions for each event. + * Mutating the event's members allows us to not have to create a wrapping + * "dispatch" object that pairs the event with the listener. + */ +function accumulateDirectionalDispatches(inst, phase, event) { + { + !inst ? warning(false, 'Dispatching inst must not be null') : void 0; + } + var listener = listenerAtPhase(inst, event, phase); + if (listener) { + event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); + event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); + } +} - // Tracks components we have already warned about. - var didWarnAboutDeprecatedLifecycles = new Set(); - var didWarnAboutUnsafeLifecycles = new Set(); +/** + * Collect dispatches (must be entirely collected before dispatching - see unit + * tests). Lazily allocate the array to conserve memory. We must loop through + * each event and perform the traversal for each one. We cannot perform a + * single traversal for the entire collection of events because each event may + * have a different target. + */ +function accumulateTwoPhaseDispatchesSingle(event) { + if (event && event.dispatchConfig.phasedRegistrationNames) { + traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); + } +} - ReactStrictModeWarnings.discardPendingWarnings = function () { - pendingComponentWillMountWarnings = []; - pendingComponentWillReceivePropsWarnings = []; - pendingComponentWillUpdateWarnings = []; - pendingUnsafeLifecycleWarnings = new Map(); - }; +/** + * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. + */ +function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { + if (event && event.dispatchConfig.phasedRegistrationNames) { + var targetInst = event._targetInst; + var parentInst = targetInst ? getParentInstance(targetInst) : null; + traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event); + } +} - ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () { - pendingUnsafeLifecycleWarnings.forEach(function (lifecycleWarningsMap, strictRoot) { - var lifecyclesWarningMesages = []; +/** + * Accumulates without regard to direction, does not look for phased + * registration names. Same as `accumulateDirectDispatchesSingle` but without + * requiring that the `dispatchMarker` be the same as the dispatched ID. + */ +function accumulateDispatches(inst, ignoredDirection, event) { + if (inst && event && event.dispatchConfig.registrationName) { + var registrationName = event.dispatchConfig.registrationName; + var listener = getListener(inst, registrationName); + if (listener) { + event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); + event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); + } + } +} - Object.keys(lifecycleWarningsMap).forEach(function (lifecycle) { - var lifecycleWarnings = lifecycleWarningsMap[lifecycle]; - if (lifecycleWarnings.length > 0) { - var componentNames = new Set(); - lifecycleWarnings.forEach(function (fiber) { - componentNames.add(getComponentName(fiber) || 'Component'); - didWarnAboutUnsafeLifecycles.add(fiber.type); - }); +/** + * Accumulates dispatches on an `SyntheticEvent`, but only for the + * `dispatchMarker`. + * @param {SyntheticEvent} event + */ +function accumulateDirectDispatchesSingle(event) { + if (event && event.dispatchConfig.registrationName) { + accumulateDispatches(event._targetInst, null, event); + } +} - var formatted = lifecycle.replace('UNSAFE_', ''); - var suggestion = LIFECYCLE_SUGGESTIONS[lifecycle]; - var sortedComponentNames = Array.from(componentNames).sort().join(', '); +function accumulateTwoPhaseDispatches(events) { + forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); +} - lifecyclesWarningMesages.push(formatted + ': Please update the following components to use ' + (suggestion + ' instead: ' + sortedComponentNames)); - } - }); +function accumulateTwoPhaseDispatchesSkipTarget(events) { + forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); +} - if (lifecyclesWarningMesages.length > 0) { - var strictRootComponentStack = getStackAddendumByWorkInProgressFiber(strictRoot); +function accumulateEnterLeaveDispatches(leave, enter, from, to) { + traverseEnterLeave(from, to, accumulateDispatches, leave, enter); +} - warning(false, 'Unsafe lifecycle methods were found within a strict-mode tree:%s' + '\n\n%s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-strict-mode-warnings', strictRootComponentStack, lifecyclesWarningMesages.join('\n\n')); - } - }); +function accumulateDirectDispatches(events) { + forEachAccumulated(events, accumulateDirectDispatchesSingle); +} - pendingUnsafeLifecycleWarnings = new Map(); - }; +var EventPropagators = Object.freeze({ + accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches, + accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget, + accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches, + accumulateDirectDispatches: accumulateDirectDispatches +}); - var getStrictRoot = function (fiber) { - var maybeStrictRoot = null; +var contentKey = null; - while (fiber !== null) { - if (fiber.mode & StrictMode) { - maybeStrictRoot = fiber; - } +/** + * Gets the key used to access text content on a DOM node. + * + * @return {?string} Key used to access text content. + * @internal + */ +function getTextContentAccessor() { + if (!contentKey && ExecutionEnvironment.canUseDOM) { + // Prefer textContent to innerText because many browsers support both but + // SVG elements don't support innerText even when
does. + contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText'; + } + return contentKey; +} - fiber = fiber['return']; - } +/** + * This helper object stores information about text content of a target node, + * allowing comparison of content before and after a given event. + * + * Identify the node where selection currently begins, then observe + * both its text content and its current position in the DOM. Since the + * browser may natively replace the target node during composition, we can + * use its position to find its replacement. + * + * + */ +var compositionState = { + _root: null, + _startText: null, + _fallbackText: null +}; - return maybeStrictRoot; - }; +function initialize(nativeEventTarget) { + compositionState._root = nativeEventTarget; + compositionState._startText = getText(); + return true; +} - ReactStrictModeWarnings.flushPendingDeprecationWarnings = function () { - if (pendingComponentWillMountWarnings.length > 0) { - var uniqueNames = new Set(); - pendingComponentWillMountWarnings.forEach(function (fiber) { - uniqueNames.add(getComponentName(fiber) || 'Component'); - didWarnAboutDeprecatedLifecycles.add(fiber.type); - }); +function reset() { + compositionState._root = null; + compositionState._startText = null; + compositionState._fallbackText = null; +} - var sortedNames = Array.from(uniqueNames).sort().join(', '); +function getData() { + if (compositionState._fallbackText) { + return compositionState._fallbackText; + } - lowPriorityWarning$1(false, 'componentWillMount is deprecated and will be removed in the next major version. ' + 'Use componentDidMount instead. As a temporary workaround, ' + 'you can rename to UNSAFE_componentWillMount.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', sortedNames); + var start = void 0; + var startValue = compositionState._startText; + var startLength = startValue.length; + var end = void 0; + var endValue = getText(); + var endLength = endValue.length; - pendingComponentWillMountWarnings = []; + for (start = 0; start < startLength; start++) { + if (startValue[start] !== endValue[start]) { + break; } + } - if (pendingComponentWillReceivePropsWarnings.length > 0) { - var _uniqueNames = new Set(); - pendingComponentWillReceivePropsWarnings.forEach(function (fiber) { - _uniqueNames.add(getComponentName(fiber) || 'Component'); - didWarnAboutDeprecatedLifecycles.add(fiber.type); - }); + var minEnd = startLength - start; + for (end = 1; end <= minEnd; end++) { + if (startValue[startLength - end] !== endValue[endLength - end]) { + break; + } + } - var _sortedNames = Array.from(_uniqueNames).sort().join(', '); + var sliceTail = end > 1 ? 1 - end : undefined; + compositionState._fallbackText = endValue.slice(start, sliceTail); + return compositionState._fallbackText; +} - lowPriorityWarning$1(false, 'componentWillReceiveProps is deprecated and will be removed in the next major version. ' + 'Use static getDerivedStateFromProps instead.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', _sortedNames); +function getText() { + if ('value' in compositionState._root) { + return compositionState._root.value; + } + return compositionState._root[getTextContentAccessor()]; +} - pendingComponentWillReceivePropsWarnings = []; - } +/* eslint valid-typeof: 0 */ - if (pendingComponentWillUpdateWarnings.length > 0) { - var _uniqueNames2 = new Set(); - pendingComponentWillUpdateWarnings.forEach(function (fiber) { - _uniqueNames2.add(getComponentName(fiber) || 'Component'); - didWarnAboutDeprecatedLifecycles.add(fiber.type); - }); +var didWarnForAddedNewProperty = false; +var EVENT_POOL_SIZE = 10; - var _sortedNames2 = Array.from(_uniqueNames2).sort().join(', '); +var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances']; - lowPriorityWarning$1(false, 'componentWillUpdate is deprecated and will be removed in the next major version. ' + 'Use componentDidUpdate instead. As a temporary workaround, ' + 'you can rename to UNSAFE_componentWillUpdate.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', _sortedNames2); +/** + * @interface Event + * @see http://www.w3.org/TR/DOM-Level-3-Events/ + */ +var EventInterface = { + type: null, + target: null, + // currentTarget is set when dispatching; no use in copying it here + currentTarget: emptyFunction.thatReturnsNull, + eventPhase: null, + bubbles: null, + cancelable: null, + timeStamp: function (event) { + return event.timeStamp || Date.now(); + }, + defaultPrevented: null, + isTrusted: null +}; - pendingComponentWillUpdateWarnings = []; - } - }; +/** + * Synthetic events are dispatched by event plugins, typically in response to a + * top-level event delegation handler. + * + * These systems should generally use pooling to reduce the frequency of garbage + * collection. The system should check `isPersistent` to determine whether the + * event should be released into the pool after being dispatched. Users that + * need a persisted event should invoke `persist`. + * + * Synthetic events (and subclasses) implement the DOM Level 3 Events API by + * normalizing browser quirks. Subclasses do not necessarily have to implement a + * DOM interface; custom application-specific events can also subclass this. + * + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {*} targetInst Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @param {DOMEventTarget} nativeEventTarget Target node. + */ +function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) { + { + // these have a getter/setter for warnings + delete this.nativeEvent; + delete this.preventDefault; + delete this.stopPropagation; + } - ReactStrictModeWarnings.recordDeprecationWarnings = function (fiber, instance) { - // Dedup strategy: Warn once per component. - if (didWarnAboutDeprecatedLifecycles.has(fiber.type)) { - return; - } + this.dispatchConfig = dispatchConfig; + this._targetInst = targetInst; + this.nativeEvent = nativeEvent; - // Don't warn about react-lifecycles-compat polyfilled components. - if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) { - pendingComponentWillMountWarnings.push(fiber); + var Interface = this.constructor.Interface; + for (var propName in Interface) { + if (!Interface.hasOwnProperty(propName)) { + continue; } - if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) { - pendingComponentWillReceivePropsWarnings.push(fiber); + { + delete this[propName]; // this has a getter/setter for warnings } - if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) { - pendingComponentWillUpdateWarnings.push(fiber); + var normalize = Interface[propName]; + if (normalize) { + this[propName] = normalize(nativeEvent); + } else { + if (propName === 'target') { + this.target = nativeEventTarget; + } else { + this[propName] = nativeEvent[propName]; + } } - }; + } - ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) { - var strictRoot = getStrictRoot(fiber); + var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; + if (defaultPrevented) { + this.isDefaultPrevented = emptyFunction.thatReturnsTrue; + } else { + this.isDefaultPrevented = emptyFunction.thatReturnsFalse; + } + this.isPropagationStopped = emptyFunction.thatReturnsFalse; + return this; +} - // Dedup strategy: Warn once per component. - // This is difficult to track any other way since component names - // are often vague and are likely to collide between 3rd party libraries. - // An expand property is probably okay to use here since it's DEV-only, - // and will only be set in the event of serious warnings. - if (didWarnAboutUnsafeLifecycles.has(fiber.type)) { +_assign(SyntheticEvent.prototype, { + preventDefault: function () { + this.defaultPrevented = true; + var event = this.nativeEvent; + if (!event) { return; } - // Don't warn about react-lifecycles-compat polyfilled components. - // Note that it is sufficient to check for the presence of a - // single lifecycle, componentWillMount, with the polyfill flag. - if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning === true) { - return; + if (event.preventDefault) { + event.preventDefault(); + } else if (typeof event.returnValue !== 'unknown') { + event.returnValue = false; } + this.isDefaultPrevented = emptyFunction.thatReturnsTrue; + }, - var warningsForRoot = void 0; - if (!pendingUnsafeLifecycleWarnings.has(strictRoot)) { - warningsForRoot = { - UNSAFE_componentWillMount: [], - UNSAFE_componentWillReceiveProps: [], - UNSAFE_componentWillUpdate: [] - }; + stopPropagation: function () { + var event = this.nativeEvent; + if (!event) { + return; + } - pendingUnsafeLifecycleWarnings.set(strictRoot, warningsForRoot); - } else { - warningsForRoot = pendingUnsafeLifecycleWarnings.get(strictRoot); + if (event.stopPropagation) { + event.stopPropagation(); + } else if (typeof event.cancelBubble !== 'unknown') { + // The ChangeEventPlugin registers a "propertychange" event for + // IE. This event does not support bubbling or cancelling, and + // any references to cancelBubble throw "Member not found". A + // typeof check of "unknown" circumvents this issue (and is also + // IE specific). + event.cancelBubble = true; } - var unsafeLifecycles = []; - if (typeof instance.componentWillMount === 'function' || typeof instance.UNSAFE_componentWillMount === 'function') { - unsafeLifecycles.push('UNSAFE_componentWillMount'); + this.isPropagationStopped = emptyFunction.thatReturnsTrue; + }, + + /** + * We release all dispatched `SyntheticEvent`s after each event loop, adding + * them back into the pool. This allows a way to hold onto a reference that + * won't be added back into the pool. + */ + persist: function () { + this.isPersistent = emptyFunction.thatReturnsTrue; + }, + + /** + * Checks if this event should be released back into the pool. + * + * @return {boolean} True if this should not be released, false otherwise. + */ + isPersistent: emptyFunction.thatReturnsFalse, + + /** + * `PooledClass` looks for `destructor` on each instance it releases. + */ + destructor: function () { + var Interface = this.constructor.Interface; + for (var propName in Interface) { + { + Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName])); + } } - if (typeof instance.componentWillReceiveProps === 'function' || typeof instance.UNSAFE_componentWillReceiveProps === 'function') { - unsafeLifecycles.push('UNSAFE_componentWillReceiveProps'); + for (var i = 0; i < shouldBeReleasedProperties.length; i++) { + this[shouldBeReleasedProperties[i]] = null; } - if (typeof instance.componentWillUpdate === 'function' || typeof instance.UNSAFE_componentWillUpdate === 'function') { - unsafeLifecycles.push('UNSAFE_componentWillUpdate'); + { + Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null)); + Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction)); + Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction)); } + } +}); - if (unsafeLifecycles.length > 0) { - unsafeLifecycles.forEach(function (lifecycle) { - warningsForRoot[lifecycle].push(fiber); - }); - } - }; -} +SyntheticEvent.Interface = EventInterface; -// Exports ReactDOM.createRoot -var enableUserTimingAPI = true; +/** + * Helper to reduce boilerplate when creating subclasses. + */ +SyntheticEvent.extend = function (Interface) { + var Super = this; -// Mutating mode (React DOM, React ART, React Native): -var enableMutatingReconciler = true; -// Experimental noop mode (currently unused): -var enableNoopReconciler = false; -// Experimental persistent mode (Fabric): -var enablePersistentReconciler = false; -// Experimental error-boundary API that can recover from errors within a single -// render phase -var enableGetDerivedStateFromCatch = false; -// Helps identify side effects in begin-phase lifecycle hooks and setState reducers: -var debugRenderPhaseSideEffects = false; + var E = function () {}; + E.prototype = Super.prototype; + var prototype = new E(); -// In some cases, StrictMode should also double-render lifecycles. -// This can be confusing for tests though, -// And it can be bad for performance in production. -// This feature flag can be used to control the behavior: -var debugRenderPhaseSideEffectsForStrictMode = true; + function Class() { + return Super.apply(this, arguments); + } + _assign(prototype, Class.prototype); + Class.prototype = prototype; + Class.prototype.constructor = Class; -// To preserve the "Pause on caught exceptions" behavior of the debugger, we -// replay the begin phase of a failed component inside invokeGuardedCallback. -var replayFailedUnitOfWorkWithInvokeGuardedCallback = true; + Class.Interface = _assign({}, Super.Interface, Interface); + Class.extend = Super.extend; + addEventPoolingTo(Class); -// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6: -var warnAboutDeprecatedLifecycles = false; + return Class; +}; -var alwaysUseRequestIdleCallbackPolyfill = false; +/** Proxying after everything set on SyntheticEvent + * to resolve Proxy issue on some WebKit browsers + * in which some Event properties are set to undefined (GH#10010) + */ +{ + var isProxySupported = typeof Proxy === 'function' && + // https://github.com/facebook/react/issues/12011 + !Object.isSealed(new Proxy({}, {})); -// Only used in www builds. + if (isProxySupported) { + /*eslint-disable no-func-assign */ + SyntheticEvent = new Proxy(SyntheticEvent, { + construct: function (target, args) { + return this.apply(target, Object.create(target.prototype), args); + }, + apply: function (constructor, that, args) { + return new Proxy(constructor.apply(that, args), { + set: function (target, prop, value) { + if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) { + !(didWarnForAddedNewProperty || target.isPersistent()) ? warning(false, "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; + didWarnForAddedNewProperty = true; + } + target[prop] = value; + return true; + } + }); + } + }); + /*eslint-enable no-func-assign */ + } +} -// Prefix measurements so that it's possible to filter them. -// Longer prefixes are hard to read in DevTools. -var reactEmoji = '\u269B'; -var warningEmoji = '\u26D4'; -var supportsUserTiming = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function'; +addEventPoolingTo(SyntheticEvent); -// Keep track of current fiber so that we know the path to unwind on pause. -// TODO: this looks the same as nextUnitOfWork in scheduler. Can we unify them? -var currentFiber = null; -// If we're in the middle of user code, which fiber and method is it? -// Reusing `currentFiber` would be confusing for this because user code fiber -// can change during commit phase too, but we don't need to unwind it (since -// lifecycles in the commit phase don't resemble a tree). -var currentPhase = null; -var currentPhaseFiber = null; -// Did lifecycle hook schedule an update? This is often a performance problem, -// so we will keep track of it, and include it in the report. -// Track commits caused by cascading updates. -var isCommitting = false; -var hasScheduledUpdateInCurrentCommit = false; -var hasScheduledUpdateInCurrentPhase = false; -var commitCountInCurrentWorkLoop = 0; -var effectCountInCurrentCommit = 0; -var isWaitingForCallback = false; -// During commits, we only show a measurement once per method name -// to avoid stretch the commit phase with measurement overhead. -var labelsInCurrentCommit = new Set(); - -var formatMarkName = function (markName) { - return reactEmoji + ' ' + markName; -}; +/** + * Helper to nullify syntheticEvent instance properties when destructing + * + * @param {String} propName + * @param {?object} getVal + * @return {object} defineProperty object + */ +function getPooledWarningPropertyDefinition(propName, getVal) { + var isFunction = typeof getVal === 'function'; + return { + configurable: true, + set: set, + get: get + }; -var formatLabel = function (label, warning$$1) { - var prefix = warning$$1 ? warningEmoji + ' ' : reactEmoji + ' '; - var suffix = warning$$1 ? ' Warning: ' + warning$$1 : ''; - return '' + prefix + label + suffix; -}; + function set(val) { + var action = isFunction ? 'setting the method' : 'setting the property'; + warn(action, 'This is effectively a no-op'); + return val; + } -var beginMark = function (markName) { - performance.mark(formatMarkName(markName)); -}; + function get() { + var action = isFunction ? 'accessing the method' : 'accessing the property'; + var result = isFunction ? 'This is a no-op function' : 'This is set to null'; + warn(action, result); + return getVal; + } -var clearMark = function (markName) { - performance.clearMarks(formatMarkName(markName)); -}; + function warn(action, result) { + var warningCondition = false; + !warningCondition ? warning(false, "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; + } +} -var endMark = function (label, markName, warning$$1) { - var formattedMarkName = formatMarkName(markName); - var formattedLabel = formatLabel(label, warning$$1); - try { - performance.measure(formattedLabel, formattedMarkName); - } catch (err) {} - // If previous mark was missing for some reason, this will throw. - // This could only happen if React crashed in an unexpected place earlier. - // Don't pile on with more errors. +function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { + var EventConstructor = this; + if (EventConstructor.eventPool.length) { + var instance = EventConstructor.eventPool.pop(); + EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst); + return instance; + } + return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst); +} - // Clear marks immediately to avoid growing buffer. - performance.clearMarks(formattedMarkName); - performance.clearMeasures(formattedLabel); -}; +function releasePooledEvent(event) { + var EventConstructor = this; + !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0; + event.destructor(); + if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) { + EventConstructor.eventPool.push(event); + } +} -var getFiberMarkName = function (label, debugID) { - return label + ' (#' + debugID + ')'; -}; +function addEventPoolingTo(EventConstructor) { + EventConstructor.eventPool = []; + EventConstructor.getPooled = getPooledEvent; + EventConstructor.release = releasePooledEvent; +} -var getFiberLabel = function (componentName, isMounted, phase) { - if (phase === null) { - // These are composite component total time measurements. - return componentName + ' [' + (isMounted ? 'update' : 'mount') + ']'; - } else { - // Composite component methods. - return componentName + '.' + phase; - } -}; +var SyntheticEvent$1 = SyntheticEvent; -var beginFiberMark = function (fiber, phase) { - var componentName = getComponentName(fiber) || 'Unknown'; - var debugID = fiber._debugID; - var isMounted = fiber.alternate !== null; - var label = getFiberLabel(componentName, isMounted, phase); +/** + * @interface Event + * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents + */ +var SyntheticCompositionEvent = SyntheticEvent$1.extend({ + data: null +}); - if (isCommitting && labelsInCurrentCommit.has(label)) { - // During the commit phase, we don't show duplicate labels because - // there is a fixed overhead for every measurement, and we don't - // want to stretch the commit phase beyond necessary. - return false; - } - labelsInCurrentCommit.add(label); +/** + * @interface Event + * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 + * /#events-inputevents + */ +var SyntheticInputEvent = SyntheticEvent$1.extend({ + data: null +}); - var markName = getFiberMarkName(label, debugID); - beginMark(markName); - return true; -}; +var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space +var START_KEYCODE = 229; -var clearFiberMark = function (fiber, phase) { - var componentName = getComponentName(fiber) || 'Unknown'; - var debugID = fiber._debugID; - var isMounted = fiber.alternate !== null; - var label = getFiberLabel(componentName, isMounted, phase); - var markName = getFiberMarkName(label, debugID); - clearMark(markName); -}; +var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window; -var endFiberMark = function (fiber, phase, warning$$1) { - var componentName = getComponentName(fiber) || 'Unknown'; - var debugID = fiber._debugID; - var isMounted = fiber.alternate !== null; - var label = getFiberLabel(componentName, isMounted, phase); - var markName = getFiberMarkName(label, debugID); - endMark(label, markName, warning$$1); -}; +var documentMode = null; +if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) { + documentMode = document.documentMode; +} -var shouldIgnoreFiber = function (fiber) { - // Host components should be skipped in the timeline. - // We could check typeof fiber.type, but does this work with RN? - switch (fiber.tag) { - case HostRoot: - case HostComponent: - case HostText: - case HostPortal: - case CallComponent: - case ReturnComponent: - case Fragment: - case ContextProvider: - case ContextConsumer: - return true; - default: - return false; - } -}; +// Webkit offers a very useful `textInput` event that can be used to +// directly represent `beforeInput`. The IE `textinput` event is not as +// useful, so we don't use it. +var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode; -var clearPendingPhaseMeasurement = function () { - if (currentPhase !== null && currentPhaseFiber !== null) { - clearFiberMark(currentPhaseFiber, currentPhase); - } - currentPhaseFiber = null; - currentPhase = null; - hasScheduledUpdateInCurrentPhase = false; -}; +// In IE9+, we have access to composition events, but the data supplied +// by the native compositionend event may be incorrect. Japanese ideographic +// spaces, for instance (\u3000) are not recorded correctly. +var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); -var pauseTimers = function () { - // Stops all currently active measurements so that they can be resumed - // if we continue in a later deferred loop from the same unit of work. - var fiber = currentFiber; - while (fiber) { - if (fiber._debugIsCurrentlyTiming) { - endFiberMark(fiber, null, null); - } - fiber = fiber['return']; - } -}; +var SPACEBAR_CODE = 32; +var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); -var resumeTimersRecursively = function (fiber) { - if (fiber['return'] !== null) { - resumeTimersRecursively(fiber['return']); - } - if (fiber._debugIsCurrentlyTiming) { - beginFiberMark(fiber, null); +// Events and their corresponding property names. +var eventTypes = { + beforeInput: { + phasedRegistrationNames: { + bubbled: 'onBeforeInput', + captured: 'onBeforeInputCapture' + }, + dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste'] + }, + compositionEnd: { + phasedRegistrationNames: { + bubbled: 'onCompositionEnd', + captured: 'onCompositionEndCapture' + }, + dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] + }, + compositionStart: { + phasedRegistrationNames: { + bubbled: 'onCompositionStart', + captured: 'onCompositionStartCapture' + }, + dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] + }, + compositionUpdate: { + phasedRegistrationNames: { + bubbled: 'onCompositionUpdate', + captured: 'onCompositionUpdateCapture' + }, + dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] } }; -var resumeTimers = function () { - // Resumes all measurements that were active during the last deferred loop. - if (currentFiber !== null) { - resumeTimersRecursively(currentFiber); - } -}; +// Track whether we've ever handled a keypress on the space key. +var hasSpaceKeypress = false; -function recordEffect() { - if (enableUserTimingAPI) { - effectCountInCurrentCommit++; - } +/** + * Return whether a native keypress event is assumed to be a command. + * This is required because Firefox fires `keypress` events for key commands + * (cut, copy, select-all, etc.) even though no character is inserted. + */ +function isKeypressCommand(nativeEvent) { + return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && + // ctrlKey && altKey is equivalent to AltGr, and is not a command. + !(nativeEvent.ctrlKey && nativeEvent.altKey); } -function recordScheduleUpdate() { - if (enableUserTimingAPI) { - if (isCommitting) { - hasScheduledUpdateInCurrentCommit = true; - } - if (currentPhase !== null && currentPhase !== 'componentWillMount' && currentPhase !== 'componentWillReceiveProps') { - hasScheduledUpdateInCurrentPhase = true; - } +/** + * Translate native top level events into event types. + * + * @param {string} topLevelType + * @return {object} + */ +function getCompositionEventType(topLevelType) { + switch (topLevelType) { + case 'topCompositionStart': + return eventTypes.compositionStart; + case 'topCompositionEnd': + return eventTypes.compositionEnd; + case 'topCompositionUpdate': + return eventTypes.compositionUpdate; } } -function startRequestCallbackTimer() { - if (enableUserTimingAPI) { - if (supportsUserTiming && !isWaitingForCallback) { - isWaitingForCallback = true; - beginMark('(Waiting for async callback...)'); - } - } +/** + * Does our fallback best-guess model think this event signifies that + * composition has begun? + * + * @param {string} topLevelType + * @param {object} nativeEvent + * @return {boolean} + */ +function isFallbackCompositionStart(topLevelType, nativeEvent) { + return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE; } -function stopRequestCallbackTimer(didExpire, expirationTime) { - if (enableUserTimingAPI) { - if (supportsUserTiming) { - isWaitingForCallback = false; - var warning$$1 = didExpire ? 'React was blocked by main thread' : null; - endMark('(Waiting for async callback... will force flush in ' + expirationTime + ' ms)', '(Waiting for async callback...)', warning$$1); - } +/** + * Does our fallback mode think that this event is the end of composition? + * + * @param {string} topLevelType + * @param {object} nativeEvent + * @return {boolean} + */ +function isFallbackCompositionEnd(topLevelType, nativeEvent) { + switch (topLevelType) { + case 'topKeyUp': + // Command keys insert or clear IME input. + return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; + case 'topKeyDown': + // Expect IME keyCode on each keydown. If we get any other + // code we must have exited earlier. + return nativeEvent.keyCode !== START_KEYCODE; + case 'topKeyPress': + case 'topMouseDown': + case 'topBlur': + // Events are not possible without cancelling IME. + return true; + default: + return false; } } -function startWorkTimer(fiber) { - if (enableUserTimingAPI) { - if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { - return; - } - // If we pause, this is the fiber to unwind from. - currentFiber = fiber; - if (!beginFiberMark(fiber, null)) { - return; - } - fiber._debugIsCurrentlyTiming = true; +/** + * Google Input Tools provides composition data via a CustomEvent, + * with the `data` property populated in the `detail` object. If this + * is available on the event object, use it. If not, this is a plain + * composition event and we have nothing special to extract. + * + * @param {object} nativeEvent + * @return {?string} + */ +function getDataFromCustomEvent(nativeEvent) { + var detail = nativeEvent.detail; + if (typeof detail === 'object' && 'data' in detail) { + return detail.data; } + return null; } -function cancelWorkTimer(fiber) { - if (enableUserTimingAPI) { - if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { - return; - } - // Remember we shouldn't complete measurement for this fiber. - // Otherwise flamechart will be deep even for small updates. - fiber._debugIsCurrentlyTiming = false; - clearFiberMark(fiber, null); - } -} +// Track the current IME composition status, if any. +var isComposing = false; -function stopWorkTimer(fiber) { - if (enableUserTimingAPI) { - if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { - return; - } - // If we pause, its parent is the fiber to unwind from. - currentFiber = fiber['return']; - if (!fiber._debugIsCurrentlyTiming) { - return; - } - fiber._debugIsCurrentlyTiming = false; - endFiberMark(fiber, null, null); - } -} +/** + * @return {?object} A SyntheticCompositionEvent. + */ +function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var eventType = void 0; + var fallbackData = void 0; -function stopFailedWorkTimer(fiber) { - if (enableUserTimingAPI) { - if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { - return; - } - // If we pause, its parent is the fiber to unwind from. - currentFiber = fiber['return']; - if (!fiber._debugIsCurrentlyTiming) { - return; + if (canUseCompositionEvent) { + eventType = getCompositionEventType(topLevelType); + } else if (!isComposing) { + if (isFallbackCompositionStart(topLevelType, nativeEvent)) { + eventType = eventTypes.compositionStart; } - fiber._debugIsCurrentlyTiming = false; - var warning$$1 = 'An error was thrown inside this error boundary'; - endFiberMark(fiber, null, warning$$1); + } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { + eventType = eventTypes.compositionEnd; } -} -function startPhaseTimer(fiber, phase) { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - clearPendingPhaseMeasurement(); - if (!beginFiberMark(fiber, phase)) { - return; - } - currentPhaseFiber = fiber; - currentPhase = phase; + if (!eventType) { + return null; } -} -function stopPhaseTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - if (currentPhase !== null && currentPhaseFiber !== null) { - var warning$$1 = hasScheduledUpdateInCurrentPhase ? 'Scheduled a cascading update' : null; - endFiberMark(currentPhaseFiber, currentPhase, warning$$1); + if (useFallbackCompositionData) { + // The current composition is stored statically and must not be + // overwritten while composition continues. + if (!isComposing && eventType === eventTypes.compositionStart) { + isComposing = initialize(nativeEventTarget); + } else if (eventType === eventTypes.compositionEnd) { + if (isComposing) { + fallbackData = getData(); + } } - currentPhase = null; - currentPhaseFiber = null; } -} -function startWorkLoopTimer(nextUnitOfWork) { - if (enableUserTimingAPI) { - currentFiber = nextUnitOfWork; - if (!supportsUserTiming) { - return; - } - commitCountInCurrentWorkLoop = 0; - // This is top level call. - // Any other measurements are performed within. - beginMark('(React Tree Reconciliation)'); - // Resume any measurements that were in progress during the last loop. - resumeTimers(); - } -} + var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget); -function stopWorkLoopTimer(interruptedBy, didCompleteRoot) { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - var warning$$1 = null; - if (interruptedBy !== null) { - if (interruptedBy.tag === HostRoot) { - warning$$1 = 'A top-level update interrupted the previous render'; - } else { - var componentName = getComponentName(interruptedBy) || 'Unknown'; - warning$$1 = 'An update to ' + componentName + ' interrupted the previous render'; - } - } else if (commitCountInCurrentWorkLoop > 1) { - warning$$1 = 'There were cascading updates'; + if (fallbackData) { + // Inject data generated from fallback path into the synthetic event. + // This matches the property of native CompositionEventInterface. + event.data = fallbackData; + } else { + var customData = getDataFromCustomEvent(nativeEvent); + if (customData !== null) { + event.data = customData; } - commitCountInCurrentWorkLoop = 0; - var label = didCompleteRoot ? '(React Tree Reconciliation: Completed Root)' : '(React Tree Reconciliation: Yielded)'; - // Pause any measurements until the next loop. - pauseTimers(); - endMark(label, '(React Tree Reconciliation)', warning$$1); } -} -function startCommitTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - isCommitting = true; - hasScheduledUpdateInCurrentCommit = false; - labelsInCurrentCommit.clear(); - beginMark('(Committing Changes)'); - } + accumulateTwoPhaseDispatches(event); + return event; } -function stopCommitTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - - var warning$$1 = null; - if (hasScheduledUpdateInCurrentCommit) { - warning$$1 = 'Lifecycle hook scheduled a cascading update'; - } else if (commitCountInCurrentWorkLoop > 0) { - warning$$1 = 'Caused by a cascading update in earlier commit'; - } - hasScheduledUpdateInCurrentCommit = false; - commitCountInCurrentWorkLoop++; - isCommitting = false; - labelsInCurrentCommit.clear(); +/** + * @param {TopLevelTypes} topLevelType Record from `BrowserEventConstants`. + * @param {object} nativeEvent Native browser event. + * @return {?string} The string corresponding to this `beforeInput` event. + */ +function getNativeBeforeInputChars(topLevelType, nativeEvent) { + switch (topLevelType) { + case 'topCompositionEnd': + return getDataFromCustomEvent(nativeEvent); + case 'topKeyPress': + /** + * If native `textInput` events are available, our goal is to make + * use of them. However, there is a special case: the spacebar key. + * In Webkit, preventing default on a spacebar `textInput` event + * cancels character insertion, but it *also* causes the browser + * to fall back to its default spacebar behavior of scrolling the + * page. + * + * Tracking at: + * https://code.google.com/p/chromium/issues/detail?id=355103 + * + * To avoid this issue, use the keypress event as if no `textInput` + * event is available. + */ + var which = nativeEvent.which; + if (which !== SPACEBAR_CODE) { + return null; + } - endMark('(Committing Changes)', '(Committing Changes)', warning$$1); - } -} + hasSpaceKeypress = true; + return SPACEBAR_CHAR; -function startCommitSnapshotEffectsTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - effectCountInCurrentCommit = 0; - beginMark('(Committing Snapshot Effects)'); - } -} + case 'topTextInput': + // Record the characters to be added to the DOM. + var chars = nativeEvent.data; -function stopCommitSnapshotEffectsTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - var count = effectCountInCurrentCommit; - effectCountInCurrentCommit = 0; - endMark('(Committing Snapshot Effects: ' + count + ' Total)', '(Committing Snapshot Effects)', null); + // If it's a spacebar character, assume that we have already handled + // it at the keypress level and bail immediately. Android Chrome + // doesn't give us keycodes, so we need to blacklist it. + if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { + return null; + } + + return chars; + + default: + // For other native event types, do nothing. + return null; } } -function startCommitHostEffectsTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; +/** + * For browsers that do not provide the `textInput` event, extract the + * appropriate string to use for SyntheticInputEvent. + * + * @param {string} topLevelType Record from `BrowserEventConstants`. + * @param {object} nativeEvent Native browser event. + * @return {?string} The fallback string for this `beforeInput` event. + */ +function getFallbackBeforeInputChars(topLevelType, nativeEvent) { + // If we are currently composing (IME) and using a fallback to do so, + // try to extract the composed characters from the fallback object. + // If composition event is available, we extract a string only at + // compositionevent, otherwise extract it at fallback events. + if (isComposing) { + if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) { + var chars = getData(); + reset(); + isComposing = false; + return chars; } - effectCountInCurrentCommit = 0; - beginMark('(Committing Host Effects)'); + return null; } -} -function stopCommitHostEffectsTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - var count = effectCountInCurrentCommit; - effectCountInCurrentCommit = 0; - endMark('(Committing Host Effects: ' + count + ' Total)', '(Committing Host Effects)', null); + switch (topLevelType) { + case 'topPaste': + // If a paste event occurs after a keypress, throw out the input + // chars. Paste events should not lead to BeforeInput events. + return null; + case 'topKeyPress': + /** + * As of v27, Firefox may fire keypress events even when no character + * will be inserted. A few possibilities: + * + * - `which` is `0`. Arrow keys, Esc key, etc. + * + * - `which` is the pressed key code, but no char is available. + * Ex: 'AltGr + d` in Polish. There is no modified character for + * this key combination and no character is inserted into the + * document, but FF fires the keypress for char code `100` anyway. + * No `input` event will occur. + * + * - `which` is the pressed key code, but a command combination is + * being used. Ex: `Cmd+C`. No character is inserted, and no + * `input` event will occur. + */ + if (!isKeypressCommand(nativeEvent)) { + // IE fires the `keypress` event when a user types an emoji via + // Touch keyboard of Windows. In such a case, the `char` property + // holds an emoji character like `\uD83D\uDE0A`. Because its length + // is 2, the property `which` does not represent an emoji correctly. + // In such a case, we directly return the `char` property instead of + // using `which`. + if (nativeEvent.char && nativeEvent.char.length > 1) { + return nativeEvent.char; + } else if (nativeEvent.which) { + return String.fromCharCode(nativeEvent.which); + } + } + return null; + case 'topCompositionEnd': + return useFallbackCompositionData ? null : nativeEvent.data; + default: + return null; } } -function startCommitLifeCyclesTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - effectCountInCurrentCommit = 0; - beginMark('(Calling Lifecycle Methods)'); +/** + * Extract a SyntheticInputEvent for `beforeInput`, based on either native + * `textInput` or fallback behavior. + * + * @return {?object} A SyntheticInputEvent. + */ +function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var chars = void 0; + + if (canUseTextInputEvent) { + chars = getNativeBeforeInputChars(topLevelType, nativeEvent); + } else { + chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); } -} -function stopCommitLifeCyclesTimer() { - if (enableUserTimingAPI) { - if (!supportsUserTiming) { - return; - } - var count = effectCountInCurrentCommit; - effectCountInCurrentCommit = 0; - endMark('(Calling Lifecycle Methods: ' + count + ' Total)', '(Calling Lifecycle Methods)', null); + // If no characters are being inserted, no BeforeInput event should + // be fired. + if (!chars) { + return null; } -} -var didWarnUpdateInsideUpdate = void 0; + var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget); -{ - didWarnUpdateInsideUpdate = false; + event.data = chars; + accumulateTwoPhaseDispatches(event); + return event; } -// Callbacks are not validated until invocation +/** + * Create an `onBeforeInput` event to match + * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. + * + * This event plugin is based on the native `textInput` event + * available in Chrome, Safari, Opera, and IE. This event fires after + * `onKeyPress` and `onCompositionEnd`, but before `onInput`. + * + * `beforeInput` is spec'd but not implemented in any browsers, and + * the `input` event does not provide any useful information about what has + * actually been added, contrary to the spec. Thus, `textInput` is the best + * available event to identify the characters that have actually been inserted + * into the target node. + * + * This plugin is also responsible for emitting `composition` events, thus + * allowing us to share composition fallback code for both `beforeInput` and + * `composition` event types. + */ +var BeforeInputEventPlugin = { + eventTypes: eventTypes, + extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var composition = extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget); -// Singly linked-list of updates. When an update is scheduled, it is added to -// the queue of the current fiber and the work-in-progress fiber. The two queues -// are separate but they share a persistent structure. -// -// During reconciliation, updates are removed from the work-in-progress fiber, -// but they remain on the current fiber. That ensures that if a work-in-progress -// is aborted, the aborted updates are recovered by cloning from current. -// -// The work-in-progress queue is always a subset of the current queue. -// -// When the tree is committed, the work-in-progress becomes the current. + var beforeInput = extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget); + + if (composition === null) { + return beforeInput; + } + if (beforeInput === null) { + return composition; + } -function createUpdateQueue(baseState) { - var queue = { - baseState: baseState, - expirationTime: NoWork, - first: null, - last: null, - callbackList: null, - hasForceUpdate: false, - isInitialized: false, - capturedValues: null - }; - { - queue.isProcessing = false; + return [composition, beforeInput]; } - return queue; -} +}; -function insertUpdateIntoQueue(queue, update) { - // Append the update to the end of the list. - if (queue.last === null) { - // Queue is empty - queue.first = queue.last = update; - } else { - queue.last.next = update; - queue.last = update; +// Use to restore controlled state after a change event has fired. + +var fiberHostComponent = null; + +var ReactControlledComponentInjection = { + injectFiberControlledHostComponent: function (hostComponentImpl) { + // The fiber implementation doesn't use dynamic dispatch so we need to + // inject the implementation. + fiberHostComponent = hostComponentImpl; } - if (queue.expirationTime === NoWork || queue.expirationTime > update.expirationTime) { - queue.expirationTime = update.expirationTime; +}; + +var restoreTarget = null; +var restoreQueue = null; + +function restoreStateOfTarget(target) { + // We perform this translation at the end of the event loop so that we + // always receive the correct fiber here + var internalInstance = getInstanceFromNode(target); + if (!internalInstance) { + // Unmounted + return; } + !(fiberHostComponent && typeof fiberHostComponent.restoreControlledState === 'function') ? invariant(false, 'Fiber needs to be injected to handle a fiber target for controlled events. This error is likely caused by a bug in React. Please file an issue.') : void 0; + var props = getFiberCurrentPropsFromNode(internalInstance.stateNode); + fiberHostComponent.restoreControlledState(internalInstance.stateNode, internalInstance.type, props); } -var q1 = void 0; -var q2 = void 0; -function ensureUpdateQueues(fiber) { - q1 = q2 = null; - // We'll have at least one and at most two distinct update queues. - var alternateFiber = fiber.alternate; - var queue1 = fiber.updateQueue; - if (queue1 === null) { - // TODO: We don't know what the base state will be until we begin work. - // It depends on which fiber is the next current. Initialize with an empty - // base state, then set to the memoizedState when rendering. Not super - // happy with this approach. - queue1 = fiber.updateQueue = createUpdateQueue(null); - } +var injection$2 = ReactControlledComponentInjection; - var queue2 = void 0; - if (alternateFiber !== null) { - queue2 = alternateFiber.updateQueue; - if (queue2 === null) { - queue2 = alternateFiber.updateQueue = createUpdateQueue(null); +function enqueueStateRestore(target) { + if (restoreTarget) { + if (restoreQueue) { + restoreQueue.push(target); + } else { + restoreQueue = [target]; } } else { - queue2 = null; + restoreTarget = target; } - queue2 = queue2 !== queue1 ? queue2 : null; +} - // Use module variables instead of returning a tuple - q1 = queue1; - q2 = queue2; +function needsStateRestore() { + return restoreTarget !== null || restoreQueue !== null; } -function insertUpdateIntoFiber(fiber, update) { - ensureUpdateQueues(fiber); - var queue1 = q1; - var queue2 = q2; +function restoreStateIfNeeded() { + if (!restoreTarget) { + return; + } + var target = restoreTarget; + var queuedTargets = restoreQueue; + restoreTarget = null; + restoreQueue = null; - // Warn if an update is scheduled from inside an updater function. - { - if ((queue1.isProcessing || queue2 !== null && queue2.isProcessing) && !didWarnUpdateInsideUpdate) { - warning(false, 'An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.'); - didWarnUpdateInsideUpdate = true; + restoreStateOfTarget(target); + if (queuedTargets) { + for (var i = 0; i < queuedTargets.length; i++) { + restoreStateOfTarget(queuedTargets[i]); } } +} - // If there's only one queue, add the update to that queue and exit. - if (queue2 === null) { - insertUpdateIntoQueue(queue1, update); - return; - } +var ReactControlledComponent = Object.freeze({ + injection: injection$2, + enqueueStateRestore: enqueueStateRestore, + needsStateRestore: needsStateRestore, + restoreStateIfNeeded: restoreStateIfNeeded +}); - // If either queue is empty, we need to add to both queues. - if (queue1.last === null || queue2.last === null) { - insertUpdateIntoQueue(queue1, update); - insertUpdateIntoQueue(queue2, update); - return; - } +// Used as a way to call batchedUpdates when we don't have a reference to +// the renderer. Such as when we're dispatching events or if third party +// libraries need to call batchedUpdates. Eventually, this API will go away when +// everything is batched by default. We'll then have a similar API to opt-out of +// scheduled work and instead do synchronous work. - // If both lists are not empty, the last update is the same for both lists - // because of structural sharing. So, we should only append to one of - // the lists. - insertUpdateIntoQueue(queue1, update); - // But we still need to update the `last` pointer of queue2. - queue2.last = update; -} +// Defaults +var _batchedUpdates = function (fn, bookkeeping) { + return fn(bookkeeping); +}; +var _interactiveUpdates = function (fn, a, b) { + return fn(a, b); +}; +var _flushInteractiveUpdates = function () {}; -function getUpdateExpirationTime(fiber) { - switch (fiber.tag) { - case HostRoot: - case ClassComponent: - var updateQueue = fiber.updateQueue; - if (updateQueue === null) { - return NoWork; - } - return updateQueue.expirationTime; - default: - return NoWork; +var isBatching = false; +function batchedUpdates(fn, bookkeeping) { + if (isBatching) { + // If we are currently inside another batch, we need to wait until it + // fully completes before restoring state. + return fn(bookkeeping); + } + isBatching = true; + try { + return _batchedUpdates(fn, bookkeeping); + } finally { + // Here we wait until all updates have propagated, which is important + // when using controlled components within layers: + // https://github.com/facebook/react/issues/1698 + // Then we restore state of any controlled component. + isBatching = false; + var controlledComponentsHavePendingUpdates = needsStateRestore(); + if (controlledComponentsHavePendingUpdates) { + // If a controlled event was fired, we may need to restore the state of + // the DOM node back to the controlled value. This is necessary when React + // bails out of the update without touching the DOM. + _flushInteractiveUpdates(); + restoreStateIfNeeded(); + } } } -function getStateFromUpdate(update, instance, prevState, props) { - var partialState = update.partialState; - if (typeof partialState === 'function') { - return partialState.call(instance, prevState, props); - } else { - return partialState; - } +function interactiveUpdates(fn, a, b) { + return _interactiveUpdates(fn, a, b); } -function processUpdateQueue(current, workInProgress, queue, instance, props, renderExpirationTime) { - if (current !== null && current.updateQueue === queue) { - // We need to create a work-in-progress queue, by cloning the current queue. - var currentQueue = queue; - queue = workInProgress.updateQueue = { - baseState: currentQueue.baseState, - expirationTime: currentQueue.expirationTime, - first: currentQueue.first, - last: currentQueue.last, - isInitialized: currentQueue.isInitialized, - capturedValues: currentQueue.capturedValues, - // These fields are no longer valid because they were already committed. - // Reset them. - callbackList: null, - hasForceUpdate: false - }; - } - { - // Set this flag so we can warn if setState is called inside the update - // function of another setState. - queue.isProcessing = true; + +var injection$3 = { + injectRenderer: function (renderer) { + _batchedUpdates = renderer.batchedUpdates; + _interactiveUpdates = renderer.interactiveUpdates; + _flushInteractiveUpdates = renderer.flushInteractiveUpdates; } +}; - // Reset the remaining expiration time. If we skip over any updates, we'll - // increase this accordingly. - queue.expirationTime = NoWork; +/** + * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary + */ +var supportedInputTypes = { + color: true, + date: true, + datetime: true, + 'datetime-local': true, + email: true, + month: true, + number: true, + password: true, + range: true, + search: true, + tel: true, + text: true, + time: true, + url: true, + week: true +}; - // TODO: We don't know what the base state will be until we begin work. - // It depends on which fiber is the next current. Initialize with an empty - // base state, then set to the memoizedState when rendering. Not super - // happy with this approach. - var state = void 0; - if (queue.isInitialized) { - state = queue.baseState; - } else { - state = queue.baseState = workInProgress.memoizedState; - queue.isInitialized = true; +function isTextInputElement(elem) { + var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); + + if (nodeName === 'input') { + return !!supportedInputTypes[elem.type]; } - var dontMutatePrevState = true; - var update = queue.first; - var didSkip = false; - while (update !== null) { - var updateExpirationTime = update.expirationTime; - if (updateExpirationTime > renderExpirationTime) { - // This update does not have sufficient priority. Skip it. - var remainingExpirationTime = queue.expirationTime; - if (remainingExpirationTime === NoWork || remainingExpirationTime > updateExpirationTime) { - // Update the remaining expiration time. - queue.expirationTime = updateExpirationTime; - } - if (!didSkip) { - didSkip = true; - queue.baseState = state; - } - // Continue to the next update. - update = update.next; - continue; - } - // This update does have sufficient priority. + if (nodeName === 'textarea') { + return true; + } - // If no previous updates were skipped, drop this update from the queue by - // advancing the head of the list. - if (!didSkip) { - queue.first = update.next; - if (queue.first === null) { - queue.last = null; - } - } - - // Invoke setState callback an extra time to help detect side-effects. - // Ignore the return value in this case. - if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) { - getStateFromUpdate(update, instance, state, props); - } + return false; +} - // Process the update - var _partialState = void 0; - if (update.isReplace) { - state = getStateFromUpdate(update, instance, state, props); - dontMutatePrevState = true; - } else { - _partialState = getStateFromUpdate(update, instance, state, props); - if (_partialState) { - if (dontMutatePrevState) { - // $FlowFixMe: Idk how to type this properly. - state = _assign({}, state, _partialState); - } else { - state = _assign(state, _partialState); - } - dontMutatePrevState = false; - } - } - if (update.isForced) { - queue.hasForceUpdate = true; - } - if (update.callback !== null) { - // Append to list of callbacks. - var _callbackList = queue.callbackList; - if (_callbackList === null) { - _callbackList = queue.callbackList = []; - } - _callbackList.push(update); - } - if (update.capturedValue !== null) { - var _capturedValues = queue.capturedValues; - if (_capturedValues === null) { - queue.capturedValues = [update.capturedValue]; - } else { - _capturedValues.push(update.capturedValue); - } - } - update = update.next; - } +/** + * HTML nodeType values that represent the type of the node + */ - if (queue.callbackList !== null) { - workInProgress.effectTag |= Callback; - } else if (queue.first === null && !queue.hasForceUpdate && queue.capturedValues === null) { - // The queue is empty. We can reset it. - workInProgress.updateQueue = null; - } +var ELEMENT_NODE = 1; +var TEXT_NODE = 3; +var COMMENT_NODE = 8; +var DOCUMENT_NODE = 9; +var DOCUMENT_FRAGMENT_NODE = 11; - if (!didSkip) { - didSkip = true; - queue.baseState = state; - } +/** + * Gets the target node from a native browser event by accounting for + * inconsistencies in browser DOM APIs. + * + * @param {object} nativeEvent Native browser event. + * @return {DOMEventTarget} Target node. + */ +function getEventTarget(nativeEvent) { + var target = nativeEvent.target || window; - { - // No longer processing. - queue.isProcessing = false; + // Normalize SVG element events #4963 + if (target.correspondingUseElement) { + target = target.correspondingUseElement; } - return state; + // Safari may fire events on text nodes (Node.TEXT_NODE is 3). + // @see http://www.quirksmode.org/js/events_properties.html + return target.nodeType === TEXT_NODE ? target.parentNode : target; } -function commitCallbacks(queue, context) { - var callbackList = queue.callbackList; - if (callbackList === null) { - return; - } - // Set the list to null to make sure they don't get called more than once. - queue.callbackList = null; - for (var i = 0; i < callbackList.length; i++) { - var update = callbackList[i]; - var _callback = update.callback; - // This update might be processed again. Clear the callback so it's only - // called once. - update.callback = null; - !(typeof _callback === 'function') ? invariant(false, 'Invalid argument passed as callback. Expected a function. Instead received: %s', _callback) : void 0; - _callback.call(context); +/** + * Checks if an event is supported in the current execution environment. + * + * NOTE: This will not work correctly for non-generic events such as `change`, + * `reset`, `load`, `error`, and `select`. + * + * Borrows from Modernizr. + * + * @param {string} eventNameSuffix Event name, e.g. "click". + * @param {?boolean} capture Check if the capture phase is supported. + * @return {boolean} True if the event is supported. + * @internal + * @license Modernizr 3.0.0pre (Custom Build) | MIT + */ +function isEventSupported(eventNameSuffix, capture) { + if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { + return false; } -} -var fakeInternalInstance = {}; -var isArray = Array.isArray; + var eventName = 'on' + eventNameSuffix; + var isSupported = eventName in document; -var didWarnAboutStateAssignmentForComponent = void 0; -var didWarnAboutUndefinedDerivedState = void 0; -var didWarnAboutUninitializedState = void 0; -var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = void 0; -var didWarnAboutLegacyLifecyclesAndDerivedState = void 0; -var warnOnInvalidCallback$1 = void 0; + if (!isSupported) { + var element = document.createElement('div'); + element.setAttribute(eventName, 'return;'); + isSupported = typeof element[eventName] === 'function'; + } -{ - didWarnAboutStateAssignmentForComponent = new Set(); - didWarnAboutUndefinedDerivedState = new Set(); - didWarnAboutUninitializedState = new Set(); - didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set(); - didWarnAboutLegacyLifecyclesAndDerivedState = new Set(); + return isSupported; +} - var didWarnOnInvalidCallback = new Set(); +function isCheckable(elem) { + var type = elem.type; + var nodeName = elem.nodeName; + return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio'); +} - warnOnInvalidCallback$1 = function (callback, callerName) { - if (callback === null || typeof callback === 'function') { - return; - } - var key = callerName + '_' + callback; - if (!didWarnOnInvalidCallback.has(key)) { - didWarnOnInvalidCallback.add(key); - warning(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback); - } - }; +function getTracker(node) { + return node._valueTracker; +} - // This is so gross but it's at least non-critical and can be removed if - // it causes problems. This is meant to give a nicer error message for - // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component, - // ...)) which otherwise throws a "_processChildContext is not a function" - // exception. - Object.defineProperty(fakeInternalInstance, '_processChildContext', { - enumerable: false, - value: function () { - invariant(false, '_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn\'t supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).'); - } - }); - Object.freeze(fakeInternalInstance); +function detachTracker(node) { + node._valueTracker = null; } -function callGetDerivedStateFromCatch(ctor, capturedValues) { - var resultState = {}; - for (var i = 0; i < capturedValues.length; i++) { - var capturedValue = capturedValues[i]; - var error = capturedValue.value; - var partialState = ctor.getDerivedStateFromCatch.call(null, error); - if (partialState !== null && partialState !== undefined) { - _assign(resultState, partialState); - } + +function getValueFromNode(node) { + var value = ''; + if (!node) { + return value; } - return resultState; + + if (isCheckable(node)) { + value = node.checked ? 'true' : 'false'; + } else { + value = node.value; + } + + return value; } -var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExpirationForFiber, memoizeProps, memoizeState) { - var cacheContext = legacyContext.cacheContext, - getMaskedContext = legacyContext.getMaskedContext, - getUnmaskedContext = legacyContext.getUnmaskedContext, - isContextConsumer = legacyContext.isContextConsumer, - hasContextChanged = legacyContext.hasContextChanged; +function trackValueOnNode(node) { + var valueField = isCheckable(node) ? 'checked' : 'value'; + var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField); - // Class component state updater + var currentValue = '' + node[valueField]; - var updater = { - isMounted: isMounted, - enqueueSetState: function (instance, partialState, callback) { - var fiber = get(instance); - callback = callback === undefined ? null : callback; - { - warnOnInvalidCallback$1(callback, 'setState'); - } - var expirationTime = computeExpirationForFiber(fiber); - var update = { - expirationTime: expirationTime, - partialState: partialState, - callback: callback, - isReplace: false, - isForced: false, - capturedValue: null, - next: null - }; - insertUpdateIntoFiber(fiber, update); - scheduleWork(fiber, expirationTime); - }, - enqueueReplaceState: function (instance, state, callback) { - var fiber = get(instance); - callback = callback === undefined ? null : callback; - { - warnOnInvalidCallback$1(callback, 'replaceState'); - } - var expirationTime = computeExpirationForFiber(fiber); - var update = { - expirationTime: expirationTime, - partialState: state, - callback: callback, - isReplace: true, - isForced: false, - capturedValue: null, - next: null - }; - insertUpdateIntoFiber(fiber, update); - scheduleWork(fiber, expirationTime); + // if someone has already defined a value or Safari, then bail + // and don't track value will cause over reporting of changes, + // but it's better then a hard failure + // (needed for certain tests that spyOn input values and Safari) + if (node.hasOwnProperty(valueField) || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') { + return; + } + + Object.defineProperty(node, valueField, { + configurable: true, + get: function () { + return descriptor.get.call(this); }, - enqueueForceUpdate: function (instance, callback) { - var fiber = get(instance); - callback = callback === undefined ? null : callback; - { - warnOnInvalidCallback$1(callback, 'forceUpdate'); - } - var expirationTime = computeExpirationForFiber(fiber); - var update = { - expirationTime: expirationTime, - partialState: null, - callback: callback, - isReplace: false, - isForced: true, - capturedValue: null, - next: null - }; - insertUpdateIntoFiber(fiber, update); - scheduleWork(fiber, expirationTime); + set: function (value) { + currentValue = '' + value; + descriptor.set.call(this, value); } - }; + }); + // We could've passed this the first time + // but it triggers a bug in IE11 and Edge 14/15. + // Calling defineProperty() again should be equivalent. + // https://github.com/facebook/react/issues/11768 + Object.defineProperty(node, valueField, { + enumerable: descriptor.enumerable + }); - function checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext) { - if (oldProps === null || workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate) { - // If the workInProgress already has an Update effect, return true - return true; + var tracker = { + getValue: function () { + return currentValue; + }, + setValue: function (value) { + currentValue = '' + value; + }, + stopTracking: function () { + detachTracker(node); + delete node[valueField]; } + }; + return tracker; +} - var instance = workInProgress.stateNode; - var ctor = workInProgress.type; - if (typeof instance.shouldComponentUpdate === 'function') { - startPhaseTimer(workInProgress, 'shouldComponentUpdate'); - var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, newContext); - stopPhaseTimer(); +function track(node) { + if (getTracker(node)) { + return; + } - { - warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(workInProgress) || 'Component'); - } + // TODO: Once it's just Fiber we can move this to node._wrapperState + node._valueTracker = trackValueOnNode(node); +} - return shouldUpdate; - } +function updateValueIfChanged(node) { + if (!node) { + return false; + } - if (ctor.prototype && ctor.prototype.isPureReactComponent) { - return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState); - } + var tracker = getTracker(node); + // if there is no tracker at this point it's unlikely + // that trying again will succeed + if (!tracker) { + return true; + } + var lastValue = tracker.getValue(); + var nextValue = getValueFromNode(node); + if (nextValue !== lastValue) { + tracker.setValue(nextValue); return true; } + return false; +} - function checkClassInstance(workInProgress) { - var instance = workInProgress.stateNode; - var type = workInProgress.type; - { - var name = getComponentName(workInProgress) || 'Component'; - var renderPresent = instance.render; +var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - if (!renderPresent) { - if (type.prototype && typeof type.prototype.render === 'function') { - warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name); - } else { - warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name); - } - } +var ReactCurrentOwner = ReactInternals.ReactCurrentOwner; +var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame; - var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state; - warning(noGetInitialStateOnES6, '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?', name); - var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved; - warning(noGetDefaultPropsOnES6, '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.', name); - var noInstancePropTypes = !instance.propTypes; - warning(noInstancePropTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name); - var noInstanceContextTypes = !instance.contextTypes; - warning(noInstanceContextTypes, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name); - var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function'; - warning(noComponentShouldUpdate, '%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.', name); - if (type.prototype && type.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') { - warning(false, '%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(workInProgress) || 'A pure component'); - } - var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function'; - warning(noComponentDidUnmount, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name); - var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function'; - warning(noComponentDidReceiveProps, '%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name); - var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function'; - warning(noComponentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name); - var noUnsafeComponentWillRecieveProps = typeof instance.UNSAFE_componentWillRecieveProps !== 'function'; - warning(noUnsafeComponentWillRecieveProps, '%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name); - var hasMutatedProps = instance.props !== workInProgress.pendingProps; - warning(instance.props === undefined || !hasMutatedProps, '%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name); - var noInstanceDefaultProps = !instance.defaultProps; - warning(noInstanceDefaultProps, 'Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name); +var describeComponentFrame = function (name, source, ownerName) { + return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); +}; - if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(type)) { - didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(type); - warning(false, '%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(workInProgress)); - } +// The Symbol used to tag the ReactElement-like types. If there is no native Symbol +// nor polyfill, then a plain number is used for performance. +var hasSymbol = typeof Symbol === 'function' && Symbol['for']; - var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function'; - warning(noInstanceGetDerivedStateFromProps, '%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); - var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromCatch !== 'function'; - warning(noInstanceGetDerivedStateFromCatch, '%s: getDerivedStateFromCatch() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); - var noStaticGetSnapshotBeforeUpdate = typeof type.getSnapshotBeforeUpdate !== 'function'; - warning(noStaticGetSnapshotBeforeUpdate, '%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name); - var _state = instance.state; - if (_state && (typeof _state !== 'object' || isArray(_state))) { - warning(false, '%s.state: must be set to an object or null', name); - } - if (typeof instance.getChildContext === 'function') { - warning(typeof type.childContextTypes === 'object', '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name); - } +var REACT_ELEMENT_TYPE = hasSymbol ? Symbol['for']('react.element') : 0xeac7; +var REACT_CALL_TYPE = hasSymbol ? Symbol['for']('react.call') : 0xeac8; +var REACT_RETURN_TYPE = hasSymbol ? Symbol['for']('react.return') : 0xeac9; +var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca; +var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb; +var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol['for']('react.strict_mode') : 0xeacc; +var REACT_PROVIDER_TYPE = hasSymbol ? Symbol['for']('react.provider') : 0xeacd; +var REACT_CONTEXT_TYPE = hasSymbol ? Symbol['for']('react.context') : 0xeace; +var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol['for']('react.async_mode') : 0xeacf; +var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol['for']('react.forward_ref') : 0xead0; + +var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; +var FAUX_ITERATOR_SYMBOL = '@@iterator'; + +function getIteratorFn(maybeIterable) { + if (maybeIterable === null || typeof maybeIterable === 'undefined') { + return null; + } + var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; + if (typeof maybeIterator === 'function') { + return maybeIterator; + } + return null; +} + +function getComponentName(fiber) { + var type = fiber.type; + + if (typeof type === 'function') { + return type.displayName || type.name; + } + if (typeof type === 'string') { + return type; + } + switch (type) { + case REACT_FRAGMENT_TYPE: + return 'ReactFragment'; + case REACT_PORTAL_TYPE: + return 'ReactPortal'; + case REACT_CALL_TYPE: + return 'ReactCall'; + case REACT_RETURN_TYPE: + return 'ReactReturn'; + } + if (typeof type === 'object' && type !== null) { + switch (type.$$typeof) { + case REACT_FORWARD_REF_TYPE: + var functionName = type.render.displayName || type.render.name || ''; + return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef'; } } + return null; +} - function resetInputPointers(workInProgress, instance) { - instance.props = workInProgress.memoizedProps; - instance.state = workInProgress.memoizedState; +function describeFiber(fiber) { + switch (fiber.tag) { + case IndeterminateComponent: + case FunctionalComponent: + case ClassComponent: + case HostComponent: + var owner = fiber._debugOwner; + var source = fiber._debugSource; + var name = getComponentName(fiber); + var ownerName = null; + if (owner) { + ownerName = getComponentName(owner); + } + return describeComponentFrame(name, source, ownerName); + default: + return ''; } +} - function adoptClassInstance(workInProgress, instance) { - instance.updater = updater; - workInProgress.stateNode = instance; - // The instance needs access to the fiber so that it can schedule updates - set(instance, workInProgress); - { - instance._reactInternalInstance = fakeInternalInstance; +// This function can only be called with a work-in-progress fiber and +// only during begin or complete phase. Do not call it under any other +// circumstances. +function getStackAddendumByWorkInProgressFiber(workInProgress) { + var info = ''; + var node = workInProgress; + do { + info += describeFiber(node); + // Otherwise this return pointer might point to the wrong tree: + node = node['return']; + } while (node); + return info; +} + +function getCurrentFiberOwnerName$1() { + { + var fiber = ReactDebugCurrentFiber.current; + if (fiber === null) { + return null; + } + var owner = fiber._debugOwner; + if (owner !== null && typeof owner !== 'undefined') { + return getComponentName(owner); } } + return null; +} - function constructClassInstance(workInProgress, props) { - var ctor = workInProgress.type; - var unmaskedContext = getUnmaskedContext(workInProgress); - var needsContext = isContextConsumer(workInProgress); - var context = needsContext ? getMaskedContext(workInProgress, unmaskedContext) : emptyObject; - - // Instantiate twice to help detect side-effects. - if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) { - new ctor(props, context); // eslint-disable-line no-new +function getCurrentFiberStackAddendum$1() { + { + var fiber = ReactDebugCurrentFiber.current; + if (fiber === null) { + return null; } + // Safe because if current fiber exists, we are reconciling, + // and it is guaranteed to be the work-in-progress version. + return getStackAddendumByWorkInProgressFiber(fiber); + } + return null; +} - var instance = new ctor(props, context); - var state = instance.state !== null && instance.state !== undefined ? instance.state : null; - adoptClassInstance(workInProgress, instance); +function resetCurrentFiber() { + ReactDebugCurrentFrame.getCurrentStack = null; + ReactDebugCurrentFiber.current = null; + ReactDebugCurrentFiber.phase = null; +} - { - if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) { - var componentName = getComponentName(workInProgress) || 'Component'; - if (!didWarnAboutUninitializedState.has(componentName)) { - didWarnAboutUninitializedState.add(componentName); - warning(false, '%s: Did not properly initialize state during construction. ' + 'Expected state to be an object, but it was %s.', componentName, instance.state === null ? 'null' : 'undefined'); - } - } +function setCurrentFiber(fiber) { + ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackAddendum$1; + ReactDebugCurrentFiber.current = fiber; + ReactDebugCurrentFiber.phase = null; +} - // If new component APIs are defined, "unsafe" lifecycles won't be called. - // Warn about these lifecycles if they are present. - // Don't warn about react-lifecycles-compat polyfilled methods though. - if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') { - var foundWillMountName = null; - var foundWillReceivePropsName = null; - var foundWillUpdateName = null; - if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) { - foundWillMountName = 'componentWillMount'; - } else if (typeof instance.UNSAFE_componentWillMount === 'function') { - foundWillMountName = 'UNSAFE_componentWillMount'; - } - if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) { - foundWillReceivePropsName = 'componentWillReceiveProps'; - } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') { - foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps'; - } - if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) { - foundWillUpdateName = 'componentWillUpdate'; - } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') { - foundWillUpdateName = 'UNSAFE_componentWillUpdate'; - } - if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) { - var _componentName = getComponentName(workInProgress) || 'Component'; - var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()'; - if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) { - didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName); - warning(false, 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-async-component-lifecycle-hooks', _componentName, newApiName, foundWillMountName !== null ? '\n ' + foundWillMountName : '', foundWillReceivePropsName !== null ? '\n ' + foundWillReceivePropsName : '', foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : ''); - } - } - } - } +function setCurrentPhase(phase) { + ReactDebugCurrentFiber.phase = phase; +} - workInProgress.memoizedState = state; +var ReactDebugCurrentFiber = { + current: null, + phase: null, + resetCurrentFiber: resetCurrentFiber, + setCurrentFiber: setCurrentFiber, + setCurrentPhase: setCurrentPhase, + getCurrentFiberOwnerName: getCurrentFiberOwnerName$1, + getCurrentFiberStackAddendum: getCurrentFiberStackAddendum$1 +}; - var partialState = callGetDerivedStateFromProps(workInProgress, instance, props, state); +// A reserved attribute. +// It is handled by React separately and shouldn't be written to the DOM. +var RESERVED = 0; - if (partialState !== null && partialState !== undefined) { - // Render-phase updates (like this) should not be added to the update queue, - // So that multiple render passes do not enqueue multiple updates. - // Instead, just synchronously merge the returned state into the instance. - workInProgress.memoizedState = _assign({}, workInProgress.memoizedState, partialState); - } +// A simple string attribute. +// Attributes that aren't in the whitelist are presumed to have this type. +var STRING = 1; - // Cache unmasked context so we can avoid recreating masked context unless necessary. - // ReactFiberContext usually updates this cache but can't for newly-created instances. - if (needsContext) { - cacheContext(workInProgress, unmaskedContext, context); - } +// A string attribute that accepts booleans in React. In HTML, these are called +// "enumerated" attributes with "true" and "false" as possible values. +// When true, it should be set to a "true" string. +// When false, it should be set to a "false" string. +var BOOLEANISH_STRING = 2; - return instance; - } +// A real boolean attribute. +// When true, it should be present (set either to an empty string or its name). +// When false, it should be omitted. +var BOOLEAN = 3; - function callComponentWillMount(workInProgress, instance) { - startPhaseTimer(workInProgress, 'componentWillMount'); - var oldState = instance.state; +// An attribute that can be used as a flag as well as with a value. +// When true, it should be present (set either to an empty string or its name). +// When false, it should be omitted. +// For any other value, should be present with that value. +var OVERLOADED_BOOLEAN = 4; - if (typeof instance.componentWillMount === 'function') { - instance.componentWillMount(); - } - if (typeof instance.UNSAFE_componentWillMount === 'function') { - instance.UNSAFE_componentWillMount(); - } +// An attribute that must be numeric or parse as a numeric. +// When falsy, it should be removed. +var NUMERIC = 5; - stopPhaseTimer(); +// An attribute that must be positive numeric or parse as a positive numeric. +// When falsy, it should be removed. +var POSITIVE_NUMERIC = 6; - if (oldState !== instance.state) { - { - warning(false, '%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentName(workInProgress) || 'Component'); - } - updater.enqueueReplaceState(instance, instance.state, null); - } +/* eslint-disable max-len */ +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'; +/* eslint-enable max-len */ +var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040'; + + +var ROOT_ATTRIBUTE_NAME = 'data-reactroot'; +var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$'); + +var illegalAttributeNameCache = {}; +var validatedAttributeNameCache = {}; + +function isAttributeNameSafe(attributeName) { + if (validatedAttributeNameCache.hasOwnProperty(attributeName)) { + return true; + } + if (illegalAttributeNameCache.hasOwnProperty(attributeName)) { + return false; + } + if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { + validatedAttributeNameCache[attributeName] = true; + return true; + } + illegalAttributeNameCache[attributeName] = true; + { + warning(false, 'Invalid attribute name: `%s`', attributeName); } + return false; +} - function callComponentWillReceiveProps(workInProgress, instance, newProps, newContext) { - var oldState = instance.state; - startPhaseTimer(workInProgress, 'componentWillReceiveProps'); - if (typeof instance.componentWillReceiveProps === 'function') { - instance.componentWillReceiveProps(newProps, newContext); - } - if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') { - instance.UNSAFE_componentWillReceiveProps(newProps, newContext); - } - stopPhaseTimer(); +function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) { + if (propertyInfo !== null) { + return propertyInfo.type === RESERVED; + } + if (isCustomComponentTag) { + return false; + } + if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) { + return true; + } + return false; +} - if (instance.state !== oldState) { +function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) { + if (propertyInfo !== null && propertyInfo.type === RESERVED) { + return false; + } + switch (typeof value) { + case 'function': + // $FlowIssue symbol is perfectly valid here + case 'symbol': + // eslint-disable-line + return true; + case 'boolean': { - var componentName = getComponentName(workInProgress) || 'Component'; - if (!didWarnAboutStateAssignmentForComponent.has(componentName)) { - didWarnAboutStateAssignmentForComponent.add(componentName); - warning(false, '%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName); + if (isCustomComponentTag) { + return false; + } + if (propertyInfo !== null) { + return !propertyInfo.acceptsBooleans; + } else { + var prefix = name.toLowerCase().slice(0, 5); + return prefix !== 'data-' && prefix !== 'aria-'; } } - updater.enqueueReplaceState(instance, instance.state, null); + default: + return false; + } +} + +function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) { + if (value === null || typeof value === 'undefined') { + return true; + } + if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) { + return true; + } + if (propertyInfo !== null) { + switch (propertyInfo.type) { + case BOOLEAN: + return !value; + case OVERLOADED_BOOLEAN: + return value === false; + case NUMERIC: + return isNaN(value); + case POSITIVE_NUMERIC: + return isNaN(value) || value < 1; } } + return false; +} - function callGetDerivedStateFromProps(workInProgress, instance, nextProps, prevState) { - var type = workInProgress.type; +function getPropertyInfo(name) { + return properties.hasOwnProperty(name) ? properties[name] : null; +} +function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace) { + this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN; + this.attributeName = attributeName; + this.attributeNamespace = attributeNamespace; + this.mustUseProperty = mustUseProperty; + this.propertyName = name; + this.type = type; +} - if (typeof type.getDerivedStateFromProps === 'function') { - if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) { - // Invoke method an extra time to help detect side-effects. - type.getDerivedStateFromProps.call(null, nextProps, prevState); - } +// When adding attributes to this list, be sure to also add them to +// the `possibleStandardNames` module to ensure casing and incorrect +// name warnings. +var properties = {}; - var partialState = type.getDerivedStateFromProps.call(null, nextProps, prevState); +// These props are reserved by React. They shouldn't be written to the DOM. +['children', 'dangerouslySetInnerHTML', +// TODO: This prevents the assignment of defaultValue to regular +// elements (not just inputs). Now that ReactDOMInput assigns to the +// defaultValue property -- do we need this? +'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) { + properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty + name, // attributeName + null); +}); - { - if (partialState === undefined) { - var componentName = getComponentName(workInProgress) || 'Component'; - if (!didWarnAboutUndefinedDerivedState.has(componentName)) { - didWarnAboutUndefinedDerivedState.add(componentName); - warning(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName); - } - } - } +// A few React string attributes have a different name. +// This is a mapping from React prop names to the attribute names. +[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) { + var name = _ref[0], + attributeName = _ref[1]; - return partialState; - } - } + properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty + attributeName, // attributeName + null); +}); - // Invokes the mount life-cycles on a previously never rendered instance. - function mountClassInstance(workInProgress, renderExpirationTime) { - var ctor = workInProgress.type; - var current = workInProgress.alternate; +// These are "enumerated" HTML attributes that accept "true" and "false". +// In React, we let users pass `true` and `false` even though technically +// these aren't boolean attributes (they are coerced to strings). +['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) { + properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty + name.toLowerCase(), // attributeName + null); +}); - { - checkClassInstance(workInProgress); - } +// These are "enumerated" SVG attributes that accept "true" and "false". +// In React, we let users pass `true` and `false` even though technically +// these aren't boolean attributes (they are coerced to strings). +// Since these are SVG attributes, their attribute names are case-sensitive. +['autoReverse', 'externalResourcesRequired', 'preserveAlpha'].forEach(function (name) { + properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty + name, // attributeName + null); +}); - var instance = workInProgress.stateNode; - var props = workInProgress.pendingProps; - var unmaskedContext = getUnmaskedContext(workInProgress); +// These are HTML boolean attributes. +['allowFullScreen', 'async', +// Note: there is a special case that prevents it from being written to the DOM +// on the client side because the browsers are inconsistent. Instead we call focus(). +'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', +// Microdata +'itemScope'].forEach(function (name) { + properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty + name.toLowerCase(), // attributeName + null); +}); - instance.props = props; - instance.state = workInProgress.memoizedState; - instance.refs = emptyObject; - instance.context = getMaskedContext(workInProgress, unmaskedContext); +// These are the few React props that we set as DOM properties +// rather than attributes. These are all booleans. +['checked', +// Note: `option.selected` is not updated if `select.multiple` is +// disabled with `removeAttribute`. We have special logic for handling this. +'multiple', 'muted', 'selected'].forEach(function (name) { + properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty + name.toLowerCase(), // attributeName + null); +}); - { - if (workInProgress.mode & StrictMode) { - ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance); - } +// These are HTML attributes that are "overloaded booleans": they behave like +// booleans, but can also accept a string value. +['capture', 'download'].forEach(function (name) { + properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty + name.toLowerCase(), // attributeName + null); +}); - if (warnAboutDeprecatedLifecycles) { - ReactStrictModeWarnings.recordDeprecationWarnings(workInProgress, instance); - } - } +// These are HTML attributes that must be positive numbers. +['cols', 'rows', 'size', 'span'].forEach(function (name) { + properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty + name.toLowerCase(), // attributeName + null); +}); - // In order to support react-lifecycles-compat polyfilled components, - // Unsafe lifecycles should not be invoked for components using the new APIs. - if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) { - callComponentWillMount(workInProgress, instance); - // If we had additional state updates during this life-cycle, let's - // process them now. - var updateQueue = workInProgress.updateQueue; - if (updateQueue !== null) { - instance.state = processUpdateQueue(current, workInProgress, updateQueue, instance, props, renderExpirationTime); - } - } - if (typeof instance.componentDidMount === 'function') { - workInProgress.effectTag |= Update; - } - } +// These are HTML attributes that must be numbers. +['rowSpan', 'start'].forEach(function (name) { + properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty + name.toLowerCase(), // attributeName + null); +}); - function resumeMountClassInstance(workInProgress, renderExpirationTime) { - var ctor = workInProgress.type; - var instance = workInProgress.stateNode; - resetInputPointers(workInProgress, instance); +var CAMELIZE = /[\-\:]([a-z])/g; +var capitalize = function (token) { + return token[1].toUpperCase(); +}; - var oldProps = workInProgress.memoizedProps; - var newProps = workInProgress.pendingProps; - var oldContext = instance.context; - var newUnmaskedContext = getUnmaskedContext(workInProgress); - var newContext = getMaskedContext(workInProgress, newUnmaskedContext); +// This is a list of all SVG attributes that need special casing, namespacing, +// or boolean value assignment. Regular attributes that just accept strings +// and have the same names are omitted, just like in the HTML whitelist. +// Some of these attributes can be hard to find. This list was created by +// scrapping the MDN documentation. +['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (attributeName) { + var name = attributeName.replace(CAMELIZE, capitalize); + properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty + attributeName, null); +}); - var hasNewLifecycles = typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; +// String SVG attributes with the xlink namespace. +['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) { + var name = attributeName.replace(CAMELIZE, capitalize); + properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty + attributeName, 'http://www.w3.org/1999/xlink'); +}); - // Note: During these life-cycles, instance.props/instance.state are what - // ever the previously attempted to render - not the "current". However, - // during componentDidUpdate we pass the "current" props. +// String SVG attributes with the xml namespace. +['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) { + var name = attributeName.replace(CAMELIZE, capitalize); + properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty + attributeName, 'http://www.w3.org/XML/1998/namespace'); +}); - // In order to support react-lifecycles-compat polyfilled components, - // Unsafe lifecycles should not be invoked for components using the new APIs. - if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { - if (oldProps !== newProps || oldContext !== newContext) { - callComponentWillReceiveProps(workInProgress, instance, newProps, newContext); - } - } +// Special case: this attribute exists both in HTML and SVG. +// Its "tabindex" attribute name is case-sensitive in SVG so we can't just use +// its React `tabIndex` name, like we do for attributes that exist only in HTML. +properties.tabIndex = new PropertyInfoRecord('tabIndex', STRING, false, // mustUseProperty +'tabindex', // attributeName +null); - // Compute the next state using the memoized state and the update queue. - var oldState = workInProgress.memoizedState; - // TODO: Previous state can be null. - var newState = void 0; - var derivedStateFromCatch = void 0; - if (workInProgress.updateQueue !== null) { - newState = processUpdateQueue(null, workInProgress, workInProgress.updateQueue, instance, newProps, renderExpirationTime); +/** + * Get the value for a property on a node. Only used in DEV for SSR validation. + * The "expected" argument is used as a hint of what the expected value is. + * Some properties have multiple equivalent values. + */ +function getValueForProperty(node, name, expected, propertyInfo) { + { + if (propertyInfo.mustUseProperty) { + var propertyName = propertyInfo.propertyName; - var updateQueue = workInProgress.updateQueue; - if (updateQueue !== null && updateQueue.capturedValues !== null && enableGetDerivedStateFromCatch && typeof ctor.getDerivedStateFromCatch === 'function') { - var capturedValues = updateQueue.capturedValues; - // Don't remove these from the update queue yet. We need them in - // finishClassComponent. Do the reset there. - // TODO: This is awkward. Refactor class components. - // updateQueue.capturedValues = null; - derivedStateFromCatch = callGetDerivedStateFromCatch(ctor, capturedValues); - } + return node[propertyName]; } else { - newState = oldState; - } + var attributeName = propertyInfo.attributeName; - var derivedStateFromProps = void 0; - if (oldProps !== newProps) { - // The prevState parameter should be the partially updated state. - // Otherwise, spreading state in return values could override updates. - derivedStateFromProps = callGetDerivedStateFromProps(workInProgress, instance, newProps, newState); - } + var stringValue = null; - if (derivedStateFromProps !== null && derivedStateFromProps !== undefined) { - // Render-phase updates (like this) should not be added to the update queue, - // So that multiple render passes do not enqueue multiple updates. - // Instead, just synchronously merge the returned state into the instance. - newState = newState === null || newState === undefined ? derivedStateFromProps : _assign({}, newState, derivedStateFromProps); + if (propertyInfo.type === OVERLOADED_BOOLEAN) { + if (node.hasAttribute(attributeName)) { + var value = node.getAttribute(attributeName); + if (value === '') { + return true; + } + if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { + return value; + } + if (value === '' + expected) { + return expected; + } + return value; + } + } else if (node.hasAttribute(attributeName)) { + if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { + // We had an attribute but shouldn't have had one, so read it + // for the error message. + return node.getAttribute(attributeName); + } + if (propertyInfo.type === BOOLEAN) { + // If this was a boolean, it doesn't matter what the value is + // the fact that we have it is the same as the expected. + return expected; + } + // Even if this property uses a namespace we use getAttribute + // because we assume its namespaced name is the same as our config. + // To use getAttributeNS we need the local name which we don't have + // in our config atm. + stringValue = node.getAttribute(attributeName); + } - // Update the base state of the update queue. - // FIXME: This is getting ridiculous. Refactor plz! - var _updateQueue = workInProgress.updateQueue; - if (_updateQueue !== null) { - _updateQueue.baseState = _assign({}, _updateQueue.baseState, derivedStateFromProps); + if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { + return stringValue === null ? expected : stringValue; + } else if (stringValue === '' + expected) { + return expected; + } else { + return stringValue; } } - if (derivedStateFromCatch !== null && derivedStateFromCatch !== undefined) { - // Render-phase updates (like this) should not be added to the update queue, - // So that multiple render passes do not enqueue multiple updates. - // Instead, just synchronously merge the returned state into the instance. - newState = newState === null || newState === undefined ? derivedStateFromCatch : _assign({}, newState, derivedStateFromCatch); + } +} - // Update the base state of the update queue. - // FIXME: This is getting ridiculous. Refactor plz! - var _updateQueue2 = workInProgress.updateQueue; - if (_updateQueue2 !== null) { - _updateQueue2.baseState = _assign({}, _updateQueue2.baseState, derivedStateFromCatch); - } +/** + * Get the value for a attribute on a node. Only used in DEV for SSR validation. + * The third argument is used as a hint of what the expected value is. Some + * attributes have multiple equivalent values. + */ +function getValueForAttribute(node, name, expected) { + { + if (!isAttributeNameSafe(name)) { + return; } - - if (oldProps === newProps && oldState === newState && !hasContextChanged() && !(workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate)) { - // If an update was already in progress, we should schedule an Update - // effect even though we're bailing out, so that cWU/cDU are called. - if (typeof instance.componentDidMount === 'function') { - workInProgress.effectTag |= Update; - } - return false; + if (!node.hasAttribute(name)) { + return expected === undefined ? undefined : null; } - - var shouldUpdate = checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext); - - if (shouldUpdate) { - // In order to support react-lifecycles-compat polyfilled components, - // Unsafe lifecycles should not be invoked for components using the new APIs. - if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) { - startPhaseTimer(workInProgress, 'componentWillMount'); - if (typeof instance.componentWillMount === 'function') { - instance.componentWillMount(); - } - if (typeof instance.UNSAFE_componentWillMount === 'function') { - instance.UNSAFE_componentWillMount(); - } - stopPhaseTimer(); - } - if (typeof instance.componentDidMount === 'function') { - workInProgress.effectTag |= Update; - } - } else { - // If an update was already in progress, we should schedule an Update - // effect even though we're bailing out, so that cWU/cDU are called. - if (typeof instance.componentDidMount === 'function') { - workInProgress.effectTag |= Update; - } - - // If shouldComponentUpdate returned false, we should still update the - // memoized props/state to indicate that this work can be reused. - memoizeProps(workInProgress, newProps); - memoizeState(workInProgress, newState); + var value = node.getAttribute(name); + if (value === '' + expected) { + return expected; } - - // Update the existing instance's state, props, and context pointers even - // if shouldComponentUpdate returns false. - instance.props = newProps; - instance.state = newState; - instance.context = newContext; - - return shouldUpdate; + return value; } +} - // Invokes the update life-cycles and returns false if it shouldn't rerender. - function updateClassInstance(current, workInProgress, renderExpirationTime) { - var ctor = workInProgress.type; - var instance = workInProgress.stateNode; - resetInputPointers(workInProgress, instance); - - var oldProps = workInProgress.memoizedProps; - var newProps = workInProgress.pendingProps; - var oldContext = instance.context; - var newUnmaskedContext = getUnmaskedContext(workInProgress); - var newContext = getMaskedContext(workInProgress, newUnmaskedContext); - - var hasNewLifecycles = typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; - - // Note: During these life-cycles, instance.props/instance.state are what - // ever the previously attempted to render - not the "current". However, - // during componentDidUpdate we pass the "current" props. - - // In order to support react-lifecycles-compat polyfilled components, - // Unsafe lifecycles should not be invoked for components using the new APIs. - if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { - if (oldProps !== newProps || oldContext !== newContext) { - callComponentWillReceiveProps(workInProgress, instance, newProps, newContext); +/** + * Sets the value for a property on a node. + * + * @param {DOMElement} node + * @param {string} name + * @param {*} value + */ +function setValueForProperty(node, name, value, isCustomComponentTag) { + var propertyInfo = getPropertyInfo(name); + if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) { + return; + } + if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) { + value = null; + } + // If the prop isn't in the special list, treat it as a simple attribute. + if (isCustomComponentTag || propertyInfo === null) { + if (isAttributeNameSafe(name)) { + var _attributeName = name; + if (value === null) { + node.removeAttribute(_attributeName); + } else { + node.setAttribute(_attributeName, '' + value); } } + return; + } + var mustUseProperty = propertyInfo.mustUseProperty; - // Compute the next state using the memoized state and the update queue. - var oldState = workInProgress.memoizedState; - // TODO: Previous state can be null. - var newState = void 0; - var derivedStateFromCatch = void 0; + if (mustUseProperty) { + var propertyName = propertyInfo.propertyName; - if (workInProgress.updateQueue !== null) { - newState = processUpdateQueue(current, workInProgress, workInProgress.updateQueue, instance, newProps, renderExpirationTime); + if (value === null) { + var type = propertyInfo.type; - var updateQueue = workInProgress.updateQueue; - if (updateQueue !== null && updateQueue.capturedValues !== null && enableGetDerivedStateFromCatch && typeof ctor.getDerivedStateFromCatch === 'function') { - var capturedValues = updateQueue.capturedValues; - // Don't remove these from the update queue yet. We need them in - // finishClassComponent. Do the reset there. - // TODO: This is awkward. Refactor class components. - // updateQueue.capturedValues = null; - derivedStateFromCatch = callGetDerivedStateFromCatch(ctor, capturedValues); - } + node[propertyName] = type === BOOLEAN ? false : ''; } else { - newState = oldState; - } - - var derivedStateFromProps = void 0; - if (oldProps !== newProps) { - // The prevState parameter should be the partially updated state. - // Otherwise, spreading state in return values could override updates. - derivedStateFromProps = callGetDerivedStateFromProps(workInProgress, instance, newProps, newState); + // Contrary to `setAttribute`, object properties are properly + // `toString`ed by IE8/9. + node[propertyName] = value; } + return; + } + // The rest are treated as attributes with special cases. + var attributeName = propertyInfo.attributeName, + attributeNamespace = propertyInfo.attributeNamespace; - if (derivedStateFromProps !== null && derivedStateFromProps !== undefined) { - // Render-phase updates (like this) should not be added to the update queue, - // So that multiple render passes do not enqueue multiple updates. - // Instead, just synchronously merge the returned state into the instance. - newState = newState === null || newState === undefined ? derivedStateFromProps : _assign({}, newState, derivedStateFromProps); + if (value === null) { + node.removeAttribute(attributeName); + } else { + var _type = propertyInfo.type; - // Update the base state of the update queue. - // FIXME: This is getting ridiculous. Refactor plz! - var _updateQueue3 = workInProgress.updateQueue; - if (_updateQueue3 !== null) { - _updateQueue3.baseState = _assign({}, _updateQueue3.baseState, derivedStateFromProps); - } + var attributeValue = void 0; + if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) { + attributeValue = ''; + } else { + // `setAttribute` with objects becomes only `[object]` in IE8/9, + // ('' + value) makes it output the correct toString()-value. + attributeValue = '' + value; } - if (derivedStateFromCatch !== null && derivedStateFromCatch !== undefined) { - // Render-phase updates (like this) should not be added to the update queue, - // So that multiple render passes do not enqueue multiple updates. - // Instead, just synchronously merge the returned state into the instance. - newState = newState === null || newState === undefined ? derivedStateFromCatch : _assign({}, newState, derivedStateFromCatch); - - // Update the base state of the update queue. - // FIXME: This is getting ridiculous. Refactor plz! - var _updateQueue4 = workInProgress.updateQueue; - if (_updateQueue4 !== null) { - _updateQueue4.baseState = _assign({}, _updateQueue4.baseState, derivedStateFromCatch); - } + if (attributeNamespace) { + node.setAttributeNS(attributeNamespace, attributeName, attributeValue); + } else { + node.setAttribute(attributeName, attributeValue); } + } +} - if (oldProps === newProps && oldState === newState && !hasContextChanged() && !(workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate)) { - // If an update was already in progress, we should schedule an Update - // effect even though we're bailing out, so that cWU/cDU are called. - if (typeof instance.componentDidUpdate === 'function') { - if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) { - workInProgress.effectTag |= Update; - } - } - if (typeof instance.getSnapshotBeforeUpdate === 'function') { - if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) { - workInProgress.effectTag |= Snapshot; - } - } - return false; - } +var ReactControlledValuePropTypes = { + checkPropTypes: null +}; - var shouldUpdate = checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext); +{ + var hasReadOnlyValue = { + button: true, + checkbox: true, + image: true, + hidden: true, + radio: true, + reset: true, + submit: true + }; - if (shouldUpdate) { - // In order to support react-lifecycles-compat polyfilled components, - // Unsafe lifecycles should not be invoked for components using the new APIs. - if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) { - startPhaseTimer(workInProgress, 'componentWillUpdate'); - if (typeof instance.componentWillUpdate === 'function') { - instance.componentWillUpdate(newProps, newState, newContext); - } - if (typeof instance.UNSAFE_componentWillUpdate === 'function') { - instance.UNSAFE_componentWillUpdate(newProps, newState, newContext); - } - stopPhaseTimer(); - } - if (typeof instance.componentDidUpdate === 'function') { - workInProgress.effectTag |= Update; - } - if (typeof instance.getSnapshotBeforeUpdate === 'function') { - workInProgress.effectTag |= Snapshot; - } - } else { - // If an update was already in progress, we should schedule an Update - // effect even though we're bailing out, so that cWU/cDU are called. - if (typeof instance.componentDidUpdate === 'function') { - if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) { - workInProgress.effectTag |= Update; - } + var propTypes = { + value: function (props, propName, componentName) { + if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) { + return null; } - if (typeof instance.getSnapshotBeforeUpdate === 'function') { - if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) { - workInProgress.effectTag |= Snapshot; - } + 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`.'); + }, + checked: function (props, propName, componentName) { + if (!props[propName] || props.onChange || props.readOnly || props.disabled) { + return null; } - - // If shouldComponentUpdate returned false, we should still update the - // memoized props/state to indicate that this work can be reused. - memoizeProps(workInProgress, newProps); - memoizeState(workInProgress, newState); + 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`.'); } - - // Update the existing instance's state, props, and context pointers even - // if shouldComponentUpdate returns false. - instance.props = newProps; - instance.state = newState; - instance.context = newContext; - - return shouldUpdate; - } - - return { - adoptClassInstance: adoptClassInstance, - callGetDerivedStateFromProps: callGetDerivedStateFromProps, - constructClassInstance: constructClassInstance, - mountClassInstance: mountClassInstance, - resumeMountClassInstance: resumeMountClassInstance, - updateClassInstance: updateClassInstance }; -}; -var getCurrentFiberStackAddendum$2 = ReactDebugCurrentFiber.getCurrentFiberStackAddendum; + /** + * Provide a linked `value` attribute for controlled forms. You should not use + * this outside of the ReactDOM controlled form components. + */ + ReactControlledValuePropTypes.checkPropTypes = function (tagName, props, getStack) { + checkPropTypes(propTypes, props, 'prop', tagName, getStack); + }; +} +// TODO: direct imports like some-package/src/* are bad. Fix me. +var getCurrentFiberOwnerName = ReactDebugCurrentFiber.getCurrentFiberOwnerName; +var getCurrentFiberStackAddendum = ReactDebugCurrentFiber.getCurrentFiberStackAddendum; -var didWarnAboutMaps = void 0; -var didWarnAboutStringRefInStrictMode = void 0; -var ownerHasKeyUseWarning = void 0; -var ownerHasFunctionTypeWarning = void 0; -var warnForMissingKey = function (child) {}; +var didWarnValueDefaultValue = false; +var didWarnCheckedDefaultChecked = false; +var didWarnControlledToUncontrolled = false; +var didWarnUncontrolledToControlled = false; -{ - didWarnAboutMaps = false; - didWarnAboutStringRefInStrictMode = {}; +function isControlled(props) { + var usesChecked = props.type === 'checkbox' || props.type === 'radio'; + return usesChecked ? props.checked != null : props.value != null; +} - /** - * Warn if there's no key explicitly set on dynamic arrays of children or - * object keys are not valid. This allows us to keep track of children between - * updates. - */ - ownerHasKeyUseWarning = {}; - ownerHasFunctionTypeWarning = {}; +/** + * Implements an host component that allows setting these optional + * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. + * + * If `checked` or `value` are not supplied (or null/undefined), user actions + * that affect the checked state or value will trigger updates to the element. + * + * If they are supplied (and not null/undefined), the rendered element will not + * trigger updates to the element. Instead, the props must change in order for + * the rendered element to be updated. + * + * The rendered element will be initialized as unchecked (or `defaultChecked`) + * with an empty value (or `defaultValue`). + * + * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html + */ - warnForMissingKey = function (child) { - if (child === null || typeof child !== 'object') { - return; - } - if (!child._store || child._store.validated || child.key != null) { - return; - } - !(typeof child._store === 'object') ? invariant(false, 'React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.') : void 0; - child._store.validated = true; +function getHostProps(element, props) { + var node = element; + var checked = props.checked; - var currentComponentErrorInfo = 'Each child in an array or iterator should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + (getCurrentFiberStackAddendum$2() || ''); - if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { - return; - } - ownerHasKeyUseWarning[currentComponentErrorInfo] = true; + var hostProps = _assign({}, props, { + defaultChecked: undefined, + defaultValue: undefined, + value: undefined, + checked: checked != null ? checked : node._wrapperState.initialChecked + }); - warning(false, 'Each child in an array or iterator should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.%s', getCurrentFiberStackAddendum$2()); - }; + return hostProps; } -var isArray$1 = Array.isArray; +function initWrapperState(element, props) { + { + ReactControlledValuePropTypes.checkPropTypes('input', props, getCurrentFiberStackAddendum); -function coerceRef(returnFiber, current, element) { - var mixedRef = element.ref; - if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') { - { - if (returnFiber.mode & StrictMode) { - var componentName = getComponentName(returnFiber) || 'Component'; - if (!didWarnAboutStringRefInStrictMode[componentName]) { - warning(false, 'A string ref, "%s", has been found within a strict mode tree. ' + 'String refs are a source of potential bugs and should be avoided. ' + 'We recommend using createRef() instead.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-string-ref', mixedRef, getStackAddendumByWorkInProgressFiber(returnFiber)); - didWarnAboutStringRefInStrictMode[componentName] = true; - } - } + if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) { + 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', getCurrentFiberOwnerName() || 'A component', props.type); + didWarnCheckedDefaultChecked = true; } - - if (element._owner) { - var owner = element._owner; - var inst = void 0; - if (owner) { - var ownerFiber = owner; - !(ownerFiber.tag === ClassComponent) ? invariant(false, 'Stateless function components cannot have refs.') : void 0; - inst = ownerFiber.stateNode; - } - !inst ? invariant(false, 'Missing owner for string ref %s. This error is likely caused by a bug in React. Please file an issue.', mixedRef) : void 0; - var stringRef = '' + mixedRef; - // Check if previous string ref matches new string ref - if (current !== null && current.ref !== null && current.ref._stringRef === stringRef) { - return current.ref; - } - var ref = function (value) { - var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs; - if (value === null) { - delete refs[stringRef]; - } else { - refs[stringRef] = value; - } - }; - ref._stringRef = stringRef; - return ref; - } else { - !(typeof mixedRef === 'string') ? invariant(false, 'Expected ref to be a function or a string.') : void 0; - !element._owner ? invariant(false, 'Element ref was specified as a string (%s) but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a functional component\n2. You may be adding a ref to a component that was not created inside a component\'s render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information.', mixedRef) : void 0; + if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { + 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', getCurrentFiberOwnerName() || 'A component', props.type); + didWarnValueDefaultValue = true; } } - return mixedRef; -} -function throwOnInvalidObjectType(returnFiber, newChild) { - if (returnFiber.type !== 'textarea') { - var addendum = ''; - { - addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + (getCurrentFiberStackAddendum$2() || ''); - } - invariant(false, 'Objects are not valid as a React child (found: %s).%s', Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild, addendum); - } -} + var node = element; + var defaultValue = props.defaultValue == null ? '' : props.defaultValue; -function warnOnFunctionType() { - var currentComponentErrorInfo = 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of from render. ' + 'Or maybe you meant to call this function rather than return it.' + (getCurrentFiberStackAddendum$2() || ''); + node._wrapperState = { + initialChecked: props.checked != null ? props.checked : props.defaultChecked, + initialValue: getSafeValue(props.value != null ? props.value : defaultValue), + controlled: isControlled(props) + }; +} - if (ownerHasFunctionTypeWarning[currentComponentErrorInfo]) { - return; +function updateChecked(element, props) { + var node = element; + var checked = props.checked; + if (checked != null) { + setValueForProperty(node, 'checked', checked, false); } - ownerHasFunctionTypeWarning[currentComponentErrorInfo] = true; - - warning(false, 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of from render. ' + 'Or maybe you meant to call this function rather than return it.%s', getCurrentFiberStackAddendum$2() || ''); } -// This wrapper function exists because I expect to clone the code in each path -// to be able to optimize each path individually by branching early. This needs -// a compiler or we can do it manually. Helpers that don't need this branching -// live outside of this function. -function ChildReconciler(shouldTrackSideEffects) { - function deleteChild(returnFiber, childToDelete) { - if (!shouldTrackSideEffects) { - // Noop. - return; - } - // Deletions are added in reversed order so we add it to the front. - // At this point, the return fiber's effect list is empty except for - // deletions, so we can just append the deletion to the list. The remaining - // effects aren't added until the complete phase. Once we implement - // resuming, this may not be true. - var last = returnFiber.lastEffect; - if (last !== null) { - last.nextEffect = childToDelete; - returnFiber.lastEffect = childToDelete; - } else { - returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; - } - childToDelete.nextEffect = null; - childToDelete.effectTag = Deletion; - } +function updateWrapper(element, props) { + var node = element; + { + var _controlled = isControlled(props); - function deleteRemainingChildren(returnFiber, currentFirstChild) { - if (!shouldTrackSideEffects) { - // Noop. - return null; + if (!node._wrapperState.controlled && _controlled && !didWarnUncontrolledToControlled) { + warning(false, 'A component 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%s', props.type, getCurrentFiberStackAddendum()); + didWarnUncontrolledToControlled = true; } - - // TODO: For the shouldClone case, this could be micro-optimized a bit by - // assuming that after the first child we've already added everything. - var childToDelete = currentFirstChild; - while (childToDelete !== null) { - deleteChild(returnFiber, childToDelete); - childToDelete = childToDelete.sibling; + if (node._wrapperState.controlled && !_controlled && !didWarnControlledToUncontrolled) { + warning(false, 'A component 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%s', props.type, getCurrentFiberStackAddendum()); + didWarnControlledToUncontrolled = true; } - return null; } - function mapRemainingChildren(returnFiber, currentFirstChild) { - // Add the remaining children to a temporary map so that we can find them by - // keys quickly. Implicit (null) keys get added to this set with their index - var existingChildren = new Map(); + updateChecked(element, props); - var existingChild = currentFirstChild; - while (existingChild !== null) { - if (existingChild.key !== null) { - existingChildren.set(existingChild.key, existingChild); - } else { - existingChildren.set(existingChild.index, existingChild); + var value = getSafeValue(props.value); + + if (value != null) { + if (props.type === 'number') { + if (value === 0 && node.value === '' || + // eslint-disable-next-line + node.value != value) { + node.value = '' + value; } - existingChild = existingChild.sibling; + } else if (node.value !== '' + value) { + node.value = '' + value; } - return existingChildren; } - function useFiber(fiber, pendingProps, expirationTime) { - // We currently set sibling to null and index to 0 here because it is easy - // to forget to do before returning it. E.g. for the single child case. - var clone = createWorkInProgress(fiber, pendingProps, expirationTime); - clone.index = 0; - clone.sibling = null; - return clone; + if (props.hasOwnProperty('value')) { + setDefaultValue(node, props.type, value); + } else if (props.hasOwnProperty('defaultValue')) { + setDefaultValue(node, props.type, getSafeValue(props.defaultValue)); } - function placeChild(newFiber, lastPlacedIndex, newIndex) { - newFiber.index = newIndex; - if (!shouldTrackSideEffects) { - // Noop. - return lastPlacedIndex; - } - var current = newFiber.alternate; - if (current !== null) { - var oldIndex = current.index; - if (oldIndex < lastPlacedIndex) { - // This is a move. - newFiber.effectTag = Placement; - return lastPlacedIndex; - } else { - // This item can stay in place. - return oldIndex; - } - } else { - // This is an insertion. - newFiber.effectTag = Placement; - return lastPlacedIndex; - } + if (props.checked == null && props.defaultChecked != null) { + node.defaultChecked = !!props.defaultChecked; } +} - function placeSingleChild(newFiber) { - // This is simpler for the single child case. We only need to do a - // placement for inserting new children. - if (shouldTrackSideEffects && newFiber.alternate === null) { - newFiber.effectTag = Placement; - } - return newFiber; - } +function postMountWrapper(element, props) { + var node = element; - function updateTextNode(returnFiber, current, textContent, expirationTime) { - if (current === null || current.tag !== HostText) { - // Insert - var created = createFiberFromText(textContent, returnFiber.mode, expirationTime); - created['return'] = returnFiber; - return created; - } else { - // Update - var existing = useFiber(current, textContent, expirationTime); - existing['return'] = returnFiber; - return existing; + if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) { + // Do not assign value if it is already set. This prevents user text input + // from being lost during SSR hydration. + if (node.value === '') { + node.value = '' + node._wrapperState.initialValue; } - } - function updateElement(returnFiber, current, element, expirationTime) { - if (current !== null && current.type === element.type) { - // Move based on index - var existing = useFiber(current, element.props, expirationTime); - existing.ref = coerceRef(returnFiber, current, element); - existing['return'] = returnFiber; - { - existing._debugSource = element._source; - existing._debugOwner = element._owner; - } - return existing; - } else { - // Insert - var created = createFiberFromElement(element, returnFiber.mode, expirationTime); - created.ref = coerceRef(returnFiber, current, element); - created['return'] = returnFiber; - return created; - } + // value must be assigned before defaultValue. This fixes an issue where the + // visually displayed value of date inputs disappears on mobile Safari and Chrome: + // https://github.com/facebook/react/issues/7233 + node.defaultValue = '' + node._wrapperState.initialValue; } - function updatePortal(returnFiber, current, portal, expirationTime) { - if (current === null || current.tag !== HostPortal || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) { - // Insert - var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime); - created['return'] = returnFiber; - return created; - } else { - // Update - var existing = useFiber(current, portal.children || [], expirationTime); - existing['return'] = returnFiber; - return existing; - } + // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug + // this is needed to work around a chrome bug where setting defaultChecked + // will sometimes influence the value of checked (even after detachment). + // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416 + // We need to temporarily unset name to avoid disrupting radio button groups. + var name = node.name; + if (name !== '') { + node.name = ''; } - - function updateFragment(returnFiber, current, fragment, expirationTime, key) { - if (current === null || current.tag !== Fragment) { - // Insert - var created = createFiberFromFragment(fragment, returnFiber.mode, expirationTime, key); - created['return'] = returnFiber; - return created; - } else { - // Update - var existing = useFiber(current, fragment, expirationTime); - existing['return'] = returnFiber; - return existing; - } + node.defaultChecked = !node.defaultChecked; + node.defaultChecked = !node.defaultChecked; + if (name !== '') { + node.name = name; } +} - function createChild(returnFiber, newChild, expirationTime) { - if (typeof newChild === 'string' || typeof newChild === 'number') { - // Text nodes don't have keys. If the previous node is implicitly keyed - // we can continue to replace it without aborting even if it is not a text - // node. - var created = createFiberFromText('' + newChild, returnFiber.mode, expirationTime); - created['return'] = returnFiber; - return created; +function restoreControlledState(element, props) { + var node = element; + updateWrapper(node, props); + updateNamedCousins(node, props); +} + +function updateNamedCousins(rootNode, props) { + var name = props.name; + if (props.type === 'radio' && name != null) { + var queryRoot = rootNode; + + while (queryRoot.parentNode) { + queryRoot = queryRoot.parentNode; } - if (typeof newChild === 'object' && newChild !== null) { - switch (newChild.$$typeof) { - case REACT_ELEMENT_TYPE: - { - var _created = createFiberFromElement(newChild, returnFiber.mode, expirationTime); - _created.ref = coerceRef(returnFiber, null, newChild); - _created['return'] = returnFiber; - return _created; - } - case REACT_PORTAL_TYPE: - { - var _created2 = createFiberFromPortal(newChild, returnFiber.mode, expirationTime); - _created2['return'] = returnFiber; - return _created2; - } - } + // If `rootNode.form` was non-null, then we could try `form.elements`, + // but that sometimes behaves strangely in IE8. We could also try using + // `form.getElementsByName`, but that will only return direct children + // and won't include inputs that use the HTML5 `form=` attribute. Since + // the input might not even be in a form. It might not even be in the + // document. Let's just use the local `querySelectorAll` to ensure we don't + // miss anything. + var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]'); - if (isArray$1(newChild) || getIteratorFn(newChild)) { - var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null); - _created3['return'] = returnFiber; - return _created3; + for (var i = 0; i < group.length; i++) { + var otherNode = group[i]; + if (otherNode === rootNode || otherNode.form !== rootNode.form) { + continue; } + // This will throw if radio buttons rendered by different copies of React + // and the same name are rendered into the same form (same as #1939). + // That's probably okay; we don't support it just as we don't support + // mixing React radio buttons with non-React ones. + var otherProps = getFiberCurrentPropsFromNode$1(otherNode); + !otherProps ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : void 0; - throwOnInvalidObjectType(returnFiber, newChild); - } + // We need update the tracked value on the named cousin since the value + // was changed but the input saw no event or value set + updateValueIfChanged(otherNode); - { - if (typeof newChild === 'function') { - warnOnFunctionType(); - } + // If this is a controlled radio button group, forcing the input that + // was previously checked to update will cause it to be come re-checked + // as appropriate. + updateWrapper(otherNode, otherProps); } - - return null; } +} - function updateSlot(returnFiber, oldFiber, newChild, expirationTime) { - // Update the fiber if the keys match, otherwise return null. +// In Chrome, assigning defaultValue to certain input types triggers input validation. +// For number inputs, the display value loses trailing decimal points. For email inputs, +// Chrome raises "The specified value is not a valid email address". +// +// Here we check to see if the defaultValue has actually changed, avoiding these problems +// when the user is inputting text +// +// https://github.com/facebook/react/issues/7253 +function setDefaultValue(node, type, value) { + if ( + // Focused number inputs synchronize on blur. See ChangeEventPlugin.js + type !== 'number' || node.ownerDocument.activeElement !== node) { + if (value == null) { + node.defaultValue = '' + node._wrapperState.initialValue; + } else if (node.defaultValue !== '' + value) { + node.defaultValue = '' + value; + } + } +} - var key = oldFiber !== null ? oldFiber.key : null; +function getSafeValue(value) { + switch (typeof value) { + case 'boolean': + case 'number': + case 'object': + case 'string': + case 'undefined': + return value; + default: + // function, symbol are assigned as empty strings + return ''; + } +} - if (typeof newChild === 'string' || typeof newChild === 'number') { - // Text nodes don't have keys. If the previous node is implicitly keyed - // we can continue to replace it without aborting even if it is not a text - // node. - if (key !== null) { - return null; - } - return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime); - } +var eventTypes$1 = { + change: { + phasedRegistrationNames: { + bubbled: 'onChange', + captured: 'onChangeCapture' + }, + dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange'] + } +}; - if (typeof newChild === 'object' && newChild !== null) { - switch (newChild.$$typeof) { - case REACT_ELEMENT_TYPE: - { - if (newChild.key === key) { - if (newChild.type === REACT_FRAGMENT_TYPE) { - return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key); - } - return updateElement(returnFiber, oldFiber, newChild, expirationTime); - } else { - return null; - } - } - case REACT_PORTAL_TYPE: - { - if (newChild.key === key) { - return updatePortal(returnFiber, oldFiber, newChild, expirationTime); - } else { - return null; - } - } - } +function createAndAccumulateChangeEvent(inst, nativeEvent, target) { + var event = SyntheticEvent$1.getPooled(eventTypes$1.change, inst, nativeEvent, target); + event.type = 'change'; + // Flag this event loop as needing state restore. + enqueueStateRestore(target); + accumulateTwoPhaseDispatches(event); + return event; +} +/** + * For IE shims + */ +var activeElement = null; +var activeElementInst = null; - if (isArray$1(newChild) || getIteratorFn(newChild)) { - if (key !== null) { - return null; - } +/** + * SECTION: handle `change` event + */ +function shouldUseChangeEvent(elem) { + var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); + return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; +} - return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null); - } +function manualDispatchChangeEvent(nativeEvent) { + var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent)); - throwOnInvalidObjectType(returnFiber, newChild); - } + // If change and propertychange bubbled, we'd just bind to it like all the + // other events and have it go through ReactBrowserEventEmitter. Since it + // doesn't, we manually listen for the events and so we have to enqueue and + // process the abstract event manually. + // + // Batching is necessary here in order to ensure that all event handlers run + // before the next rerender (including event handlers attached to ancestor + // elements instead of directly on the input). Without this, controlled + // components don't work properly in conjunction with event bubbling because + // the component is rerendered and the value reverted before all the event + // handlers can run. See https://github.com/facebook/react/issues/708. + batchedUpdates(runEventInBatch, event); +} - { - if (typeof newChild === 'function') { - warnOnFunctionType(); - } - } +function runEventInBatch(event) { + runEventsInBatch(event, false); +} - return null; +function getInstIfValueChanged(targetInst) { + var targetNode = getNodeFromInstance$1(targetInst); + if (updateValueIfChanged(targetNode)) { + return targetInst; } +} - function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) { - if (typeof newChild === 'string' || typeof newChild === 'number') { - // Text nodes don't have keys, so we neither have to check the old nor - // new node for the key. If both are text nodes, they match. - var matchedFiber = existingChildren.get(newIdx) || null; - return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime); - } +function getTargetInstForChangeEvent(topLevelType, targetInst) { + if (topLevelType === 'topChange') { + return targetInst; + } +} - if (typeof newChild === 'object' && newChild !== null) { - switch (newChild.$$typeof) { - case REACT_ELEMENT_TYPE: - { - var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; - if (newChild.type === REACT_FRAGMENT_TYPE) { - return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key); - } - return updateElement(returnFiber, _matchedFiber, newChild, expirationTime); - } - case REACT_PORTAL_TYPE: - { - var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; - return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime); - } - } +/** + * SECTION: handle `input` event + */ +var isInputEventSupported = false; +if (ExecutionEnvironment.canUseDOM) { + // IE9 claims to support the input event but fails to trigger it when + // deleting text, so we ignore its input events. + isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9); +} - if (isArray$1(newChild) || getIteratorFn(newChild)) { - var _matchedFiber3 = existingChildren.get(newIdx) || null; - return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null); - } +/** + * (For IE <=9) Starts tracking propertychange events on the passed-in element + * and override the value property so that we can distinguish user events from + * value changes in JS. + */ +function startWatchingForValueChange(target, targetInst) { + activeElement = target; + activeElementInst = targetInst; + activeElement.attachEvent('onpropertychange', handlePropertyChange); +} - throwOnInvalidObjectType(returnFiber, newChild); - } +/** + * (For IE <=9) Removes the event listeners from the currently-tracked element, + * if any exists. + */ +function stopWatchingForValueChange() { + if (!activeElement) { + return; + } + activeElement.detachEvent('onpropertychange', handlePropertyChange); + activeElement = null; + activeElementInst = null; +} - { - if (typeof newChild === 'function') { - warnOnFunctionType(); - } - } +/** + * (For IE <=9) Handles a propertychange event, sending a `change` event if + * the value of the active element has changed. + */ +function handlePropertyChange(nativeEvent) { + if (nativeEvent.propertyName !== 'value') { + return; + } + if (getInstIfValueChanged(activeElementInst)) { + manualDispatchChangeEvent(nativeEvent); + } +} - return null; +function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) { + if (topLevelType === 'topFocus') { + // In IE9, propertychange fires for most input events but is buggy and + // doesn't fire when text is deleted, but conveniently, selectionchange + // appears to fire in all of the remaining cases so we catch those and + // forward the event if the value has changed + // In either case, we don't want to call the event handler if the value + // is changed from JS so we redefine a setter for `.value` that updates + // our activeElementValue variable, allowing us to ignore those changes + // + // stopWatching() should be a noop here but we call it just in case we + // missed a blur event somehow. + stopWatchingForValueChange(); + startWatchingForValueChange(target, targetInst); + } else if (topLevelType === 'topBlur') { + stopWatchingForValueChange(); } +} - /** - * Warns if there is a duplicate or missing key - */ - function warnOnInvalidKey(child, knownKeys) { - { - if (typeof child !== 'object' || child === null) { - return knownKeys; - } - switch (child.$$typeof) { - case REACT_ELEMENT_TYPE: - case REACT_PORTAL_TYPE: - warnForMissingKey(child); - var key = child.key; - if (typeof key !== 'string') { - break; - } - if (knownKeys === null) { - knownKeys = new Set(); - knownKeys.add(key); - break; - } - if (!knownKeys.has(key)) { - knownKeys.add(key); - break; - } - warning(false, 'Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.%s', key, getCurrentFiberStackAddendum$2()); - break; - default: - break; - } - } - return knownKeys; +// For IE8 and IE9. +function getTargetInstForInputEventPolyfill(topLevelType, targetInst) { + if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') { + // On the selectionchange event, the target is just document which isn't + // helpful for us so just check activeElement instead. + // + // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire + // propertychange on the first input event after setting `value` from a + // script and fires only keydown, keypress, keyup. Catching keyup usually + // gets it and catching keydown lets us fire an event for the first + // keystroke if user does a key repeat (it'll be a little delayed: right + // before the second keystroke). Other input methods (e.g., paste) seem to + // fire selectionchange normally. + return getInstIfValueChanged(activeElementInst); } +} - function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) { - // This algorithm can't optimize by searching from boths ends since we - // don't have backpointers on fibers. I'm trying to see how far we can get - // with that model. If it ends up not being worth the tradeoffs, we can - // add it later. +/** + * SECTION: handle `click` event + */ +function shouldUseClickEvent(elem) { + // Use the `click` event to detect changes to checkbox and radio inputs. + // This approach works across all browsers, whereas `change` does not fire + // until `blur` in IE8. + var nodeName = elem.nodeName; + return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio'); +} - // Even with a two ended optimization, we'd want to optimize for the case - // where there are few changes and brute force the comparison instead of - // going for the Map. It'd like to explore hitting that path first in - // forward-only mode and only go for the Map once we notice that we need - // lots of look ahead. This doesn't handle reversal as well as two ended - // search but that's unusual. Besides, for the two ended optimization to - // work on Iterables, we'd need to copy the whole set. +function getTargetInstForClickEvent(topLevelType, targetInst) { + if (topLevelType === 'topClick') { + return getInstIfValueChanged(targetInst); + } +} - // In this first iteration, we'll just live with hitting the bad case - // (adding everything to a Map) in for every insert/move. +function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) { + if (topLevelType === 'topInput' || topLevelType === 'topChange') { + return getInstIfValueChanged(targetInst); + } +} - // If you change this code, also update reconcileChildrenIterator() which - // uses the same algorithm. +function handleControlledInputBlur(inst, node) { + // TODO: In IE, inst is occasionally null. Why? + if (inst == null) { + return; + } - { - // First, validate keys. - var knownKeys = null; - for (var i = 0; i < newChildren.length; i++) { - var child = newChildren[i]; - knownKeys = warnOnInvalidKey(child, knownKeys); - } - } + // Fiber and ReactDOM keep wrapper state in separate places + var state = inst._wrapperState || node._wrapperState; - var resultingFirstChild = null; - var previousNewFiber = null; + if (!state || !state.controlled || node.type !== 'number') { + return; + } - var oldFiber = currentFirstChild; - var lastPlacedIndex = 0; - var newIdx = 0; - var nextOldFiber = null; - for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) { - if (oldFiber.index > newIdx) { - nextOldFiber = oldFiber; - oldFiber = null; - } else { - nextOldFiber = oldFiber.sibling; - } - var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], expirationTime); - if (newFiber === null) { - // TODO: This breaks on empty slots like null children. That's - // unfortunate because it triggers the slow path all the time. We need - // a better way to communicate whether this was a miss or null, - // boolean, undefined, etc. - if (oldFiber === null) { - oldFiber = nextOldFiber; - } - break; - } - if (shouldTrackSideEffects) { - if (oldFiber && newFiber.alternate === null) { - // We matched the slot, but we didn't reuse the existing fiber, so we - // need to delete the existing child. - deleteChild(returnFiber, oldFiber); - } - } - lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); - if (previousNewFiber === null) { - // TODO: Move out of the loop. This only happens for the first run. - resultingFirstChild = newFiber; - } else { - // TODO: Defer siblings if we're not at the right index for this slot. - // I.e. if we had null values before, then we want to defer this - // for each null value. However, we also don't want to call updateSlot - // with the previous one. - previousNewFiber.sibling = newFiber; - } - previousNewFiber = newFiber; - oldFiber = nextOldFiber; - } + // If controlled, assign the value attribute to the current value on blur + setDefaultValue(node, 'number', node.value); +} - if (newIdx === newChildren.length) { - // We've reached the end of the new children. We can delete the rest. - deleteRemainingChildren(returnFiber, oldFiber); - return resultingFirstChild; - } +/** + * This plugin creates an `onChange` event that normalizes change events + * across form elements. This event fires at a time when it's possible to + * change the element's value without seeing a flicker. + * + * Supported elements are: + * - input (see `isTextInputElement`) + * - textarea + * - select + */ +var ChangeEventPlugin = { + eventTypes: eventTypes$1, - if (oldFiber === null) { - // If we don't have any more existing children we can choose a fast path - // since the rest will all be insertions. - for (; newIdx < newChildren.length; newIdx++) { - var _newFiber = createChild(returnFiber, newChildren[newIdx], expirationTime); - if (!_newFiber) { - continue; - } - lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx); - if (previousNewFiber === null) { - // TODO: Move out of the loop. This only happens for the first run. - resultingFirstChild = _newFiber; - } else { - previousNewFiber.sibling = _newFiber; - } - previousNewFiber = _newFiber; + _isInputEventSupported: isInputEventSupported, + + extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window; + + var getTargetInstFunc = void 0, + handleEventFunc = void 0; + if (shouldUseChangeEvent(targetNode)) { + getTargetInstFunc = getTargetInstForChangeEvent; + } else if (isTextInputElement(targetNode)) { + if (isInputEventSupported) { + getTargetInstFunc = getTargetInstForInputOrChangeEvent; + } else { + getTargetInstFunc = getTargetInstForInputEventPolyfill; + handleEventFunc = handleEventsForInputEventPolyfill; } - return resultingFirstChild; + } else if (shouldUseClickEvent(targetNode)) { + getTargetInstFunc = getTargetInstForClickEvent; } - // Add all children to a key map for quick lookups. - var existingChildren = mapRemainingChildren(returnFiber, oldFiber); - - // Keep scanning and use the map to restore deleted items as moves. - for (; newIdx < newChildren.length; newIdx++) { - var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], expirationTime); - if (_newFiber2) { - if (shouldTrackSideEffects) { - if (_newFiber2.alternate !== null) { - // The new fiber is a work in progress, but if there exists a - // current, that means that we reused the fiber. We need to delete - // it from the child list so that we don't add it to the deletion - // list. - existingChildren['delete'](_newFiber2.key === null ? newIdx : _newFiber2.key); - } - } - lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx); - if (previousNewFiber === null) { - resultingFirstChild = _newFiber2; - } else { - previousNewFiber.sibling = _newFiber2; - } - previousNewFiber = _newFiber2; + if (getTargetInstFunc) { + var inst = getTargetInstFunc(topLevelType, targetInst); + if (inst) { + var event = createAndAccumulateChangeEvent(inst, nativeEvent, nativeEventTarget); + return event; } } - if (shouldTrackSideEffects) { - // Any existing children that weren't consumed above were deleted. We need - // to add them to the deletion list. - existingChildren.forEach(function (child) { - return deleteChild(returnFiber, child); - }); + if (handleEventFunc) { + handleEventFunc(topLevelType, targetNode, targetInst); } - return resultingFirstChild; + // When blurring, set the value attribute for number inputs + if (topLevelType === 'topBlur') { + handleControlledInputBlur(targetInst, targetNode); + } } +}; - function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, expirationTime) { - // This is the same implementation as reconcileChildrenArray(), - // but using the iterator instead. - - var iteratorFn = getIteratorFn(newChildrenIterable); - !(typeof iteratorFn === 'function') ? invariant(false, 'An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.') : void 0; - - { - // Warn about using Maps as children - if (typeof newChildrenIterable.entries === 'function') { - var possibleMap = newChildrenIterable; - if (possibleMap.entries === iteratorFn) { - warning(didWarnAboutMaps, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', getCurrentFiberStackAddendum$2()); - didWarnAboutMaps = true; - } - } - - // First, validate keys. - // We'll get a different iterator later for the main pass. - var _newChildren = iteratorFn.call(newChildrenIterable); - if (_newChildren) { - var knownKeys = null; - var _step = _newChildren.next(); - for (; !_step.done; _step = _newChildren.next()) { - var child = _step.value; - knownKeys = warnOnInvalidKey(child, knownKeys); - } - } - } +/** + * Module that is injectable into `EventPluginHub`, that specifies a + * deterministic ordering of `EventPlugin`s. A convenient way to reason about + * plugins, without having to package every one of them. This is better than + * having plugins be ordered in the same order that they are injected because + * that ordering would be influenced by the packaging order. + * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that + * preventing default on events is convenient in `SimpleEventPlugin` handlers. + */ +var DOMEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin']; - var newChildren = iteratorFn.call(newChildrenIterable); - !(newChildren != null) ? invariant(false, 'An iterable object provided no iterator.') : void 0; +var SyntheticUIEvent = SyntheticEvent$1.extend({ + view: null, + detail: null +}); - var resultingFirstChild = null; - var previousNewFiber = null; +/** + * Translation from modifier key to the associated property in the event. + * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers + */ - var oldFiber = currentFirstChild; - var lastPlacedIndex = 0; - var newIdx = 0; - var nextOldFiber = null; +var modifierKeyToProp = { + Alt: 'altKey', + Control: 'ctrlKey', + Meta: 'metaKey', + Shift: 'shiftKey' +}; - var step = newChildren.next(); - for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) { - if (oldFiber.index > newIdx) { - nextOldFiber = oldFiber; - oldFiber = null; - } else { - nextOldFiber = oldFiber.sibling; - } - var newFiber = updateSlot(returnFiber, oldFiber, step.value, expirationTime); - if (newFiber === null) { - // TODO: This breaks on empty slots like null children. That's - // unfortunate because it triggers the slow path all the time. We need - // a better way to communicate whether this was a miss or null, - // boolean, undefined, etc. - if (!oldFiber) { - oldFiber = nextOldFiber; - } - break; - } - if (shouldTrackSideEffects) { - if (oldFiber && newFiber.alternate === null) { - // We matched the slot, but we didn't reuse the existing fiber, so we - // need to delete the existing child. - deleteChild(returnFiber, oldFiber); - } - } - lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); - if (previousNewFiber === null) { - // TODO: Move out of the loop. This only happens for the first run. - resultingFirstChild = newFiber; - } else { - // TODO: Defer siblings if we're not at the right index for this slot. - // I.e. if we had null values before, then we want to defer this - // for each null value. However, we also don't want to call updateSlot - // with the previous one. - previousNewFiber.sibling = newFiber; - } - previousNewFiber = newFiber; - oldFiber = nextOldFiber; - } +// IE8 does not implement getModifierState so we simply map it to the only +// modifier keys exposed by the event itself, does not support Lock-keys. +// Currently, all major browsers except Chrome seems to support Lock-keys. +function modifierStateGetter(keyArg) { + var syntheticEvent = this; + var nativeEvent = syntheticEvent.nativeEvent; + if (nativeEvent.getModifierState) { + return nativeEvent.getModifierState(keyArg); + } + var keyProp = modifierKeyToProp[keyArg]; + return keyProp ? !!nativeEvent[keyProp] : false; +} - if (step.done) { - // We've reached the end of the new children. We can delete the rest. - deleteRemainingChildren(returnFiber, oldFiber); - return resultingFirstChild; - } +function getEventModifierState(nativeEvent) { + return modifierStateGetter; +} - if (oldFiber === null) { - // If we don't have any more existing children we can choose a fast path - // since the rest will all be insertions. - for (; !step.done; newIdx++, step = newChildren.next()) { - var _newFiber3 = createChild(returnFiber, step.value, expirationTime); - if (_newFiber3 === null) { - continue; - } - lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx); - if (previousNewFiber === null) { - // TODO: Move out of the loop. This only happens for the first run. - resultingFirstChild = _newFiber3; - } else { - previousNewFiber.sibling = _newFiber3; - } - previousNewFiber = _newFiber3; - } - return resultingFirstChild; - } +/** + * @interface MouseEvent + * @see http://www.w3.org/TR/DOM-Level-3-Events/ + */ +var SyntheticMouseEvent = SyntheticUIEvent.extend({ + screenX: null, + screenY: null, + clientX: null, + clientY: null, + pageX: null, + pageY: null, + ctrlKey: null, + shiftKey: null, + altKey: null, + metaKey: null, + getModifierState: getEventModifierState, + button: null, + buttons: null, + relatedTarget: function (event) { + return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement); + } +}); - // Add all children to a key map for quick lookups. - var existingChildren = mapRemainingChildren(returnFiber, oldFiber); +var eventTypes$2 = { + mouseEnter: { + registrationName: 'onMouseEnter', + dependencies: ['topMouseOut', 'topMouseOver'] + }, + mouseLeave: { + registrationName: 'onMouseLeave', + dependencies: ['topMouseOut', 'topMouseOver'] + } +}; - // Keep scanning and use the map to restore deleted items as moves. - for (; !step.done; newIdx++, step = newChildren.next()) { - var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, expirationTime); - if (_newFiber4 !== null) { - if (shouldTrackSideEffects) { - if (_newFiber4.alternate !== null) { - // The new fiber is a work in progress, but if there exists a - // current, that means that we reused the fiber. We need to delete - // it from the child list so that we don't add it to the deletion - // list. - existingChildren['delete'](_newFiber4.key === null ? newIdx : _newFiber4.key); - } - } - lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx); - if (previousNewFiber === null) { - resultingFirstChild = _newFiber4; - } else { - previousNewFiber.sibling = _newFiber4; - } - previousNewFiber = _newFiber4; - } - } +var EnterLeaveEventPlugin = { + eventTypes: eventTypes$2, - if (shouldTrackSideEffects) { - // Any existing children that weren't consumed above were deleted. We need - // to add them to the deletion list. - existingChildren.forEach(function (child) { - return deleteChild(returnFiber, child); - }); + /** + * For almost every interaction we care about, there will be both a top-level + * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that + * we do not extract duplicate events. However, moving the mouse into the + * browser from outside will not fire a `mouseout` event. In this case, we use + * the `mouseover` top-level event. + */ + extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { + if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) { + return null; } - - return resultingFirstChild; - } - - function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, expirationTime) { - // There's no need to check for keys on text nodes since we don't have a - // way to define them. - if (currentFirstChild !== null && currentFirstChild.tag === HostText) { - // We already have an existing node so let's just update it and delete - // the rest. - deleteRemainingChildren(returnFiber, currentFirstChild.sibling); - var existing = useFiber(currentFirstChild, textContent, expirationTime); - existing['return'] = returnFiber; - return existing; + if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') { + // Must not be a mouse in or mouse out - ignoring. + return null; } - // The existing first child is not a text node so we need to create one - // and delete the existing ones. - deleteRemainingChildren(returnFiber, currentFirstChild); - var created = createFiberFromText(textContent, returnFiber.mode, expirationTime); - created['return'] = returnFiber; - return created; - } - function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) { - var key = element.key; - var child = currentFirstChild; - while (child !== null) { - // TODO: If key === null and child.key === null, then this only applies to - // the first item in the list. - if (child.key === key) { - if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.type === element.type) { - deleteRemainingChildren(returnFiber, child.sibling); - var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime); - existing.ref = coerceRef(returnFiber, child, element); - existing['return'] = returnFiber; - { - existing._debugSource = element._source; - existing._debugOwner = element._owner; - } - return existing; - } else { - deleteRemainingChildren(returnFiber, child); - break; - } + var win = void 0; + if (nativeEventTarget.window === nativeEventTarget) { + // `nativeEventTarget` is probably a window object. + win = nativeEventTarget; + } else { + // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. + var doc = nativeEventTarget.ownerDocument; + if (doc) { + win = doc.defaultView || doc.parentWindow; } else { - deleteChild(returnFiber, child); + win = window; } - child = child.sibling; } - if (element.type === REACT_FRAGMENT_TYPE) { - var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key); - created['return'] = returnFiber; - return created; + var from = void 0; + var to = void 0; + if (topLevelType === 'topMouseOut') { + from = targetInst; + var related = nativeEvent.relatedTarget || nativeEvent.toElement; + to = related ? getClosestInstanceFromNode(related) : null; } else { - var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime); - _created4.ref = coerceRef(returnFiber, currentFirstChild, element); - _created4['return'] = returnFiber; - return _created4; + // Moving to a node from outside the window. + from = null; + to = targetInst; } - } - function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) { - var key = portal.key; - var child = currentFirstChild; - while (child !== null) { - // TODO: If key === null and child.key === null, then this only applies to - // the first item in the list. - if (child.key === key) { - if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) { - deleteRemainingChildren(returnFiber, child.sibling); - var existing = useFiber(child, portal.children || [], expirationTime); - existing['return'] = returnFiber; - return existing; - } else { - deleteRemainingChildren(returnFiber, child); - break; - } - } else { - deleteChild(returnFiber, child); - } - child = child.sibling; + if (from === to) { + // Nothing pertains to our managed components. + return null; } - var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime); - created['return'] = returnFiber; - return created; - } + var fromNode = from == null ? win : getNodeFromInstance$1(from); + var toNode = to == null ? win : getNodeFromInstance$1(to); - // This API will tag the children with the side-effect of the reconciliation - // itself. They will be added to the side-effect list as we pass through the - // children and the parent. - function reconcileChildFibers(returnFiber, currentFirstChild, newChild, expirationTime) { - // This function is not recursive. - // If the top level item is an array, we treat it as a set of children, - // not as a fragment. Nested arrays on the other hand will be treated as - // fragment nodes. Recursion happens at the normal flow. + var leave = SyntheticMouseEvent.getPooled(eventTypes$2.mouseLeave, from, nativeEvent, nativeEventTarget); + leave.type = 'mouseleave'; + leave.target = fromNode; + leave.relatedTarget = toNode; - // Handle top level unkeyed fragments as if they were arrays. - // This leads to an ambiguity between <>{[...]} and <>.... - // We treat the ambiguous cases above the same. - if (typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null) { - newChild = newChild.props.children; - } + var enter = SyntheticMouseEvent.getPooled(eventTypes$2.mouseEnter, to, nativeEvent, nativeEventTarget); + enter.type = 'mouseenter'; + enter.target = toNode; + enter.relatedTarget = fromNode; - // Handle object types - var isObject = typeof newChild === 'object' && newChild !== null; + accumulateEnterLeaveDispatches(leave, enter, from, to); - if (isObject) { - switch (newChild.$$typeof) { - case REACT_ELEMENT_TYPE: - return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, expirationTime)); - case REACT_PORTAL_TYPE: - return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, expirationTime)); - } - } + return [leave, enter]; + } +}; - if (typeof newChild === 'string' || typeof newChild === 'number') { - return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime)); - } - - if (isArray$1(newChild)) { - return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime); - } +/** + * `ReactInstanceMap` maintains a mapping from a public facing stateful + * instance (key) and the internal representation (value). This allows public + * methods to accept the user facing instance as an argument and map them back + * to internal methods. + * + * Note that this module is currently shared and assumed to be stateless. + * If this becomes an actual Map, that will break. + */ - if (getIteratorFn(newChild)) { - return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, expirationTime); - } +/** + * This API should be called `delete` but we'd have to make sure to always + * transform these to strings for IE support. When this transform is fully + * supported we can rename it. + */ - if (isObject) { - throwOnInvalidObjectType(returnFiber, newChild); - } - { - if (typeof newChild === 'function') { - warnOnFunctionType(); - } - } - if (typeof newChild === 'undefined') { - // If the new child is undefined, and the return fiber is a composite - // component, throw an error. If Fiber return types are disabled, - // we already threw above. - switch (returnFiber.tag) { - case ClassComponent: - { - { - var instance = returnFiber.stateNode; - if (instance.render._isMockFunction) { - // We allow auto-mocks to proceed as if they're returning null. - break; - } - } - } - // Intentionally fall through to the next case, which handles both - // functions and classes - // eslint-disable-next-lined no-fallthrough - case FunctionalComponent: - { - var Component = returnFiber.type; - invariant(false, '%s(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.', Component.displayName || Component.name || 'Component'); - } - } - } +function get(key) { + return key._reactInternalFiber; +} - // Remaining cases are all treated as empty. - return deleteRemainingChildren(returnFiber, currentFirstChild); - } +function has(key) { + return key._reactInternalFiber !== undefined; +} - return reconcileChildFibers; +function set(key, value) { + key._reactInternalFiber = value; } -var reconcileChildFibers = ChildReconciler(true); -var mountChildFibers = ChildReconciler(false); +// Don't change these two values. They're used by React Dev Tools. +var NoEffect = /* */0; +var PerformedWork = /* */1; -function cloneChildFibers(current, workInProgress) { - !(current === null || workInProgress.child === current.child) ? invariant(false, 'Resuming work not yet implemented.') : void 0; +// You can change the rest (and add more). +var Placement = /* */2; +var Update = /* */4; +var PlacementAndUpdate = /* */6; +var Deletion = /* */8; +var ContentReset = /* */16; +var Callback = /* */32; +var DidCapture = /* */64; +var Ref = /* */128; +var ErrLog = /* */256; +var Snapshot = /* */2048; - if (workInProgress.child === null) { - return; - } +// Union of all host effects +var HostEffectMask = /* */2559; - var currentChild = workInProgress.child; - var newChild = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime); - workInProgress.child = newChild; +var Incomplete = /* */512; +var ShouldCapture = /* */1024; - newChild['return'] = workInProgress; - while (currentChild.sibling !== null) { - currentChild = currentChild.sibling; - newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime); - newChild['return'] = workInProgress; +var MOUNTING = 1; +var MOUNTED = 2; +var UNMOUNTED = 3; + +function isFiberMountedImpl(fiber) { + var node = fiber; + if (!fiber.alternate) { + // If there is no alternate, this might be a new tree that isn't inserted + // yet. If it is, then it will have a pending insertion effect on it. + if ((node.effectTag & Placement) !== NoEffect) { + return MOUNTING; + } + while (node['return']) { + node = node['return']; + if ((node.effectTag & Placement) !== NoEffect) { + return MOUNTING; + } + } + } else { + while (node['return']) { + node = node['return']; + } } - newChild.sibling = null; + if (node.tag === HostRoot) { + // TODO: Check if this was a nested HostRoot when used with + // renderContainerIntoSubtree. + return MOUNTED; + } + // If we didn't hit the root, that means that we're in an disconnected tree + // that has been unmounted. + return UNMOUNTED; } -var didWarnAboutBadClass = void 0; -var didWarnAboutGetDerivedStateOnFunctionalComponent = void 0; -var didWarnAboutStatelessRefs = void 0; - -{ - didWarnAboutBadClass = {}; - didWarnAboutGetDerivedStateOnFunctionalComponent = {}; - didWarnAboutStatelessRefs = {}; +function isFiberMounted(fiber) { + return isFiberMountedImpl(fiber) === MOUNTED; } -var ReactFiberBeginWork = function (config, hostContext, legacyContext, newContext, hydrationContext, scheduleWork, computeExpirationForFiber) { - var shouldSetTextContent = config.shouldSetTextContent, - shouldDeprioritizeSubtree = config.shouldDeprioritizeSubtree; - var pushHostContext = hostContext.pushHostContext, - pushHostContainer = hostContext.pushHostContainer; - var pushProvider = newContext.pushProvider; - var getMaskedContext = legacyContext.getMaskedContext, - getUnmaskedContext = legacyContext.getUnmaskedContext, - hasLegacyContextChanged = legacyContext.hasContextChanged, - pushLegacyContextProvider = legacyContext.pushContextProvider, - pushTopLevelContextObject = legacyContext.pushTopLevelContextObject, - invalidateContextProvider = legacyContext.invalidateContextProvider; - var enterHydrationState = hydrationContext.enterHydrationState, - resetHydrationState = hydrationContext.resetHydrationState, - tryToClaimNextHydratableInstance = hydrationContext.tryToClaimNextHydratableInstance; - - var _ReactFiberClassCompo = ReactFiberClassComponent(legacyContext, scheduleWork, computeExpirationForFiber, memoizeProps, memoizeState), - adoptClassInstance = _ReactFiberClassCompo.adoptClassInstance, - callGetDerivedStateFromProps = _ReactFiberClassCompo.callGetDerivedStateFromProps, - constructClassInstance = _ReactFiberClassCompo.constructClassInstance, - mountClassInstance = _ReactFiberClassCompo.mountClassInstance, - resumeMountClassInstance = _ReactFiberClassCompo.resumeMountClassInstance, - updateClassInstance = _ReactFiberClassCompo.updateClassInstance; - - // TODO: Remove this and use reconcileChildrenAtExpirationTime directly. - +function isMounted(component) { + { + var owner = ReactCurrentOwner.current; + if (owner !== null && owner.tag === ClassComponent) { + var ownerFiber = owner; + var instance = ownerFiber.stateNode; + !instance._warnedAboutRefsInRender ? warning(false, '%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.', getComponentName(ownerFiber) || 'A component') : void 0; + instance._warnedAboutRefsInRender = true; + } + } - function reconcileChildren(current, workInProgress, nextChildren) { - reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, workInProgress.expirationTime); + var fiber = get(component); + if (!fiber) { + return false; } + return isFiberMountedImpl(fiber) === MOUNTED; +} - function reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, renderExpirationTime) { - if (current === null) { - // If this is a fresh new component that hasn't been rendered yet, we - // won't update its child set by applying minimal side-effects. Instead, - // we will add them all to the child before it gets rendered. That means - // we can optimize this reconciliation pass by not tracking side-effects. - workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime); - } else { - // If the current child is the same as the work in progress, it means that - // we haven't yet started any work on these children. Therefore, we use - // the clone algorithm to create a copy of all the current children. +function assertIsMounted(fiber) { + !(isFiberMountedImpl(fiber) === MOUNTED) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0; +} - // If we had any progressed work already, that is invalid at this point so - // let's throw it out. - workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderExpirationTime); +function findCurrentFiberUsingSlowPath(fiber) { + var alternate = fiber.alternate; + if (!alternate) { + // If there is no alternate, then we only need to check if it is mounted. + var state = isFiberMountedImpl(fiber); + !(state !== UNMOUNTED) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0; + if (state === MOUNTING) { + return null; } + return fiber; } + // If we have two possible branches, we'll walk backwards up to the root + // to see what path the root points to. On the way we may hit one of the + // special cases and we'll deal with them. + var a = fiber; + var b = alternate; + while (true) { + var parentA = a['return']; + var parentB = parentA ? parentA.alternate : null; + if (!parentA || !parentB) { + // We're at the root. + break; + } - function updateForwardRef(current, workInProgress) { - var render = workInProgress.type.render; - var nextChildren = render(workInProgress.pendingProps, workInProgress.ref); - reconcileChildren(current, workInProgress, nextChildren); - memoizeProps(workInProgress, nextChildren); - return workInProgress.child; - } + // If both copies of the parent fiber point to the same child, we can + // assume that the child is current. This happens when we bailout on low + // priority: the bailed out fiber's child reuses the current child. + if (parentA.child === parentB.child) { + var child = parentA.child; + while (child) { + if (child === a) { + // We've determined that A is the current branch. + assertIsMounted(parentA); + return fiber; + } + if (child === b) { + // We've determined that B is the current branch. + assertIsMounted(parentA); + return alternate; + } + child = child.sibling; + } + // We should never have an alternate for any mounting node. So the only + // way this could possibly happen is if this was unmounted, if at all. + invariant(false, 'Unable to find node on an unmounted component.'); + } - function updateFragment(current, workInProgress) { - var nextChildren = workInProgress.pendingProps; - if (hasLegacyContextChanged()) { - // Normally we can bail out on props equality but if context has changed - // we don't do the bailout and we have to reuse existing props instead. - } else if (workInProgress.memoizedProps === nextChildren) { - return bailoutOnAlreadyFinishedWork(current, workInProgress); + if (a['return'] !== b['return']) { + // The return pointer of A and the return pointer of B point to different + // fibers. We assume that return pointers never criss-cross, so A must + // belong to the child set of A.return, and B must belong to the child + // set of B.return. + a = parentA; + b = parentB; + } else { + // The return pointers point to the same fiber. We'll have to use the + // default, slow path: scan the child sets of each parent alternate to see + // which child belongs to which set. + // + // Search parent A's child set + var didFindChild = false; + var _child = parentA.child; + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentA; + b = parentB; + break; + } + if (_child === b) { + didFindChild = true; + b = parentA; + a = parentB; + break; + } + _child = _child.sibling; + } + if (!didFindChild) { + // Search parent B's child set + _child = parentB.child; + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentB; + b = parentA; + break; + } + if (_child === b) { + didFindChild = true; + b = parentB; + a = parentA; + break; + } + _child = _child.sibling; + } + !didFindChild ? invariant(false, 'Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.') : void 0; + } } - reconcileChildren(current, workInProgress, nextChildren); - memoizeProps(workInProgress, nextChildren); - return workInProgress.child; + + !(a.alternate === b) ? invariant(false, 'Return fibers should always be each others\' alternates. This error is likely caused by a bug in React. Please file an issue.') : void 0; + } + // If the root is not a host container, we're in a disconnected tree. I.e. + // unmounted. + !(a.tag === HostRoot) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0; + if (a.stateNode.current === a) { + // We've determined that A is the current branch. + return fiber; } + // Otherwise B has to be current branch. + return alternate; +} - function updateMode(current, workInProgress) { - var nextChildren = workInProgress.pendingProps.children; - if (hasLegacyContextChanged()) { - // Normally we can bail out on props equality but if context has changed - // we don't do the bailout and we have to reuse existing props instead. - } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) { - return bailoutOnAlreadyFinishedWork(current, workInProgress); - } - reconcileChildren(current, workInProgress, nextChildren); - memoizeProps(workInProgress, nextChildren); - return workInProgress.child; +function findCurrentHostFiber(parent) { + var currentParent = findCurrentFiberUsingSlowPath(parent); + if (!currentParent) { + return null; } - function markRef(current, workInProgress) { - var ref = workInProgress.ref; - if (current === null && ref !== null || current !== null && current.ref !== ref) { - // Schedule a Ref effect - workInProgress.effectTag |= Ref; + // Next we'll drill down this component to find the first HostComponent/Text. + var node = currentParent; + while (true) { + if (node.tag === HostComponent || node.tag === HostText) { + return node; + } else if (node.child) { + node.child['return'] = node; + node = node.child; + continue; + } + if (node === currentParent) { + return null; + } + while (!node.sibling) { + if (!node['return'] || node['return'] === currentParent) { + return null; + } + node = node['return']; } + node.sibling['return'] = node['return']; + node = node.sibling; } + // Flow needs the return null here, but ESLint complains about it. + // eslint-disable-next-line no-unreachable + return null; +} - function updateFunctionalComponent(current, workInProgress) { - var fn = workInProgress.type; - var nextProps = workInProgress.pendingProps; +function findCurrentHostFiberWithNoPortals(parent) { + var currentParent = findCurrentFiberUsingSlowPath(parent); + if (!currentParent) { + return null; + } - if (hasLegacyContextChanged()) { - // Normally we can bail out on props equality but if context has changed - // we don't do the bailout and we have to reuse existing props instead. - } else { - if (workInProgress.memoizedProps === nextProps) { - return bailoutOnAlreadyFinishedWork(current, workInProgress); + // Next we'll drill down this component to find the first HostComponent/Text. + var node = currentParent; + while (true) { + if (node.tag === HostComponent || node.tag === HostText) { + return node; + } else if (node.child && node.tag !== HostPortal) { + node.child['return'] = node; + node = node.child; + continue; + } + if (node === currentParent) { + return null; + } + while (!node.sibling) { + if (!node['return'] || node['return'] === currentParent) { + return null; } - // TODO: consider bringing fn.shouldComponentUpdate() back. - // It used to be here. + node = node['return']; } + node.sibling['return'] = node['return']; + node = node.sibling; + } + // Flow needs the return null here, but ESLint complains about it. + // eslint-disable-next-line no-unreachable + return null; +} - var unmaskedContext = getUnmaskedContext(workInProgress); - var context = getMaskedContext(workInProgress, unmaskedContext); +function addEventBubbleListener(element, eventType, listener) { + element.addEventListener(eventType, listener, false); +} - var nextChildren = void 0; +function addEventCaptureListener(element, eventType, listener) { + element.addEventListener(eventType, listener, true); +} - { - ReactCurrentOwner.current = workInProgress; - ReactDebugCurrentFiber.setCurrentPhase('render'); - nextChildren = fn(nextProps, context); - ReactDebugCurrentFiber.setCurrentPhase(null); - } - // React DevTools reads this flag. - workInProgress.effectTag |= PerformedWork; - reconcileChildren(current, workInProgress, nextChildren); - memoizeProps(workInProgress, nextProps); - return workInProgress.child; +/** + * @interface Event + * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface + * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent + */ +var SyntheticAnimationEvent = SyntheticEvent$1.extend({ + animationName: null, + elapsedTime: null, + pseudoElement: null +}); + +/** + * @interface Event + * @see http://www.w3.org/TR/clipboard-apis/ + */ +var SyntheticClipboardEvent = SyntheticEvent$1.extend({ + clipboardData: function (event) { + return 'clipboardData' in event ? event.clipboardData : window.clipboardData; } +}); - function updateClassComponent(current, workInProgress, renderExpirationTime) { - // Push context providers early to prevent context stack mismatches. - // During mounting we don't know the child context yet as the instance doesn't exist. - // We will invalidate the child context in finishClassComponent() right after rendering. - var hasContext = pushLegacyContextProvider(workInProgress); - var shouldUpdate = void 0; - if (current === null) { - if (workInProgress.stateNode === null) { - // In the initial pass we might need to construct the instance. - constructClassInstance(workInProgress, workInProgress.pendingProps); - mountClassInstance(workInProgress, renderExpirationTime); +/** + * @interface FocusEvent + * @see http://www.w3.org/TR/DOM-Level-3-Events/ + */ +var SyntheticFocusEvent = SyntheticUIEvent.extend({ + relatedTarget: null +}); - shouldUpdate = true; - } else { - // In a resume, we'll already have an instance we can reuse. - shouldUpdate = resumeMountClassInstance(workInProgress, renderExpirationTime); - } - } else { - shouldUpdate = updateClassInstance(current, workInProgress, renderExpirationTime); - } +/** + * `charCode` represents the actual "character code" and is safe to use with + * `String.fromCharCode`. As such, only keys that correspond to printable + * characters produce a valid `charCode`, the only exception to this is Enter. + * The Tab-key is considered non-printable and does not have a `charCode`, + * presumably because it does not produce a tab-character in browsers. + * + * @param {object} nativeEvent Native browser event. + * @return {number} Normalized `charCode` property. + */ +function getEventCharCode(nativeEvent) { + var charCode = void 0; + var keyCode = nativeEvent.keyCode; - // We processed the update queue inside updateClassInstance. It may have - // included some errors that were dispatched during the commit phase. - // TODO: Refactor class components so this is less awkward. - var didCaptureError = false; - var updateQueue = workInProgress.updateQueue; - if (updateQueue !== null && updateQueue.capturedValues !== null) { - shouldUpdate = true; - didCaptureError = true; + if ('charCode' in nativeEvent) { + charCode = nativeEvent.charCode; + + // FF does not set `charCode` for the Enter-key, check against `keyCode`. + if (charCode === 0 && keyCode === 13) { + charCode = 13; } - return finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime); + } else { + // IE8 does not implement `charCode`, but `keyCode` has the correct value. + charCode = keyCode; } - function finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime) { - // Refs should update even if shouldComponentUpdate returns false - markRef(current, workInProgress); + // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux) + // report Enter as charCode 10 when ctrl is pressed. + if (charCode === 10) { + charCode = 13; + } - if (!shouldUpdate && !didCaptureError) { - // Context providers should defer to sCU for rendering - if (hasContext) { - invalidateContextProvider(workInProgress, false); - } - - return bailoutOnAlreadyFinishedWork(current, workInProgress); - } - - var ctor = workInProgress.type; - var instance = workInProgress.stateNode; - - // Rerender - ReactCurrentOwner.current = workInProgress; - var nextChildren = void 0; - if (didCaptureError && (!enableGetDerivedStateFromCatch || typeof ctor.getDerivedStateFromCatch !== 'function')) { - // If we captured an error, but getDerivedStateFrom catch is not defined, - // unmount all the children. componentDidCatch will schedule an update to - // re-render a fallback. This is temporary until we migrate everyone to - // the new API. - // TODO: Warn in a future release. - nextChildren = null; - } else { - { - ReactDebugCurrentFiber.setCurrentPhase('render'); - nextChildren = instance.render(); - if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) { - instance.render(); - } - ReactDebugCurrentFiber.setCurrentPhase(null); - } - } - - // React DevTools reads this flag. - workInProgress.effectTag |= PerformedWork; - if (didCaptureError) { - // If we're recovering from an error, reconcile twice: first to delete - // all the existing children. - reconcileChildrenAtExpirationTime(current, workInProgress, null, renderExpirationTime); - workInProgress.child = null; - // Now we can continue reconciling like normal. This has the effect of - // remounting all children regardless of whether their their - // identity matches. - } - reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, renderExpirationTime); - // Memoize props and state using the values we just used to render. - // TODO: Restructure so we never read values from the instance. - memoizeState(workInProgress, instance.state); - memoizeProps(workInProgress, instance.props); - - // The context might have changed so we need to recalculate it. - if (hasContext) { - invalidateContextProvider(workInProgress, true); - } - - return workInProgress.child; + // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. + // Must not discard the (non-)printable Enter-key. + if (charCode >= 32 || charCode === 13) { + return charCode; } - function pushHostRootContext(workInProgress) { - var root = workInProgress.stateNode; - if (root.pendingContext) { - pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context); - } else if (root.context) { - // Should always be set - pushTopLevelContextObject(workInProgress, root.context, false); - } - pushHostContainer(workInProgress, root.containerInfo); - } + return 0; +} - function updateHostRoot(current, workInProgress, renderExpirationTime) { - pushHostRootContext(workInProgress); - var updateQueue = workInProgress.updateQueue; - if (updateQueue !== null) { - var prevState = workInProgress.memoizedState; - var state = processUpdateQueue(current, workInProgress, updateQueue, null, null, renderExpirationTime); - memoizeState(workInProgress, state); - updateQueue = workInProgress.updateQueue; +/** + * Normalization of deprecated HTML5 `key` values + * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names + */ +var normalizeKey = { + Esc: 'Escape', + Spacebar: ' ', + Left: 'ArrowLeft', + Up: 'ArrowUp', + Right: 'ArrowRight', + Down: 'ArrowDown', + Del: 'Delete', + Win: 'OS', + Menu: 'ContextMenu', + Apps: 'ContextMenu', + Scroll: 'ScrollLock', + MozPrintableKey: 'Unidentified' +}; - var element = void 0; - if (updateQueue !== null && updateQueue.capturedValues !== null) { - // There's an uncaught error. Unmount the whole root. - element = null; - } else if (prevState === state) { - // If the state is the same as before, that's a bailout because we had - // no work that expires at this time. - resetHydrationState(); - return bailoutOnAlreadyFinishedWork(current, workInProgress); - } else { - element = state.element; - } - var root = workInProgress.stateNode; - if ((current === null || current.child === null) && root.hydrate && enterHydrationState(workInProgress)) { - // If we don't have any current children this might be the first pass. - // We always try to hydrate. If this isn't a hydration pass there won't - // be any children to hydrate which is effectively the same thing as - // not hydrating. +/** + * Translation from legacy `keyCode` to HTML5 `key` + * Only special keys supported, all others depend on keyboard layout or browser + * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names + */ +var translateToKey = { + '8': 'Backspace', + '9': 'Tab', + '12': 'Clear', + '13': 'Enter', + '16': 'Shift', + '17': 'Control', + '18': 'Alt', + '19': 'Pause', + '20': 'CapsLock', + '27': 'Escape', + '32': ' ', + '33': 'PageUp', + '34': 'PageDown', + '35': 'End', + '36': 'Home', + '37': 'ArrowLeft', + '38': 'ArrowUp', + '39': 'ArrowRight', + '40': 'ArrowDown', + '45': 'Insert', + '46': 'Delete', + '112': 'F1', + '113': 'F2', + '114': 'F3', + '115': 'F4', + '116': 'F5', + '117': 'F6', + '118': 'F7', + '119': 'F8', + '120': 'F9', + '121': 'F10', + '122': 'F11', + '123': 'F12', + '144': 'NumLock', + '145': 'ScrollLock', + '224': 'Meta' +}; - // This is a bit of a hack. We track the host root as a placement to - // know that we're currently in a mounting state. That way isMounted - // works as expected. We must reset this before committing. - // TODO: Delete this when we delete isMounted and findDOMNode. - workInProgress.effectTag |= Placement; +/** + * @param {object} nativeEvent Native browser event. + * @return {string} Normalized `key` property. + */ +function getEventKey(nativeEvent) { + if (nativeEvent.key) { + // Normalize inconsistent values reported by browsers due to + // implementations of a working draft specification. - // Ensure that children mount into this root without tracking - // side-effects. This ensures that we don't store Placement effects on - // nodes that will be hydrated. - workInProgress.child = mountChildFibers(workInProgress, null, element, renderExpirationTime); - } else { - // Otherwise reset hydration state in case we aborted and resumed another - // root. - resetHydrationState(); - reconcileChildren(current, workInProgress, element); - } - memoizeState(workInProgress, state); - return workInProgress.child; + // FireFox implements `key` but returns `MozPrintableKey` for all + // printable characters (normalized to `Unidentified`), ignore it. + var key = normalizeKey[nativeEvent.key] || nativeEvent.key; + if (key !== 'Unidentified') { + return key; } - resetHydrationState(); - // If there is no update queue, that's a bailout because the root has no props. - return bailoutOnAlreadyFinishedWork(current, workInProgress); } - function updateHostComponent(current, workInProgress, renderExpirationTime) { - pushHostContext(workInProgress); + // Browser does not implement `key`, polyfill as much of it as we can. + if (nativeEvent.type === 'keypress') { + var charCode = getEventCharCode(nativeEvent); - if (current === null) { - tryToClaimNextHydratableInstance(workInProgress); - } + // The enter-key is technically both printable and non-printable and can + // thus be captured by `keypress`, no other non-printable key should. + return charCode === 13 ? 'Enter' : String.fromCharCode(charCode); + } + if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') { + // While user keyboard layout determines the actual meaning of each + // `keyCode` value, almost all function keys have a universal value. + return translateToKey[nativeEvent.keyCode] || 'Unidentified'; + } + return ''; +} - var type = workInProgress.type; - var memoizedProps = workInProgress.memoizedProps; - var nextProps = workInProgress.pendingProps; - var prevProps = current !== null ? current.memoizedProps : null; +/** + * @interface KeyboardEvent + * @see http://www.w3.org/TR/DOM-Level-3-Events/ + */ +var SyntheticKeyboardEvent = SyntheticUIEvent.extend({ + key: getEventKey, + location: null, + ctrlKey: null, + shiftKey: null, + altKey: null, + metaKey: null, + repeat: null, + locale: null, + getModifierState: getEventModifierState, + // Legacy Interface + charCode: function (event) { + // `charCode` is the result of a KeyPress event and represents the value of + // the actual printable character. - if (hasLegacyContextChanged()) { - // Normally we can bail out on props equality but if context has changed - // we don't do the bailout and we have to reuse existing props instead. - } else if (memoizedProps === nextProps) { - var isHidden = workInProgress.mode & AsyncMode && shouldDeprioritizeSubtree(type, nextProps); - if (isHidden) { - // Before bailing out, make sure we've deprioritized a hidden component. - workInProgress.expirationTime = Never; - } - if (!isHidden || renderExpirationTime !== Never) { - return bailoutOnAlreadyFinishedWork(current, workInProgress); - } - // If we're rendering a hidden node at hidden priority, don't bailout. The - // parent is complete, but the children may not be. + // KeyPress is deprecated, but its replacement is not yet final and not + // implemented in any major browser. Only KeyPress has charCode. + if (event.type === 'keypress') { + return getEventCharCode(event); } + return 0; + }, + keyCode: function (event) { + // `keyCode` is the result of a KeyDown/Up event and represents the value of + // physical keyboard key. - var nextChildren = nextProps.children; - var isDirectTextChild = shouldSetTextContent(type, nextProps); - - if (isDirectTextChild) { - // We special case a direct text child of a host node. This is a common - // case. We won't handle it as a reified child. We will instead handle - // this in the host environment that also have access to this prop. That - // avoids allocating another HostText fiber and traversing it. - nextChildren = null; - } else if (prevProps && shouldSetTextContent(type, prevProps)) { - // If we're switching from a direct text child to a normal child, or to - // empty, we need to schedule the text content to be reset. - workInProgress.effectTag |= ContentReset; + // The actual meaning of the value depends on the users' keyboard layout + // which cannot be detected. Assuming that it is a US keyboard layout + // provides a surprisingly accurate mapping for US and European users. + // Due to this, it is left to the user to implement at this time. + if (event.type === 'keydown' || event.type === 'keyup') { + return event.keyCode; } - - markRef(current, workInProgress); - - // Check the host config to see if the children are offscreen/hidden. - if (renderExpirationTime !== Never && workInProgress.mode & AsyncMode && shouldDeprioritizeSubtree(type, nextProps)) { - // Down-prioritize the children. - workInProgress.expirationTime = Never; - // Bailout and come back to this fiber later. - workInProgress.memoizedProps = nextProps; - return null; + return 0; + }, + which: function (event) { + // `which` is an alias for either `keyCode` or `charCode` depending on the + // type of the event. + if (event.type === 'keypress') { + return getEventCharCode(event); } - - reconcileChildren(current, workInProgress, nextChildren); - memoizeProps(workInProgress, nextProps); - return workInProgress.child; - } - - function updateHostText(current, workInProgress) { - if (current === null) { - tryToClaimNextHydratableInstance(workInProgress); + if (event.type === 'keydown' || event.type === 'keyup') { + return event.keyCode; } - var nextProps = workInProgress.pendingProps; - memoizeProps(workInProgress, nextProps); - // Nothing to do here. This is terminal. We'll do the completion step - // immediately after. - return null; + return 0; } +}); - function mountIndeterminateComponent(current, workInProgress, renderExpirationTime) { - !(current === null) ? invariant(false, 'An indeterminate component should never have mounted. This error is likely caused by a bug in React. Please file an issue.') : void 0; - var fn = workInProgress.type; - var props = workInProgress.pendingProps; - var unmaskedContext = getUnmaskedContext(workInProgress); - var context = getMaskedContext(workInProgress, unmaskedContext); - - var value = void 0; +/** + * @interface DragEvent + * @see http://www.w3.org/TR/DOM-Level-3-Events/ + */ +var SyntheticDragEvent = SyntheticMouseEvent.extend({ + dataTransfer: null +}); - { - if (fn.prototype && typeof fn.prototype.render === 'function') { - var componentName = getComponentName(workInProgress) || 'Unknown'; +/** + * @interface TouchEvent + * @see http://www.w3.org/TR/touch-events/ + */ +var SyntheticTouchEvent = SyntheticUIEvent.extend({ + touches: null, + targetTouches: null, + changedTouches: null, + altKey: null, + metaKey: null, + ctrlKey: null, + shiftKey: null, + getModifierState: getEventModifierState +}); - if (!didWarnAboutBadClass[componentName]) { - warning(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName); - didWarnAboutBadClass[componentName] = true; - } - } - ReactCurrentOwner.current = workInProgress; - value = fn(props, context); - } - // React DevTools reads this flag. - workInProgress.effectTag |= PerformedWork; +/** + * @interface Event + * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events- + * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent + */ +var SyntheticTransitionEvent = SyntheticEvent$1.extend({ + propertyName: null, + elapsedTime: null, + pseudoElement: null +}); - if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) { - var Component = workInProgress.type; +/** + * @interface WheelEvent + * @see http://www.w3.org/TR/DOM-Level-3-Events/ + */ +var SyntheticWheelEvent = SyntheticMouseEvent.extend({ + deltaX: function (event) { + return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive). + 'wheelDeltaX' in event ? -event.wheelDeltaX : 0; + }, + deltaY: function (event) { + return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive). + 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive). + 'wheelDelta' in event ? -event.wheelDelta : 0; + }, - // Proceed under the assumption that this is a class instance - workInProgress.tag = ClassComponent; + deltaZ: null, - workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null; + // Browsers without "deltaMode" is reporting in raw wheel delta where one + // notch on the scroll is always +/- 120, roughly equivalent to pixels. + // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or + // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size. + deltaMode: null +}); - if (typeof Component.getDerivedStateFromProps === 'function') { - var partialState = callGetDerivedStateFromProps(workInProgress, value, props, workInProgress.memoizedState); +/** + * Turns + * ['abort', ...] + * into + * eventTypes = { + * 'abort': { + * phasedRegistrationNames: { + * bubbled: 'onAbort', + * captured: 'onAbortCapture', + * }, + * dependencies: ['topAbort'], + * }, + * ... + * }; + * topLevelEventsToDispatchConfig = { + * 'topAbort': { sameConfig } + * }; + */ +var interactiveEventTypeNames = ['blur', 'cancel', 'click', 'close', 'contextMenu', 'copy', 'cut', 'doubleClick', 'dragEnd', 'dragStart', 'drop', 'focus', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'mouseDown', 'mouseUp', 'paste', 'pause', 'play', 'rateChange', 'reset', 'seeked', 'submit', 'touchCancel', 'touchEnd', 'touchStart', 'volumeChange']; +var nonInteractiveEventTypeNames = ['abort', 'animationEnd', 'animationIteration', 'animationStart', 'canPlay', 'canPlayThrough', 'drag', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'mouseMove', 'mouseOut', 'mouseOver', 'playing', 'progress', 'scroll', 'seeking', 'stalled', 'suspend', 'timeUpdate', 'toggle', 'touchMove', 'transitionEnd', 'waiting', 'wheel']; - if (partialState !== null && partialState !== undefined) { - workInProgress.memoizedState = _assign({}, workInProgress.memoizedState, partialState); - } - } +var eventTypes$4 = {}; +var topLevelEventsToDispatchConfig = {}; - // Push context providers early to prevent context stack mismatches. - // During mounting we don't know the child context yet as the instance doesn't exist. - // We will invalidate the child context in finishClassComponent() right after rendering. - var hasContext = pushLegacyContextProvider(workInProgress); - adoptClassInstance(workInProgress, value); - mountClassInstance(workInProgress, renderExpirationTime); - return finishClassComponent(current, workInProgress, true, hasContext, false, renderExpirationTime); - } else { - // Proceed under the assumption that this is a functional component - workInProgress.tag = FunctionalComponent; - { - var _Component = workInProgress.type; +function addEventTypeNameToConfig(event, isInteractive) { + var capitalizedEvent = event[0].toUpperCase() + event.slice(1); + var onEvent = 'on' + capitalizedEvent; + var topEvent = 'top' + capitalizedEvent; - if (_Component) { - warning(!_Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', _Component.displayName || _Component.name || 'Component'); - } - if (workInProgress.ref !== null) { - var info = ''; - var ownerName = ReactDebugCurrentFiber.getCurrentFiberOwnerName(); - if (ownerName) { - info += '\n\nCheck the render method of `' + ownerName + '`.'; - } + var type = { + phasedRegistrationNames: { + bubbled: onEvent, + captured: onEvent + 'Capture' + }, + dependencies: [topEvent], + isInteractive: isInteractive + }; + eventTypes$4[event] = type; + topLevelEventsToDispatchConfig[topEvent] = type; +} - var warningKey = ownerName || workInProgress._debugID || ''; - var debugSource = workInProgress._debugSource; - if (debugSource) { - warningKey = debugSource.fileName + ':' + debugSource.lineNumber; - } - if (!didWarnAboutStatelessRefs[warningKey]) { - didWarnAboutStatelessRefs[warningKey] = true; - warning(false, 'Stateless function components cannot be given refs. ' + 'Attempts to access this ref will fail.%s%s', info, ReactDebugCurrentFiber.getCurrentFiberStackAddendum()); - } - } +interactiveEventTypeNames.forEach(function (eventTypeName) { + addEventTypeNameToConfig(eventTypeName, true); +}); +nonInteractiveEventTypeNames.forEach(function (eventTypeName) { + addEventTypeNameToConfig(eventTypeName, false); +}); - if (typeof fn.getDerivedStateFromProps === 'function') { - var _componentName = getComponentName(workInProgress) || 'Unknown'; +// Only used in DEV for exhaustiveness validation. +var knownHTMLTopLevelTypes = ['topAbort', 'topCancel', 'topCanPlay', 'topCanPlayThrough', 'topClose', 'topDurationChange', 'topEmptied', 'topEncrypted', 'topEnded', 'topError', 'topInput', 'topInvalid', 'topLoad', 'topLoadedData', 'topLoadedMetadata', 'topLoadStart', 'topPause', 'topPlay', 'topPlaying', 'topProgress', 'topRateChange', 'topReset', 'topSeeked', 'topSeeking', 'topStalled', 'topSubmit', 'topSuspend', 'topTimeUpdate', 'topToggle', 'topVolumeChange', 'topWaiting']; - if (!didWarnAboutGetDerivedStateOnFunctionalComponent[_componentName]) { - warning(false, '%s: Stateless functional components do not support getDerivedStateFromProps.', _componentName); - didWarnAboutGetDerivedStateOnFunctionalComponent[_componentName] = true; - } - } - } - reconcileChildren(current, workInProgress, value); - memoizeProps(workInProgress, props); - return workInProgress.child; - } - } +var SimpleEventPlugin = { + eventTypes: eventTypes$4, - function updateCallComponent(current, workInProgress, renderExpirationTime) { - var nextProps = workInProgress.pendingProps; - if (hasLegacyContextChanged()) { - // Normally we can bail out on props equality but if context has changed - // we don't do the bailout and we have to reuse existing props instead. - } else if (workInProgress.memoizedProps === nextProps) { - nextProps = workInProgress.memoizedProps; - // TODO: When bailing out, we might need to return the stateNode instead - // of the child. To check it for work. - // return bailoutOnAlreadyFinishedWork(current, workInProgress); - } + isInteractiveTopLevelEventType: function (topLevelType) { + var config = topLevelEventsToDispatchConfig[topLevelType]; + return config !== undefined && config.isInteractive === true; + }, - var nextChildren = nextProps.children; - // The following is a fork of reconcileChildrenAtExpirationTime but using - // stateNode to store the child. - if (current === null) { - workInProgress.stateNode = mountChildFibers(workInProgress, workInProgress.stateNode, nextChildren, renderExpirationTime); - } else { - workInProgress.stateNode = reconcileChildFibers(workInProgress, current.stateNode, nextChildren, renderExpirationTime); + extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType]; + if (!dispatchConfig) { + return null; } - - memoizeProps(workInProgress, nextProps); - // This doesn't take arbitrary time so we could synchronously just begin - // eagerly do the work of workInProgress.child as an optimization. - return workInProgress.stateNode; - } - - function updatePortalComponent(current, workInProgress, renderExpirationTime) { - pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); - var nextChildren = workInProgress.pendingProps; - if (hasLegacyContextChanged()) { - // Normally we can bail out on props equality but if context has changed - // we don't do the bailout and we have to reuse existing props instead. - } else if (workInProgress.memoizedProps === nextChildren) { - return bailoutOnAlreadyFinishedWork(current, workInProgress); - } - - if (current === null) { - // Portals are special because we don't append the children during mount - // but at commit. Therefore we need to track insertions which the normal - // flow doesn't do during mount. This doesn't happen at the root because - // the root always starts with a "current" with a null child. - // TODO: Consider unifying this with how the root works. - workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime); - memoizeProps(workInProgress, nextChildren); - } else { - reconcileChildren(current, workInProgress, nextChildren); - memoizeProps(workInProgress, nextChildren); - } - return workInProgress.child; - } - - function propagateContextChange(workInProgress, context, changedBits, renderExpirationTime) { - var fiber = workInProgress.child; - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber['return'] = workInProgress; - } - while (fiber !== null) { - var nextFiber = void 0; - // Visit this fiber. - switch (fiber.tag) { - case ContextConsumer: - // Check if the context matches. - var observedBits = fiber.stateNode | 0; - if (fiber.type === context && (observedBits & changedBits) !== 0) { - // Update the expiration time of all the ancestors, including - // the alternates. - var node = fiber; - while (node !== null) { - var alternate = node.alternate; - if (node.expirationTime === NoWork || node.expirationTime > renderExpirationTime) { - node.expirationTime = renderExpirationTime; - if (alternate !== null && (alternate.expirationTime === NoWork || alternate.expirationTime > renderExpirationTime)) { - alternate.expirationTime = renderExpirationTime; - } - } else if (alternate !== null && (alternate.expirationTime === NoWork || alternate.expirationTime > renderExpirationTime)) { - alternate.expirationTime = renderExpirationTime; - } else { - // Neither alternate was updated, which means the rest of the - // ancestor path already has sufficient priority. - break; - } - node = node['return']; - } - // Don't scan deeper than a matching consumer. When we render the - // consumer, we'll continue scanning from that point. This way the - // scanning work is time-sliced. - nextFiber = null; - } else { - // Traverse down. - nextFiber = fiber.child; - } - break; - case ContextProvider: - // Don't scan deeper if this is a matching provider - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - break; - default: - // Traverse down. - nextFiber = fiber.child; - break; - } - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber['return'] = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - var sibling = nextFiber.sibling; - if (sibling !== null) { - nextFiber = sibling; - break; + var EventConstructor = void 0; + switch (topLevelType) { + case 'topKeyPress': + // Firefox creates a keypress event for function keys too. This removes + // the unwanted keypress events. Enter is however both printable and + // non-printable. One would expect Tab to be as well (but it isn't). + if (getEventCharCode(nativeEvent) === 0) { + return null; + } + /* falls through */ + case 'topKeyDown': + case 'topKeyUp': + EventConstructor = SyntheticKeyboardEvent; + break; + case 'topBlur': + case 'topFocus': + EventConstructor = SyntheticFocusEvent; + break; + case 'topClick': + // Firefox creates a click event on right mouse clicks. This removes the + // unwanted click events. + if (nativeEvent.button === 2) { + return null; + } + /* falls through */ + case 'topDoubleClick': + case 'topMouseDown': + case 'topMouseMove': + case 'topMouseUp': + // TODO: Disabled elements should not respond to mouse events + /* falls through */ + case 'topMouseOut': + case 'topMouseOver': + case 'topContextMenu': + EventConstructor = SyntheticMouseEvent; + break; + case 'topDrag': + case 'topDragEnd': + case 'topDragEnter': + case 'topDragExit': + case 'topDragLeave': + case 'topDragOver': + case 'topDragStart': + case 'topDrop': + EventConstructor = SyntheticDragEvent; + break; + case 'topTouchCancel': + case 'topTouchEnd': + case 'topTouchMove': + case 'topTouchStart': + EventConstructor = SyntheticTouchEvent; + break; + case 'topAnimationEnd': + case 'topAnimationIteration': + case 'topAnimationStart': + EventConstructor = SyntheticAnimationEvent; + break; + case 'topTransitionEnd': + EventConstructor = SyntheticTransitionEvent; + break; + case 'topScroll': + EventConstructor = SyntheticUIEvent; + break; + case 'topWheel': + EventConstructor = SyntheticWheelEvent; + break; + case 'topCopy': + case 'topCut': + case 'topPaste': + EventConstructor = SyntheticClipboardEvent; + break; + default: + { + if (knownHTMLTopLevelTypes.indexOf(topLevelType) === -1) { + warning(false, 'SimpleEventPlugin: Unhandled event type, `%s`. This warning ' + 'is likely caused by a bug in React. Please file an issue.', topLevelType); } - // No more siblings. Traverse up. - nextFiber = nextFiber['return']; } - } - fiber = nextFiber; + // HTML Events + // @see http://www.w3.org/TR/html5/index.html#events-0 + EventConstructor = SyntheticEvent$1; + break; } + var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget); + accumulateTwoPhaseDispatches(event); + return event; } +}; - function updateContextProvider(current, workInProgress, renderExpirationTime) { - var providerType = workInProgress.type; - var context = providerType._context; - - var newProps = workInProgress.pendingProps; - var oldProps = workInProgress.memoizedProps; - - if (hasLegacyContextChanged()) { - // Normally we can bail out on props equality but if context has changed - // we don't do the bailout and we have to reuse existing props instead. - } else if (oldProps === newProps) { - workInProgress.stateNode = 0; - pushProvider(workInProgress); - return bailoutOnAlreadyFinishedWork(current, workInProgress); - } - - var newValue = newProps.value; - workInProgress.memoizedProps = newProps; +var isInteractiveTopLevelEventType = SimpleEventPlugin.isInteractiveTopLevelEventType; - var changedBits = void 0; - if (oldProps === null) { - // Initial render - changedBits = MAX_SIGNED_31_BIT_INT; - } else { - if (oldProps.value === newProps.value) { - // No change. Bailout early if children are the same. - if (oldProps.children === newProps.children) { - workInProgress.stateNode = 0; - pushProvider(workInProgress); - return bailoutOnAlreadyFinishedWork(current, workInProgress); - } - changedBits = 0; - } else { - var oldValue = oldProps.value; - // Use Object.is to compare the new context value to the old value. - // Inlined Object.is polyfill. - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - if (oldValue === newValue && (oldValue !== 0 || 1 / oldValue === 1 / newValue) || oldValue !== oldValue && newValue !== newValue // eslint-disable-line no-self-compare - ) { - // No change. Bailout early if children are the same. - if (oldProps.children === newProps.children) { - workInProgress.stateNode = 0; - pushProvider(workInProgress); - return bailoutOnAlreadyFinishedWork(current, workInProgress); - } - changedBits = 0; - } else { - changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT; - { - warning((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits); - } - changedBits |= 0; - if (changedBits === 0) { - // No change. Bailout early if children are the same. - if (oldProps.children === newProps.children) { - workInProgress.stateNode = 0; - pushProvider(workInProgress); - return bailoutOnAlreadyFinishedWork(current, workInProgress); - } - } else { - propagateContextChange(workInProgress, context, changedBits, renderExpirationTime); - } - } - } - } +var CALLBACK_BOOKKEEPING_POOL_SIZE = 10; +var callbackBookkeepingPool = []; - workInProgress.stateNode = changedBits; - pushProvider(workInProgress); +/** + * Find the deepest React component completely containing the root of the + * passed-in instance (for use when entire React trees are nested within each + * other). If React trees are not nested, returns null. + */ +function findRootContainerNode(inst) { + // TODO: It may be a good idea to cache this to prevent unnecessary DOM + // traversal, but caching is difficult to do correctly without using a + // mutation observer to listen for all DOM changes. + while (inst['return']) { + inst = inst['return']; + } + if (inst.tag !== HostRoot) { + // This can happen if we're in a detached tree. + return null; + } + return inst.stateNode.containerInfo; +} - var newChildren = newProps.children; - reconcileChildren(current, workInProgress, newChildren); - return workInProgress.child; +// Used to store ancestor hierarchy in top level callback +function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) { + if (callbackBookkeepingPool.length) { + var instance = callbackBookkeepingPool.pop(); + instance.topLevelType = topLevelType; + instance.nativeEvent = nativeEvent; + instance.targetInst = targetInst; + return instance; } + return { + topLevelType: topLevelType, + nativeEvent: nativeEvent, + targetInst: targetInst, + ancestors: [] + }; +} - function updateContextConsumer(current, workInProgress, renderExpirationTime) { - var context = workInProgress.type; - var newProps = workInProgress.pendingProps; - var oldProps = workInProgress.memoizedProps; +function releaseTopLevelCallbackBookKeeping(instance) { + instance.topLevelType = null; + instance.nativeEvent = null; + instance.targetInst = null; + instance.ancestors.length = 0; + if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) { + callbackBookkeepingPool.push(instance); + } +} - var newValue = context._currentValue; - var changedBits = context._changedBits; +function handleTopLevel(bookKeeping) { + var targetInst = bookKeeping.targetInst; - if (hasLegacyContextChanged()) { - // Normally we can bail out on props equality but if context has changed - // we don't do the bailout and we have to reuse existing props instead. - } else if (changedBits === 0 && oldProps === newProps) { - return bailoutOnAlreadyFinishedWork(current, workInProgress); + // Loop through the hierarchy, in case there's any nested components. + // It's important that we build the array of ancestors before calling any + // event handlers, because event handlers can modify the DOM, leading to + // inconsistencies with ReactMount's node cache. See #1105. + var ancestor = targetInst; + do { + if (!ancestor) { + bookKeeping.ancestors.push(ancestor); + break; } - workInProgress.memoizedProps = newProps; - - var observedBits = newProps.unstable_observedBits; - if (observedBits === undefined || observedBits === null) { - // Subscribe to all changes by default - observedBits = MAX_SIGNED_31_BIT_INT; + var root = findRootContainerNode(ancestor); + if (!root) { + break; } - // Store the observedBits on the fiber's stateNode for quick access. - workInProgress.stateNode = observedBits; + bookKeeping.ancestors.push(ancestor); + ancestor = getClosestInstanceFromNode(root); + } while (ancestor); - if ((changedBits & observedBits) !== 0) { - // Context change propagation stops at matching consumers, for time- - // slicing. Continue the propagation here. - propagateContextChange(workInProgress, context, changedBits, renderExpirationTime); - } - // There is no bailout on `children` equality because we expect people - // to often pass a bound method as a child, but it may reference - // `this.state` or `this.props` (and thus needs to re-render on `setState`). + for (var i = 0; i < bookKeeping.ancestors.length; i++) { + targetInst = bookKeeping.ancestors[i]; + runExtractedEventsInBatch(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent)); + } +} - var render = newProps.children; +// TODO: can we stop exporting these? +var _enabled = true; - { - warning(typeof render === 'function', 'A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.'); - } +function setEnabled(enabled) { + _enabled = !!enabled; +} - var newChildren = render(newValue); - reconcileChildren(current, workInProgress, newChildren); - return workInProgress.child; - } +function isEnabled() { + return _enabled; +} - /* - function reuseChildrenEffects(returnFiber : Fiber, firstChild : Fiber) { - let child = firstChild; - do { - // Ensure that the first and last effect of the parent corresponds - // to the children's first and last effect. - if (!returnFiber.firstEffect) { - returnFiber.firstEffect = child.firstEffect; - } - if (child.lastEffect) { - if (returnFiber.lastEffect) { - returnFiber.lastEffect.nextEffect = child.firstEffect; - } - returnFiber.lastEffect = child.lastEffect; - } - } while (child = child.sibling); +/** + * Traps top-level events by using event bubbling. + * + * @param {string} topLevelType Record from `BrowserEventConstants`. + * @param {string} handlerBaseName Event name (e.g. "click"). + * @param {object} element Element on which to attach listener. + * @return {?object} An object with a remove function which will forcefully + * remove the listener. + * @internal + */ +function trapBubbledEvent(topLevelType, handlerBaseName, element) { + if (!element) { + return null; } - */ - - function bailoutOnAlreadyFinishedWork(current, workInProgress) { - cancelWorkTimer(workInProgress); + var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent; - // TODO: We should ideally be able to bail out early if the children have no - // more work to do. However, since we don't have a separation of this - // Fiber's priority and its children yet - we don't know without doing lots - // of the same work we do anyway. Once we have that separation we can just - // bail out here if the children has no more work at this priority level. - // if (workInProgress.priorityOfChildren <= priorityLevel) { - // // If there are side-effects in these children that have not yet been - // // committed we need to ensure that they get properly transferred up. - // if (current && current.child !== workInProgress.child) { - // reuseChildrenEffects(workInProgress, child); - // } - // return null; - // } + addEventBubbleListener(element, handlerBaseName, + // Check if interactive and wrap in interactiveUpdates + dispatch.bind(null, topLevelType)); +} - cloneChildFibers(current, workInProgress); - return workInProgress.child; +/** + * Traps a top-level event by using event capturing. + * + * @param {string} topLevelType Record from `BrowserEventConstants`. + * @param {string} handlerBaseName Event name (e.g. "click"). + * @param {object} element Element on which to attach listener. + * @return {?object} An object with a remove function which will forcefully + * remove the listener. + * @internal + */ +function trapCapturedEvent(topLevelType, handlerBaseName, element) { + if (!element) { + return null; } + var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent; - function bailoutOnLowPriority(current, workInProgress) { - cancelWorkTimer(workInProgress); + addEventCaptureListener(element, handlerBaseName, + // Check if interactive and wrap in interactiveUpdates + dispatch.bind(null, topLevelType)); +} - // TODO: Handle HostComponent tags here as well and call pushHostContext()? - // See PR 8590 discussion for context - switch (workInProgress.tag) { - case HostRoot: - pushHostRootContext(workInProgress); - break; - case ClassComponent: - pushLegacyContextProvider(workInProgress); - break; - case HostPortal: - pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); - break; - case ContextProvider: - pushProvider(workInProgress); - break; - } - // TODO: What if this is currently in progress? - // How can that happen? How is this not being cloned? - return null; +function dispatchInteractiveEvent(topLevelType, nativeEvent) { + interactiveUpdates(dispatchEvent, topLevelType, nativeEvent); +} + +function dispatchEvent(topLevelType, nativeEvent) { + if (!_enabled) { + return; } - // TODO: Delete memoizeProps/State and move to reconcile/bailout instead - function memoizeProps(workInProgress, nextProps) { - workInProgress.memoizedProps = nextProps; + var nativeEventTarget = getEventTarget(nativeEvent); + var targetInst = getClosestInstanceFromNode(nativeEventTarget); + if (targetInst !== null && typeof targetInst.tag === 'number' && !isFiberMounted(targetInst)) { + // If we get an event (ex: img onload) before committing that + // component's mount, ignore it for now (that is, treat it as if it was an + // event on a non-React tree). We might also consider queueing events and + // dispatching them after the mount. + targetInst = null; } - function memoizeState(workInProgress, nextState) { - workInProgress.memoizedState = nextState; - // Don't reset the updateQueue, in case there are pending updates. Resetting - // is handled by processUpdateQueue. + var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst); + + try { + // Event queue being processed in the same cycle allows + // `preventDefault`. + batchedUpdates(handleTopLevel, bookKeeping); + } finally { + releaseTopLevelCallbackBookKeeping(bookKeeping); } +} - function beginWork(current, workInProgress, renderExpirationTime) { - if (workInProgress.expirationTime === NoWork || workInProgress.expirationTime > renderExpirationTime) { - return bailoutOnLowPriority(current, workInProgress); - } +var ReactDOMEventListener = Object.freeze({ + get _enabled () { return _enabled; }, + setEnabled: setEnabled, + isEnabled: isEnabled, + trapBubbledEvent: trapBubbledEvent, + trapCapturedEvent: trapCapturedEvent, + dispatchEvent: dispatchEvent +}); - switch (workInProgress.tag) { - case IndeterminateComponent: - return mountIndeterminateComponent(current, workInProgress, renderExpirationTime); - case FunctionalComponent: - return updateFunctionalComponent(current, workInProgress); - case ClassComponent: - return updateClassComponent(current, workInProgress, renderExpirationTime); - case HostRoot: - return updateHostRoot(current, workInProgress, renderExpirationTime); - case HostComponent: - return updateHostComponent(current, workInProgress, renderExpirationTime); - case HostText: - return updateHostText(current, workInProgress); - case CallHandlerPhase: - // This is a restart. Reset the tag to the initial phase. - workInProgress.tag = CallComponent; - // Intentionally fall through since this is now the same. - case CallComponent: - return updateCallComponent(current, workInProgress, renderExpirationTime); - case ReturnComponent: - // A return component is just a placeholder, we can just run through the - // next one immediately. - return null; - case HostPortal: - return updatePortalComponent(current, workInProgress, renderExpirationTime); - case ForwardRef: - return updateForwardRef(current, workInProgress); - case Fragment: - return updateFragment(current, workInProgress); - case Mode: - return updateMode(current, workInProgress); - case ContextProvider: - return updateContextProvider(current, workInProgress, renderExpirationTime); - case ContextConsumer: - return updateContextConsumer(current, workInProgress, renderExpirationTime); - default: - invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.'); - } - } +/** + * Generate a mapping of standard vendor prefixes using the defined style property and event name. + * + * @param {string} styleProp + * @param {string} eventName + * @returns {object} + */ +function makePrefixMap(styleProp, eventName) { + var prefixes = {}; - return { - beginWork: beginWork - }; + prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); + prefixes['Webkit' + styleProp] = 'webkit' + eventName; + prefixes['Moz' + styleProp] = 'moz' + eventName; + prefixes['ms' + styleProp] = 'MS' + eventName; + prefixes['O' + styleProp] = 'o' + eventName.toLowerCase(); + + return prefixes; +} + +/** + * A list of event names to a configurable list of vendor prefixes. + */ +var vendorPrefixes = { + animationend: makePrefixMap('Animation', 'AnimationEnd'), + animationiteration: makePrefixMap('Animation', 'AnimationIteration'), + animationstart: makePrefixMap('Animation', 'AnimationStart'), + transitionend: makePrefixMap('Transition', 'TransitionEnd') }; -var ReactFiberCompleteWork = function (config, hostContext, legacyContext, newContext, hydrationContext) { - var createInstance = config.createInstance, - createTextInstance = config.createTextInstance, - appendInitialChild = config.appendInitialChild, - finalizeInitialChildren = config.finalizeInitialChildren, - prepareUpdate = config.prepareUpdate, - mutation = config.mutation, - persistence = config.persistence; - var getRootHostContainer = hostContext.getRootHostContainer, - popHostContext = hostContext.popHostContext, - getHostContext = hostContext.getHostContext, - popHostContainer = hostContext.popHostContainer; - var popLegacyContextProvider = legacyContext.popContextProvider, - popTopLevelLegacyContextObject = legacyContext.popTopLevelContextObject; - var popProvider = newContext.popProvider; - var prepareToHydrateHostInstance = hydrationContext.prepareToHydrateHostInstance, - prepareToHydrateHostTextInstance = hydrationContext.prepareToHydrateHostTextInstance, - popHydrationState = hydrationContext.popHydrationState; +/** + * Event names that have already been detected and prefixed (if applicable). + */ +var prefixedEventNames = {}; +/** + * Element to check for prefixes on. + */ +var style = {}; - function markUpdate(workInProgress) { - // Tag the fiber with an update effect. This turns a Placement into - // an UpdateAndPlacement. - workInProgress.effectTag |= Update; +/** + * Bootstrap if a DOM exists. + */ +if (ExecutionEnvironment.canUseDOM) { + style = document.createElement('div').style; + + // On some platforms, in particular some releases of Android 4.x, + // the un-prefixed "animation" and "transition" properties are defined on the + // style object but the events that fire will still be prefixed, so we need + // to check if the un-prefixed events are usable, and if not remove them from the map. + if (!('AnimationEvent' in window)) { + delete vendorPrefixes.animationend.animation; + delete vendorPrefixes.animationiteration.animation; + delete vendorPrefixes.animationstart.animation; } - function markRef(workInProgress) { - workInProgress.effectTag |= Ref; + // Same as above + if (!('TransitionEvent' in window)) { + delete vendorPrefixes.transitionend.transition; } +} - function appendAllReturns(returns, workInProgress) { - var node = workInProgress.stateNode; - if (node) { - node['return'] = workInProgress; - } - while (node !== null) { - if (node.tag === HostComponent || node.tag === HostText || node.tag === HostPortal) { - invariant(false, 'A call cannot have host component children.'); - } else if (node.tag === ReturnComponent) { - returns.push(node.pendingProps.value); - } else if (node.child !== null) { - node.child['return'] = node; - node = node.child; - continue; - } - while (node.sibling === null) { - if (node['return'] === null || node['return'] === workInProgress) { - return; - } - node = node['return']; - } - node.sibling['return'] = node['return']; - node = node.sibling; +/** + * Attempts to determine the correct vendor prefixed event name. + * + * @param {string} eventName + * @returns {string} + */ +function getVendorPrefixedEventName(eventName) { + if (prefixedEventNames[eventName]) { + return prefixedEventNames[eventName]; + } else if (!vendorPrefixes[eventName]) { + return eventName; + } + + var prefixMap = vendorPrefixes[eventName]; + + for (var styleProp in prefixMap) { + if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) { + return prefixedEventNames[eventName] = prefixMap[styleProp]; } } - function moveCallToHandlerPhase(current, workInProgress, renderExpirationTime) { - var props = workInProgress.memoizedProps; - !props ? invariant(false, 'Should be resolved by now. This error is likely caused by a bug in React. Please file an issue.') : void 0; + return eventName; +} - // First step of the call has completed. Now we need to do the second. - // TODO: It would be nice to have a multi stage call represented by a - // single component, or at least tail call optimize nested ones. Currently - // that requires additional fields that we don't want to add to the fiber. - // So this requires nested handlers. - // Note: This doesn't mutate the alternate node. I don't think it needs to - // since this stage is reset for every pass. - workInProgress.tag = CallHandlerPhase; +/** + * Types of raw signals from the browser caught at the top level. + * + * For events like 'submit' or audio/video events which don't consistently + * bubble (which we trap at a lower node than `document`), binding + * at `document` would cause duplicate events so we don't include them here. + */ +var topLevelTypes = { + topAnimationEnd: getVendorPrefixedEventName('animationend'), + topAnimationIteration: getVendorPrefixedEventName('animationiteration'), + topAnimationStart: getVendorPrefixedEventName('animationstart'), + topBlur: 'blur', + topCancel: 'cancel', + topChange: 'change', + topClick: 'click', + topClose: 'close', + topCompositionEnd: 'compositionend', + topCompositionStart: 'compositionstart', + topCompositionUpdate: 'compositionupdate', + topContextMenu: 'contextmenu', + topCopy: 'copy', + topCut: 'cut', + topDoubleClick: 'dblclick', + topDrag: 'drag', + topDragEnd: 'dragend', + topDragEnter: 'dragenter', + topDragExit: 'dragexit', + topDragLeave: 'dragleave', + topDragOver: 'dragover', + topDragStart: 'dragstart', + topDrop: 'drop', + topFocus: 'focus', + topInput: 'input', + topKeyDown: 'keydown', + topKeyPress: 'keypress', + topKeyUp: 'keyup', + topLoad: 'load', + topLoadStart: 'loadstart', + topMouseDown: 'mousedown', + topMouseMove: 'mousemove', + topMouseOut: 'mouseout', + topMouseOver: 'mouseover', + topMouseUp: 'mouseup', + topPaste: 'paste', + topScroll: 'scroll', + topSelectionChange: 'selectionchange', + topTextInput: 'textInput', + topToggle: 'toggle', + topTouchCancel: 'touchcancel', + topTouchEnd: 'touchend', + topTouchMove: 'touchmove', + topTouchStart: 'touchstart', + topTransitionEnd: getVendorPrefixedEventName('transitionend'), + topWheel: 'wheel' +}; - // Build up the returns. - // TODO: Compare this to a generator or opaque helpers like Children. - var returns = []; - appendAllReturns(returns, workInProgress); - var fn = props.handler; - var childProps = props.props; - var nextChildren = fn(childProps, returns); +// There are so many media events, it makes sense to just +// maintain a list of them. Note these aren't technically +// "top-level" since they don't bubble. We should come up +// with a better naming convention if we come to refactoring +// the event system. +var mediaEventTypes = { + topAbort: 'abort', + topCanPlay: 'canplay', + topCanPlayThrough: 'canplaythrough', + topDurationChange: 'durationchange', + topEmptied: 'emptied', + topEncrypted: 'encrypted', + topEnded: 'ended', + topError: 'error', + topLoadedData: 'loadeddata', + topLoadedMetadata: 'loadedmetadata', + topLoadStart: 'loadstart', + topPause: 'pause', + topPlay: 'play', + topPlaying: 'playing', + topProgress: 'progress', + topRateChange: 'ratechange', + topSeeked: 'seeked', + topSeeking: 'seeking', + topStalled: 'stalled', + topSuspend: 'suspend', + topTimeUpdate: 'timeupdate', + topVolumeChange: 'volumechange', + topWaiting: 'waiting' +}; - var currentFirstChild = current !== null ? current.child : null; - workInProgress.child = reconcileChildFibers(workInProgress, currentFirstChild, nextChildren, renderExpirationTime); - return workInProgress.child; +/** + * Summary of `ReactBrowserEventEmitter` event handling: + * + * - Top-level delegation is used to trap most native browser events. This + * may only occur in the main thread and is the responsibility of + * ReactDOMEventListener, which is injected and can therefore support + * pluggable event sources. This is the only work that occurs in the main + * thread. + * + * - We normalize and de-duplicate events to account for browser quirks. This + * may be done in the worker thread. + * + * - Forward these native events (with the associated top-level type used to + * trap it) to `EventPluginHub`, which in turn will ask plugins if they want + * to extract any synthetic events. + * + * - The `EventPluginHub` will then process each event by annotating them with + * "dispatches", a sequence of listeners and IDs that care about that event. + * + * - The `EventPluginHub` then dispatches the events. + * + * Overview of React and the event system: + * + * +------------+ . + * | DOM | . + * +------------+ . + * | . + * v . + * +------------+ . + * | ReactEvent | . + * | Listener | . + * +------------+ . +-----------+ + * | . +--------+|SimpleEvent| + * | . | |Plugin | + * +-----|------+ . v +-----------+ + * | | | . +--------------+ +------------+ + * | +-----------.--->|EventPluginHub| | Event | + * | | . | | +-----------+ | Propagators| + * | ReactEvent | . | | |TapEvent | |------------| + * | Emitter | . | |<---+|Plugin | |other plugin| + * | | . | | +-----------+ | utilities | + * | +-----------.--->| | +------------+ + * | | | . +--------------+ + * +-----|------+ . ^ +-----------+ + * | . | |Enter/Leave| + * + . +-------+|Plugin | + * +-------------+ . +-----------+ + * | application | . + * |-------------| . + * | | . + * | | . + * +-------------+ . + * . + * React Core . General Purpose Event Plugin System + */ + +var alreadyListeningTo = {}; +var reactTopListenersCounter = 0; + +/** + * To ensure no conflicts with other potential React instances on the page + */ +var topListenersIDKey = '_reactListenersID' + ('' + Math.random()).slice(2); + +function getListeningForDocument(mountAt) { + // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` + // directly. + if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { + mountAt[topListenersIDKey] = reactTopListenersCounter++; + alreadyListeningTo[mountAt[topListenersIDKey]] = {}; } + return alreadyListeningTo[mountAt[topListenersIDKey]]; +} - function appendAllChildren(parent, workInProgress) { - // We only have the top Fiber that was created but we need recurse down its - // children to find all the terminal nodes. - var node = workInProgress.child; - while (node !== null) { - if (node.tag === HostComponent || node.tag === HostText) { - appendInitialChild(parent, node.stateNode); - } else if (node.tag === HostPortal) { - // If we have a portal child, then we don't want to traverse - // down its children. Instead, we'll get insertions from each child in - // the portal directly. - } else if (node.child !== null) { - node.child['return'] = node; - node = node.child; - continue; - } - if (node === workInProgress) { - return; - } - while (node.sibling === null) { - if (node['return'] === null || node['return'] === workInProgress) { - return; +/** + * We listen for bubbled touch events on the document object. + * + * Firefox v8.01 (and possibly others) exhibited strange behavior when + * mounting `onmousemove` events at some node that was not the document + * element. The symptoms were that if your mouse is not moving over something + * contained within that mount point (for example on the background) the + * top-level listeners for `onmousemove` won't be called. However, if you + * register the `mousemove` on the document object, then it will of course + * catch all `mousemove`s. This along with iOS quirks, justifies restricting + * top-level listeners to the document object only, at least for these + * movement types of events and possibly all events. + * + * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html + * + * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but + * they bubble to document. + * + * @param {string} registrationName Name of listener (e.g. `onClick`). + * @param {object} contentDocumentHandle Document which owns the container + */ +function listenTo(registrationName, contentDocumentHandle) { + var mountAt = contentDocumentHandle; + var isListening = getListeningForDocument(mountAt); + var dependencies = registrationNameDependencies[registrationName]; + + for (var i = 0; i < dependencies.length; i++) { + var dependency = dependencies[i]; + if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { + if (dependency === 'topScroll') { + trapCapturedEvent('topScroll', 'scroll', mountAt); + } else if (dependency === 'topFocus' || dependency === 'topBlur') { + trapCapturedEvent('topFocus', 'focus', mountAt); + trapCapturedEvent('topBlur', 'blur', mountAt); + + // to make sure blur and focus event listeners are only attached once + isListening.topBlur = true; + isListening.topFocus = true; + } else if (dependency === 'topCancel') { + if (isEventSupported('cancel', true)) { + trapCapturedEvent('topCancel', 'cancel', mountAt); } - node = node['return']; + isListening.topCancel = true; + } else if (dependency === 'topClose') { + if (isEventSupported('close', true)) { + trapCapturedEvent('topClose', 'close', mountAt); + } + isListening.topClose = true; + } else if (topLevelTypes.hasOwnProperty(dependency)) { + trapBubbledEvent(dependency, topLevelTypes[dependency], mountAt); } - node.sibling['return'] = node['return']; - node = node.sibling; + + isListening[dependency] = true; } } +} - var updateHostContainer = void 0; - var updateHostComponent = void 0; - var updateHostText = void 0; - if (mutation) { - if (enableMutatingReconciler) { - // Mutation mode - updateHostContainer = function (workInProgress) { - // Noop - }; - updateHostComponent = function (current, workInProgress, updatePayload, type, oldProps, newProps, rootContainerInstance, currentHostContext) { - // TODO: Type this specific to this type of component. - workInProgress.updateQueue = updatePayload; - // If the update payload indicates that there is a change or if there - // is a new ref we mark this as an update. All the work is done in commitWork. - if (updatePayload) { - markUpdate(workInProgress); - } - }; - updateHostText = function (current, workInProgress, oldText, newText) { - // If the text differs, mark it as an update. All the work in done in commitWork. - if (oldText !== newText) { - markUpdate(workInProgress); - } - }; - } else { - invariant(false, 'Mutating reconciler is disabled.'); +function isListeningToAllDependencies(registrationName, mountAt) { + var isListening = getListeningForDocument(mountAt); + var dependencies = registrationNameDependencies[registrationName]; + for (var i = 0; i < dependencies.length; i++) { + var dependency = dependencies[i]; + if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { + return false; } - } else if (persistence) { - if (enablePersistentReconciler) { - // Persistent host tree mode - var cloneInstance = persistence.cloneInstance, - createContainerChildSet = persistence.createContainerChildSet, - appendChildToContainerChildSet = persistence.appendChildToContainerChildSet, - finalizeContainerChildren = persistence.finalizeContainerChildren; + } + return true; +} - // An unfortunate fork of appendAllChildren because we have two different parent types. +/** + * Given any node return the first leaf node without children. + * + * @param {DOMElement|DOMTextNode} node + * @return {DOMElement|DOMTextNode} + */ +function getLeafNode(node) { + while (node && node.firstChild) { + node = node.firstChild; + } + return node; +} - var appendAllChildrenToContainer = function (containerChildSet, workInProgress) { - // We only have the top Fiber that was created but we need recurse down its - // children to find all the terminal nodes. - var node = workInProgress.child; - while (node !== null) { - if (node.tag === HostComponent || node.tag === HostText) { - appendChildToContainerChildSet(containerChildSet, node.stateNode); - } else if (node.tag === HostPortal) { - // If we have a portal child, then we don't want to traverse - // down its children. Instead, we'll get insertions from each child in - // the portal directly. - } else if (node.child !== null) { - node.child['return'] = node; - node = node.child; - continue; - } - if (node === workInProgress) { - return; - } - while (node.sibling === null) { - if (node['return'] === null || node['return'] === workInProgress) { - return; - } - node = node['return']; - } - node.sibling['return'] = node['return']; - node = node.sibling; - } - }; - updateHostContainer = function (workInProgress) { - var portalOrRoot = workInProgress.stateNode; - var childrenUnchanged = workInProgress.firstEffect === null; - if (childrenUnchanged) { - // No changes, just reuse the existing instance. - } else { - var container = portalOrRoot.containerInfo; - var newChildSet = createContainerChildSet(container); - // If children might have changed, we have to add them all to the set. - appendAllChildrenToContainer(newChildSet, workInProgress); - portalOrRoot.pendingChildren = newChildSet; - // Schedule an update on the container to swap out the container. - markUpdate(workInProgress); - finalizeContainerChildren(container, newChildSet); - } - }; - updateHostComponent = function (current, workInProgress, updatePayload, type, oldProps, newProps, rootContainerInstance, currentHostContext) { - // If there are no effects associated with this node, then none of our children had any updates. - // This guarantees that we can reuse all of them. - var childrenUnchanged = workInProgress.firstEffect === null; - var currentInstance = current.stateNode; - if (childrenUnchanged && updatePayload === null) { - // No changes, just reuse the existing instance. - // Note that this might release a previous clone. - workInProgress.stateNode = currentInstance; - } else { - var recyclableInstance = workInProgress.stateNode; - var newInstance = cloneInstance(currentInstance, updatePayload, type, oldProps, newProps, workInProgress, childrenUnchanged, recyclableInstance); - if (finalizeInitialChildren(newInstance, type, newProps, rootContainerInstance, currentHostContext)) { - markUpdate(workInProgress); - } - workInProgress.stateNode = newInstance; - if (childrenUnchanged) { - // If there are no other effects in this tree, we need to flag this node as having one. - // Even though we're not going to use it for anything. - // Otherwise parents won't know that there are new children to propagate upwards. - markUpdate(workInProgress); - } else { - // If children might have changed, we have to add them all to the set. - appendAllChildren(newInstance, workInProgress); - } - } - }; - updateHostText = function (current, workInProgress, oldText, newText) { - if (oldText !== newText) { - // If the text content differs, we'll create a new text instance for it. - var rootContainerInstance = getRootHostContainer(); - var currentHostContext = getHostContext(); - workInProgress.stateNode = createTextInstance(newText, rootContainerInstance, currentHostContext, workInProgress); - // We'll have to mark it as having an effect, even though we won't use the effect for anything. - // This lets the parents know that at least one of their children has changed. - markUpdate(workInProgress); - } - }; - } else { - invariant(false, 'Persistent reconciler is disabled.'); - } - } else { - if (enableNoopReconciler) { - // No host operations - updateHostContainer = function (workInProgress) { - // Noop - }; - updateHostComponent = function (current, workInProgress, updatePayload, type, oldProps, newProps, rootContainerInstance, currentHostContext) { - // Noop - }; - updateHostText = function (current, workInProgress, oldText, newText) { - // Noop - }; - } else { - invariant(false, 'Noop reconciler is disabled.'); +/** + * Get the next sibling within a container. This will walk up the + * DOM if a node's siblings have been exhausted. + * + * @param {DOMElement|DOMTextNode} node + * @return {?DOMElement|DOMTextNode} + */ +function getSiblingNode(node) { + while (node) { + if (node.nextSibling) { + return node.nextSibling; } + node = node.parentNode; } +} - function completeWork(current, workInProgress, renderExpirationTime) { - var newProps = workInProgress.pendingProps; - switch (workInProgress.tag) { - case FunctionalComponent: - return null; - case ClassComponent: - { - // We are leaving this subtree, so pop context if any. - popLegacyContextProvider(workInProgress); +/** + * Get object describing the nodes which contain characters at offset. + * + * @param {DOMElement|DOMTextNode} root + * @param {number} offset + * @return {?object} + */ +function getNodeForCharacterOffset(root, offset) { + var node = getLeafNode(root); + var nodeStart = 0; + var nodeEnd = 0; - // If this component caught an error, schedule an error log effect. - var instance = workInProgress.stateNode; - var updateQueue = workInProgress.updateQueue; - if (updateQueue !== null && updateQueue.capturedValues !== null) { - workInProgress.effectTag &= ~DidCapture; - if (typeof instance.componentDidCatch === 'function') { - workInProgress.effectTag |= ErrLog; - } else { - // Normally we clear this in the commit phase, but since we did not - // schedule an effect, we need to reset it here. - updateQueue.capturedValues = null; - } - } - return null; - } - case HostRoot: - { - popHostContainer(workInProgress); - popTopLevelLegacyContextObject(workInProgress); - var fiberRoot = workInProgress.stateNode; - if (fiberRoot.pendingContext) { - fiberRoot.context = fiberRoot.pendingContext; - fiberRoot.pendingContext = null; - } - if (current === null || current.child === null) { - // If we hydrated, pop so that we can delete any remaining children - // that weren't hydrated. - popHydrationState(workInProgress); - // This resets the hacky state to fix isMounted before committing. - // TODO: Delete this when we delete isMounted and findDOMNode. - workInProgress.effectTag &= ~Placement; - } - updateHostContainer(workInProgress); + while (node) { + if (node.nodeType === TEXT_NODE) { + nodeEnd = nodeStart + node.textContent.length; - var _updateQueue = workInProgress.updateQueue; - if (_updateQueue !== null && _updateQueue.capturedValues !== null) { - workInProgress.effectTag |= ErrLog; - } - return null; - } - case HostComponent: - { - popHostContext(workInProgress); - var rootContainerInstance = getRootHostContainer(); - var type = workInProgress.type; - if (current !== null && workInProgress.stateNode != null) { - // If we have an alternate, that means this is an update and we need to - // schedule a side-effect to do the updates. - var oldProps = current.memoizedProps; - // If we get updated because one of our children updated, we don't - // have newProps so we'll have to reuse them. - // TODO: Split the update API as separate for the props vs. children. - // Even better would be if children weren't special cased at all tho. - var _instance = workInProgress.stateNode; - var currentHostContext = getHostContext(); - // TODO: Experiencing an error where oldProps is null. Suggests a host - // component is hitting the resume path. Figure out why. Possibly - // related to `hidden`. - var updatePayload = prepareUpdate(_instance, type, oldProps, newProps, rootContainerInstance, currentHostContext); + if (nodeStart <= offset && nodeEnd >= offset) { + return { + node: node, + offset: offset - nodeStart + }; + } - updateHostComponent(current, workInProgress, updatePayload, type, oldProps, newProps, rootContainerInstance, currentHostContext); + nodeStart = nodeEnd; + } - if (current.ref !== workInProgress.ref) { - markRef(workInProgress); - } - } else { - if (!newProps) { - !(workInProgress.stateNode !== null) ? invariant(false, 'We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.') : void 0; - // This can happen when we abort work. - return null; - } + node = getLeafNode(getSiblingNode(node)); + } +} - var _currentHostContext = getHostContext(); - // TODO: Move createInstance to beginWork and keep it on a context - // "stack" as the parent. Then append children as we go in beginWork - // or completeWork depending on we want to add then top->down or - // bottom->up. Top->down is faster in IE11. - var wasHydrated = popHydrationState(workInProgress); - if (wasHydrated) { - // TODO: Move this and createInstance step into the beginPhase - // to consolidate. - if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, _currentHostContext)) { - // If changes to the hydrated node needs to be applied at the - // commit-phase we mark this as such. - markUpdate(workInProgress); - } - } else { - var _instance2 = createInstance(type, newProps, rootContainerInstance, _currentHostContext, workInProgress); +/** + * @param {DOMElement} outerNode + * @return {?object} + */ +function getOffsets(outerNode) { + var selection = window.getSelection && window.getSelection(); - appendAllChildren(_instance2, workInProgress); + if (!selection || selection.rangeCount === 0) { + return null; + } - // Certain renderers require commit-time effects for initial mount. - // (eg DOM renderer supports auto-focus for certain elements). - // Make sure such renderers get scheduled for later work. - if (finalizeInitialChildren(_instance2, type, newProps, rootContainerInstance, _currentHostContext)) { - markUpdate(workInProgress); - } - workInProgress.stateNode = _instance2; - } + var anchorNode = selection.anchorNode, + anchorOffset = selection.anchorOffset, + focusNode = selection.focusNode, + focusOffset = selection.focusOffset; - if (workInProgress.ref !== null) { - // If there is a ref on a host node we need to schedule a callback - markRef(workInProgress); - } - } - return null; - } - case HostText: - { - var newText = newProps; - if (current && workInProgress.stateNode != null) { - var oldText = current.memoizedProps; - // If we have an alternate, that means this is an update and we need - // to schedule a side-effect to do the updates. - updateHostText(current, workInProgress, oldText, newText); - } else { - if (typeof newText !== 'string') { - !(workInProgress.stateNode !== null) ? invariant(false, 'We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.') : void 0; - // This can happen when we abort work. - return null; - } - var _rootContainerInstance = getRootHostContainer(); - var _currentHostContext2 = getHostContext(); - var _wasHydrated = popHydrationState(workInProgress); - if (_wasHydrated) { - if (prepareToHydrateHostTextInstance(workInProgress)) { - markUpdate(workInProgress); - } - } else { - workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext2, workInProgress); - } - } - return null; - } - case CallComponent: - return moveCallToHandlerPhase(current, workInProgress, renderExpirationTime); - case CallHandlerPhase: - // Reset the tag to now be a first phase call. - workInProgress.tag = CallComponent; - return null; - case ReturnComponent: - // Does nothing. - return null; - case ForwardRef: - return null; - case Fragment: - return null; - case Mode: - return null; - case HostPortal: - popHostContainer(workInProgress); - updateHostContainer(workInProgress); - return null; - case ContextProvider: - // Pop provider fiber - popProvider(workInProgress); - return null; - case ContextConsumer: - return null; - // Error cases - case IndeterminateComponent: - invariant(false, 'An indeterminate component should have become determinate before completing. This error is likely caused by a bug in React. Please file an issue.'); - // eslint-disable-next-line no-fallthrough - default: - invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.'); - } - } + // In Firefox, anchorNode and focusNode can be "anonymous divs", e.g. the + // up/down buttons on an . Anonymous divs do not seem to + // expose properties, triggering a "Permission denied error" if any of its + // properties are accessed. The only seemingly possible way to avoid erroring + // is to access a property that typically works for non-anonymous divs and + // catch any error that may otherwise arise. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=208427 - return { - completeWork: completeWork - }; -}; + try { + /* eslint-disable no-unused-expressions */ + anchorNode.nodeType; + focusNode.nodeType; + /* eslint-enable no-unused-expressions */ + } catch (e) { + return null; + } -function createCapturedValue(value, source) { - // If the value is an error, call this function immediately after it is thrown - // so the stack is accurate. - return { - value: value, - source: source, - stack: getStackAddendumByWorkInProgressFiber(source) - }; + return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset); } -var ReactFiberUnwindWork = function (hostContext, legacyContext, newContext, scheduleWork, isAlreadyFailedLegacyErrorBoundary) { - var popHostContainer = hostContext.popHostContainer, - popHostContext = hostContext.popHostContext; - var popLegacyContextProvider = legacyContext.popContextProvider, - popTopLevelLegacyContextObject = legacyContext.popTopLevelContextObject; - var popProvider = newContext.popProvider; - +/** + * Returns {start, end} where `start` is the character/codepoint index of + * (anchorNode, anchorOffset) within the textContent of `outerNode`, and + * `end` is the index of (focusNode, focusOffset). + * + * Returns null if you pass in garbage input but we should probably just crash. + * + * Exported only for testing. + */ +function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) { + var length = 0; + var start = -1; + var end = -1; + var indexWithinAnchor = 0; + var indexWithinFocus = 0; + var node = outerNode; + var parentNode = null; - function throwException(returnFiber, sourceFiber, rawValue) { - // The source fiber did not complete. - sourceFiber.effectTag |= Incomplete; - // Its effect list is no longer valid. - sourceFiber.firstEffect = sourceFiber.lastEffect = null; + outer: while (true) { + var next = null; - var value = createCapturedValue(rawValue, sourceFiber); + while (true) { + if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) { + start = length + anchorOffset; + } + if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) { + end = length + focusOffset; + } - var workInProgress = returnFiber; - do { - switch (workInProgress.tag) { - case HostRoot: - { - // Uncaught error - var errorInfo = value; - ensureUpdateQueues(workInProgress); - var updateQueue = workInProgress.updateQueue; - updateQueue.capturedValues = [errorInfo]; - workInProgress.effectTag |= ShouldCapture; - return; - } - case ClassComponent: - // Capture and retry - var ctor = workInProgress.type; - var _instance = workInProgress.stateNode; - if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromCatch === 'function' && enableGetDerivedStateFromCatch || _instance !== null && typeof _instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(_instance))) { - ensureUpdateQueues(workInProgress); - var _updateQueue = workInProgress.updateQueue; - var capturedValues = _updateQueue.capturedValues; - if (capturedValues === null) { - _updateQueue.capturedValues = [value]; - } else { - capturedValues.push(value); - } - workInProgress.effectTag |= ShouldCapture; - return; - } - break; - default: - break; + if (node.nodeType === TEXT_NODE) { + length += node.nodeValue.length; } - workInProgress = workInProgress['return']; - } while (workInProgress !== null); - } - function unwindWork(workInProgress) { - switch (workInProgress.tag) { - case ClassComponent: - { - popLegacyContextProvider(workInProgress); - var effectTag = workInProgress.effectTag; - if (effectTag & ShouldCapture) { - workInProgress.effectTag = effectTag & ~ShouldCapture | DidCapture; - return workInProgress; - } - return null; - } - case HostRoot: - { - popHostContainer(workInProgress); - popTopLevelLegacyContextObject(workInProgress); - var _effectTag = workInProgress.effectTag; - if (_effectTag & ShouldCapture) { - workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture; - return workInProgress; - } - return null; - } - case HostComponent: - { - popHostContext(workInProgress); - return null; - } - case HostPortal: - popHostContainer(workInProgress); - return null; - case ContextProvider: - popProvider(workInProgress); - return null; - default: - return null; + if ((next = node.firstChild) === null) { + break; + } + // Moving from `node` to its first child `next`. + parentNode = node; + node = next; } - } - function unwindInterruptedWork(interruptedWork) { - switch (interruptedWork.tag) { - case ClassComponent: - { - popLegacyContextProvider(interruptedWork); - break; - } - case HostRoot: - { - popHostContainer(interruptedWork); - popTopLevelLegacyContextObject(interruptedWork); - break; - } - case HostComponent: - { - popHostContext(interruptedWork); - break; - } - case HostPortal: - popHostContainer(interruptedWork); - break; - case ContextProvider: - popProvider(interruptedWork); - break; - default: + while (true) { + if (node === outerNode) { + // If `outerNode` has children, this is always the second time visiting + // it. If it has no children, this is still the first loop, and the only + // valid selection is anchorNode and focusNode both equal to this node + // and both offsets 0, in which case we will have handled above. + break outer; + } + if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) { + start = length; + } + if (parentNode === focusNode && ++indexWithinFocus === focusOffset) { + end = length; + } + if ((next = node.nextSibling) !== null) { break; + } + node = parentNode; + parentNode = node.parentNode; } + + // Moving from `node` to its next sibling `next`. + node = next; + } + + if (start === -1 || end === -1) { + // This should never happen. (Would happen if the anchor/focus nodes aren't + // actually inside the passed-in node.) + return null; } return { - throwException: throwException, - unwindWork: unwindWork, - unwindInterruptedWork: unwindInterruptedWork + start: start, + end: end }; -}; - -// This module is forked in different environments. -// By default, return `true` to log errors to the console. -// Forks can return `false` if this isn't desirable. -function showErrorDialog(capturedError) { - return true; } -function logCapturedError(capturedError) { - var logError = showErrorDialog(capturedError); - - // Allow injected showErrorDialog() to prevent default console.error logging. - // This enables renderers like ReactNative to better manage redbox behavior. - if (logError === false) { +/** + * In modern non-IE browsers, we can support both forward and backward + * selections. + * + * Note: IE10+ supports the Selection object, but it does not support + * the `extend` method, which means that even in modern IE, it's not possible + * to programmatically create a backward selection. Thus, for all IE + * versions, we use the old IE API to create our selections. + * + * @param {DOMElement|DOMTextNode} node + * @param {object} offsets + */ +function setOffsets(node, offsets) { + if (!window.getSelection) { return; } - var error = capturedError.error; - var suppressLogging = error && error.suppressReactErrorLogging; - if (suppressLogging) { - return; + var selection = window.getSelection(); + var length = node[getTextContentAccessor()].length; + var start = Math.min(offsets.start, length); + var end = offsets.end === undefined ? start : Math.min(offsets.end, length); + + // IE 11 uses modern selection, but doesn't support the extend method. + // Flip backward selections, so we can set with a single range. + if (!selection.extend && start > end) { + var temp = end; + end = start; + start = temp; } - { - var componentName = capturedError.componentName, - componentStack = capturedError.componentStack, - errorBoundaryName = capturedError.errorBoundaryName, - errorBoundaryFound = capturedError.errorBoundaryFound, - willRetry = capturedError.willRetry; - + var startMarker = getNodeForCharacterOffset(node, start); + var endMarker = getNodeForCharacterOffset(node, end); - var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:'; + if (startMarker && endMarker) { + if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) { + return; + } + var range = document.createRange(); + range.setStart(startMarker.node, startMarker.offset); + selection.removeAllRanges(); - var errorBoundaryMessage = void 0; - // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow. - if (errorBoundaryFound && errorBoundaryName) { - if (willRetry) { - errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.'); - } else { - errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.'; - } + if (start > end) { + selection.addRange(range); + selection.extend(endMarker.node, endMarker.offset); } else { - errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://fb.me/react-error-boundaries to learn more about error boundaries.'; + range.setEnd(endMarker.node, endMarker.offset); + selection.addRange(range); } - var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage); - - // In development, we provide our own message with just the component stack. - // We don't include the original error message and JS stack because the browser - // has already printed it. Even if the application swallows the error, it is still - // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils. - console.error(combinedMessage); } } -var invokeGuardedCallback$3 = ReactErrorUtils.invokeGuardedCallback; -var hasCaughtError$1 = ReactErrorUtils.hasCaughtError; -var clearCaughtError$1 = ReactErrorUtils.clearCaughtError; +function isInDocument(node) { + return containsNode(document.documentElement, node); +} +/** + * @ReactInputSelection: React input selection module. Based on Selection.js, + * but modified to be suitable for react and has a couple of bug fixes (doesn't + * assume buttons have range selections allowed). + * Input selection module for React. + */ -var didWarnAboutUndefinedSnapshotBeforeUpdate = null; -{ - didWarnAboutUndefinedSnapshotBeforeUpdate = new Set(); +function hasSelectionCapabilities(elem) { + var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); + return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true'); } -function logError(boundary, errorInfo) { - var source = errorInfo.source; - var stack = errorInfo.stack; - if (stack === null) { - stack = getStackAddendumByWorkInProgressFiber(source); - } - - var capturedError = { - componentName: source !== null ? getComponentName(source) : null, - componentStack: stack !== null ? stack : '', - error: errorInfo.value, - errorBoundary: null, - errorBoundaryName: null, - errorBoundaryFound: false, - willRetry: false +function getSelectionInformation() { + var focusedElem = getActiveElement(); + return { + focusedElem: focusedElem, + selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection$1(focusedElem) : null }; +} - if (boundary !== null && boundary.tag === ClassComponent) { - capturedError.errorBoundary = boundary.stateNode; - capturedError.errorBoundaryName = getComponentName(boundary); - capturedError.errorBoundaryFound = true; - capturedError.willRetry = true; - } +/** + * @restoreSelection: If any selection information was potentially lost, + * restore it. This is useful when performing operations that could remove dom + * nodes and place them back in, resulting in focus being lost. + */ +function restoreSelection(priorSelectionInformation) { + var curFocusedElem = getActiveElement(); + var priorFocusedElem = priorSelectionInformation.focusedElem; + var priorSelectionRange = priorSelectionInformation.selectionRange; + if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { + if (hasSelectionCapabilities(priorFocusedElem)) { + setSelection(priorFocusedElem, priorSelectionRange); + } - try { - logCapturedError(capturedError); - } catch (e) { - // Prevent cycle if logCapturedError() throws. - // A cycle may still occur if logCapturedError renders a component that throws. - var suppressLogging = e && e.suppressReactErrorLogging; - if (!suppressLogging) { - console.error(e); + // Focusing a node can change the scroll position, which is undesirable + var ancestors = []; + var ancestor = priorFocusedElem; + while (ancestor = ancestor.parentNode) { + if (ancestor.nodeType === ELEMENT_NODE) { + ancestors.push({ + element: ancestor, + left: ancestor.scrollLeft, + top: ancestor.scrollTop + }); + } + } + + priorFocusedElem.focus(); + + for (var i = 0; i < ancestors.length; i++) { + var info = ancestors[i]; + info.element.scrollLeft = info.left; + info.element.scrollTop = info.top; } } } -var ReactFiberCommitWork = function (config, captureError, scheduleWork, computeExpirationForFiber, markLegacyErrorBoundaryAsFailed, recalculateCurrentTime) { - var getPublicInstance = config.getPublicInstance, - mutation = config.mutation, - persistence = config.persistence; +/** + * @getSelection: Gets the selection bounds of a focused textarea, input or + * contentEditable node. + * -@input: Look up selection bounds of this input + * -@return {start: selectionStart, end: selectionEnd} + */ +function getSelection$1(input) { + var selection = void 0; + if ('selectionStart' in input) { + // Modern browser with input or textarea. + selection = { + start: input.selectionStart, + end: input.selectionEnd + }; + } else { + // Content editable or old IE textarea. + selection = getOffsets(input); + } - var callComponentWillUnmountWithTimer = function (current, instance) { - startPhaseTimer(current, 'componentWillUnmount'); - instance.props = current.memoizedProps; - instance.state = current.memoizedState; - instance.componentWillUnmount(); - stopPhaseTimer(); - }; + return selection || { start: 0, end: 0 }; +} - // Capture errors so they don't interrupt unmounting. - function safelyCallComponentWillUnmount(current, instance) { - { - invokeGuardedCallback$3(null, callComponentWillUnmountWithTimer, null, current, instance); - if (hasCaughtError$1()) { - var unmountError = clearCaughtError$1(); - captureError(current, unmountError); - } - } +/** + * @setSelection: Sets the selection bounds of a textarea or input and focuses + * the input. + * -@input Set selection bounds of this input or textarea + * -@offsets Object of same form that is returned from get* + */ +function setSelection(input, offsets) { + var start = offsets.start, + end = offsets.end; + + if (end === undefined) { + end = start; } - function safelyDetachRef(current) { - var ref = current.ref; - if (ref !== null) { - if (typeof ref === 'function') { - { - invokeGuardedCallback$3(null, ref, null, null); - if (hasCaughtError$1()) { - var refError = clearCaughtError$1(); - captureError(current, refError); - } - } - } else { - ref.current = null; - } - } + if ('selectionStart' in input) { + input.selectionStart = start; + input.selectionEnd = Math.min(end, input.value.length); + } else { + setOffsets(input, offsets); } +} - function commitBeforeMutationLifeCycles(current, finishedWork) { - switch (finishedWork.tag) { - case ClassComponent: - { - if (finishedWork.effectTag & Snapshot) { - if (current !== null) { - var prevProps = current.memoizedProps; - var prevState = current.memoizedState; - startPhaseTimer(finishedWork, 'getSnapshotBeforeUpdate'); - var _instance = finishedWork.stateNode; - _instance.props = finishedWork.memoizedProps; - _instance.state = finishedWork.memoizedState; - var snapshot = _instance.getSnapshotBeforeUpdate(prevProps, prevState); - { - var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate; - if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) { - didWarnSet.add(finishedWork.type); - warning(false, '%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentName(finishedWork)); - } - } - _instance.__reactInternalSnapshotBeforeUpdate = snapshot; - stopPhaseTimer(); - } - } - return; - } - case HostRoot: - case HostComponent: - case HostText: - case HostPortal: - // Nothing to do for these component types - return; - default: - { - invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.'); - } - } +var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11; + +var eventTypes$3 = { + select: { + phasedRegistrationNames: { + bubbled: 'onSelect', + captured: 'onSelectCapture' + }, + dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange'] } +}; - function commitLifeCycles(finishedRoot, current, finishedWork, currentTime, committedExpirationTime) { - switch (finishedWork.tag) { - case ClassComponent: - { - var _instance2 = finishedWork.stateNode; - if (finishedWork.effectTag & Update) { - if (current === null) { - startPhaseTimer(finishedWork, 'componentDidMount'); - _instance2.props = finishedWork.memoizedProps; - _instance2.state = finishedWork.memoizedState; - _instance2.componentDidMount(); - stopPhaseTimer(); - } else { - var prevProps = current.memoizedProps; - var prevState = current.memoizedState; - startPhaseTimer(finishedWork, 'componentDidUpdate'); - _instance2.props = finishedWork.memoizedProps; - _instance2.state = finishedWork.memoizedState; - _instance2.componentDidUpdate(prevProps, prevState, _instance2.__reactInternalSnapshotBeforeUpdate); - stopPhaseTimer(); - } - } - var updateQueue = finishedWork.updateQueue; - if (updateQueue !== null) { - commitCallbacks(updateQueue, _instance2); - } - return; - } - case HostRoot: - { - var _updateQueue = finishedWork.updateQueue; - if (_updateQueue !== null) { - var _instance3 = null; - if (finishedWork.child !== null) { - switch (finishedWork.child.tag) { - case HostComponent: - _instance3 = getPublicInstance(finishedWork.child.stateNode); - break; - case ClassComponent: - _instance3 = finishedWork.child.stateNode; - break; - } - } - commitCallbacks(_updateQueue, _instance3); - } - return; - } - case HostComponent: - { - var _instance4 = finishedWork.stateNode; +var activeElement$1 = null; +var activeElementInst$1 = null; +var lastSelection = null; +var mouseDown = false; - // Renderers may schedule work to be done after host components are mounted - // (eg DOM renderer may schedule auto-focus for inputs and form controls). - // These effects should only be committed when components are first mounted, - // aka when there is no current/alternate. - if (current === null && finishedWork.effectTag & Update) { - var type = finishedWork.type; - var props = finishedWork.memoizedProps; - commitMount(_instance4, type, props, finishedWork); - } +/** + * Get an object which is a unique representation of the current selection. + * + * The return value will not be consistent across nodes or browsers, but + * two identical selections on the same node will return identical objects. + * + * @param {DOMElement} node + * @return {object} + */ +function getSelection(node) { + if ('selectionStart' in node && hasSelectionCapabilities(node)) { + return { + start: node.selectionStart, + end: node.selectionEnd + }; + } else if (window.getSelection) { + var selection = window.getSelection(); + return { + anchorNode: selection.anchorNode, + anchorOffset: selection.anchorOffset, + focusNode: selection.focusNode, + focusOffset: selection.focusOffset + }; + } +} - return; - } - case HostText: - { - // We have no life-cycles associated with text. - return; - } - case HostPortal: - { - // We have no life-cycles associated with portals. - return; - } - default: - { - invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.'); - } - } +/** + * Poll selection to see whether it's changed. + * + * @param {object} nativeEvent + * @return {?SyntheticEvent} + */ +function constructSelectEvent(nativeEvent, nativeEventTarget) { + // Ensure we have the right element, and that the user is not dragging a + // selection (this matches native `select` event behavior). In HTML5, select + // fires only on input and textarea thus if there's no focused element we + // won't dispatch. + if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement()) { + return null; } - function commitErrorLogging(finishedWork, onUncaughtError) { - switch (finishedWork.tag) { - case ClassComponent: - { - var ctor = finishedWork.type; - var _instance5 = finishedWork.stateNode; - var updateQueue = finishedWork.updateQueue; - !(updateQueue !== null && updateQueue.capturedValues !== null) ? invariant(false, 'An error logging effect should not have been scheduled if no errors were captured. This error is likely caused by a bug in React. Please file an issue.') : void 0; - var capturedErrors = updateQueue.capturedValues; - updateQueue.capturedValues = null; + // Only fire when selection has actually changed. + var currentSelection = getSelection(activeElement$1); + if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { + lastSelection = currentSelection; - if (typeof ctor.getDerivedStateFromCatch !== 'function') { - // To preserve the preexisting retry behavior of error boundaries, - // we keep track of which ones already failed during this batch. - // This gets reset before we yield back to the browser. - // TODO: Warn in strict mode if getDerivedStateFromCatch is - // not defined. - markLegacyErrorBoundaryAsFailed(_instance5); - } + var syntheticEvent = SyntheticEvent$1.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget); - _instance5.props = finishedWork.memoizedProps; - _instance5.state = finishedWork.memoizedState; - for (var i = 0; i < capturedErrors.length; i++) { - var errorInfo = capturedErrors[i]; - var _error = errorInfo.value; - var stack = errorInfo.stack; - logError(finishedWork, errorInfo); - _instance5.componentDidCatch(_error, { - componentStack: stack !== null ? stack : '' - }); - } - } - break; - case HostRoot: - { - var _updateQueue2 = finishedWork.updateQueue; - !(_updateQueue2 !== null && _updateQueue2.capturedValues !== null) ? invariant(false, 'An error logging effect should not have been scheduled if no errors were captured. This error is likely caused by a bug in React. Please file an issue.') : void 0; - var _capturedErrors = _updateQueue2.capturedValues; - _updateQueue2.capturedValues = null; - for (var _i = 0; _i < _capturedErrors.length; _i++) { - var _errorInfo = _capturedErrors[_i]; - logError(finishedWork, _errorInfo); - onUncaughtError(_errorInfo.value); - } - break; - } - default: - invariant(false, 'This unit of work tag cannot capture errors. This error is likely caused by a bug in React. Please file an issue.'); - } - } + syntheticEvent.type = 'select'; + syntheticEvent.target = activeElement$1; - function commitAttachRef(finishedWork) { - var ref = finishedWork.ref; - if (ref !== null) { - var _instance6 = finishedWork.stateNode; - var instanceToUse = void 0; - switch (finishedWork.tag) { - case HostComponent: - instanceToUse = getPublicInstance(_instance6); - break; - default: - instanceToUse = _instance6; - } - if (typeof ref === 'function') { - ref(instanceToUse); - } else { - { - if (!ref.hasOwnProperty('current')) { - warning(false, 'Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork), getStackAddendumByWorkInProgressFiber(finishedWork)); - } - } + accumulateTwoPhaseDispatches(syntheticEvent); - ref.current = instanceToUse; - } - } + return syntheticEvent; } - function commitDetachRef(current) { - var currentRef = current.ref; - if (currentRef !== null) { - if (typeof currentRef === 'function') { - currentRef(null); - } else { - currentRef.current = null; - } - } - } + return null; +} - // User-originating errors (lifecycles and refs) should not interrupt - // deletion, so don't let them throw. Host-originating errors should - // interrupt deletion, so it's okay - function commitUnmount(current) { - if (typeof onCommitUnmount === 'function') { - onCommitUnmount(current); - } +/** + * This plugin creates an `onSelect` event that normalizes select events + * across form elements. + * + * Supported elements are: + * - input (see `isTextInputElement`) + * - textarea + * - contentEditable + * + * This differs from native browser implementations in the following ways: + * - Fires on contentEditable fields as well as inputs. + * - Fires for collapsed selection. + * - Fires after user input. + */ +var SelectEventPlugin = { + eventTypes: eventTypes$3, - switch (current.tag) { - case ClassComponent: - { - safelyDetachRef(current); - var _instance7 = current.stateNode; - if (typeof _instance7.componentWillUnmount === 'function') { - safelyCallComponentWillUnmount(current, _instance7); - } - return; - } - case HostComponent: - { - safelyDetachRef(current); - return; - } - case CallComponent: - { - commitNestedUnmounts(current.stateNode); - return; - } - case HostPortal: - { - // TODO: this is recursive. - // We are also not using this parent because - // the portal will get pushed immediately. - if (enableMutatingReconciler && mutation) { - unmountHostComponents(current); - } else if (enablePersistentReconciler && persistence) { - emptyPortalContainer(current); - } - return; - } + extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var doc = nativeEventTarget.window === nativeEventTarget ? nativeEventTarget.document : nativeEventTarget.nodeType === DOCUMENT_NODE ? nativeEventTarget : nativeEventTarget.ownerDocument; + // Track whether all listeners exists for this plugin. If none exist, we do + // not extract events. See #3639. + if (!doc || !isListeningToAllDependencies('onSelect', doc)) { + return null; } - } - function commitNestedUnmounts(root) { - // While we're inside a removed host node we don't want to call - // removeChild on the inner nodes because they're removed by the top - // call anyway. We also want to call componentWillUnmount on all - // composites before this host node is removed from the tree. Therefore - var node = root; - while (true) { - commitUnmount(node); - // Visit children because they may contain more composite or host nodes. - // Skip portals because commitUnmount() currently visits them recursively. - if (node.child !== null && ( - // If we use mutation we drill down into portals using commitUnmount above. - // If we don't use mutation we drill down into portals here instead. - !mutation || node.tag !== HostPortal)) { - node.child['return'] = node; - node = node.child; - continue; - } - if (node === root) { - return; - } - while (node.sibling === null) { - if (node['return'] === null || node['return'] === root) { - return; + var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window; + + switch (topLevelType) { + // Track the input node that has focus. + case 'topFocus': + if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') { + activeElement$1 = targetNode; + activeElementInst$1 = targetInst; + lastSelection = null; } - node = node['return']; - } - node.sibling['return'] = node['return']; - node = node.sibling; + break; + case 'topBlur': + activeElement$1 = null; + activeElementInst$1 = null; + lastSelection = null; + break; + // Don't fire the event while the user is dragging. This matches the + // semantics of the native select event. + case 'topMouseDown': + mouseDown = true; + break; + case 'topContextMenu': + case 'topMouseUp': + mouseDown = false; + return constructSelectEvent(nativeEvent, nativeEventTarget); + // Chrome and IE fire non-standard event when selection is changed (and + // sometimes when it hasn't). IE's event fires out of order with respect + // to key and input events on deletion, so we discard it. + // + // Firefox doesn't support selectionchange, so check selection status + // after each key entry. The selection changes after keydown and before + // keyup, but we check on keydown as well in the case of holding down a + // key, when multiple keydown events are fired but only one keyup is. + // This is also our approach for IE handling, for the reason above. + case 'topSelectionChange': + if (skipSelectionChangeEvent) { + break; + } + // falls through + case 'topKeyDown': + case 'topKeyUp': + return constructSelectEvent(nativeEvent, nativeEventTarget); } + + return null; } +}; - function detachFiber(current) { - // Cut off the return pointers to disconnect it from the tree. Ideally, we - // should clear the child pointer of the parent alternate to let this - // get GC:ed but we don't know which for sure which parent is the current - // one so we'll settle for GC:ing the subtree of this child. This child - // itself will be GC:ed when the parent updates the next time. - current['return'] = null; - current.child = null; - if (current.alternate) { - current.alternate.child = null; - current.alternate['return'] = null; - } +/** + * Inject modules for resolving DOM hierarchy and plugin ordering. + */ +injection.injectEventPluginOrder(DOMEventPluginOrder); +injection$1.injectComponentTree(ReactDOMComponentTree); + +/** + * Some important event plugins included by default (without having to require + * them). + */ +injection.injectEventPluginsByName({ + SimpleEventPlugin: SimpleEventPlugin, + EnterLeaveEventPlugin: EnterLeaveEventPlugin, + ChangeEventPlugin: ChangeEventPlugin, + SelectEventPlugin: SelectEventPlugin, + BeforeInputEventPlugin: BeforeInputEventPlugin +}); + +// Max 31 bit integer. The max integer size in V8 for 32-bit systems. +// Math.pow(2, 30) - 1 +// 0b111111111111111111111111111111 +var MAX_SIGNED_31_BIT_INT = 1073741823; + +// TODO: Use an opaque type once ESLint et al support the syntax + + +var NoWork = 0; +var Sync = 1; +var Never = MAX_SIGNED_31_BIT_INT; + +var UNIT_SIZE = 10; +var MAGIC_NUMBER_OFFSET = 2; + +// 1 unit of expiration time represents 10ms. +function msToExpirationTime(ms) { + // Always add an offset so that we don't clash with the magic number for NoWork. + return (ms / UNIT_SIZE | 0) + MAGIC_NUMBER_OFFSET; +} + +function expirationTimeToMs(expirationTime) { + return (expirationTime - MAGIC_NUMBER_OFFSET) * UNIT_SIZE; +} + +function ceiling(num, precision) { + return ((num / precision | 0) + 1) * precision; +} + +function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) { + return ceiling(currentTime + expirationInMs / UNIT_SIZE, bucketSizeMs / UNIT_SIZE); +} + +var NoContext = 0; +var AsyncMode = 1; +var StrictMode = 2; + +var hasBadMapPolyfill = void 0; + +{ + hasBadMapPolyfill = false; + try { + var nonExtensibleObject = Object.preventExtensions({}); + var testMap = new Map([[nonExtensibleObject, null]]); + var testSet = new Set([nonExtensibleObject]); + // This is necessary for Rollup to not consider these unused. + // https://github.com/rollup/rollup/issues/1771 + // TODO: we can remove these if Rollup fixes the bug. + testMap.set(0, 0); + testSet.add(0); + } catch (e) { + // TODO: Consider warning about bad polyfills + hasBadMapPolyfill = true; } +} - var emptyPortalContainer = void 0; +// A Fiber is work on a Component that needs to be done or was done. There can +// be more than one per component. - if (!mutation) { - var commitContainer = void 0; - if (persistence) { - var replaceContainerChildren = persistence.replaceContainerChildren, - createContainerChildSet = persistence.createContainerChildSet; - emptyPortalContainer = function (current) { - var portal = current.stateNode; - var containerInfo = portal.containerInfo; +var debugCounter = void 0; - var emptyChildSet = createContainerChildSet(containerInfo); - replaceContainerChildren(containerInfo, emptyChildSet); - }; - commitContainer = function (finishedWork) { - switch (finishedWork.tag) { - case ClassComponent: - { - return; - } - case HostComponent: - { - return; - } - case HostText: - { - return; - } - case HostRoot: - case HostPortal: - { - var portalOrRoot = finishedWork.stateNode; - var containerInfo = portalOrRoot.containerInfo, - _pendingChildren = portalOrRoot.pendingChildren; +{ + debugCounter = 1; +} - replaceContainerChildren(containerInfo, _pendingChildren); - return; - } - default: - { - invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.'); - } - } - }; - } else { - commitContainer = function (finishedWork) { - // Noop - }; - } - if (enablePersistentReconciler || enableNoopReconciler) { - return { - commitResetTextContent: function (finishedWork) {}, - commitPlacement: function (finishedWork) {}, - commitDeletion: function (current) { - // Detach refs and call componentWillUnmount() on the whole subtree. - commitNestedUnmounts(current); - detachFiber(current); - }, - commitWork: function (current, finishedWork) { - commitContainer(finishedWork); - }, +function FiberNode(tag, pendingProps, key, mode) { + // Instance + this.tag = tag; + this.key = key; + this.type = null; + this.stateNode = null; - commitLifeCycles: commitLifeCycles, - commitBeforeMutationLifeCycles: commitBeforeMutationLifeCycles, - commitErrorLogging: commitErrorLogging, - commitAttachRef: commitAttachRef, - commitDetachRef: commitDetachRef - }; - } else if (persistence) { - invariant(false, 'Persistent reconciler is disabled.'); - } else { - invariant(false, 'Noop reconciler is disabled.'); + // Fiber + this['return'] = null; + this.child = null; + this.sibling = null; + this.index = 0; + + this.ref = null; + + this.pendingProps = pendingProps; + this.memoizedProps = null; + this.updateQueue = null; + this.memoizedState = null; + + this.mode = mode; + + // Effects + this.effectTag = NoEffect; + this.nextEffect = null; + + this.firstEffect = null; + this.lastEffect = null; + + this.expirationTime = NoWork; + + this.alternate = null; + + { + this._debugID = debugCounter++; + this._debugSource = null; + this._debugOwner = null; + this._debugIsCurrentlyTiming = false; + if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') { + Object.preventExtensions(this); } } - var commitMount = mutation.commitMount, - commitUpdate = mutation.commitUpdate, - resetTextContent = mutation.resetTextContent, - commitTextUpdate = mutation.commitTextUpdate, - appendChild = mutation.appendChild, - appendChildToContainer = mutation.appendChildToContainer, - insertBefore = mutation.insertBefore, - insertInContainerBefore = mutation.insertInContainerBefore, - removeChild = mutation.removeChild, - removeChildFromContainer = mutation.removeChildFromContainer; +} + +// This is a constructor function, rather than a POJO constructor, still +// please ensure we do the following: +// 1) Nobody should add any instance methods on this. Instance methods can be +// more difficult to predict when they get optimized and they are almost +// never inlined properly in static compilers. +// 2) Nobody should rely on `instanceof Fiber` for type testing. We should +// always know when it is a fiber. +// 3) We might want to experiment with using numeric keys since they are easier +// to optimize in a non-JIT environment. +// 4) We can easily go from a constructor to a createFiber object literal if that +// is faster. +// 5) It should be easy to port this to a C struct and keep a C implementation +// compatible. +var createFiber = function (tag, pendingProps, key, mode) { + // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors + return new FiberNode(tag, pendingProps, key, mode); +}; +function shouldConstruct(Component) { + return !!(Component.prototype && Component.prototype.isReactComponent); +} - function getHostParentFiber(fiber) { - var parent = fiber['return']; - while (parent !== null) { - if (isHostParent(parent)) { - return parent; - } - parent = parent['return']; +// This is used to create an alternate fiber to do work on. +function createWorkInProgress(current, pendingProps, expirationTime) { + var workInProgress = current.alternate; + if (workInProgress === null) { + // We use a double buffering pooling technique because we know that we'll + // only ever need at most two versions of a tree. We pool the "other" unused + // node that we're free to reuse. This is lazily created to avoid allocating + // extra objects for things that are never updated. It also allow us to + // reclaim the extra memory if needed. + workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode); + workInProgress.type = current.type; + workInProgress.stateNode = current.stateNode; + + { + // DEV-only fields + workInProgress._debugID = current._debugID; + workInProgress._debugSource = current._debugSource; + workInProgress._debugOwner = current._debugOwner; } - invariant(false, 'Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.'); - } - function isHostParent(fiber) { - return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal; + workInProgress.alternate = current; + current.alternate = workInProgress; + } else { + workInProgress.pendingProps = pendingProps; + + // We already have an alternate. + // Reset the effect tag. + workInProgress.effectTag = NoEffect; + + // The effect list is no longer valid. + workInProgress.nextEffect = null; + workInProgress.firstEffect = null; + workInProgress.lastEffect = null; } - function getHostSibling(fiber) { - // We're going to search forward into the tree until we find a sibling host - // node. Unfortunately, if multiple insertions are done in a row we have to - // search past them. This leads to exponential search for the next sibling. - var node = fiber; - siblings: while (true) { - // If we didn't find anything, let's try the next sibling. - while (node.sibling === null) { - if (node['return'] === null || isHostParent(node['return'])) { - // If we pop out of the root or hit the parent the fiber we are the - // last sibling. - return null; - } - node = node['return']; - } - node.sibling['return'] = node['return']; - node = node.sibling; - while (node.tag !== HostComponent && node.tag !== HostText) { - // If it is not host node and, we might have a host node inside it. - // Try to search down until we find one. - if (node.effectTag & Placement) { - // If we don't have a child, try the siblings instead. - continue siblings; - } - // If we don't have a child, try the siblings instead. - // We also skip portals because they are not part of this host tree. - if (node.child === null || node.tag === HostPortal) { - continue siblings; - } else { - node.child['return'] = node; - node = node.child; - } - } - // Check if this host node is stable or about to be placed. - if (!(node.effectTag & Placement)) { - // Found it! - return node.stateNode; - } - } + workInProgress.expirationTime = expirationTime; + + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; + + // These will be overridden during the parent's reconciliation + workInProgress.sibling = current.sibling; + workInProgress.index = current.index; + workInProgress.ref = current.ref; + + return workInProgress; +} + +function createHostRootFiber(isAsync) { + var mode = isAsync ? AsyncMode | StrictMode : NoContext; + return createFiber(HostRoot, null, null, mode); +} + +function createFiberFromElement(element, mode, expirationTime) { + var owner = null; + { + owner = element._owner; } - function commitPlacement(finishedWork) { - // Recursively insert all host nodes into the parent. - var parentFiber = getHostParentFiber(finishedWork); - var parent = void 0; - var isContainer = void 0; - switch (parentFiber.tag) { - case HostComponent: - parent = parentFiber.stateNode; - isContainer = false; + var fiber = void 0; + var type = element.type; + var key = element.key; + var pendingProps = element.props; + + var fiberTag = void 0; + if (typeof type === 'function') { + fiberTag = shouldConstruct(type) ? ClassComponent : IndeterminateComponent; + } else if (typeof type === 'string') { + fiberTag = HostComponent; + } else { + switch (type) { + case REACT_FRAGMENT_TYPE: + return createFiberFromFragment(pendingProps.children, mode, expirationTime, key); + case REACT_ASYNC_MODE_TYPE: + fiberTag = Mode; + mode |= AsyncMode | StrictMode; break; - case HostRoot: - parent = parentFiber.stateNode.containerInfo; - isContainer = true; + case REACT_STRICT_MODE_TYPE: + fiberTag = Mode; + mode |= StrictMode; break; - case HostPortal: - parent = parentFiber.stateNode.containerInfo; - isContainer = true; + case REACT_CALL_TYPE: + fiberTag = CallComponent; + break; + case REACT_RETURN_TYPE: + fiberTag = ReturnComponent; break; default: - invariant(false, 'Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.'); - } - if (parentFiber.effectTag & ContentReset) { - // Reset the text content of the parent before doing any insertions - resetTextContent(parent); - // Clear ContentReset from the effect tag - parentFiber.effectTag &= ~ContentReset; - } - - var before = getHostSibling(finishedWork); - // We only have the top Fiber that was inserted but we need recurse down its - // children to find all the terminal nodes. - var node = finishedWork; - while (true) { - if (node.tag === HostComponent || node.tag === HostText) { - if (before) { - if (isContainer) { - insertInContainerBefore(parent, node.stateNode, before); - } else { - insertBefore(parent, node.stateNode, before); - } - } else { - if (isContainer) { - appendChildToContainer(parent, node.stateNode); + { + if (typeof type === 'object' && type !== null) { + switch (type.$$typeof) { + case REACT_PROVIDER_TYPE: + fiberTag = ContextProvider; + break; + case REACT_CONTEXT_TYPE: + // This is a consumer + fiberTag = ContextConsumer; + break; + case REACT_FORWARD_REF_TYPE: + fiberTag = ForwardRef; + break; + default: + if (typeof type.tag === 'number') { + // Currently assumed to be a continuation and therefore is a + // fiber already. + // TODO: The yield system is currently broken for updates in + // some cases. The reified yield stores a fiber, but we don't + // know which fiber that is; the current or a workInProgress? + // When the continuation gets rendered here we don't know if we + // can reuse that fiber or if we need to clone it. There is + // probably a clever way to restructure this. + fiber = type; + fiber.pendingProps = pendingProps; + fiber.expirationTime = expirationTime; + return fiber; + } else { + throwOnInvalidElementType(type, owner); + } + break; + } } else { - appendChild(parent, node.stateNode); + throwOnInvalidElementType(type, owner); } } - } else if (node.tag === HostPortal) { - // If the insertion itself is a portal, then we don't want to traverse - // down its children. Instead, we'll get insertions from each child in - // the portal directly. - } else if (node.child !== null) { - node.child['return'] = node; - node = node.child; - continue; - } - if (node === finishedWork) { - return; - } - while (node.sibling === null) { - if (node['return'] === null || node['return'] === finishedWork) { - return; - } - node = node['return']; - } - node.sibling['return'] = node['return']; - node = node.sibling; } } - function unmountHostComponents(current) { - // We only have the top Fiber that was inserted but we need recurse down its - var node = current; + fiber = createFiber(fiberTag, pendingProps, key, mode); + fiber.type = type; + fiber.expirationTime = expirationTime; - // Each iteration, currentParent is populated with node's host parent if not - // currentParentIsValid. - var currentParentIsValid = false; - var currentParent = void 0; - var currentParentIsContainer = void 0; + { + fiber._debugSource = element._source; + fiber._debugOwner = element._owner; + } - while (true) { - if (!currentParentIsValid) { - var parent = node['return']; - findParent: while (true) { - !(parent !== null) ? invariant(false, 'Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.') : void 0; - switch (parent.tag) { - case HostComponent: - currentParent = parent.stateNode; - currentParentIsContainer = false; - break findParent; - case HostRoot: - currentParent = parent.stateNode.containerInfo; - currentParentIsContainer = true; - break findParent; - case HostPortal: - currentParent = parent.stateNode.containerInfo; - currentParentIsContainer = true; - break findParent; - } - parent = parent['return']; - } - currentParentIsValid = true; - } + return fiber; +} - if (node.tag === HostComponent || node.tag === HostText) { - commitNestedUnmounts(node); - // After all the children have unmounted, it is now safe to remove the - // node from the tree. - if (currentParentIsContainer) { - removeChildFromContainer(currentParent, node.stateNode); - } else { - removeChild(currentParent, node.stateNode); - } - // Don't visit children because we already visited them. - } else if (node.tag === HostPortal) { - // When we go into a portal, it becomes the parent to remove from. - // We will reassign it back when we pop the portal on the way up. - currentParent = node.stateNode.containerInfo; - // Visit children because portals might contain host components. - if (node.child !== null) { - node.child['return'] = node; - node = node.child; - continue; - } - } else { - commitUnmount(node); - // Visit children because we may find more host components below. - if (node.child !== null) { - node.child['return'] = node; - node = node.child; - continue; - } - } - if (node === current) { - return; - } - while (node.sibling === null) { - if (node['return'] === null || node['return'] === current) { - return; - } - node = node['return']; - if (node.tag === HostPortal) { - // When we go out of the portal, we need to restore the parent. - // Since we don't keep a stack of them, we will search for it. - currentParentIsValid = false; - } - } - node.sibling['return'] = node['return']; - node = node.sibling; +function throwOnInvalidElementType(type, owner) { + var info = ''; + { + if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { + info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; + } + var ownerName = owner ? getComponentName(owner) : null; + if (ownerName) { + info += '\n\nCheck the render method of `' + ownerName + '`.'; } } + invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', type == null ? type : typeof type, info); +} - function commitDeletion(current) { - // Recursively delete all host nodes from the parent. - // Detach refs and call componentWillUnmount() on the whole subtree. - unmountHostComponents(current); - detachFiber(current); - } +function createFiberFromFragment(elements, mode, expirationTime, key) { + var fiber = createFiber(Fragment, elements, key, mode); + fiber.expirationTime = expirationTime; + return fiber; +} - function commitWork(current, finishedWork) { - switch (finishedWork.tag) { - case ClassComponent: - { - return; - } - case HostComponent: - { - var _instance8 = finishedWork.stateNode; - if (_instance8 != null) { - // Commit the work prepared earlier. - var newProps = finishedWork.memoizedProps; - // For hydration we reuse the update path but we treat the oldProps - // as the newProps. The updatePayload will contain the real change in - // this case. - var oldProps = current !== null ? current.memoizedProps : newProps; - var type = finishedWork.type; - // TODO: Type the updateQueue to be specific to host components. - var updatePayload = finishedWork.updateQueue; - finishedWork.updateQueue = null; - if (updatePayload !== null) { - commitUpdate(_instance8, updatePayload, type, oldProps, newProps, finishedWork); - } - } - return; - } - case HostText: - { - !(finishedWork.stateNode !== null) ? invariant(false, 'This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.') : void 0; - var textInstance = finishedWork.stateNode; - var newText = finishedWork.memoizedProps; - // For hydration we reuse the update path but we treat the oldProps - // as the newProps. The updatePayload will contain the real change in - // this case. - var oldText = current !== null ? current.memoizedProps : newText; - commitTextUpdate(textInstance, oldText, newText); - return; - } - case HostRoot: - { - return; - } - default: - { - invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.'); - } - } - } +function createFiberFromText(content, mode, expirationTime) { + var fiber = createFiber(HostText, content, null, mode); + fiber.expirationTime = expirationTime; + return fiber; +} - function commitResetTextContent(current) { - resetTextContent(current.stateNode); - } +function createFiberFromHostInstanceForDeletion() { + var fiber = createFiber(HostComponent, null, null, NoContext); + fiber.type = 'DELETED'; + return fiber; +} - if (enableMutatingReconciler) { - return { - commitBeforeMutationLifeCycles: commitBeforeMutationLifeCycles, - commitResetTextContent: commitResetTextContent, - commitPlacement: commitPlacement, - commitDeletion: commitDeletion, - commitWork: commitWork, - commitLifeCycles: commitLifeCycles, - commitErrorLogging: commitErrorLogging, - commitAttachRef: commitAttachRef, - commitDetachRef: commitDetachRef - }; - } else { - invariant(false, 'Mutating reconciler is disabled.'); +function createFiberFromPortal(portal, mode, expirationTime) { + var pendingProps = portal.children !== null ? portal.children : []; + var fiber = createFiber(HostPortal, pendingProps, portal.key, mode); + fiber.expirationTime = expirationTime; + fiber.stateNode = { + containerInfo: portal.containerInfo, + pendingChildren: null, // Used by persistent updates + implementation: portal.implementation + }; + return fiber; +} + +// Used for stashing WIP properties to replay failed work in DEV. +function assignFiberPropertiesInDEV(target, source) { + if (target === null) { + // This Fiber's initial properties will always be overwritten. + // We only use a Fiber to ensure the same hidden class so DEV isn't slow. + target = createFiber(IndeterminateComponent, null, null, NoContext); } -}; -var NO_CONTEXT = {}; + // This is intentionally written as a list of all properties. + // We tried to use Object.assign() instead but this is called in + // the hottest path, and Object.assign() was too slow: + // https://github.com/facebook/react/issues/12502 + // This code is DEV-only so size is not a concern. -var ReactFiberHostContext = function (config, stack) { - var getChildHostContext = config.getChildHostContext, - getRootHostContext = config.getRootHostContext; - var createCursor = stack.createCursor, - push = stack.push, - pop = stack.pop; + target.tag = source.tag; + target.key = source.key; + target.type = source.type; + target.stateNode = source.stateNode; + target['return'] = source['return']; + target.child = source.child; + target.sibling = source.sibling; + target.index = source.index; + target.ref = source.ref; + target.pendingProps = source.pendingProps; + target.memoizedProps = source.memoizedProps; + target.updateQueue = source.updateQueue; + target.memoizedState = source.memoizedState; + target.mode = source.mode; + target.effectTag = source.effectTag; + target.nextEffect = source.nextEffect; + target.firstEffect = source.firstEffect; + target.lastEffect = source.lastEffect; + target.expirationTime = source.expirationTime; + target.alternate = source.alternate; + target._debugID = source._debugID; + target._debugSource = source._debugSource; + target._debugOwner = source._debugOwner; + target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming; + return target; +} +// TODO: This should be lifted into the renderer. - var contextStackCursor = createCursor(NO_CONTEXT); - var contextFiberStackCursor = createCursor(NO_CONTEXT); - var rootInstanceStackCursor = createCursor(NO_CONTEXT); - function requiredContext(c) { - !(c !== NO_CONTEXT) ? invariant(false, 'Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.') : void 0; - return c; - } +function createFiberRoot(containerInfo, isAsync, hydrate) { + // Cyclic construction. This cheats the type system right now because + // stateNode is any. + var uninitializedFiber = createHostRootFiber(isAsync); + var root = { + current: uninitializedFiber, + containerInfo: containerInfo, + pendingChildren: null, + pendingCommitExpirationTime: NoWork, + finishedWork: null, + context: null, + pendingContext: null, + hydrate: hydrate, + remainingExpirationTime: NoWork, + firstBatch: null, + nextScheduledRoot: null + }; + uninitializedFiber.stateNode = root; + return root; +} - function getRootHostContainer() { - var rootInstance = requiredContext(rootInstanceStackCursor.current); - return rootInstance; - } +var onCommitFiberRoot = null; +var onCommitFiberUnmount = null; +var hasLoggedError = false; - function pushHostContainer(fiber, nextRootInstance) { - // Push current root instance onto the stack; - // This allows us to reset root when portals are popped. - push(rootInstanceStackCursor, nextRootInstance, fiber); - // Track the context and the Fiber that provided it. - // This enables us to pop only Fibers that provide unique contexts. - push(contextFiberStackCursor, fiber, fiber); +function catchErrors(fn) { + return function (arg) { + try { + return fn(arg); + } catch (err) { + if (true && !hasLoggedError) { + hasLoggedError = true; + warning(false, 'React DevTools encountered an error: %s', err); + } + } + }; +} - // Finally, we need to push the host context to the stack. - // However, we can't just call getRootHostContext() and push it because - // we'd have a different number of entries on the stack depending on - // whether getRootHostContext() throws somewhere in renderer code or not. - // So we push an empty value first. This lets us safely unwind on errors. - push(contextStackCursor, NO_CONTEXT, fiber); - var nextRootContext = getRootHostContext(nextRootInstance); - // Now that we know this function doesn't throw, replace it. - pop(contextStackCursor, fiber); - push(contextStackCursor, nextRootContext, fiber); +function injectInternals(internals) { + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { + // No DevTools + return false; + } + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled) { + // This isn't a real property on the hook, but it can be set to opt out + // of DevTools integration and associated warnings and logs. + // https://github.com/facebook/react/issues/3877 + return true; + } + if (!hook.supportsFiber) { + { + warning(false, 'The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://fb.me/react-devtools'); + } + // DevTools exists, even though it doesn't support Fiber. + return true; + } + try { + var rendererID = hook.inject(internals); + // We have successfully injected, so now it is safe to set up hooks. + onCommitFiberRoot = catchErrors(function (root) { + return hook.onCommitFiberRoot(rendererID, root); + }); + onCommitFiberUnmount = catchErrors(function (fiber) { + return hook.onCommitFiberUnmount(rendererID, fiber); + }); + } catch (err) { + // Catch all errors because it is unsafe to throw during initialization. + { + warning(false, 'React DevTools encountered an error: %s.', err); + } } + // DevTools exists + return true; +} - function popHostContainer(fiber) { - pop(contextStackCursor, fiber); - pop(contextFiberStackCursor, fiber); - pop(rootInstanceStackCursor, fiber); +function onCommitRoot(root) { + if (typeof onCommitFiberRoot === 'function') { + onCommitFiberRoot(root); } +} - function getHostContext() { - var context = requiredContext(contextStackCursor.current); - return context; +function onCommitUnmount(fiber) { + if (typeof onCommitFiberUnmount === 'function') { + onCommitFiberUnmount(fiber); } +} - function pushHostContext(fiber) { - var rootInstance = requiredContext(rootInstanceStackCursor.current); - var context = requiredContext(contextStackCursor.current); - var nextContext = getChildHostContext(context, fiber.type, rootInstance); +/** + * Forked from fbjs/warning: + * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js + * + * Only change is we use console.warn instead of console.error, + * and do nothing when 'console' is not supported. + * This really simplifies the code. + * --- + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ - // Don't push this Fiber's context unless it's unique. - if (context === nextContext) { - return; - } +var lowPriorityWarning = function () {}; - // Track the context and the Fiber that provided it. - // This enables us to pop only Fibers that provide unique contexts. - push(contextFiberStackCursor, fiber, fiber); - push(contextStackCursor, nextContext, fiber); - } +{ + var printWarning = function (format) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } - function popHostContext(fiber) { - // Do not pop unless this Fiber provided the current context. - // pushHostContext() only pushes Fibers that provide unique contexts. - if (contextFiberStackCursor.current !== fiber) { - return; + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.warn(message); } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; - pop(contextStackCursor, fiber); - pop(contextFiberStackCursor, fiber); - } + lowPriorityWarning = function (condition, format) { + if (format === undefined) { + throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); + } + if (!condition) { + for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { + args[_key2 - 2] = arguments[_key2]; + } - return { - getHostContext: getHostContext, - getRootHostContainer: getRootHostContainer, - popHostContainer: popHostContainer, - popHostContext: popHostContext, - pushHostContainer: pushHostContainer, - pushHostContext: pushHostContext + printWarning.apply(undefined, [format].concat(args)); + } }; +} + +var lowPriorityWarning$1 = lowPriorityWarning; + +var ReactStrictModeWarnings = { + discardPendingWarnings: function () {}, + flushPendingDeprecationWarnings: function () {}, + flushPendingUnsafeLifecycleWarnings: function () {}, + recordDeprecationWarnings: function (fiber, instance) {}, + recordUnsafeLifecycleWarnings: function (fiber, instance) {} }; -var ReactFiberHydrationContext = function (config) { - var shouldSetTextContent = config.shouldSetTextContent, - hydration = config.hydration; +{ + var LIFECYCLE_SUGGESTIONS = { + UNSAFE_componentWillMount: 'componentDidMount', + UNSAFE_componentWillReceiveProps: 'static getDerivedStateFromProps', + UNSAFE_componentWillUpdate: 'componentDidUpdate' + }; - // If this doesn't have hydration mode. + var pendingComponentWillMountWarnings = []; + var pendingComponentWillReceivePropsWarnings = []; + var pendingComponentWillUpdateWarnings = []; + var pendingUnsafeLifecycleWarnings = new Map(); - if (!hydration) { - return { - enterHydrationState: function () { - return false; - }, - resetHydrationState: function () {}, - tryToClaimNextHydratableInstance: function () {}, - prepareToHydrateHostInstance: function () { - invariant(false, 'Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.'); - }, - prepareToHydrateHostTextInstance: function () { - invariant(false, 'Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.'); - }, - popHydrationState: function (fiber) { - return false; - } - }; - } + // Tracks components we have already warned about. + var didWarnAboutDeprecatedLifecycles = new Set(); + var didWarnAboutUnsafeLifecycles = new Set(); - var canHydrateInstance = hydration.canHydrateInstance, - canHydrateTextInstance = hydration.canHydrateTextInstance, - getNextHydratableSibling = hydration.getNextHydratableSibling, - getFirstHydratableChild = hydration.getFirstHydratableChild, - hydrateInstance = hydration.hydrateInstance, - hydrateTextInstance = hydration.hydrateTextInstance, - didNotMatchHydratedContainerTextInstance = hydration.didNotMatchHydratedContainerTextInstance, - didNotMatchHydratedTextInstance = hydration.didNotMatchHydratedTextInstance, - didNotHydrateContainerInstance = hydration.didNotHydrateContainerInstance, - didNotHydrateInstance = hydration.didNotHydrateInstance, - didNotFindHydratableContainerInstance = hydration.didNotFindHydratableContainerInstance, - didNotFindHydratableContainerTextInstance = hydration.didNotFindHydratableContainerTextInstance, - didNotFindHydratableInstance = hydration.didNotFindHydratableInstance, - didNotFindHydratableTextInstance = hydration.didNotFindHydratableTextInstance; + var setToSortedString = function (set) { + var array = []; + set.forEach(function (value) { + array.push(value); + }); + return array.sort().join(', '); + }; - // The deepest Fiber on the stack involved in a hydration context. - // This may have been an insertion or a hydration. + ReactStrictModeWarnings.discardPendingWarnings = function () { + pendingComponentWillMountWarnings = []; + pendingComponentWillReceivePropsWarnings = []; + pendingComponentWillUpdateWarnings = []; + pendingUnsafeLifecycleWarnings = new Map(); + }; - var hydrationParentFiber = null; - var nextHydratableInstance = null; - var isHydrating = false; + ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () { + pendingUnsafeLifecycleWarnings.forEach(function (lifecycleWarningsMap, strictRoot) { + var lifecyclesWarningMesages = []; - function enterHydrationState(fiber) { - var parentInstance = fiber.stateNode.containerInfo; - nextHydratableInstance = getFirstHydratableChild(parentInstance); - hydrationParentFiber = fiber; - isHydrating = true; - return true; - } - - function deleteHydratableInstance(returnFiber, instance) { - { - switch (returnFiber.tag) { - case HostRoot: - didNotHydrateContainerInstance(returnFiber.stateNode.containerInfo, instance); - break; - case HostComponent: - didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance); - break; - } - } - - var childToDelete = createFiberFromHostInstanceForDeletion(); - childToDelete.stateNode = instance; - childToDelete['return'] = returnFiber; - childToDelete.effectTag = Deletion; - - // This might seem like it belongs on progressedFirstDeletion. However, - // these children are not part of the reconciliation list of children. - // Even if we abort and rereconcile the children, that will try to hydrate - // again and the nodes are still in the host tree so these will be - // recreated. - if (returnFiber.lastEffect !== null) { - returnFiber.lastEffect.nextEffect = childToDelete; - returnFiber.lastEffect = childToDelete; - } else { - returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; - } - } + Object.keys(lifecycleWarningsMap).forEach(function (lifecycle) { + var lifecycleWarnings = lifecycleWarningsMap[lifecycle]; + if (lifecycleWarnings.length > 0) { + var componentNames = new Set(); + lifecycleWarnings.forEach(function (fiber) { + componentNames.add(getComponentName(fiber) || 'Component'); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); - function insertNonHydratedInstance(returnFiber, fiber) { - fiber.effectTag |= Placement; - { - switch (returnFiber.tag) { - case HostRoot: - { - var parentContainer = returnFiber.stateNode.containerInfo; - switch (fiber.tag) { - case HostComponent: - var type = fiber.type; - var props = fiber.pendingProps; - didNotFindHydratableContainerInstance(parentContainer, type, props); - break; - case HostText: - var text = fiber.pendingProps; - didNotFindHydratableContainerTextInstance(parentContainer, text); - break; - } - break; - } - case HostComponent: - { - var parentType = returnFiber.type; - var parentProps = returnFiber.memoizedProps; - var parentInstance = returnFiber.stateNode; - switch (fiber.tag) { - case HostComponent: - var _type = fiber.type; - var _props = fiber.pendingProps; - didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type, _props); - break; - case HostText: - var _text = fiber.pendingProps; - didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text); - break; - } - break; - } - default: - return; - } - } - } + var formatted = lifecycle.replace('UNSAFE_', ''); + var suggestion = LIFECYCLE_SUGGESTIONS[lifecycle]; + var sortedComponentNames = setToSortedString(componentNames); - function tryHydrate(fiber, nextInstance) { - switch (fiber.tag) { - case HostComponent: - { - var type = fiber.type; - var props = fiber.pendingProps; - var instance = canHydrateInstance(nextInstance, type, props); - if (instance !== null) { - fiber.stateNode = instance; - return true; - } - return false; - } - case HostText: - { - var text = fiber.pendingProps; - var textInstance = canHydrateTextInstance(nextInstance, text); - if (textInstance !== null) { - fiber.stateNode = textInstance; - return true; - } - return false; + lifecyclesWarningMesages.push(formatted + ': Please update the following components to use ' + (suggestion + ' instead: ' + sortedComponentNames)); } - default: - return false; - } - } - - function tryToClaimNextHydratableInstance(fiber) { - if (!isHydrating) { - return; - } - var nextInstance = nextHydratableInstance; - if (!nextInstance) { - // Nothing to hydrate. Make it an insertion. - insertNonHydratedInstance(hydrationParentFiber, fiber); - isHydrating = false; - hydrationParentFiber = fiber; - return; - } - if (!tryHydrate(fiber, nextInstance)) { - // If we can't hydrate this instance let's try the next one. - // We use this as a heuristic. It's based on intuition and not data so it - // might be flawed or unnecessary. - nextInstance = getNextHydratableSibling(nextInstance); - if (!nextInstance || !tryHydrate(fiber, nextInstance)) { - // Nothing to hydrate. Make it an insertion. - insertNonHydratedInstance(hydrationParentFiber, fiber); - isHydrating = false; - hydrationParentFiber = fiber; - return; - } - // We matched the next one, we'll now assume that the first one was - // superfluous and we'll delete it. Since we can't eagerly delete it - // we'll have to schedule a deletion. To do that, this node needs a dummy - // fiber associated with it. - deleteHydratableInstance(hydrationParentFiber, nextHydratableInstance); - } - hydrationParentFiber = fiber; - nextHydratableInstance = getFirstHydratableChild(nextInstance); - } + }); - function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) { - var instance = fiber.stateNode; - var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber); - // TODO: Type this specific to this type of component. - fiber.updateQueue = updatePayload; - // If the update payload indicates that there is a change or if there - // is a new ref we mark this as an update. - if (updatePayload !== null) { - return true; - } - return false; - } + if (lifecyclesWarningMesages.length > 0) { + var strictRootComponentStack = getStackAddendumByWorkInProgressFiber(strictRoot); - function prepareToHydrateHostTextInstance(fiber) { - var textInstance = fiber.stateNode; - var textContent = fiber.memoizedProps; - var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber); - { - if (shouldUpdate) { - // We assume that prepareToHydrateHostTextInstance is called in a context where the - // hydration parent is the parent host component of this host text. - var returnFiber = hydrationParentFiber; - if (returnFiber !== null) { - switch (returnFiber.tag) { - case HostRoot: - { - var parentContainer = returnFiber.stateNode.containerInfo; - didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent); - break; - } - case HostComponent: - { - var parentType = returnFiber.type; - var parentProps = returnFiber.memoizedProps; - var parentInstance = returnFiber.stateNode; - didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent); - break; - } - } - } + warning(false, 'Unsafe lifecycle methods were found within a strict-mode tree:%s' + '\n\n%s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-strict-mode-warnings', strictRootComponentStack, lifecyclesWarningMesages.join('\n\n')); } - } - return shouldUpdate; - } - - function popToNextHostParent(fiber) { - var parent = fiber['return']; - while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot) { - parent = parent['return']; - } - hydrationParentFiber = parent; - } + }); - function popHydrationState(fiber) { - if (fiber !== hydrationParentFiber) { - // We're deeper than the current hydration context, inside an inserted - // tree. - return false; - } - if (!isHydrating) { - // If we're not currently hydrating but we're in a hydration context, then - // we were an insertion and now need to pop up reenter hydration of our - // siblings. - popToNextHostParent(fiber); - isHydrating = true; - return false; - } + pendingUnsafeLifecycleWarnings = new Map(); + }; - var type = fiber.type; + var getStrictRoot = function (fiber) { + var maybeStrictRoot = null; - // If we have any remaining hydratable nodes, we need to delete them now. - // We only do this deeper than head and body since they tend to have random - // other nodes in them. We also ignore components with pure text content in - // side of them. - // TODO: Better heuristic. - if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) { - var nextInstance = nextHydratableInstance; - while (nextInstance) { - deleteHydratableInstance(fiber, nextInstance); - nextInstance = getNextHydratableSibling(nextInstance); + while (fiber !== null) { + if (fiber.mode & StrictMode) { + maybeStrictRoot = fiber; } - } - - popToNextHostParent(fiber); - nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null; - return true; - } - function resetHydrationState() { - hydrationParentFiber = null; - nextHydratableInstance = null; - isHydrating = false; - } + fiber = fiber['return']; + } - return { - enterHydrationState: enterHydrationState, - resetHydrationState: resetHydrationState, - tryToClaimNextHydratableInstance: tryToClaimNextHydratableInstance, - prepareToHydrateHostInstance: prepareToHydrateHostInstance, - prepareToHydrateHostTextInstance: prepareToHydrateHostTextInstance, - popHydrationState: popHydrationState + return maybeStrictRoot; }; -}; -// This lets us hook into Fiber to debug what it's doing. -// See https://github.com/facebook/react/pull/8033. -// This is not part of the public API, not even for React DevTools. -// You may only inject a debugTool if you work on React Fiber itself. -var ReactFiberInstrumentation = { - debugTool: null -}; + ReactStrictModeWarnings.flushPendingDeprecationWarnings = function () { + if (pendingComponentWillMountWarnings.length > 0) { + var uniqueNames = new Set(); + pendingComponentWillMountWarnings.forEach(function (fiber) { + uniqueNames.add(getComponentName(fiber) || 'Component'); + didWarnAboutDeprecatedLifecycles.add(fiber.type); + }); -var ReactFiberInstrumentation_1 = ReactFiberInstrumentation; + var sortedNames = setToSortedString(uniqueNames); -var warnedAboutMissingGetChildContext = void 0; + lowPriorityWarning$1(false, 'componentWillMount is deprecated and will be removed in the next major version. ' + 'Use componentDidMount instead. As a temporary workaround, ' + 'you can rename to UNSAFE_componentWillMount.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', sortedNames); -{ - warnedAboutMissingGetChildContext = {}; -} + pendingComponentWillMountWarnings = []; + } -var ReactFiberLegacyContext = function (stack) { - var createCursor = stack.createCursor, - push = stack.push, - pop = stack.pop; + if (pendingComponentWillReceivePropsWarnings.length > 0) { + var _uniqueNames = new Set(); + pendingComponentWillReceivePropsWarnings.forEach(function (fiber) { + _uniqueNames.add(getComponentName(fiber) || 'Component'); + didWarnAboutDeprecatedLifecycles.add(fiber.type); + }); - // A cursor to the current merged context object on the stack. + var _sortedNames = setToSortedString(_uniqueNames); - var contextStackCursor = createCursor(emptyObject); - // A cursor to a boolean indicating whether the context has changed. - var didPerformWorkStackCursor = createCursor(false); - // Keep track of the previous context object that was on the stack. - // We use this to get access to the parent context after we have already - // pushed the next context provider, and now need to merge their contexts. - var previousContext = emptyObject; + lowPriorityWarning$1(false, 'componentWillReceiveProps is deprecated and will be removed in the next major version. ' + 'Use static getDerivedStateFromProps instead.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', _sortedNames); - function getUnmaskedContext(workInProgress) { - var hasOwnContext = isContextProvider(workInProgress); - if (hasOwnContext) { - // If the fiber is a context provider itself, when we read its context - // we have already pushed its own child context on the stack. A context - // provider should not "see" its own child context. Therefore we read the - // previous (parent) context instead for a context provider. - return previousContext; + pendingComponentWillReceivePropsWarnings = []; } - return contextStackCursor.current; - } - function cacheContext(workInProgress, unmaskedContext, maskedContext) { - var instance = workInProgress.stateNode; - instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; - instance.__reactInternalMemoizedMaskedChildContext = maskedContext; - } + if (pendingComponentWillUpdateWarnings.length > 0) { + var _uniqueNames2 = new Set(); + pendingComponentWillUpdateWarnings.forEach(function (fiber) { + _uniqueNames2.add(getComponentName(fiber) || 'Component'); + didWarnAboutDeprecatedLifecycles.add(fiber.type); + }); - function getMaskedContext(workInProgress, unmaskedContext) { - var type = workInProgress.type; - var contextTypes = type.contextTypes; - if (!contextTypes) { - return emptyObject; - } + var _sortedNames2 = setToSortedString(_uniqueNames2); - // Avoid recreating masked context unless unmasked context has changed. - // Failing to do this will result in unnecessary calls to componentWillReceiveProps. - // This may trigger infinite loops if componentWillReceiveProps calls setState. - var instance = workInProgress.stateNode; - if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) { - return instance.__reactInternalMemoizedMaskedChildContext; - } + lowPriorityWarning$1(false, 'componentWillUpdate is deprecated and will be removed in the next major version. ' + 'Use componentDidUpdate instead. As a temporary workaround, ' + 'you can rename to UNSAFE_componentWillUpdate.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', _sortedNames2); - var context = {}; - for (var key in contextTypes) { - context[key] = unmaskedContext[key]; + pendingComponentWillUpdateWarnings = []; } + }; - { - var name = getComponentName(workInProgress) || 'Unknown'; - checkPropTypes(contextTypes, context, 'context', name, ReactDebugCurrentFiber.getCurrentFiberStackAddendum); + ReactStrictModeWarnings.recordDeprecationWarnings = function (fiber, instance) { + // Dedup strategy: Warn once per component. + if (didWarnAboutDeprecatedLifecycles.has(fiber.type)) { + return; } - // Cache unmasked context so we can avoid recreating masked context unless necessary. - // Context is created before the class component is instantiated so check for instance. - if (instance) { - cacheContext(workInProgress, unmaskedContext, context); + // Don't warn about react-lifecycles-compat polyfilled components. + if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) { + pendingComponentWillMountWarnings.push(fiber); } + if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) { + pendingComponentWillReceivePropsWarnings.push(fiber); + } + if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) { + pendingComponentWillUpdateWarnings.push(fiber); + } + }; - return context; - } - - function hasContextChanged() { - return didPerformWorkStackCursor.current; - } - - function isContextConsumer(fiber) { - return fiber.tag === ClassComponent && fiber.type.contextTypes != null; - } - - function isContextProvider(fiber) { - return fiber.tag === ClassComponent && fiber.type.childContextTypes != null; - } + ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) { + var strictRoot = getStrictRoot(fiber); - function popContextProvider(fiber) { - if (!isContextProvider(fiber)) { + // Dedup strategy: Warn once per component. + // This is difficult to track any other way since component names + // are often vague and are likely to collide between 3rd party libraries. + // An expand property is probably okay to use here since it's DEV-only, + // and will only be set in the event of serious warnings. + if (didWarnAboutUnsafeLifecycles.has(fiber.type)) { return; } - pop(didPerformWorkStackCursor, fiber); - pop(contextStackCursor, fiber); - } - - function popTopLevelContextObject(fiber) { - pop(didPerformWorkStackCursor, fiber); - pop(contextStackCursor, fiber); - } - - function pushTopLevelContextObject(fiber, context, didChange) { - !(contextStackCursor.cursor == null) ? invariant(false, 'Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.') : void 0; - - push(contextStackCursor, context, fiber); - push(didPerformWorkStackCursor, didChange, fiber); - } - - function processChildContext(fiber, parentContext) { - var instance = fiber.stateNode; - var childContextTypes = fiber.type.childContextTypes; + // Don't warn about react-lifecycles-compat polyfilled components. + // Note that it is sufficient to check for the presence of a + // single lifecycle, componentWillMount, with the polyfill flag. + if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning === true) { + return; + } - // TODO (bvaughn) Replace this behavior with an invariant() in the future. - // It has only been added in Fiber to match the (unintentional) behavior in Stack. - if (typeof instance.getChildContext !== 'function') { - { - var componentName = getComponentName(fiber) || 'Unknown'; + var warningsForRoot = void 0; + if (!pendingUnsafeLifecycleWarnings.has(strictRoot)) { + warningsForRoot = { + UNSAFE_componentWillMount: [], + UNSAFE_componentWillReceiveProps: [], + UNSAFE_componentWillUpdate: [] + }; - if (!warnedAboutMissingGetChildContext[componentName]) { - warnedAboutMissingGetChildContext[componentName] = true; - warning(false, '%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName); - } - } - return parentContext; + pendingUnsafeLifecycleWarnings.set(strictRoot, warningsForRoot); + } else { + warningsForRoot = pendingUnsafeLifecycleWarnings.get(strictRoot); } - var childContext = void 0; - { - ReactDebugCurrentFiber.setCurrentPhase('getChildContext'); + var unsafeLifecycles = []; + if (typeof instance.componentWillMount === 'function' || typeof instance.UNSAFE_componentWillMount === 'function') { + unsafeLifecycles.push('UNSAFE_componentWillMount'); } - startPhaseTimer(fiber, 'getChildContext'); - childContext = instance.getChildContext(); - stopPhaseTimer(); - { - ReactDebugCurrentFiber.setCurrentPhase(null); + if (typeof instance.componentWillReceiveProps === 'function' || typeof instance.UNSAFE_componentWillReceiveProps === 'function') { + unsafeLifecycles.push('UNSAFE_componentWillReceiveProps'); } - for (var contextKey in childContext) { - !(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(fiber) || 'Unknown', contextKey) : void 0; + if (typeof instance.componentWillUpdate === 'function' || typeof instance.UNSAFE_componentWillUpdate === 'function') { + unsafeLifecycles.push('UNSAFE_componentWillUpdate'); } - { - var name = getComponentName(fiber) || 'Unknown'; - checkPropTypes(childContextTypes, childContext, 'child context', name, - // In practice, there is one case in which we won't get a stack. It's when - // somebody calls unstable_renderSubtreeIntoContainer() and we process - // context from the parent component instance. The stack will be missing - // because it's outside of the reconciliation, and so the pointer has not - // been set. This is rare and doesn't matter. We'll also remove that API. - ReactDebugCurrentFiber.getCurrentFiberStackAddendum); + + if (unsafeLifecycles.length > 0) { + unsafeLifecycles.forEach(function (lifecycle) { + warningsForRoot[lifecycle].push(fiber); + }); } + }; +} - return _assign({}, parentContext, childContext); - } +// Exports ReactDOM.createRoot +var enableUserTimingAPI = true; - function pushContextProvider(workInProgress) { - if (!isContextProvider(workInProgress)) { - return false; - } +// Mutating mode (React DOM, React ART, React Native): +var enableMutatingReconciler = true; +// Experimental noop mode (currently unused): +var enableNoopReconciler = false; +// Experimental persistent mode (Fabric): +var enablePersistentReconciler = false; +// Experimental error-boundary API that can recover from errors within a single +// render phase +var enableGetDerivedStateFromCatch = false; +// Helps identify side effects in begin-phase lifecycle hooks and setState reducers: +var debugRenderPhaseSideEffects = false; - var instance = workInProgress.stateNode; - // We push the context as early as possible to ensure stack integrity. - // If the instance does not exist yet, we will push null at first, - // and replace it on the stack later when invalidating the context. - var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyObject; +// In some cases, StrictMode should also double-render lifecycles. +// This can be confusing for tests though, +// And it can be bad for performance in production. +// This feature flag can be used to control the behavior: +var debugRenderPhaseSideEffectsForStrictMode = true; - // Remember the parent context so we can merge with it later. - // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. - previousContext = contextStackCursor.current; - push(contextStackCursor, memoizedMergedChildContext, workInProgress); - push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress); +// To preserve the "Pause on caught exceptions" behavior of the debugger, we +// replay the begin phase of a failed component inside invokeGuardedCallback. +var replayFailedUnitOfWorkWithInvokeGuardedCallback = true; - return true; - } +// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6: +var warnAboutDeprecatedLifecycles = false; - function invalidateContextProvider(workInProgress, didChange) { - var instance = workInProgress.stateNode; - !instance ? invariant(false, 'Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.') : void 0; +var alwaysUseRequestIdleCallbackPolyfill = false; - if (didChange) { - // Merge parent and own context. - // Skip this if we're not updating due to sCU. - // This avoids unnecessarily recomputing memoized values. - var mergedContext = processChildContext(workInProgress, previousContext); - instance.__reactInternalMemoizedMergedChildContext = mergedContext; +// Only used in www builds. - // Replace the old (or empty) context with the new one. - // It is important to unwind the context in the reverse order. - pop(didPerformWorkStackCursor, workInProgress); - pop(contextStackCursor, workInProgress); - // Now push the new context and mark that it has changed. - push(contextStackCursor, mergedContext, workInProgress); - push(didPerformWorkStackCursor, didChange, workInProgress); - } else { - pop(didPerformWorkStackCursor, workInProgress); - push(didPerformWorkStackCursor, didChange, workInProgress); - } - } +// Prefix measurements so that it's possible to filter them. +// Longer prefixes are hard to read in DevTools. +var reactEmoji = '\u269B'; +var warningEmoji = '\u26D4'; +var supportsUserTiming = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function'; - function findCurrentUnmaskedContext(fiber) { - // Currently this is only used with renderSubtreeIntoContainer; not sure if it - // makes sense elsewhere - !(isFiberMounted(fiber) && fiber.tag === ClassComponent) ? invariant(false, 'Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.') : void 0; +// Keep track of current fiber so that we know the path to unwind on pause. +// TODO: this looks the same as nextUnitOfWork in scheduler. Can we unify them? +var currentFiber = null; +// If we're in the middle of user code, which fiber and method is it? +// Reusing `currentFiber` would be confusing for this because user code fiber +// can change during commit phase too, but we don't need to unwind it (since +// lifecycles in the commit phase don't resemble a tree). +var currentPhase = null; +var currentPhaseFiber = null; +// Did lifecycle hook schedule an update? This is often a performance problem, +// so we will keep track of it, and include it in the report. +// Track commits caused by cascading updates. +var isCommitting = false; +var hasScheduledUpdateInCurrentCommit = false; +var hasScheduledUpdateInCurrentPhase = false; +var commitCountInCurrentWorkLoop = 0; +var effectCountInCurrentCommit = 0; +var isWaitingForCallback = false; +// During commits, we only show a measurement once per method name +// to avoid stretch the commit phase with measurement overhead. +var labelsInCurrentCommit = new Set(); - var node = fiber; - while (node.tag !== HostRoot) { - if (isContextProvider(node)) { - return node.stateNode.__reactInternalMemoizedMergedChildContext; - } - var parent = node['return']; - !parent ? invariant(false, 'Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.') : void 0; - node = parent; - } - return node.stateNode.context; - } +var formatMarkName = function (markName) { + return reactEmoji + ' ' + markName; +}; - return { - getUnmaskedContext: getUnmaskedContext, - cacheContext: cacheContext, - getMaskedContext: getMaskedContext, - hasContextChanged: hasContextChanged, - isContextConsumer: isContextConsumer, - isContextProvider: isContextProvider, - popContextProvider: popContextProvider, - popTopLevelContextObject: popTopLevelContextObject, - pushTopLevelContextObject: pushTopLevelContextObject, - processChildContext: processChildContext, - pushContextProvider: pushContextProvider, - invalidateContextProvider: invalidateContextProvider, - findCurrentUnmaskedContext: findCurrentUnmaskedContext - }; +var formatLabel = function (label, warning$$1) { + var prefix = warning$$1 ? warningEmoji + ' ' : reactEmoji + ' '; + var suffix = warning$$1 ? ' Warning: ' + warning$$1 : ''; + return '' + prefix + label + suffix; }; -var ReactFiberNewContext = function (stack) { - var createCursor = stack.createCursor, - push = stack.push, - pop = stack.pop; +var beginMark = function (markName) { + performance.mark(formatMarkName(markName)); +}; +var clearMark = function (markName) { + performance.clearMarks(formatMarkName(markName)); +}; - var providerCursor = createCursor(null); - var valueCursor = createCursor(null); - var changedBitsCursor = createCursor(0); +var endMark = function (label, markName, warning$$1) { + var formattedMarkName = formatMarkName(markName); + var formattedLabel = formatLabel(label, warning$$1); + try { + performance.measure(formattedLabel, formattedMarkName); + } catch (err) {} + // If previous mark was missing for some reason, this will throw. + // This could only happen if React crashed in an unexpected place earlier. + // Don't pile on with more errors. - var rendererSigil = void 0; - { - // Use this to detect multiple renderers using the same context - rendererSigil = {}; - } + // Clear marks immediately to avoid growing buffer. + performance.clearMarks(formattedMarkName); + performance.clearMeasures(formattedLabel); +}; - function pushProvider(providerFiber) { - var context = providerFiber.type._context; +var getFiberMarkName = function (label, debugID) { + return label + ' (#' + debugID + ')'; +}; - push(changedBitsCursor, context._changedBits, providerFiber); - push(valueCursor, context._currentValue, providerFiber); - push(providerCursor, providerFiber, providerFiber); +var getFiberLabel = function (componentName, isMounted, phase) { + if (phase === null) { + // These are composite component total time measurements. + return componentName + ' [' + (isMounted ? 'update' : 'mount') + ']'; + } else { + // Composite component methods. + return componentName + '.' + phase; + } +}; - context._currentValue = providerFiber.pendingProps.value; - context._changedBits = providerFiber.stateNode; +var beginFiberMark = function (fiber, phase) { + var componentName = getComponentName(fiber) || 'Unknown'; + var debugID = fiber._debugID; + var isMounted = fiber.alternate !== null; + var label = getFiberLabel(componentName, isMounted, phase); - { - warning(context._currentRenderer === null || context._currentRenderer === rendererSigil, 'Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.'); - context._currentRenderer = rendererSigil; - } + if (isCommitting && labelsInCurrentCommit.has(label)) { + // During the commit phase, we don't show duplicate labels because + // there is a fixed overhead for every measurement, and we don't + // want to stretch the commit phase beyond necessary. + return false; } + labelsInCurrentCommit.add(label); - function popProvider(providerFiber) { - var changedBits = changedBitsCursor.current; - var currentValue = valueCursor.current; - - pop(providerCursor, providerFiber); - pop(valueCursor, providerFiber); - pop(changedBitsCursor, providerFiber); + var markName = getFiberMarkName(label, debugID); + beginMark(markName); + return true; +}; - var context = providerFiber.type._context; - context._currentValue = currentValue; - context._changedBits = changedBits; - } +var clearFiberMark = function (fiber, phase) { + var componentName = getComponentName(fiber) || 'Unknown'; + var debugID = fiber._debugID; + var isMounted = fiber.alternate !== null; + var label = getFiberLabel(componentName, isMounted, phase); + var markName = getFiberMarkName(label, debugID); + clearMark(markName); +}; - return { - pushProvider: pushProvider, - popProvider: popProvider - }; +var endFiberMark = function (fiber, phase, warning$$1) { + var componentName = getComponentName(fiber) || 'Unknown'; + var debugID = fiber._debugID; + var isMounted = fiber.alternate !== null; + var label = getFiberLabel(componentName, isMounted, phase); + var markName = getFiberMarkName(label, debugID); + endMark(label, markName, warning$$1); }; -var ReactFiberStack = function () { - var valueStack = []; +var shouldIgnoreFiber = function (fiber) { + // Host components should be skipped in the timeline. + // We could check typeof fiber.type, but does this work with RN? + switch (fiber.tag) { + case HostRoot: + case HostComponent: + case HostText: + case HostPortal: + case CallComponent: + case ReturnComponent: + case Fragment: + case ContextProvider: + case ContextConsumer: + case Mode: + return true; + default: + return false; + } +}; - var fiberStack = void 0; +var clearPendingPhaseMeasurement = function () { + if (currentPhase !== null && currentPhaseFiber !== null) { + clearFiberMark(currentPhaseFiber, currentPhase); + } + currentPhaseFiber = null; + currentPhase = null; + hasScheduledUpdateInCurrentPhase = false; +}; - { - fiberStack = []; +var pauseTimers = function () { + // Stops all currently active measurements so that they can be resumed + // if we continue in a later deferred loop from the same unit of work. + var fiber = currentFiber; + while (fiber) { + if (fiber._debugIsCurrentlyTiming) { + endFiberMark(fiber, null, null); + } + fiber = fiber['return']; } +}; - var index = -1; +var resumeTimersRecursively = function (fiber) { + if (fiber['return'] !== null) { + resumeTimersRecursively(fiber['return']); + } + if (fiber._debugIsCurrentlyTiming) { + beginFiberMark(fiber, null); + } +}; - function createCursor(defaultValue) { - return { - current: defaultValue - }; +var resumeTimers = function () { + // Resumes all measurements that were active during the last deferred loop. + if (currentFiber !== null) { + resumeTimersRecursively(currentFiber); } +}; - function isEmpty() { - return index === -1; +function recordEffect() { + if (enableUserTimingAPI) { + effectCountInCurrentCommit++; } +} - function pop(cursor, fiber) { - if (index < 0) { - { - warning(false, 'Unexpected pop.'); - } - return; +function recordScheduleUpdate() { + if (enableUserTimingAPI) { + if (isCommitting) { + hasScheduledUpdateInCurrentCommit = true; + } + if (currentPhase !== null && currentPhase !== 'componentWillMount' && currentPhase !== 'componentWillReceiveProps') { + hasScheduledUpdateInCurrentPhase = true; } + } +} - { - if (fiber !== fiberStack[index]) { - warning(false, 'Unexpected Fiber popped.'); - } +function startRequestCallbackTimer() { + if (enableUserTimingAPI) { + if (supportsUserTiming && !isWaitingForCallback) { + isWaitingForCallback = true; + beginMark('(Waiting for async callback...)'); } + } +} - cursor.current = valueStack[index]; +function stopRequestCallbackTimer(didExpire, expirationTime) { + if (enableUserTimingAPI) { + if (supportsUserTiming) { + isWaitingForCallback = false; + var warning$$1 = didExpire ? 'React was blocked by main thread' : null; + endMark('(Waiting for async callback... will force flush in ' + expirationTime + ' ms)', '(Waiting for async callback...)', warning$$1); + } + } +} - valueStack[index] = null; +function startWorkTimer(fiber) { + if (enableUserTimingAPI) { + if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { + return; + } + // If we pause, this is the fiber to unwind from. + currentFiber = fiber; + if (!beginFiberMark(fiber, null)) { + return; + } + fiber._debugIsCurrentlyTiming = true; + } +} - { - fiberStack[index] = null; +function cancelWorkTimer(fiber) { + if (enableUserTimingAPI) { + if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { + return; } + // Remember we shouldn't complete measurement for this fiber. + // Otherwise flamechart will be deep even for small updates. + fiber._debugIsCurrentlyTiming = false; + clearFiberMark(fiber, null); + } +} - index--; +function stopWorkTimer(fiber) { + if (enableUserTimingAPI) { + if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { + return; + } + // If we pause, its parent is the fiber to unwind from. + currentFiber = fiber['return']; + if (!fiber._debugIsCurrentlyTiming) { + return; + } + fiber._debugIsCurrentlyTiming = false; + endFiberMark(fiber, null, null); } +} - function push(cursor, value, fiber) { - index++; +function stopFailedWorkTimer(fiber) { + if (enableUserTimingAPI) { + if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { + return; + } + // If we pause, its parent is the fiber to unwind from. + currentFiber = fiber['return']; + if (!fiber._debugIsCurrentlyTiming) { + return; + } + fiber._debugIsCurrentlyTiming = false; + var warning$$1 = 'An error was thrown inside this error boundary'; + endFiberMark(fiber, null, warning$$1); + } +} - valueStack[index] = cursor.current; +function startPhaseTimer(fiber, phase) { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + clearPendingPhaseMeasurement(); + if (!beginFiberMark(fiber, phase)) { + return; + } + currentPhaseFiber = fiber; + currentPhase = phase; + } +} - { - fiberStack[index] = fiber; +function stopPhaseTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + if (currentPhase !== null && currentPhaseFiber !== null) { + var warning$$1 = hasScheduledUpdateInCurrentPhase ? 'Scheduled a cascading update' : null; + endFiberMark(currentPhaseFiber, currentPhase, warning$$1); } + currentPhase = null; + currentPhaseFiber = null; + } +} - cursor.current = value; +function startWorkLoopTimer(nextUnitOfWork) { + if (enableUserTimingAPI) { + currentFiber = nextUnitOfWork; + if (!supportsUserTiming) { + return; + } + commitCountInCurrentWorkLoop = 0; + // This is top level call. + // Any other measurements are performed within. + beginMark('(React Tree Reconciliation)'); + // Resume any measurements that were in progress during the last loop. + resumeTimers(); } +} - function checkThatStackIsEmpty() { - { - if (index !== -1) { - warning(false, 'Expected an empty stack. Something was not reset properly.'); +function stopWorkLoopTimer(interruptedBy, didCompleteRoot) { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + var warning$$1 = null; + if (interruptedBy !== null) { + if (interruptedBy.tag === HostRoot) { + warning$$1 = 'A top-level update interrupted the previous render'; + } else { + var componentName = getComponentName(interruptedBy) || 'Unknown'; + warning$$1 = 'An update to ' + componentName + ' interrupted the previous render'; } + } else if (commitCountInCurrentWorkLoop > 1) { + warning$$1 = 'There were cascading updates'; } + commitCountInCurrentWorkLoop = 0; + var label = didCompleteRoot ? '(React Tree Reconciliation: Completed Root)' : '(React Tree Reconciliation: Yielded)'; + // Pause any measurements until the next loop. + pauseTimers(); + endMark(label, '(React Tree Reconciliation)', warning$$1); } +} - function resetStackAfterFatalErrorInDev() { - { - index = -1; - valueStack.length = 0; - fiberStack.length = 0; +function startCommitTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; } + isCommitting = true; + hasScheduledUpdateInCurrentCommit = false; + labelsInCurrentCommit.clear(); + beginMark('(Committing Changes)'); } +} - return { - createCursor: createCursor, - isEmpty: isEmpty, - pop: pop, - push: push, - checkThatStackIsEmpty: checkThatStackIsEmpty, - resetStackAfterFatalErrorInDev: resetStackAfterFatalErrorInDev - }; -}; - -var invokeGuardedCallback$2 = ReactErrorUtils.invokeGuardedCallback; -var hasCaughtError = ReactErrorUtils.hasCaughtError; -var clearCaughtError = ReactErrorUtils.clearCaughtError; +function stopCommitTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + var warning$$1 = null; + if (hasScheduledUpdateInCurrentCommit) { + warning$$1 = 'Lifecycle hook scheduled a cascading update'; + } else if (commitCountInCurrentWorkLoop > 0) { + warning$$1 = 'Caused by a cascading update in earlier commit'; + } + hasScheduledUpdateInCurrentCommit = false; + commitCountInCurrentWorkLoop++; + isCommitting = false; + labelsInCurrentCommit.clear(); -var didWarnAboutStateTransition = void 0; -var didWarnSetStateChildContext = void 0; -var warnAboutUpdateOnUnmounted = void 0; -var warnAboutInvalidUpdates = void 0; + endMark('(Committing Changes)', '(Committing Changes)', warning$$1); + } +} -{ - didWarnAboutStateTransition = false; - didWarnSetStateChildContext = false; - var didWarnStateUpdateForUnmountedComponent = {}; +function startCommitSnapshotEffectsTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + effectCountInCurrentCommit = 0; + beginMark('(Committing Snapshot Effects)'); + } +} - warnAboutUpdateOnUnmounted = function (fiber) { - // We show the whole stack but dedupe on the top component's name because - // the problematic code almost always lies inside that component. - var componentName = getComponentName(fiber) || 'ReactClass'; - if (didWarnStateUpdateForUnmountedComponent[componentName]) { +function stopCommitSnapshotEffectsTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { return; } - warning(false, "Can't call setState (or forceUpdate) on an unmounted component. This " + 'is a no-op, but it indicates a memory leak in your application. To ' + 'fix, cancel all subscriptions and asynchronous tasks in the ' + 'componentWillUnmount method.%s', getStackAddendumByWorkInProgressFiber(fiber)); - didWarnStateUpdateForUnmountedComponent[componentName] = true; - }; + var count = effectCountInCurrentCommit; + effectCountInCurrentCommit = 0; + endMark('(Committing Snapshot Effects: ' + count + ' Total)', '(Committing Snapshot Effects)', null); + } +} - warnAboutInvalidUpdates = function (instance) { - switch (ReactDebugCurrentFiber.phase) { - case 'getChildContext': - if (didWarnSetStateChildContext) { - return; - } - warning(false, 'setState(...): Cannot call setState() inside getChildContext()'); - didWarnSetStateChildContext = true; - break; - case 'render': - if (didWarnAboutStateTransition) { - return; - } - warning(false, '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`.'); - didWarnAboutStateTransition = true; - break; +function startCommitHostEffectsTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; } - }; + effectCountInCurrentCommit = 0; + beginMark('(Committing Host Effects)'); + } } -var ReactFiberScheduler = function (config) { - var stack = ReactFiberStack(); - var hostContext = ReactFiberHostContext(config, stack); - var legacyContext = ReactFiberLegacyContext(stack); - var newContext = ReactFiberNewContext(stack); - var popHostContext = hostContext.popHostContext, - popHostContainer = hostContext.popHostContainer; - var popTopLevelLegacyContextObject = legacyContext.popTopLevelContextObject, - popLegacyContextProvider = legacyContext.popContextProvider; - var popProvider = newContext.popProvider; - - var hydrationContext = ReactFiberHydrationContext(config); +function stopCommitHostEffectsTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + var count = effectCountInCurrentCommit; + effectCountInCurrentCommit = 0; + endMark('(Committing Host Effects: ' + count + ' Total)', '(Committing Host Effects)', null); + } +} - var _ReactFiberBeginWork = ReactFiberBeginWork(config, hostContext, legacyContext, newContext, hydrationContext, scheduleWork, computeExpirationForFiber), - beginWork = _ReactFiberBeginWork.beginWork; +function startCommitLifeCyclesTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + effectCountInCurrentCommit = 0; + beginMark('(Calling Lifecycle Methods)'); + } +} - var _ReactFiberCompleteWo = ReactFiberCompleteWork(config, hostContext, legacyContext, newContext, hydrationContext), - completeWork = _ReactFiberCompleteWo.completeWork; +function stopCommitLifeCyclesTimer() { + if (enableUserTimingAPI) { + if (!supportsUserTiming) { + return; + } + var count = effectCountInCurrentCommit; + effectCountInCurrentCommit = 0; + endMark('(Calling Lifecycle Methods: ' + count + ' Total)', '(Calling Lifecycle Methods)', null); + } +} - var _ReactFiberUnwindWork = ReactFiberUnwindWork(hostContext, legacyContext, newContext, scheduleWork, isAlreadyFailedLegacyErrorBoundary), - throwException = _ReactFiberUnwindWork.throwException, - unwindWork = _ReactFiberUnwindWork.unwindWork, - unwindInterruptedWork = _ReactFiberUnwindWork.unwindInterruptedWork; +var didWarnUpdateInsideUpdate = void 0; - var _ReactFiberCommitWork = ReactFiberCommitWork(config, onCommitPhaseError, scheduleWork, computeExpirationForFiber, markLegacyErrorBoundaryAsFailed, recalculateCurrentTime), - commitBeforeMutationLifeCycles = _ReactFiberCommitWork.commitBeforeMutationLifeCycles, - commitResetTextContent = _ReactFiberCommitWork.commitResetTextContent, - commitPlacement = _ReactFiberCommitWork.commitPlacement, - commitDeletion = _ReactFiberCommitWork.commitDeletion, - commitWork = _ReactFiberCommitWork.commitWork, - commitLifeCycles = _ReactFiberCommitWork.commitLifeCycles, - commitErrorLogging = _ReactFiberCommitWork.commitErrorLogging, - commitAttachRef = _ReactFiberCommitWork.commitAttachRef, - commitDetachRef = _ReactFiberCommitWork.commitDetachRef; +{ + didWarnUpdateInsideUpdate = false; +} - var now = config.now, - scheduleDeferredCallback = config.scheduleDeferredCallback, - cancelDeferredCallback = config.cancelDeferredCallback, - prepareForCommit = config.prepareForCommit, - resetAfterCommit = config.resetAfterCommit; +// Callbacks are not validated until invocation - // Represents the current time in ms. - var originalStartTimeMs = now(); - var mostRecentCurrentTime = msToExpirationTime(0); - var mostRecentCurrentTimeMs = originalStartTimeMs; +// Singly linked-list of updates. When an update is scheduled, it is added to +// the queue of the current fiber and the work-in-progress fiber. The two queues +// are separate but they share a persistent structure. +// +// During reconciliation, updates are removed from the work-in-progress fiber, +// but they remain on the current fiber. That ensures that if a work-in-progress +// is aborted, the aborted updates are recovered by cloning from current. +// +// The work-in-progress queue is always a subset of the current queue. +// +// When the tree is committed, the work-in-progress becomes the current. - // Used to ensure computeUniqueAsyncExpiration is monotonically increases. - var lastUniqueAsyncExpiration = 0; - // Represents the expiration time that incoming updates should use. (If this - // is NoWork, use the default strategy: async updates in async mode, sync - // updates in sync mode.) - var expirationContext = NoWork; +function createUpdateQueue(baseState) { + var queue = { + baseState: baseState, + expirationTime: NoWork, + first: null, + last: null, + callbackList: null, + hasForceUpdate: false, + isInitialized: false, + capturedValues: null + }; + { + queue.isProcessing = false; + } + return queue; +} - var isWorking = false; +function insertUpdateIntoQueue(queue, update) { + // Append the update to the end of the list. + if (queue.last === null) { + // Queue is empty + queue.first = queue.last = update; + } else { + queue.last.next = update; + queue.last = update; + } + if (queue.expirationTime === NoWork || queue.expirationTime > update.expirationTime) { + queue.expirationTime = update.expirationTime; + } +} - // The next work in progress fiber that we're currently working on. - var nextUnitOfWork = null; - var nextRoot = null; - // The time at which we're currently rendering work. - var nextRenderExpirationTime = NoWork; +var q1 = void 0; +var q2 = void 0; +function ensureUpdateQueues(fiber) { + q1 = q2 = null; + // We'll have at least one and at most two distinct update queues. + var alternateFiber = fiber.alternate; + var queue1 = fiber.updateQueue; + if (queue1 === null) { + // TODO: We don't know what the base state will be until we begin work. + // It depends on which fiber is the next current. Initialize with an empty + // base state, then set to the memoizedState when rendering. Not super + // happy with this approach. + queue1 = fiber.updateQueue = createUpdateQueue(null); + } - // The next fiber with an effect that we're currently committing. - var nextEffect = null; + var queue2 = void 0; + if (alternateFiber !== null) { + queue2 = alternateFiber.updateQueue; + if (queue2 === null) { + queue2 = alternateFiber.updateQueue = createUpdateQueue(null); + } + } else { + queue2 = null; + } + queue2 = queue2 !== queue1 ? queue2 : null; - var isCommitting = false; + // Use module variables instead of returning a tuple + q1 = queue1; + q2 = queue2; +} - var isRootReadyForCommit = false; +function insertUpdateIntoFiber(fiber, update) { + ensureUpdateQueues(fiber); + var queue1 = q1; + var queue2 = q2; - var legacyErrorBoundariesThatAlreadyFailed = null; + // Warn if an update is scheduled from inside an updater function. + { + if ((queue1.isProcessing || queue2 !== null && queue2.isProcessing) && !didWarnUpdateInsideUpdate) { + warning(false, 'An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.'); + didWarnUpdateInsideUpdate = true; + } + } - // Used for performance tracking. - var interruptedBy = null; + // If there's only one queue, add the update to that queue and exit. + if (queue2 === null) { + insertUpdateIntoQueue(queue1, update); + return; + } - var stashedWorkInProgressProperties = void 0; - var replayUnitOfWork = void 0; - var isReplayingFailedUnitOfWork = void 0; - var originalReplayError = void 0; - var rethrowOriginalError = void 0; - if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) { - stashedWorkInProgressProperties = null; - isReplayingFailedUnitOfWork = false; - originalReplayError = null; - replayUnitOfWork = function (failedUnitOfWork, error, isAsync) { - // Restore the original state of the work-in-progress - assignFiberPropertiesInDEV(failedUnitOfWork, stashedWorkInProgressProperties); - switch (failedUnitOfWork.tag) { - case HostRoot: - popHostContainer(failedUnitOfWork); - popTopLevelLegacyContextObject(failedUnitOfWork); - break; - case HostComponent: - popHostContext(failedUnitOfWork); - break; - case ClassComponent: - popLegacyContextProvider(failedUnitOfWork); - break; - case HostPortal: - popHostContainer(failedUnitOfWork); - break; - case ContextProvider: - popProvider(failedUnitOfWork); - break; - } - // Replay the begin phase. - isReplayingFailedUnitOfWork = true; - originalReplayError = error; - invokeGuardedCallback$2(null, workLoop, null, isAsync); - isReplayingFailedUnitOfWork = false; - originalReplayError = null; - if (hasCaughtError()) { - clearCaughtError(); - } else { - // If the begin phase did not fail the second time, set this pointer - // back to the original value. - nextUnitOfWork = failedUnitOfWork; - } - }; - rethrowOriginalError = function () { - throw originalReplayError; - }; + // If either queue is empty, we need to add to both queues. + if (queue1.last === null || queue2.last === null) { + insertUpdateIntoQueue(queue1, update); + insertUpdateIntoQueue(queue2, update); + return; } - function resetStack() { - if (nextUnitOfWork !== null) { - var interruptedWork = nextUnitOfWork['return']; - while (interruptedWork !== null) { - unwindInterruptedWork(interruptedWork); - interruptedWork = interruptedWork['return']; - } - } + // If both lists are not empty, the last update is the same for both lists + // because of structural sharing. So, we should only append to one of + // the lists. + insertUpdateIntoQueue(queue1, update); + // But we still need to update the `last` pointer of queue2. + queue2.last = update; +} - { - ReactStrictModeWarnings.discardPendingWarnings(); - stack.checkThatStackIsEmpty(); - } +function getUpdateExpirationTime(fiber) { + switch (fiber.tag) { + case HostRoot: + case ClassComponent: + var updateQueue = fiber.updateQueue; + if (updateQueue === null) { + return NoWork; + } + return updateQueue.expirationTime; + default: + return NoWork; + } +} - nextRoot = null; - nextRenderExpirationTime = NoWork; - nextUnitOfWork = null; +function getStateFromUpdate(update, instance, prevState, props) { + var partialState = update.partialState; + if (typeof partialState === 'function') { + return partialState.call(instance, prevState, props); + } else { + return partialState; + } +} - isRootReadyForCommit = false; +function processUpdateQueue(current, workInProgress, queue, instance, props, renderExpirationTime) { + if (current !== null && current.updateQueue === queue) { + // We need to create a work-in-progress queue, by cloning the current queue. + var currentQueue = queue; + queue = workInProgress.updateQueue = { + baseState: currentQueue.baseState, + expirationTime: currentQueue.expirationTime, + first: currentQueue.first, + last: currentQueue.last, + isInitialized: currentQueue.isInitialized, + capturedValues: currentQueue.capturedValues, + // These fields are no longer valid because they were already committed. + // Reset them. + callbackList: null, + hasForceUpdate: false + }; } - function commitAllHostEffects() { - while (nextEffect !== null) { - { - ReactDebugCurrentFiber.setCurrentFiber(nextEffect); - } - recordEffect(); + { + // Set this flag so we can warn if setState is called inside the update + // function of another setState. + queue.isProcessing = true; + } - var effectTag = nextEffect.effectTag; + // Reset the remaining expiration time. If we skip over any updates, we'll + // increase this accordingly. + queue.expirationTime = NoWork; - if (effectTag & ContentReset) { - commitResetTextContent(nextEffect); + // TODO: We don't know what the base state will be until we begin work. + // It depends on which fiber is the next current. Initialize with an empty + // base state, then set to the memoizedState when rendering. Not super + // happy with this approach. + var state = void 0; + if (queue.isInitialized) { + state = queue.baseState; + } else { + state = queue.baseState = workInProgress.memoizedState; + queue.isInitialized = true; + } + var dontMutatePrevState = true; + var update = queue.first; + var didSkip = false; + while (update !== null) { + var updateExpirationTime = update.expirationTime; + if (updateExpirationTime > renderExpirationTime) { + // This update does not have sufficient priority. Skip it. + var remainingExpirationTime = queue.expirationTime; + if (remainingExpirationTime === NoWork || remainingExpirationTime > updateExpirationTime) { + // Update the remaining expiration time. + queue.expirationTime = updateExpirationTime; } - - if (effectTag & Ref) { - var current = nextEffect.alternate; - if (current !== null) { - commitDetachRef(current); - } + if (!didSkip) { + didSkip = true; + queue.baseState = state; } + // Continue to the next update. + update = update.next; + continue; + } - // The following switch statement is only concerned about placement, - // updates, and deletions. To avoid needing to add a case for every - // possible bitmap value, we remove the secondary effects from the - // effect tag and switch on that value. - var primaryEffectTag = effectTag & (Placement | Update | Deletion); - switch (primaryEffectTag) { - case Placement: - { - commitPlacement(nextEffect); - // Clear the "placement" from effect tag so that we know that this is inserted, before - // any life-cycles like componentDidMount gets called. - // TODO: findDOMNode doesn't rely on this any more but isMounted - // does and isMounted is deprecated anyway so we should be able - // to kill this. - nextEffect.effectTag &= ~Placement; - break; - } - case PlacementAndUpdate: - { - // Placement - commitPlacement(nextEffect); - // Clear the "placement" from effect tag so that we know that this is inserted, before - // any life-cycles like componentDidMount gets called. - nextEffect.effectTag &= ~Placement; + // This update does have sufficient priority. - // Update - var _current = nextEffect.alternate; - commitWork(_current, nextEffect); - break; - } - case Update: - { - var _current2 = nextEffect.alternate; - commitWork(_current2, nextEffect); - break; - } - case Deletion: - { - commitDeletion(nextEffect); - break; - } + // If no previous updates were skipped, drop this update from the queue by + // advancing the head of the list. + if (!didSkip) { + queue.first = update.next; + if (queue.first === null) { + queue.last = null; } - nextEffect = nextEffect.nextEffect; } - { - ReactDebugCurrentFiber.resetCurrentFiber(); + // Invoke setState callback an extra time to help detect side-effects. + // Ignore the return value in this case. + if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) { + getStateFromUpdate(update, instance, state, props); } - } - - function commitBeforeMutationLifecycles() { - while (nextEffect !== null) { - var effectTag = nextEffect.effectTag; - if (effectTag & Snapshot) { - recordEffect(); - var current = nextEffect.alternate; - commitBeforeMutationLifeCycles(current, nextEffect); + // Process the update + var _partialState = void 0; + if (update.isReplace) { + state = getStateFromUpdate(update, instance, state, props); + dontMutatePrevState = true; + } else { + _partialState = getStateFromUpdate(update, instance, state, props); + if (_partialState) { + if (dontMutatePrevState) { + // $FlowFixMe: Idk how to type this properly. + state = _assign({}, state, _partialState); + } else { + state = _assign(state, _partialState); + } + dontMutatePrevState = false; } - - // Don't cleanup effects yet; - // This will be done by commitAllLifeCycles() - nextEffect = nextEffect.nextEffect; } - } - - function commitAllLifeCycles(finishedRoot, currentTime, committedExpirationTime) { - { - ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); - - if (warnAboutDeprecatedLifecycles) { - ReactStrictModeWarnings.flushPendingDeprecationWarnings(); - } + if (update.isForced) { + queue.hasForceUpdate = true; } - while (nextEffect !== null) { - var effectTag = nextEffect.effectTag; - - if (effectTag & (Update | Callback)) { - recordEffect(); - var current = nextEffect.alternate; - commitLifeCycles(finishedRoot, current, nextEffect, currentTime, committedExpirationTime); - } - - if (effectTag & ErrLog) { - commitErrorLogging(nextEffect, onUncaughtError); + if (update.callback !== null) { + // Append to list of callbacks. + var _callbackList = queue.callbackList; + if (_callbackList === null) { + _callbackList = queue.callbackList = []; } - - if (effectTag & Ref) { - recordEffect(); - commitAttachRef(nextEffect); + _callbackList.push(update); + } + if (update.capturedValue !== null) { + var _capturedValues = queue.capturedValues; + if (_capturedValues === null) { + queue.capturedValues = [update.capturedValue]; + } else { + _capturedValues.push(update.capturedValue); } - - var next = nextEffect.nextEffect; - // Ensure that we clean these up so that we don't accidentally keep them. - // I'm not actually sure this matters because we can't reset firstEffect - // and lastEffect since they're on every node, not just the effectful - // ones. So we have to clean everything as we reuse nodes anyway. - nextEffect.nextEffect = null; - // Ensure that we reset the effectTag here so that we can rely on effect - // tags to reason about the current life-cycle. - nextEffect = next; } + update = update.next; } - function isAlreadyFailedLegacyErrorBoundary(instance) { - return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance); + if (queue.callbackList !== null) { + workInProgress.effectTag |= Callback; + } else if (queue.first === null && !queue.hasForceUpdate && queue.capturedValues === null) { + // The queue is empty. We can reset it. + workInProgress.updateQueue = null; } - function markLegacyErrorBoundaryAsFailed(instance) { - if (legacyErrorBoundariesThatAlreadyFailed === null) { - legacyErrorBoundariesThatAlreadyFailed = new Set([instance]); - } else { - legacyErrorBoundariesThatAlreadyFailed.add(instance); - } + if (!didSkip) { + didSkip = true; + queue.baseState = state; } - function commitRoot(finishedWork) { - isWorking = true; - isCommitting = true; - startCommitTimer(); - - var root = finishedWork.stateNode; - !(root.current !== finishedWork) ? invariant(false, 'Cannot commit the same tree as before. This is probably a bug related to the return field. This error is likely caused by a bug in React. Please file an issue.') : void 0; - var committedExpirationTime = root.pendingCommitExpirationTime; - !(committedExpirationTime !== NoWork) ? invariant(false, 'Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.') : void 0; - root.pendingCommitExpirationTime = NoWork; - - var currentTime = recalculateCurrentTime(); + { + // No longer processing. + queue.isProcessing = false; + } - // Reset this to null before calling lifecycles - ReactCurrentOwner.current = null; + return state; +} - var firstEffect = void 0; - if (finishedWork.effectTag > PerformedWork) { - // A fiber's effect list consists only of its children, not itself. So if - // the root has an effect, we need to add it to the end of the list. The - // resulting list is the set that would belong to the root's parent, if - // it had one; that is, all the effects in the tree including the root. - if (finishedWork.lastEffect !== null) { - finishedWork.lastEffect.nextEffect = finishedWork; - firstEffect = finishedWork.firstEffect; - } else { - firstEffect = finishedWork; - } - } else { - // There is no effect on the root. - firstEffect = finishedWork.firstEffect; +function commitCallbacks(queue, context) { + var callbackList = queue.callbackList; + if (callbackList === null) { + return; + } + // Set the list to null to make sure they don't get called more than once. + queue.callbackList = null; + for (var i = 0; i < callbackList.length; i++) { + var update = callbackList[i]; + var _callback = update.callback; + // This update might be processed again. Clear the callback so it's only + // called once. + update.callback = null; + !(typeof _callback === 'function') ? invariant(false, 'Invalid argument passed as callback. Expected a function. Instead received: %s', _callback) : void 0; + _callback.call(context); + } +} + +var fakeInternalInstance = {}; +var isArray = Array.isArray; + +var didWarnAboutStateAssignmentForComponent = void 0; +var didWarnAboutUndefinedDerivedState = void 0; +var didWarnAboutUninitializedState = void 0; +var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = void 0; +var didWarnAboutLegacyLifecyclesAndDerivedState = void 0; +var warnOnInvalidCallback$1 = void 0; + +{ + didWarnAboutStateAssignmentForComponent = new Set(); + didWarnAboutUndefinedDerivedState = new Set(); + didWarnAboutUninitializedState = new Set(); + didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set(); + didWarnAboutLegacyLifecyclesAndDerivedState = new Set(); + + var didWarnOnInvalidCallback = new Set(); + + warnOnInvalidCallback$1 = function (callback, callerName) { + if (callback === null || typeof callback === 'function') { + return; + } + var key = callerName + '_' + callback; + if (!didWarnOnInvalidCallback.has(key)) { + didWarnOnInvalidCallback.add(key); + warning(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback); } + }; - prepareForCommit(root.containerInfo); + // This is so gross but it's at least non-critical and can be removed if + // it causes problems. This is meant to give a nicer error message for + // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component, + // ...)) which otherwise throws a "_processChildContext is not a function" + // exception. + Object.defineProperty(fakeInternalInstance, '_processChildContext', { + enumerable: false, + value: function () { + invariant(false, '_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn\'t supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).'); + } + }); + Object.freeze(fakeInternalInstance); +} +function callGetDerivedStateFromCatch(ctor, capturedValues) { + var resultState = {}; + for (var i = 0; i < capturedValues.length; i++) { + var capturedValue = capturedValues[i]; + var error = capturedValue.value; + var partialState = ctor.getDerivedStateFromCatch.call(null, error); + if (partialState !== null && partialState !== undefined) { + _assign(resultState, partialState); + } + } + return resultState; +} - // Invoke instances of getSnapshotBeforeUpdate before mutation. - nextEffect = firstEffect; - startCommitSnapshotEffectsTimer(); - while (nextEffect !== null) { - var didError = false; - var error = void 0; +var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExpirationForFiber, memoizeProps, memoizeState) { + var cacheContext = legacyContext.cacheContext, + getMaskedContext = legacyContext.getMaskedContext, + getUnmaskedContext = legacyContext.getUnmaskedContext, + isContextConsumer = legacyContext.isContextConsumer, + hasContextChanged = legacyContext.hasContextChanged; + + // Class component state updater + + var updater = { + isMounted: isMounted, + enqueueSetState: function (instance, partialState, callback) { + var fiber = get(instance); + callback = callback === undefined ? null : callback; { - invokeGuardedCallback$2(null, commitBeforeMutationLifecycles, null); - if (hasCaughtError()) { - didError = true; - error = clearCaughtError(); - } - } - if (didError) { - !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0; - onCommitPhaseError(nextEffect, error); - // Clean-up - if (nextEffect !== null) { - nextEffect = nextEffect.nextEffect; - } + warnOnInvalidCallback$1(callback, 'setState'); } - } - stopCommitSnapshotEffectsTimer(); - - // Commit all the side-effects within a tree. We'll do this in two passes. - // The first pass performs all the host insertions, updates, deletions and - // ref unmounts. - nextEffect = firstEffect; - startCommitHostEffectsTimer(); - while (nextEffect !== null) { - var _didError = false; - var _error = void 0; + var expirationTime = computeExpirationForFiber(fiber); + var update = { + expirationTime: expirationTime, + partialState: partialState, + callback: callback, + isReplace: false, + isForced: false, + capturedValue: null, + next: null + }; + insertUpdateIntoFiber(fiber, update); + scheduleWork(fiber, expirationTime); + }, + enqueueReplaceState: function (instance, state, callback) { + var fiber = get(instance); + callback = callback === undefined ? null : callback; { - invokeGuardedCallback$2(null, commitAllHostEffects, null); - if (hasCaughtError()) { - _didError = true; - _error = clearCaughtError(); - } + warnOnInvalidCallback$1(callback, 'replaceState'); } - if (_didError) { - !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0; - onCommitPhaseError(nextEffect, _error); - // Clean-up - if (nextEffect !== null) { - nextEffect = nextEffect.nextEffect; - } + var expirationTime = computeExpirationForFiber(fiber); + var update = { + expirationTime: expirationTime, + partialState: state, + callback: callback, + isReplace: true, + isForced: false, + capturedValue: null, + next: null + }; + insertUpdateIntoFiber(fiber, update); + scheduleWork(fiber, expirationTime); + }, + enqueueForceUpdate: function (instance, callback) { + var fiber = get(instance); + callback = callback === undefined ? null : callback; + { + warnOnInvalidCallback$1(callback, 'forceUpdate'); } + var expirationTime = computeExpirationForFiber(fiber); + var update = { + expirationTime: expirationTime, + partialState: null, + callback: callback, + isReplace: false, + isForced: true, + capturedValue: null, + next: null + }; + insertUpdateIntoFiber(fiber, update); + scheduleWork(fiber, expirationTime); } - stopCommitHostEffectsTimer(); + }; - resetAfterCommit(root.containerInfo); + function checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext) { + if (oldProps === null || workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate) { + // If the workInProgress already has an Update effect, return true + return true; + } - // The work-in-progress tree is now the current tree. This must come after - // the first pass of the commit phase, so that the previous tree is still - // current during componentWillUnmount, but before the second pass, so that - // the finished work is current during componentDidMount/Update. - root.current = finishedWork; + var instance = workInProgress.stateNode; + var ctor = workInProgress.type; + if (typeof instance.shouldComponentUpdate === 'function') { + startPhaseTimer(workInProgress, 'shouldComponentUpdate'); + var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, newContext); + stopPhaseTimer(); - // In the second pass we'll perform all life-cycles and ref callbacks. - // Life-cycles happen as a separate pass so that all placements, updates, - // and deletions in the entire tree have already been invoked. - // This pass also triggers any renderer-specific initial effects. - nextEffect = firstEffect; - startCommitLifeCyclesTimer(); - while (nextEffect !== null) { - var _didError2 = false; - var _error2 = void 0; { - invokeGuardedCallback$2(null, commitAllLifeCycles, null, root, currentTime, committedExpirationTime); - if (hasCaughtError()) { - _didError2 = true; - _error2 = clearCaughtError(); - } - } - if (_didError2) { - !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0; - onCommitPhaseError(nextEffect, _error2); - if (nextEffect !== null) { - nextEffect = nextEffect.nextEffect; - } + !(shouldUpdate !== undefined) ? warning(false, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(workInProgress) || 'Component') : void 0; } - } - isCommitting = false; - isWorking = false; - stopCommitLifeCyclesTimer(); - stopCommitTimer(); - if (typeof onCommitRoot === 'function') { - onCommitRoot(finishedWork.stateNode); - } - if (true && ReactFiberInstrumentation_1.debugTool) { - ReactFiberInstrumentation_1.debugTool.onCommitWork(finishedWork); + return shouldUpdate; } - var remainingTime = root.current.expirationTime; - if (remainingTime === NoWork) { - // If there's no remaining work, we can clear the set of already failed - // error boundaries. - legacyErrorBoundariesThatAlreadyFailed = null; + if (ctor.prototype && ctor.prototype.isPureReactComponent) { + return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState); } - return remainingTime; + + return true; } - function resetExpirationTime(workInProgress, renderTime) { - if (renderTime !== Never && workInProgress.expirationTime === Never) { - // The children of this component are hidden. Don't bubble their - // expiration times. - return; - } + function checkClassInstance(workInProgress) { + var instance = workInProgress.stateNode; + var type = workInProgress.type; + { + var name = getComponentName(workInProgress) || 'Component'; + var renderPresent = instance.render; - // Check for pending updates. - var newExpirationTime = getUpdateExpirationTime(workInProgress); + if (!renderPresent) { + if (type.prototype && typeof type.prototype.render === 'function') { + warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name); + } else { + warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name); + } + } - // TODO: Calls need to visit stateNode + var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state; + !noGetInitialStateOnES6 ? warning(false, '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?', name) : void 0; + var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved; + !noGetDefaultPropsOnES6 ? warning(false, '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.', name) : void 0; + var noInstancePropTypes = !instance.propTypes; + !noInstancePropTypes ? warning(false, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name) : void 0; + var noInstanceContextTypes = !instance.contextTypes; + !noInstanceContextTypes ? warning(false, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name) : void 0; + var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function'; + !noComponentShouldUpdate ? warning(false, '%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.', name) : void 0; + if (type.prototype && type.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') { + warning(false, '%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(workInProgress) || 'A pure component'); + } + var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function'; + !noComponentDidUnmount ? warning(false, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name) : void 0; + var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function'; + !noComponentDidReceiveProps ? warning(false, '%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name) : void 0; + var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function'; + !noComponentWillRecieveProps ? warning(false, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name) : void 0; + var noUnsafeComponentWillRecieveProps = typeof instance.UNSAFE_componentWillRecieveProps !== 'function'; + !noUnsafeComponentWillRecieveProps ? warning(false, '%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name) : void 0; + var hasMutatedProps = instance.props !== workInProgress.pendingProps; + !(instance.props === undefined || !hasMutatedProps) ? warning(false, '%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name) : void 0; + var noInstanceDefaultProps = !instance.defaultProps; + !noInstanceDefaultProps ? warning(false, 'Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name) : void 0; - // Bubble up the earliest expiration time. - var child = workInProgress.child; - while (child !== null) { - if (child.expirationTime !== NoWork && (newExpirationTime === NoWork || newExpirationTime > child.expirationTime)) { - newExpirationTime = child.expirationTime; + if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(type)) { + didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(type); + warning(false, '%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(workInProgress)); } - child = child.sibling; - } - workInProgress.expirationTime = newExpirationTime; - } - function completeUnitOfWork(workInProgress) { - // Attempt to complete the current unit of work, then move to the - // next sibling. If there are no more siblings, return to the - // parent fiber. - while (true) { - // The current, flushed, state of this fiber is the alternate. - // Ideally nothing should rely on this, but relying on it here - // means that we don't need an additional field on the work in - // progress. - var current = workInProgress.alternate; - { - ReactDebugCurrentFiber.setCurrentFiber(workInProgress); + var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function'; + !noInstanceGetDerivedStateFromProps ? warning(false, '%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0; + var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromCatch !== 'function'; + !noInstanceGetDerivedStateFromCatch ? warning(false, '%s: getDerivedStateFromCatch() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0; + var noStaticGetSnapshotBeforeUpdate = typeof type.getSnapshotBeforeUpdate !== 'function'; + !noStaticGetSnapshotBeforeUpdate ? warning(false, '%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name) : void 0; + var _state = instance.state; + if (_state && (typeof _state !== 'object' || isArray(_state))) { + warning(false, '%s.state: must be set to an object or null', name); + } + if (typeof instance.getChildContext === 'function') { + !(typeof type.childContextTypes === 'object') ? warning(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name) : void 0; } + } + } - var returnFiber = workInProgress['return']; - var siblingFiber = workInProgress.sibling; + function resetInputPointers(workInProgress, instance) { + instance.props = workInProgress.memoizedProps; + instance.state = workInProgress.memoizedState; + } - if ((workInProgress.effectTag & Incomplete) === NoEffect) { - // This fiber completed. - var next = completeWork(current, workInProgress, nextRenderExpirationTime); - stopWorkTimer(workInProgress); - resetExpirationTime(workInProgress, nextRenderExpirationTime); - { - ReactDebugCurrentFiber.resetCurrentFiber(); - } + function adoptClassInstance(workInProgress, instance) { + instance.updater = updater; + workInProgress.stateNode = instance; + // The instance needs access to the fiber so that it can schedule updates + set(instance, workInProgress); + { + instance._reactInternalInstance = fakeInternalInstance; + } + } - if (next !== null) { - stopWorkTimer(workInProgress); - if (true && ReactFiberInstrumentation_1.debugTool) { - ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress); - } - // If completing this work spawned new work, do that next. We'll come - // back here again. - return next; - } + function constructClassInstance(workInProgress, props) { + var ctor = workInProgress.type; + var unmaskedContext = getUnmaskedContext(workInProgress); + var needsContext = isContextConsumer(workInProgress); + var context = needsContext ? getMaskedContext(workInProgress, unmaskedContext) : emptyObject; - if (returnFiber !== null && - // Do not append effects to parents if a sibling failed to complete - (returnFiber.effectTag & Incomplete) === NoEffect) { - // Append all the effects of the subtree and this fiber onto the effect - // list of the parent. The completion order of the children affects the - // side-effect order. - if (returnFiber.firstEffect === null) { - returnFiber.firstEffect = workInProgress.firstEffect; - } - if (workInProgress.lastEffect !== null) { - if (returnFiber.lastEffect !== null) { - returnFiber.lastEffect.nextEffect = workInProgress.firstEffect; - } - returnFiber.lastEffect = workInProgress.lastEffect; - } + // Instantiate twice to help detect side-effects. + if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) { + new ctor(props, context); // eslint-disable-line no-new + } - // If this fiber had side-effects, we append it AFTER the children's - // side-effects. We can perform certain side-effects earlier if - // needed, by doing multiple passes over the effect list. We don't want - // to schedule our own side-effect on our own list because if end up - // reusing children we'll schedule this effect onto itself since we're - // at the end. - var effectTag = workInProgress.effectTag; - // Skip both NoWork and PerformedWork tags when creating the effect list. - // PerformedWork effect is read by React DevTools but shouldn't be committed. - if (effectTag > PerformedWork) { - if (returnFiber.lastEffect !== null) { - returnFiber.lastEffect.nextEffect = workInProgress; - } else { - returnFiber.firstEffect = workInProgress; - } - returnFiber.lastEffect = workInProgress; - } - } + var instance = new ctor(props, context); + var state = instance.state !== null && instance.state !== undefined ? instance.state : null; + adoptClassInstance(workInProgress, instance); - if (true && ReactFiberInstrumentation_1.debugTool) { - ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress); + { + if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) { + var componentName = getComponentName(workInProgress) || 'Component'; + if (!didWarnAboutUninitializedState.has(componentName)) { + didWarnAboutUninitializedState.add(componentName); + warning(false, '%s: Did not properly initialize state during construction. ' + 'Expected state to be an object, but it was %s.', componentName, instance.state === null ? 'null' : 'undefined'); } + } - if (siblingFiber !== null) { - // If there is more work to do in this returnFiber, do that next. - return siblingFiber; - } else if (returnFiber !== null) { - // If there's no more work in this returnFiber. Complete the returnFiber. - workInProgress = returnFiber; - continue; - } else { - // We've reached the root. - isRootReadyForCommit = true; - return null; + // If new component APIs are defined, "unsafe" lifecycles won't be called. + // Warn about these lifecycles if they are present. + // Don't warn about react-lifecycles-compat polyfilled methods though. + if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') { + var foundWillMountName = null; + var foundWillReceivePropsName = null; + var foundWillUpdateName = null; + if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) { + foundWillMountName = 'componentWillMount'; + } else if (typeof instance.UNSAFE_componentWillMount === 'function') { + foundWillMountName = 'UNSAFE_componentWillMount'; } - } else { - // This fiber did not complete because something threw. Pop values off - // the stack without entering the complete phase. If this is a boundary, - // capture values if possible. - var _next = unwindWork(workInProgress); - // Because this fiber did not complete, don't reset its expiration time. - if (workInProgress.effectTag & DidCapture) { - // Restarting an error boundary - stopFailedWorkTimer(workInProgress); - } else { - stopWorkTimer(workInProgress); + if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) { + foundWillReceivePropsName = 'componentWillReceiveProps'; + } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') { + foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps'; } - - { - ReactDebugCurrentFiber.resetCurrentFiber(); + if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) { + foundWillUpdateName = 'componentWillUpdate'; + } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') { + foundWillUpdateName = 'UNSAFE_componentWillUpdate'; } - - if (_next !== null) { - stopWorkTimer(workInProgress); - if (true && ReactFiberInstrumentation_1.debugTool) { - ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress); + if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) { + var _componentName = getComponentName(workInProgress) || 'Component'; + var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()'; + if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) { + didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName); + warning(false, 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-async-component-lifecycle-hooks', _componentName, newApiName, foundWillMountName !== null ? '\n ' + foundWillMountName : '', foundWillReceivePropsName !== null ? '\n ' + foundWillReceivePropsName : '', foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : ''); } - // If completing this work spawned new work, do that next. We'll come - // back here again. - // Since we're restarting, remove anything that is not a host effect - // from the effect tag. - _next.effectTag &= HostEffectMask; - return _next; } + } + } - if (returnFiber !== null) { - // Mark the parent fiber as incomplete and clear its effect list. - returnFiber.firstEffect = returnFiber.lastEffect = null; - returnFiber.effectTag |= Incomplete; - } + workInProgress.memoizedState = state; - if (true && ReactFiberInstrumentation_1.debugTool) { - ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress); - } + var partialState = callGetDerivedStateFromProps(workInProgress, instance, props, state); - if (siblingFiber !== null) { - // If there is more work to do in this returnFiber, do that next. - return siblingFiber; - } else if (returnFiber !== null) { - // If there's no more work in this returnFiber. Complete the returnFiber. - workInProgress = returnFiber; - continue; - } else { - return null; - } - } + if (partialState !== null && partialState !== undefined) { + // Render-phase updates (like this) should not be added to the update queue, + // So that multiple render passes do not enqueue multiple updates. + // Instead, just synchronously merge the returned state into the instance. + workInProgress.memoizedState = _assign({}, workInProgress.memoizedState, partialState); } - // Without this explicit null return Flow complains of invalid return type - // TODO Remove the above while(true) loop - // eslint-disable-next-line no-unreachable - return null; + // Cache unmasked context so we can avoid recreating masked context unless necessary. + // ReactFiberContext usually updates this cache but can't for newly-created instances. + if (needsContext) { + cacheContext(workInProgress, unmaskedContext, context); + } + + return instance; } - function performUnitOfWork(workInProgress) { - // The current, flushed, state of this fiber is the alternate. - // Ideally nothing should rely on this, but relying on it here - // means that we don't need an additional field on the work in - // progress. - var current = workInProgress.alternate; + function callComponentWillMount(workInProgress, instance) { + startPhaseTimer(workInProgress, 'componentWillMount'); + var oldState = instance.state; - // See if beginning this work spawns more work. - startWorkTimer(workInProgress); - { - ReactDebugCurrentFiber.setCurrentFiber(workInProgress); + if (typeof instance.componentWillMount === 'function') { + instance.componentWillMount(); } - - if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) { - stashedWorkInProgressProperties = assignFiberPropertiesInDEV(stashedWorkInProgressProperties, workInProgress); - } - var next = beginWork(current, workInProgress, nextRenderExpirationTime); - { - ReactDebugCurrentFiber.resetCurrentFiber(); - if (isReplayingFailedUnitOfWork) { - // Currently replaying a failed unit of work. This should be unreachable, - // because the render phase is meant to be idempotent, and it should - // have thrown again. Since it didn't, rethrow the original error, so - // React's internal stack is not misaligned. - rethrowOriginalError(); - } - } - if (true && ReactFiberInstrumentation_1.debugTool) { - ReactFiberInstrumentation_1.debugTool.onBeginWork(workInProgress); - } - - if (next === null) { - // If this doesn't spawn new work, complete the current work. - next = completeUnitOfWork(workInProgress); + if (typeof instance.UNSAFE_componentWillMount === 'function') { + instance.UNSAFE_componentWillMount(); } - ReactCurrentOwner.current = null; - - return next; - } + stopPhaseTimer(); - function workLoop(isAsync) { - if (!isAsync) { - // Flush all expired work. - while (nextUnitOfWork !== null) { - nextUnitOfWork = performUnitOfWork(nextUnitOfWork); - } - } else { - // Flush asynchronous work until the deadline runs out of time. - while (nextUnitOfWork !== null && !shouldYield()) { - nextUnitOfWork = performUnitOfWork(nextUnitOfWork); + if (oldState !== instance.state) { + { + warning(false, '%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentName(workInProgress) || 'Component'); } + updater.enqueueReplaceState(instance, instance.state, null); } } - function renderRoot(root, expirationTime, isAsync) { - !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0; - isWorking = true; - - // Check if we're starting from a fresh stack, or if we're resuming from - // previously yielded work. - if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) { - // Reset the stack and start working from the root. - resetStack(); - nextRoot = root; - nextRenderExpirationTime = expirationTime; - nextUnitOfWork = createWorkInProgress(nextRoot.current, null, nextRenderExpirationTime); - root.pendingCommitExpirationTime = NoWork; + function callComponentWillReceiveProps(workInProgress, instance, newProps, newContext) { + var oldState = instance.state; + startPhaseTimer(workInProgress, 'componentWillReceiveProps'); + if (typeof instance.componentWillReceiveProps === 'function') { + instance.componentWillReceiveProps(newProps, newContext); } + if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') { + instance.UNSAFE_componentWillReceiveProps(newProps, newContext); + } + stopPhaseTimer(); - var didFatal = false; - - startWorkLoopTimer(nextUnitOfWork); - - do { - try { - workLoop(isAsync); - } catch (thrownValue) { - if (nextUnitOfWork === null) { - // This is a fatal error. - didFatal = true; - onUncaughtError(thrownValue); - break; + if (instance.state !== oldState) { + { + var componentName = getComponentName(workInProgress) || 'Component'; + if (!didWarnAboutStateAssignmentForComponent.has(componentName)) { + didWarnAboutStateAssignmentForComponent.add(componentName); + warning(false, '%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName); } + } + updater.enqueueReplaceState(instance, instance.state, null); + } + } - if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) { - var failedUnitOfWork = nextUnitOfWork; - replayUnitOfWork(failedUnitOfWork, thrownValue, isAsync); - } + function callGetDerivedStateFromProps(workInProgress, instance, nextProps, prevState) { + var type = workInProgress.type; - var sourceFiber = nextUnitOfWork; - var returnFiber = sourceFiber['return']; - if (returnFiber === null) { - // This is the root. The root could capture its own errors. However, - // we don't know if it errors before or after we pushed the host - // context. This information is needed to avoid a stack mismatch. - // Because we're not sure, treat this as a fatal error. We could track - // which phase it fails in, but doesn't seem worth it. At least - // for now. - didFatal = true; - onUncaughtError(thrownValue); - break; - } - throwException(returnFiber, sourceFiber, thrownValue); - nextUnitOfWork = completeUnitOfWork(sourceFiber); + + if (typeof type.getDerivedStateFromProps === 'function') { + if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) { + // Invoke method an extra time to help detect side-effects. + type.getDerivedStateFromProps.call(null, nextProps, prevState); } - break; - } while (true); - // We're done performing work. Time to clean up. - var didCompleteRoot = false; - isWorking = false; + var partialState = type.getDerivedStateFromProps.call(null, nextProps, prevState); - // Yield back to main thread. - if (didFatal) { - stopWorkLoopTimer(interruptedBy, didCompleteRoot); - interruptedBy = null; - // There was a fatal error. { - stack.resetStackAfterFatalErrorInDev(); - } - return null; - } else if (nextUnitOfWork === null) { - // We reached the root. - if (isRootReadyForCommit) { - didCompleteRoot = true; - stopWorkLoopTimer(interruptedBy, didCompleteRoot); - interruptedBy = null; - // The root successfully completed. It's ready for commit. - root.pendingCommitExpirationTime = expirationTime; - var finishedWork = root.current.alternate; - return finishedWork; - } else { - // The root did not complete. - stopWorkLoopTimer(interruptedBy, didCompleteRoot); - interruptedBy = null; - invariant(false, 'Expired work should have completed. This error is likely caused by a bug in React. Please file an issue.'); + if (partialState === undefined) { + var componentName = getComponentName(workInProgress) || 'Component'; + if (!didWarnAboutUndefinedDerivedState.has(componentName)) { + didWarnAboutUndefinedDerivedState.add(componentName); + warning(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName); + } + } } - } else { - stopWorkLoopTimer(interruptedBy, didCompleteRoot); - interruptedBy = null; - // There's more work to do, but we ran out of time. Yield back to - // the renderer. - return null; + + return partialState; } } - function scheduleCapture(sourceFiber, boundaryFiber, value, expirationTime) { - // TODO: We only support dispatching errors. - var capturedValue = createCapturedValue(value, sourceFiber); - var update = { - expirationTime: expirationTime, - partialState: null, - callback: null, - isReplace: false, - isForced: false, - capturedValue: capturedValue, - next: null - }; - insertUpdateIntoFiber(boundaryFiber, update); - scheduleWork(boundaryFiber, expirationTime); - } + // Invokes the mount life-cycles on a previously never rendered instance. + function mountClassInstance(workInProgress, renderExpirationTime) { + var ctor = workInProgress.type; + var current = workInProgress.alternate; - function dispatch(sourceFiber, value, expirationTime) { - !(!isWorking || isCommitting) ? invariant(false, 'dispatch: Cannot dispatch during the render phase.') : void 0; + { + checkClassInstance(workInProgress); + } - // TODO: Handle arrays + var instance = workInProgress.stateNode; + var props = workInProgress.pendingProps; + var unmaskedContext = getUnmaskedContext(workInProgress); - var fiber = sourceFiber['return']; - while (fiber !== null) { - switch (fiber.tag) { - case ClassComponent: - var ctor = fiber.type; - var instance = fiber.stateNode; - if (typeof ctor.getDerivedStateFromCatch === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) { - scheduleCapture(sourceFiber, fiber, value, expirationTime); - return; - } - break; - // TODO: Handle async boundaries - case HostRoot: - scheduleCapture(sourceFiber, fiber, value, expirationTime); - return; + instance.props = props; + instance.state = workInProgress.memoizedState; + instance.refs = emptyObject; + instance.context = getMaskedContext(workInProgress, unmaskedContext); + + { + if (workInProgress.mode & StrictMode) { + ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance); + } + + if (warnAboutDeprecatedLifecycles) { + ReactStrictModeWarnings.recordDeprecationWarnings(workInProgress, instance); } - fiber = fiber['return']; } - if (sourceFiber.tag === HostRoot) { - // Error was thrown at the root. There is no parent, so the root - // itself should capture it. - scheduleCapture(sourceFiber, sourceFiber, value, expirationTime); + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) { + callComponentWillMount(workInProgress, instance); + // If we had additional state updates during this life-cycle, let's + // process them now. + var updateQueue = workInProgress.updateQueue; + if (updateQueue !== null) { + instance.state = processUpdateQueue(current, workInProgress, updateQueue, instance, props, renderExpirationTime); + } + } + if (typeof instance.componentDidMount === 'function') { + workInProgress.effectTag |= Update; } } - function onCommitPhaseError(fiber, error) { - return dispatch(fiber, error, Sync); - } + function resumeMountClassInstance(workInProgress, renderExpirationTime) { + var ctor = workInProgress.type; + var instance = workInProgress.stateNode; + resetInputPointers(workInProgress, instance); - function computeAsyncExpiration(currentTime) { - // Given the current clock time, returns an expiration time. We use rounding - // to batch like updates together. - // Should complete within ~1000ms. 1200ms max. - var expirationMs = 5000; - var bucketSizeMs = 250; - return computeExpirationBucket(currentTime, expirationMs, bucketSizeMs); - } + var oldProps = workInProgress.memoizedProps; + var newProps = workInProgress.pendingProps; + var oldContext = instance.context; + var newUnmaskedContext = getUnmaskedContext(workInProgress); + var newContext = getMaskedContext(workInProgress, newUnmaskedContext); - function computeInteractiveExpiration(currentTime) { - // Should complete within ~500ms. 600ms max. - var expirationMs = 500; - var bucketSizeMs = 100; - return computeExpirationBucket(currentTime, expirationMs, bucketSizeMs); - } + var hasNewLifecycles = typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; - // Creates a unique async expiration time. - function computeUniqueAsyncExpiration() { - var currentTime = recalculateCurrentTime(); - var result = computeAsyncExpiration(currentTime); - if (result <= lastUniqueAsyncExpiration) { - // Since we assume the current time monotonically increases, we only hit - // this branch when computeUniqueAsyncExpiration is fired multiple times - // within a 200ms window (or whatever the async bucket size is). - result = lastUniqueAsyncExpiration + 1; + // Note: During these life-cycles, instance.props/instance.state are what + // ever the previously attempted to render - not the "current". However, + // during componentDidUpdate we pass the "current" props. + + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { + if (oldProps !== newProps || oldContext !== newContext) { + callComponentWillReceiveProps(workInProgress, instance, newProps, newContext); + } } - lastUniqueAsyncExpiration = result; - return lastUniqueAsyncExpiration; - } - function computeExpirationForFiber(fiber) { - var expirationTime = void 0; - if (expirationContext !== NoWork) { - // An explicit expiration context was set; - expirationTime = expirationContext; - } else if (isWorking) { - if (isCommitting) { - // Updates that occur during the commit phase should have sync priority - // by default. - expirationTime = Sync; - } else { - // Updates during the render phase should expire at the same time as - // the work that is being rendered. - expirationTime = nextRenderExpirationTime; + // Compute the next state using the memoized state and the update queue. + var oldState = workInProgress.memoizedState; + // TODO: Previous state can be null. + var newState = void 0; + var derivedStateFromCatch = void 0; + if (workInProgress.updateQueue !== null) { + newState = processUpdateQueue(null, workInProgress, workInProgress.updateQueue, instance, newProps, renderExpirationTime); + + var updateQueue = workInProgress.updateQueue; + if (updateQueue !== null && updateQueue.capturedValues !== null && enableGetDerivedStateFromCatch && typeof ctor.getDerivedStateFromCatch === 'function') { + var capturedValues = updateQueue.capturedValues; + // Don't remove these from the update queue yet. We need them in + // finishClassComponent. Do the reset there. + // TODO: This is awkward. Refactor class components. + // updateQueue.capturedValues = null; + derivedStateFromCatch = callGetDerivedStateFromCatch(ctor, capturedValues); } } else { - // No explicit expiration context was set, and we're not currently - // performing work. Calculate a new expiration time. - if (fiber.mode & AsyncMode) { - if (isBatchingInteractiveUpdates) { - // This is an interactive update - var currentTime = recalculateCurrentTime(); - expirationTime = computeInteractiveExpiration(currentTime); - } else { - // This is an async update - var _currentTime = recalculateCurrentTime(); - expirationTime = computeAsyncExpiration(_currentTime); - } - } else { - // This is a sync update - expirationTime = Sync; - } + newState = oldState; } - if (isBatchingInteractiveUpdates) { - // This is an interactive update. Keep track of the lowest pending - // interactive expiration time. This allows us to synchronously flush - // all interactive updates when needed. - if (lowestPendingInteractiveExpirationTime === NoWork || expirationTime > lowestPendingInteractiveExpirationTime) { - lowestPendingInteractiveExpirationTime = expirationTime; - } + + var derivedStateFromProps = void 0; + if (oldProps !== newProps) { + // The prevState parameter should be the partially updated state. + // Otherwise, spreading state in return values could override updates. + derivedStateFromProps = callGetDerivedStateFromProps(workInProgress, instance, newProps, newState); } - return expirationTime; - } - function scheduleWork(fiber, expirationTime) { - return scheduleWorkImpl(fiber, expirationTime, false); - } + if (derivedStateFromProps !== null && derivedStateFromProps !== undefined) { + // Render-phase updates (like this) should not be added to the update queue, + // So that multiple render passes do not enqueue multiple updates. + // Instead, just synchronously merge the returned state into the instance. + newState = newState === null || newState === undefined ? derivedStateFromProps : _assign({}, newState, derivedStateFromProps); - function scheduleWorkImpl(fiber, expirationTime, isErrorRecovery) { - recordScheduleUpdate(); + // Update the base state of the update queue. + // FIXME: This is getting ridiculous. Refactor plz! + var _updateQueue = workInProgress.updateQueue; + if (_updateQueue !== null) { + _updateQueue.baseState = _assign({}, _updateQueue.baseState, derivedStateFromProps); + } + } + if (derivedStateFromCatch !== null && derivedStateFromCatch !== undefined) { + // Render-phase updates (like this) should not be added to the update queue, + // So that multiple render passes do not enqueue multiple updates. + // Instead, just synchronously merge the returned state into the instance. + newState = newState === null || newState === undefined ? derivedStateFromCatch : _assign({}, newState, derivedStateFromCatch); - { - if (!isErrorRecovery && fiber.tag === ClassComponent) { - var instance = fiber.stateNode; - warnAboutInvalidUpdates(instance); + // Update the base state of the update queue. + // FIXME: This is getting ridiculous. Refactor plz! + var _updateQueue2 = workInProgress.updateQueue; + if (_updateQueue2 !== null) { + _updateQueue2.baseState = _assign({}, _updateQueue2.baseState, derivedStateFromCatch); } } - var node = fiber; - while (node !== null) { - // Walk the parent path to the root and update each node's - // expiration time. - if (node.expirationTime === NoWork || node.expirationTime > expirationTime) { - node.expirationTime = expirationTime; + if (oldProps === newProps && oldState === newState && !hasContextChanged() && !(workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate)) { + // If an update was already in progress, we should schedule an Update + // effect even though we're bailing out, so that cWU/cDU are called. + if (typeof instance.componentDidMount === 'function') { + workInProgress.effectTag |= Update; } - if (node.alternate !== null) { - if (node.alternate.expirationTime === NoWork || node.alternate.expirationTime > expirationTime) { - node.alternate.expirationTime = expirationTime; + return false; + } + + var shouldUpdate = checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext); + + if (shouldUpdate) { + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) { + startPhaseTimer(workInProgress, 'componentWillMount'); + if (typeof instance.componentWillMount === 'function') { + instance.componentWillMount(); } - } - if (node['return'] === null) { - if (node.tag === HostRoot) { - var root = node.stateNode; - if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime < nextRenderExpirationTime) { - // This is an interruption. (Used for performance tracking.) - interruptedBy = fiber; - resetStack(); - } - if ( - // If we're in the render phase, we don't need to schedule this root - // for an update, because we'll do it before we exit... - !isWorking || isCommitting || - // ...unless this is a different root than the one we're rendering. - nextRoot !== root) { - // Add this root to the root schedule. - requestWork(root, expirationTime); - } - if (nestedUpdateCount > NESTED_UPDATE_LIMIT) { - invariant(false, 'Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.'); - } - } else { - { - if (!isErrorRecovery && fiber.tag === ClassComponent) { - warnAboutUpdateOnUnmounted(fiber); - } - } - return; + if (typeof instance.UNSAFE_componentWillMount === 'function') { + instance.UNSAFE_componentWillMount(); } + stopPhaseTimer(); } - node = node['return']; + if (typeof instance.componentDidMount === 'function') { + workInProgress.effectTag |= Update; + } + } else { + // If an update was already in progress, we should schedule an Update + // effect even though we're bailing out, so that cWU/cDU are called. + if (typeof instance.componentDidMount === 'function') { + workInProgress.effectTag |= Update; + } + + // If shouldComponentUpdate returned false, we should still update the + // memoized props/state to indicate that this work can be reused. + memoizeProps(workInProgress, newProps); + memoizeState(workInProgress, newState); } - } - function recalculateCurrentTime() { - // Subtract initial time so it fits inside 32bits - mostRecentCurrentTimeMs = now() - originalStartTimeMs; - mostRecentCurrentTime = msToExpirationTime(mostRecentCurrentTimeMs); - return mostRecentCurrentTime; - } + // Update the existing instance's state, props, and context pointers even + // if shouldComponentUpdate returns false. + instance.props = newProps; + instance.state = newState; + instance.context = newContext; - function deferredUpdates(fn) { - var previousExpirationContext = expirationContext; - var currentTime = recalculateCurrentTime(); - expirationContext = computeAsyncExpiration(currentTime); - try { - return fn(); - } finally { - expirationContext = previousExpirationContext; - } - } - function syncUpdates(fn, a, b, c, d) { - var previousExpirationContext = expirationContext; - expirationContext = Sync; - try { - return fn(a, b, c, d); - } finally { - expirationContext = previousExpirationContext; - } + return shouldUpdate; } - // TODO: Everything below this is written as if it has been lifted to the - // renderers. I'll do this in a follow-up. + // Invokes the update life-cycles and returns false if it shouldn't rerender. + function updateClassInstance(current, workInProgress, renderExpirationTime) { + var ctor = workInProgress.type; + var instance = workInProgress.stateNode; + resetInputPointers(workInProgress, instance); - // Linked-list of roots - var firstScheduledRoot = null; - var lastScheduledRoot = null; + var oldProps = workInProgress.memoizedProps; + var newProps = workInProgress.pendingProps; + var oldContext = instance.context; + var newUnmaskedContext = getUnmaskedContext(workInProgress); + var newContext = getMaskedContext(workInProgress, newUnmaskedContext); - var callbackExpirationTime = NoWork; - var callbackID = -1; - var isRendering = false; - var nextFlushedRoot = null; - var nextFlushedExpirationTime = NoWork; - var lowestPendingInteractiveExpirationTime = NoWork; - var deadlineDidExpire = false; - var hasUnhandledError = false; - var unhandledError = null; - var deadline = null; + var hasNewLifecycles = typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; - var isBatchingUpdates = false; - var isUnbatchingUpdates = false; - var isBatchingInteractiveUpdates = false; + // Note: During these life-cycles, instance.props/instance.state are what + // ever the previously attempted to render - not the "current". However, + // during componentDidUpdate we pass the "current" props. - var completedBatches = null; + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { + if (oldProps !== newProps || oldContext !== newContext) { + callComponentWillReceiveProps(workInProgress, instance, newProps, newContext); + } + } - // Use these to prevent an infinite loop of nested updates - var NESTED_UPDATE_LIMIT = 1000; - var nestedUpdateCount = 0; + // Compute the next state using the memoized state and the update queue. + var oldState = workInProgress.memoizedState; + // TODO: Previous state can be null. + var newState = void 0; + var derivedStateFromCatch = void 0; - var timeHeuristicForUnitOfWork = 1; + if (workInProgress.updateQueue !== null) { + newState = processUpdateQueue(current, workInProgress, workInProgress.updateQueue, instance, newProps, renderExpirationTime); - function scheduleCallbackWithExpiration(expirationTime) { - if (callbackExpirationTime !== NoWork) { - // A callback is already scheduled. Check its expiration time (timeout). - if (expirationTime > callbackExpirationTime) { - // Existing callback has sufficient timeout. Exit. - return; - } else { - // Existing callback has insufficient timeout. Cancel and schedule a - // new one. - cancelDeferredCallback(callbackID); + var updateQueue = workInProgress.updateQueue; + if (updateQueue !== null && updateQueue.capturedValues !== null && enableGetDerivedStateFromCatch && typeof ctor.getDerivedStateFromCatch === 'function') { + var capturedValues = updateQueue.capturedValues; + // Don't remove these from the update queue yet. We need them in + // finishClassComponent. Do the reset there. + // TODO: This is awkward. Refactor class components. + // updateQueue.capturedValues = null; + derivedStateFromCatch = callGetDerivedStateFromCatch(ctor, capturedValues); } - // The request callback timer is already running. Don't start a new one. } else { - startRequestCallbackTimer(); + newState = oldState; } - // Compute a timeout for the given expiration time. - var currentMs = now() - originalStartTimeMs; - var expirationMs = expirationTimeToMs(expirationTime); - var timeout = expirationMs - currentMs; - - callbackExpirationTime = expirationTime; - callbackID = scheduleDeferredCallback(performAsyncWork, { timeout: timeout }); - } - - // requestWork is called by the scheduler whenever a root receives an update. - // It's up to the renderer to call renderRoot at some point in the future. - function requestWork(root, expirationTime) { - addRootToSchedule(root, expirationTime); - - if (isRendering) { - // Prevent reentrancy. Remaining work will be scheduled at the end of - // the currently rendering batch. - return; + var derivedStateFromProps = void 0; + if (oldProps !== newProps) { + // The prevState parameter should be the partially updated state. + // Otherwise, spreading state in return values could override updates. + derivedStateFromProps = callGetDerivedStateFromProps(workInProgress, instance, newProps, newState); } - if (isBatchingUpdates) { - // Flush work at the end of the batch. - if (isUnbatchingUpdates) { - // ...unless we're inside unbatchedUpdates, in which case we should - // flush it now. - nextFlushedRoot = root; - nextFlushedExpirationTime = Sync; - performWorkOnRoot(root, Sync, false); + if (derivedStateFromProps !== null && derivedStateFromProps !== undefined) { + // Render-phase updates (like this) should not be added to the update queue, + // So that multiple render passes do not enqueue multiple updates. + // Instead, just synchronously merge the returned state into the instance. + newState = newState === null || newState === undefined ? derivedStateFromProps : _assign({}, newState, derivedStateFromProps); + + // Update the base state of the update queue. + // FIXME: This is getting ridiculous. Refactor plz! + var _updateQueue3 = workInProgress.updateQueue; + if (_updateQueue3 !== null) { + _updateQueue3.baseState = _assign({}, _updateQueue3.baseState, derivedStateFromProps); } - return; } + if (derivedStateFromCatch !== null && derivedStateFromCatch !== undefined) { + // Render-phase updates (like this) should not be added to the update queue, + // So that multiple render passes do not enqueue multiple updates. + // Instead, just synchronously merge the returned state into the instance. + newState = newState === null || newState === undefined ? derivedStateFromCatch : _assign({}, newState, derivedStateFromCatch); - // TODO: Get rid of Sync and use current time? - if (expirationTime === Sync) { - performSyncWork(); - } else { - scheduleCallbackWithExpiration(expirationTime); + // Update the base state of the update queue. + // FIXME: This is getting ridiculous. Refactor plz! + var _updateQueue4 = workInProgress.updateQueue; + if (_updateQueue4 !== null) { + _updateQueue4.baseState = _assign({}, _updateQueue4.baseState, derivedStateFromCatch); + } } - } - function addRootToSchedule(root, expirationTime) { - // Add the root to the schedule. - // Check if this root is already part of the schedule. - if (root.nextScheduledRoot === null) { - // This root is not already scheduled. Add it. - root.remainingExpirationTime = expirationTime; - if (lastScheduledRoot === null) { - firstScheduledRoot = lastScheduledRoot = root; - root.nextScheduledRoot = root; - } else { - lastScheduledRoot.nextScheduledRoot = root; - lastScheduledRoot = root; - lastScheduledRoot.nextScheduledRoot = firstScheduledRoot; + if (oldProps === newProps && oldState === newState && !hasContextChanged() && !(workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate)) { + // If an update was already in progress, we should schedule an Update + // effect even though we're bailing out, so that cWU/cDU are called. + if (typeof instance.componentDidUpdate === 'function') { + if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) { + workInProgress.effectTag |= Update; + } } - } else { - // This root is already scheduled, but its priority may have increased. - var remainingExpirationTime = root.remainingExpirationTime; - if (remainingExpirationTime === NoWork || expirationTime < remainingExpirationTime) { - // Update the priority. - root.remainingExpirationTime = expirationTime; + if (typeof instance.getSnapshotBeforeUpdate === 'function') { + if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) { + workInProgress.effectTag |= Snapshot; + } } + return false; } - } - function findHighestPriorityRoot() { - var highestPriorityWork = NoWork; - var highestPriorityRoot = null; - if (lastScheduledRoot !== null) { - var previousScheduledRoot = lastScheduledRoot; - var root = firstScheduledRoot; - while (root !== null) { - var remainingExpirationTime = root.remainingExpirationTime; - if (remainingExpirationTime === NoWork) { - // This root no longer has work. Remove it from the scheduler. + var shouldUpdate = checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext); - // TODO: This check is redudant, but Flow is confused by the branch - // below where we set lastScheduledRoot to null, even though we break - // from the loop right after. - !(previousScheduledRoot !== null && lastScheduledRoot !== null) ? invariant(false, 'Should have a previous and last root. This error is likely caused by a bug in React. Please file an issue.') : void 0; - if (root === root.nextScheduledRoot) { - // This is the only root in the list. - root.nextScheduledRoot = null; - firstScheduledRoot = lastScheduledRoot = null; - break; - } else if (root === firstScheduledRoot) { - // This is the first root in the list. - var next = root.nextScheduledRoot; - firstScheduledRoot = next; - lastScheduledRoot.nextScheduledRoot = next; - root.nextScheduledRoot = null; - } else if (root === lastScheduledRoot) { - // This is the last root in the list. - lastScheduledRoot = previousScheduledRoot; - lastScheduledRoot.nextScheduledRoot = firstScheduledRoot; - root.nextScheduledRoot = null; - break; - } else { - previousScheduledRoot.nextScheduledRoot = root.nextScheduledRoot; - root.nextScheduledRoot = null; - } - root = previousScheduledRoot.nextScheduledRoot; - } else { - if (highestPriorityWork === NoWork || remainingExpirationTime < highestPriorityWork) { - // Update the priority, if it's higher - highestPriorityWork = remainingExpirationTime; - highestPriorityRoot = root; - } - if (root === lastScheduledRoot) { - break; - } - previousScheduledRoot = root; - root = root.nextScheduledRoot; + if (shouldUpdate) { + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) { + startPhaseTimer(workInProgress, 'componentWillUpdate'); + if (typeof instance.componentWillUpdate === 'function') { + instance.componentWillUpdate(newProps, newState, newContext); + } + if (typeof instance.UNSAFE_componentWillUpdate === 'function') { + instance.UNSAFE_componentWillUpdate(newProps, newState, newContext); } + stopPhaseTimer(); + } + if (typeof instance.componentDidUpdate === 'function') { + workInProgress.effectTag |= Update; + } + if (typeof instance.getSnapshotBeforeUpdate === 'function') { + workInProgress.effectTag |= Snapshot; } - } - - // If the next root is the same as the previous root, this is a nested - // update. To prevent an infinite loop, increment the nested update count. - var previousFlushedRoot = nextFlushedRoot; - if (previousFlushedRoot !== null && previousFlushedRoot === highestPriorityRoot && highestPriorityWork === Sync) { - nestedUpdateCount++; } else { - // Reset whenever we switch roots. - nestedUpdateCount = 0; + // If an update was already in progress, we should schedule an Update + // effect even though we're bailing out, so that cWU/cDU are called. + if (typeof instance.componentDidUpdate === 'function') { + if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) { + workInProgress.effectTag |= Update; + } + } + if (typeof instance.getSnapshotBeforeUpdate === 'function') { + if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) { + workInProgress.effectTag |= Snapshot; + } + } + + // If shouldComponentUpdate returned false, we should still update the + // memoized props/state to indicate that this work can be reused. + memoizeProps(workInProgress, newProps); + memoizeState(workInProgress, newState); } - nextFlushedRoot = highestPriorityRoot; - nextFlushedExpirationTime = highestPriorityWork; - } - function performAsyncWork(dl) { - performWork(NoWork, true, dl); - } + // Update the existing instance's state, props, and context pointers even + // if shouldComponentUpdate returns false. + instance.props = newProps; + instance.state = newState; + instance.context = newContext; - function performSyncWork() { - performWork(Sync, false, null); + return shouldUpdate; } - function performWork(minExpirationTime, isAsync, dl) { - deadline = dl; + return { + adoptClassInstance: adoptClassInstance, + callGetDerivedStateFromProps: callGetDerivedStateFromProps, + constructClassInstance: constructClassInstance, + mountClassInstance: mountClassInstance, + resumeMountClassInstance: resumeMountClassInstance, + updateClassInstance: updateClassInstance + }; +}; - // Keep working on roots until there's no more work, or until the we reach - // the deadline. - findHighestPriorityRoot(); +var getCurrentFiberStackAddendum$2 = ReactDebugCurrentFiber.getCurrentFiberStackAddendum; - if (enableUserTimingAPI && deadline !== null) { - var didExpire = nextFlushedExpirationTime < recalculateCurrentTime(); - var timeout = expirationTimeToMs(nextFlushedExpirationTime); - stopRequestCallbackTimer(didExpire, timeout); - } - if (isAsync) { - while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime) && (!deadlineDidExpire || recalculateCurrentTime() >= nextFlushedExpirationTime)) { - performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, !deadlineDidExpire); - findHighestPriorityRoot(); - } - } else { - while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime)) { - performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, false); - findHighestPriorityRoot(); - } - } +var didWarnAboutMaps = void 0; +var didWarnAboutStringRefInStrictMode = void 0; +var ownerHasKeyUseWarning = void 0; +var ownerHasFunctionTypeWarning = void 0; +var warnForMissingKey = function (child) {}; - // We're done flushing work. Either we ran out of time in this callback, - // or there's no more work left with sufficient priority. +{ + didWarnAboutMaps = false; + didWarnAboutStringRefInStrictMode = {}; - // If we're inside a callback, set this to false since we just completed it. - if (deadline !== null) { - callbackExpirationTime = NoWork; - callbackID = -1; + /** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ + ownerHasKeyUseWarning = {}; + ownerHasFunctionTypeWarning = {}; + + warnForMissingKey = function (child) { + if (child === null || typeof child !== 'object') { + return; } - // If there's work left over, schedule a new callback. - if (nextFlushedExpirationTime !== NoWork) { - scheduleCallbackWithExpiration(nextFlushedExpirationTime); + if (!child._store || child._store.validated || child.key != null) { + return; } + !(typeof child._store === 'object') ? invariant(false, 'React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.') : void 0; + child._store.validated = true; - // Clean-up. - deadline = null; - deadlineDidExpire = false; - - finishRendering(); - } + var currentComponentErrorInfo = 'Each child in an array or iterator should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + (getCurrentFiberStackAddendum$2() || ''); + if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { + return; + } + ownerHasKeyUseWarning[currentComponentErrorInfo] = true; - function flushRoot(root, expirationTime) { - !!isRendering ? invariant(false, 'work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method.') : void 0; - // Perform work on root as if the given expiration time is the current time. - // This has the effect of synchronously flushing all work up to and - // including the given time. - nextFlushedRoot = root; - nextFlushedExpirationTime = expirationTime; - performWorkOnRoot(root, expirationTime, false); - // Flush any sync work that was scheduled by lifecycles - performSyncWork(); - finishRendering(); - } + warning(false, 'Each child in an array or iterator should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.%s', getCurrentFiberStackAddendum$2()); + }; +} - function finishRendering() { - nestedUpdateCount = 0; +var isArray$1 = Array.isArray; - if (completedBatches !== null) { - var batches = completedBatches; - completedBatches = null; - for (var i = 0; i < batches.length; i++) { - var batch = batches[i]; - try { - batch._onComplete(); - } catch (error) { - if (!hasUnhandledError) { - hasUnhandledError = true; - unhandledError = error; - } +function coerceRef(returnFiber, current, element) { + var mixedRef = element.ref; + if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') { + { + if (returnFiber.mode & StrictMode) { + var componentName = getComponentName(returnFiber) || 'Component'; + if (!didWarnAboutStringRefInStrictMode[componentName]) { + warning(false, 'A string ref, "%s", has been found within a strict mode tree. ' + 'String refs are a source of potential bugs and should be avoided. ' + 'We recommend using createRef() instead.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-string-ref', mixedRef, getStackAddendumByWorkInProgressFiber(returnFiber)); + didWarnAboutStringRefInStrictMode[componentName] = true; } } } - if (hasUnhandledError) { - var error = unhandledError; - unhandledError = null; - hasUnhandledError = false; - throw error; - } - } - - function performWorkOnRoot(root, expirationTime, isAsync) { - !!isRendering ? invariant(false, 'performWorkOnRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0; - - isRendering = true; - - // Check if this is async work or sync/expired work. - if (!isAsync) { - // Flush sync work. - var finishedWork = root.finishedWork; - if (finishedWork !== null) { - // This root is already complete. We can commit it. - completeRoot(root, finishedWork, expirationTime); - } else { - root.finishedWork = null; - finishedWork = renderRoot(root, expirationTime, false); - if (finishedWork !== null) { - // We've completed the root. Commit it. - completeRoot(root, finishedWork, expirationTime); - } + if (element._owner) { + var owner = element._owner; + var inst = void 0; + if (owner) { + var ownerFiber = owner; + !(ownerFiber.tag === ClassComponent) ? invariant(false, 'Stateless function components cannot have refs.') : void 0; + inst = ownerFiber.stateNode; } - } else { - // Flush async work. - var _finishedWork = root.finishedWork; - if (_finishedWork !== null) { - // This root is already complete. We can commit it. - completeRoot(root, _finishedWork, expirationTime); - } else { - root.finishedWork = null; - _finishedWork = renderRoot(root, expirationTime, true); - if (_finishedWork !== null) { - // We've completed the root. Check the deadline one more time - // before committing. - if (!shouldYield()) { - // Still time left. Commit the root. - completeRoot(root, _finishedWork, expirationTime); - } else { - // There's no time left. Mark this root as complete. We'll come - // back and commit it later. - root.finishedWork = _finishedWork; - } - } + !inst ? invariant(false, 'Missing owner for string ref %s. This error is likely caused by a bug in React. Please file an issue.', mixedRef) : void 0; + var stringRef = '' + mixedRef; + // Check if previous string ref matches new string ref + if (current !== null && current.ref !== null && current.ref._stringRef === stringRef) { + return current.ref; } + var ref = function (value) { + var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs; + if (value === null) { + delete refs[stringRef]; + } else { + refs[stringRef] = value; + } + }; + ref._stringRef = stringRef; + return ref; + } else { + !(typeof mixedRef === 'string') ? invariant(false, 'Expected ref to be a function or a string.') : void 0; + !element._owner ? invariant(false, 'Element ref was specified as a string (%s) but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a functional component\n2. You may be adding a ref to a component that was not created inside a component\'s render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information.', mixedRef) : void 0; } - - isRendering = false; } + return mixedRef; +} - function completeRoot(root, finishedWork, expirationTime) { - // Check if there's a batch that matches this expiration time. - var firstBatch = root.firstBatch; - if (firstBatch !== null && firstBatch._expirationTime <= expirationTime) { - if (completedBatches === null) { - completedBatches = [firstBatch]; - } else { - completedBatches.push(firstBatch); - } - if (firstBatch._defer) { - // This root is blocked from committing by a batch. Unschedule it until - // we receive another update. - root.finishedWork = finishedWork; - root.remainingExpirationTime = NoWork; - return; - } +function throwOnInvalidObjectType(returnFiber, newChild) { + if (returnFiber.type !== 'textarea') { + var addendum = ''; + { + addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + (getCurrentFiberStackAddendum$2() || ''); } + invariant(false, 'Objects are not valid as a React child (found: %s).%s', Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild, addendum); + } +} - // Commit the root. - root.finishedWork = null; - root.remainingExpirationTime = commitRoot(finishedWork); +function warnOnFunctionType() { + var currentComponentErrorInfo = 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of from render. ' + 'Or maybe you meant to call this function rather than return it.' + (getCurrentFiberStackAddendum$2() || ''); + + if (ownerHasFunctionTypeWarning[currentComponentErrorInfo]) { + return; } + ownerHasFunctionTypeWarning[currentComponentErrorInfo] = true; - // When working on async work, the reconciler asks the renderer if it should - // yield execution. For DOM, we implement this with requestIdleCallback. - function shouldYield() { - if (deadline === null) { - return false; + warning(false, 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of from render. ' + 'Or maybe you meant to call this function rather than return it.%s', getCurrentFiberStackAddendum$2() || ''); +} + +// This wrapper function exists because I expect to clone the code in each path +// to be able to optimize each path individually by branching early. This needs +// a compiler or we can do it manually. Helpers that don't need this branching +// live outside of this function. +function ChildReconciler(shouldTrackSideEffects) { + function deleteChild(returnFiber, childToDelete) { + if (!shouldTrackSideEffects) { + // Noop. + return; } - if (deadline.timeRemaining() > timeHeuristicForUnitOfWork) { - // Disregard deadline.didTimeout. Only expired work should be flushed - // during a timeout. This path is only hit for non-expired work. - return false; + // Deletions are added in reversed order so we add it to the front. + // At this point, the return fiber's effect list is empty except for + // deletions, so we can just append the deletion to the list. The remaining + // effects aren't added until the complete phase. Once we implement + // resuming, this may not be true. + var last = returnFiber.lastEffect; + if (last !== null) { + last.nextEffect = childToDelete; + returnFiber.lastEffect = childToDelete; + } else { + returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; } - deadlineDidExpire = true; - return true; + childToDelete.nextEffect = null; + childToDelete.effectTag = Deletion; } - function onUncaughtError(error) { - !(nextFlushedRoot !== null) ? invariant(false, 'Should be working on a root. This error is likely caused by a bug in React. Please file an issue.') : void 0; - // Unschedule this root so we don't work on it again until there's - // another update. - nextFlushedRoot.remainingExpirationTime = NoWork; - if (!hasUnhandledError) { - hasUnhandledError = true; - unhandledError = error; + function deleteRemainingChildren(returnFiber, currentFirstChild) { + if (!shouldTrackSideEffects) { + // Noop. + return null; + } + + // TODO: For the shouldClone case, this could be micro-optimized a bit by + // assuming that after the first child we've already added everything. + var childToDelete = currentFirstChild; + while (childToDelete !== null) { + deleteChild(returnFiber, childToDelete); + childToDelete = childToDelete.sibling; } + return null; } - // TODO: Batching should be implemented at the renderer level, not inside - // the reconciler. - function batchedUpdates(fn, a) { - var previousIsBatchingUpdates = isBatchingUpdates; - isBatchingUpdates = true; - try { - return fn(a); - } finally { - isBatchingUpdates = previousIsBatchingUpdates; - if (!isBatchingUpdates && !isRendering) { - performSyncWork(); + function mapRemainingChildren(returnFiber, currentFirstChild) { + // Add the remaining children to a temporary map so that we can find them by + // keys quickly. Implicit (null) keys get added to this set with their index + var existingChildren = new Map(); + + var existingChild = currentFirstChild; + while (existingChild !== null) { + if (existingChild.key !== null) { + existingChildren.set(existingChild.key, existingChild); + } else { + existingChildren.set(existingChild.index, existingChild); } + existingChild = existingChild.sibling; } + return existingChildren; } - // TODO: Batching should be implemented at the renderer level, not inside - // the reconciler. - function unbatchedUpdates(fn, a) { - if (isBatchingUpdates && !isUnbatchingUpdates) { - isUnbatchingUpdates = true; - try { - return fn(a); - } finally { - isUnbatchingUpdates = false; + function useFiber(fiber, pendingProps, expirationTime) { + // We currently set sibling to null and index to 0 here because it is easy + // to forget to do before returning it. E.g. for the single child case. + var clone = createWorkInProgress(fiber, pendingProps, expirationTime); + clone.index = 0; + clone.sibling = null; + return clone; + } + + function placeChild(newFiber, lastPlacedIndex, newIndex) { + newFiber.index = newIndex; + if (!shouldTrackSideEffects) { + // Noop. + return lastPlacedIndex; + } + var current = newFiber.alternate; + if (current !== null) { + var oldIndex = current.index; + if (oldIndex < lastPlacedIndex) { + // This is a move. + newFiber.effectTag = Placement; + return lastPlacedIndex; + } else { + // This item can stay in place. + return oldIndex; } + } else { + // This is an insertion. + newFiber.effectTag = Placement; + return lastPlacedIndex; } - return fn(a); } - // TODO: Batching should be implemented at the renderer level, not within - // the reconciler. - function flushSync(fn, a) { - !!isRendering ? invariant(false, 'flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.') : void 0; - var previousIsBatchingUpdates = isBatchingUpdates; - isBatchingUpdates = true; - try { - return syncUpdates(fn, a); - } finally { - isBatchingUpdates = previousIsBatchingUpdates; - performSyncWork(); + function placeSingleChild(newFiber) { + // This is simpler for the single child case. We only need to do a + // placement for inserting new children. + if (shouldTrackSideEffects && newFiber.alternate === null) { + newFiber.effectTag = Placement; } + return newFiber; } - function interactiveUpdates(fn, a, b) { - if (isBatchingInteractiveUpdates) { - return fn(a, b); - } - // If there are any pending interactive updates, synchronously flush them. - // This needs to happen before we read any handlers, because the effect of - // the previous event may influence which handlers are called during - // this event. - if (!isBatchingUpdates && !isRendering && lowestPendingInteractiveExpirationTime !== NoWork) { - // Synchronously flush pending interactive updates. - performWork(lowestPendingInteractiveExpirationTime, false, null); - lowestPendingInteractiveExpirationTime = NoWork; + function updateTextNode(returnFiber, current, textContent, expirationTime) { + if (current === null || current.tag !== HostText) { + // Insert + var created = createFiberFromText(textContent, returnFiber.mode, expirationTime); + created['return'] = returnFiber; + return created; + } else { + // Update + var existing = useFiber(current, textContent, expirationTime); + existing['return'] = returnFiber; + return existing; } - var previousIsBatchingInteractiveUpdates = isBatchingInteractiveUpdates; - var previousIsBatchingUpdates = isBatchingUpdates; - isBatchingInteractiveUpdates = true; - isBatchingUpdates = true; - try { - return fn(a, b); - } finally { - isBatchingInteractiveUpdates = previousIsBatchingInteractiveUpdates; - isBatchingUpdates = previousIsBatchingUpdates; - if (!isBatchingUpdates && !isRendering) { - performSyncWork(); + } + + function updateElement(returnFiber, current, element, expirationTime) { + if (current !== null && current.type === element.type) { + // Move based on index + var existing = useFiber(current, element.props, expirationTime); + existing.ref = coerceRef(returnFiber, current, element); + existing['return'] = returnFiber; + { + existing._debugSource = element._source; + existing._debugOwner = element._owner; } + return existing; + } else { + // Insert + var created = createFiberFromElement(element, returnFiber.mode, expirationTime); + created.ref = coerceRef(returnFiber, current, element); + created['return'] = returnFiber; + return created; } } - function flushInteractiveUpdates() { - if (!isRendering && lowestPendingInteractiveExpirationTime !== NoWork) { - // Synchronously flush pending interactive updates. - performWork(lowestPendingInteractiveExpirationTime, false, null); - lowestPendingInteractiveExpirationTime = NoWork; + function updatePortal(returnFiber, current, portal, expirationTime) { + if (current === null || current.tag !== HostPortal || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) { + // Insert + var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime); + created['return'] = returnFiber; + return created; + } else { + // Update + var existing = useFiber(current, portal.children || [], expirationTime); + existing['return'] = returnFiber; + return existing; } } - function flushControlled(fn) { - var previousIsBatchingUpdates = isBatchingUpdates; - isBatchingUpdates = true; - try { - syncUpdates(fn); - } finally { - isBatchingUpdates = previousIsBatchingUpdates; - if (!isBatchingUpdates && !isRendering) { - performWork(Sync, false, null); - } + function updateFragment(returnFiber, current, fragment, expirationTime, key) { + if (current === null || current.tag !== Fragment) { + // Insert + var created = createFiberFromFragment(fragment, returnFiber.mode, expirationTime, key); + created['return'] = returnFiber; + return created; + } else { + // Update + var existing = useFiber(current, fragment, expirationTime); + existing['return'] = returnFiber; + return existing; } } - return { - recalculateCurrentTime: recalculateCurrentTime, - computeExpirationForFiber: computeExpirationForFiber, - scheduleWork: scheduleWork, - requestWork: requestWork, - flushRoot: flushRoot, - batchedUpdates: batchedUpdates, - unbatchedUpdates: unbatchedUpdates, - flushSync: flushSync, - flushControlled: flushControlled, - deferredUpdates: deferredUpdates, - syncUpdates: syncUpdates, - interactiveUpdates: interactiveUpdates, - flushInteractiveUpdates: flushInteractiveUpdates, - computeUniqueAsyncExpiration: computeUniqueAsyncExpiration, - legacyContext: legacyContext - }; -}; - -var didWarnAboutNestedUpdates = void 0; + function createChild(returnFiber, newChild, expirationTime) { + if (typeof newChild === 'string' || typeof newChild === 'number') { + // Text nodes don't have keys. If the previous node is implicitly keyed + // we can continue to replace it without aborting even if it is not a text + // node. + var created = createFiberFromText('' + newChild, returnFiber.mode, expirationTime); + created['return'] = returnFiber; + return created; + } -{ - didWarnAboutNestedUpdates = false; -} + if (typeof newChild === 'object' && newChild !== null) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + { + var _created = createFiberFromElement(newChild, returnFiber.mode, expirationTime); + _created.ref = coerceRef(returnFiber, null, newChild); + _created['return'] = returnFiber; + return _created; + } + case REACT_PORTAL_TYPE: + { + var _created2 = createFiberFromPortal(newChild, returnFiber.mode, expirationTime); + _created2['return'] = returnFiber; + return _created2; + } + } -// 0 is PROD, 1 is DEV. -// Might add PROFILE later. + if (isArray$1(newChild) || getIteratorFn(newChild)) { + var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null); + _created3['return'] = returnFiber; + return _created3; + } + throwOnInvalidObjectType(returnFiber, newChild); + } -var ReactFiberReconciler$1 = function (config) { - var getPublicInstance = config.getPublicInstance; + { + if (typeof newChild === 'function') { + warnOnFunctionType(); + } + } - var _ReactFiberScheduler = ReactFiberScheduler(config), - computeUniqueAsyncExpiration = _ReactFiberScheduler.computeUniqueAsyncExpiration, - recalculateCurrentTime = _ReactFiberScheduler.recalculateCurrentTime, - computeExpirationForFiber = _ReactFiberScheduler.computeExpirationForFiber, - scheduleWork = _ReactFiberScheduler.scheduleWork, - requestWork = _ReactFiberScheduler.requestWork, - flushRoot = _ReactFiberScheduler.flushRoot, - batchedUpdates = _ReactFiberScheduler.batchedUpdates, - unbatchedUpdates = _ReactFiberScheduler.unbatchedUpdates, - flushSync = _ReactFiberScheduler.flushSync, - flushControlled = _ReactFiberScheduler.flushControlled, - deferredUpdates = _ReactFiberScheduler.deferredUpdates, - syncUpdates = _ReactFiberScheduler.syncUpdates, - interactiveUpdates = _ReactFiberScheduler.interactiveUpdates, - flushInteractiveUpdates = _ReactFiberScheduler.flushInteractiveUpdates, - legacyContext = _ReactFiberScheduler.legacyContext; + return null; + } - var findCurrentUnmaskedContext = legacyContext.findCurrentUnmaskedContext, - isContextProvider = legacyContext.isContextProvider, - processChildContext = legacyContext.processChildContext; + function updateSlot(returnFiber, oldFiber, newChild, expirationTime) { + // Update the fiber if the keys match, otherwise return null. + var key = oldFiber !== null ? oldFiber.key : null; - function getContextForSubtree(parentComponent) { - if (!parentComponent) { - return emptyObject; + if (typeof newChild === 'string' || typeof newChild === 'number') { + // Text nodes don't have keys. If the previous node is implicitly keyed + // we can continue to replace it without aborting even if it is not a text + // node. + if (key !== null) { + return null; + } + return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime); } - var fiber = get(parentComponent); - var parentContext = findCurrentUnmaskedContext(fiber); - return isContextProvider(fiber) ? processChildContext(fiber, parentContext) : parentContext; - } + if (typeof newChild === 'object' && newChild !== null) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + { + if (newChild.key === key) { + if (newChild.type === REACT_FRAGMENT_TYPE) { + return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key); + } + return updateElement(returnFiber, oldFiber, newChild, expirationTime); + } else { + return null; + } + } + case REACT_PORTAL_TYPE: + { + if (newChild.key === key) { + return updatePortal(returnFiber, oldFiber, newChild, expirationTime); + } else { + return null; + } + } + } - function scheduleRootUpdate(current, element, currentTime, expirationTime, callback) { - { - if (ReactDebugCurrentFiber.phase === 'render' && ReactDebugCurrentFiber.current !== null && !didWarnAboutNestedUpdates) { - didWarnAboutNestedUpdates = true; - warning(false, '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.\n\n' + 'Check the render method of %s.', getComponentName(ReactDebugCurrentFiber.current) || 'Unknown'); + if (isArray$1(newChild) || getIteratorFn(newChild)) { + if (key !== null) { + return null; + } + + return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null); } + + throwOnInvalidObjectType(returnFiber, newChild); } - callback = callback === undefined ? null : callback; { - warning(callback === null || typeof callback === 'function', 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback); + if (typeof newChild === 'function') { + warnOnFunctionType(); + } } - var update = { - expirationTime: expirationTime, - partialState: { element: element }, - callback: callback, - isReplace: false, - isForced: false, - capturedValue: null, - next: null - }; - insertUpdateIntoFiber(current, update); - scheduleWork(current, expirationTime); - - return expirationTime; + return null; } - function updateContainerAtExpirationTime(element, container, parentComponent, currentTime, expirationTime, callback) { - // TODO: If this is a nested container, this won't be the root. - var current = container.current; + function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) { + if (typeof newChild === 'string' || typeof newChild === 'number') { + // Text nodes don't have keys, so we neither have to check the old nor + // new node for the key. If both are text nodes, they match. + var matchedFiber = existingChildren.get(newIdx) || null; + return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime); + } - { - if (ReactFiberInstrumentation_1.debugTool) { - if (current.alternate === null) { - ReactFiberInstrumentation_1.debugTool.onMountContainer(container); - } else if (element === null) { - ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container); - } else { - ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container); - } + if (typeof newChild === 'object' && newChild !== null) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + { + var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; + if (newChild.type === REACT_FRAGMENT_TYPE) { + return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key); + } + return updateElement(returnFiber, _matchedFiber, newChild, expirationTime); + } + case REACT_PORTAL_TYPE: + { + var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; + return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime); + } + } + + if (isArray$1(newChild) || getIteratorFn(newChild)) { + var _matchedFiber3 = existingChildren.get(newIdx) || null; + return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null); } + + throwOnInvalidObjectType(returnFiber, newChild); } - var context = getContextForSubtree(parentComponent); - if (container.context === null) { - container.context = context; - } else { - container.pendingContext = context; + { + if (typeof newChild === 'function') { + warnOnFunctionType(); + } } - return scheduleRootUpdate(current, element, currentTime, expirationTime, callback); + return null; } - function findHostInstance(fiber) { - var hostFiber = findCurrentHostFiber(fiber); - if (hostFiber === null) { - return null; + /** + * Warns if there is a duplicate or missing key + */ + function warnOnInvalidKey(child, knownKeys) { + { + if (typeof child !== 'object' || child === null) { + return knownKeys; + } + switch (child.$$typeof) { + case REACT_ELEMENT_TYPE: + case REACT_PORTAL_TYPE: + warnForMissingKey(child); + var key = child.key; + if (typeof key !== 'string') { + break; + } + if (knownKeys === null) { + knownKeys = new Set(); + knownKeys.add(key); + break; + } + if (!knownKeys.has(key)) { + knownKeys.add(key); + break; + } + warning(false, 'Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.%s', key, getCurrentFiberStackAddendum$2()); + break; + default: + break; + } } - return hostFiber.stateNode; + return knownKeys; } - return { - createContainer: function (containerInfo, isAsync, hydrate) { - return createFiberRoot(containerInfo, isAsync, hydrate); - }, - updateContainer: function (element, container, parentComponent, callback) { - var current = container.current; - var currentTime = recalculateCurrentTime(); - var expirationTime = computeExpirationForFiber(current); - return updateContainerAtExpirationTime(element, container, parentComponent, currentTime, expirationTime, callback); - }, - updateContainerAtExpirationTime: function (element, container, parentComponent, expirationTime, callback) { - var currentTime = recalculateCurrentTime(); - return updateContainerAtExpirationTime(element, container, parentComponent, currentTime, expirationTime, callback); - }, - - - flushRoot: flushRoot, - - requestWork: requestWork, - - computeUniqueAsyncExpiration: computeUniqueAsyncExpiration, - - batchedUpdates: batchedUpdates, - - unbatchedUpdates: unbatchedUpdates, - - deferredUpdates: deferredUpdates, + function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) { + // This algorithm can't optimize by searching from boths ends since we + // don't have backpointers on fibers. I'm trying to see how far we can get + // with that model. If it ends up not being worth the tradeoffs, we can + // add it later. - syncUpdates: syncUpdates, + // Even with a two ended optimization, we'd want to optimize for the case + // where there are few changes and brute force the comparison instead of + // going for the Map. It'd like to explore hitting that path first in + // forward-only mode and only go for the Map once we notice that we need + // lots of look ahead. This doesn't handle reversal as well as two ended + // search but that's unusual. Besides, for the two ended optimization to + // work on Iterables, we'd need to copy the whole set. - interactiveUpdates: interactiveUpdates, + // In this first iteration, we'll just live with hitting the bad case + // (adding everything to a Map) in for every insert/move. - flushInteractiveUpdates: flushInteractiveUpdates, + // If you change this code, also update reconcileChildrenIterator() which + // uses the same algorithm. - flushControlled: flushControlled, + { + // First, validate keys. + var knownKeys = null; + for (var i = 0; i < newChildren.length; i++) { + var child = newChildren[i]; + knownKeys = warnOnInvalidKey(child, knownKeys); + } + } - flushSync: flushSync, + var resultingFirstChild = null; + var previousNewFiber = null; - getPublicRootInstance: function (container) { - var containerFiber = container.current; - if (!containerFiber.child) { - return null; + var oldFiber = currentFirstChild; + var lastPlacedIndex = 0; + var newIdx = 0; + var nextOldFiber = null; + for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) { + if (oldFiber.index > newIdx) { + nextOldFiber = oldFiber; + oldFiber = null; + } else { + nextOldFiber = oldFiber.sibling; } - switch (containerFiber.child.tag) { - case HostComponent: - return getPublicInstance(containerFiber.child.stateNode); - default: - return containerFiber.child.stateNode; + var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], expirationTime); + if (newFiber === null) { + // TODO: This breaks on empty slots like null children. That's + // unfortunate because it triggers the slow path all the time. We need + // a better way to communicate whether this was a miss or null, + // boolean, undefined, etc. + if (oldFiber === null) { + oldFiber = nextOldFiber; + } + break; } - }, - - - findHostInstance: findHostInstance, - - findHostInstanceWithNoPortals: function (fiber) { - var hostFiber = findCurrentHostFiberWithNoPortals(fiber); - if (hostFiber === null) { - return null; + if (shouldTrackSideEffects) { + if (oldFiber && newFiber.alternate === null) { + // We matched the slot, but we didn't reuse the existing fiber, so we + // need to delete the existing child. + deleteChild(returnFiber, oldFiber); + } } - return hostFiber.stateNode; - }, - injectIntoDevTools: function (devToolsConfig) { - var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; + lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + // TODO: Move out of the loop. This only happens for the first run. + resultingFirstChild = newFiber; + } else { + // TODO: Defer siblings if we're not at the right index for this slot. + // I.e. if we had null values before, then we want to defer this + // for each null value. However, we also don't want to call updateSlot + // with the previous one. + previousNewFiber.sibling = newFiber; + } + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } - return injectInternals(_assign({}, devToolsConfig, { - findHostInstanceByFiber: function (fiber) { - return findHostInstance(fiber); - }, - findFiberByHostInstance: function (instance) { - if (!findFiberByHostInstance) { - // Might not be implemented by the renderer. - return null; - } - return findFiberByHostInstance(instance); + if (newIdx === newChildren.length) { + // We've reached the end of the new children. We can delete the rest. + deleteRemainingChildren(returnFiber, oldFiber); + return resultingFirstChild; + } + + if (oldFiber === null) { + // If we don't have any more existing children we can choose a fast path + // since the rest will all be insertions. + for (; newIdx < newChildren.length; newIdx++) { + var _newFiber = createChild(returnFiber, newChildren[newIdx], expirationTime); + if (!_newFiber) { + continue; } - })); + lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + // TODO: Move out of the loop. This only happens for the first run. + resultingFirstChild = _newFiber; + } else { + previousNewFiber.sibling = _newFiber; + } + previousNewFiber = _newFiber; + } + return resultingFirstChild; } - }; -}; -var ReactFiberReconciler$2 = Object.freeze({ - default: ReactFiberReconciler$1 -}); + // Add all children to a key map for quick lookups. + var existingChildren = mapRemainingChildren(returnFiber, oldFiber); -var ReactFiberReconciler$3 = ( ReactFiberReconciler$2 && ReactFiberReconciler$1 ) || ReactFiberReconciler$2; + // Keep scanning and use the map to restore deleted items as moves. + for (; newIdx < newChildren.length; newIdx++) { + var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], expirationTime); + if (_newFiber2) { + if (shouldTrackSideEffects) { + if (_newFiber2.alternate !== null) { + // The new fiber is a work in progress, but if there exists a + // current, that means that we reused the fiber. We need to delete + // it from the child list so that we don't add it to the deletion + // list. + existingChildren['delete'](_newFiber2.key === null ? newIdx : _newFiber2.key); + } + } + lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + resultingFirstChild = _newFiber2; + } else { + previousNewFiber.sibling = _newFiber2; + } + previousNewFiber = _newFiber2; + } + } -// TODO: bundle Flow types with the package. + if (shouldTrackSideEffects) { + // Any existing children that weren't consumed above were deleted. We need + // to add them to the deletion list. + existingChildren.forEach(function (child) { + return deleteChild(returnFiber, child); + }); + } + return resultingFirstChild; + } + function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, expirationTime) { + // This is the same implementation as reconcileChildrenArray(), + // but using the iterator instead. -// TODO: decide on the top-level export form. -// This is hacky but makes it work with both Rollup and Jest. -var reactReconciler = ReactFiberReconciler$3['default'] ? ReactFiberReconciler$3['default'] : ReactFiberReconciler$3; + var iteratorFn = getIteratorFn(newChildrenIterable); + !(typeof iteratorFn === 'function') ? invariant(false, 'An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.') : void 0; -function createPortal$1(children, containerInfo, -// TODO: figure out the API for cross-renderer implementation. -implementation) { - var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; + { + // Warn about using Maps as children + if (typeof newChildrenIterable.entries === 'function') { + var possibleMap = newChildrenIterable; + if (possibleMap.entries === iteratorFn) { + !didWarnAboutMaps ? warning(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', getCurrentFiberStackAddendum$2()) : void 0; + didWarnAboutMaps = true; + } + } - return { - // This tag allow us to uniquely identify this as a React Portal - $$typeof: REACT_PORTAL_TYPE, - key: key == null ? null : '' + key, - children: children, - containerInfo: containerInfo, - implementation: implementation - }; -} + // First, validate keys. + // We'll get a different iterator later for the main pass. + var _newChildren = iteratorFn.call(newChildrenIterable); + if (_newChildren) { + var knownKeys = null; + var _step = _newChildren.next(); + for (; !_step.done; _step = _newChildren.next()) { + var child = _step.value; + knownKeys = warnOnInvalidKey(child, knownKeys); + } + } + } -// TODO: this is special because it gets imported during build. + var newChildren = iteratorFn.call(newChildrenIterable); + !(newChildren != null) ? invariant(false, 'An iterable object provided no iterator.') : void 0; -var ReactVersion = '16.3.1'; + var resultingFirstChild = null; + var previousNewFiber = null; -// a requestAnimationFrame, storing the time for the start of the frame, then -// scheduling a postMessage which gets scheduled after paint. Within the -// postMessage handler do as much work as possible until time + frame rate. -// By separating the idle call into a separate event tick we ensure that -// layout, paint and other browser work is counted against the available time. -// The frame rate is dynamically adjusted. + var oldFiber = currentFirstChild; + var lastPlacedIndex = 0; + var newIdx = 0; + var nextOldFiber = null; -{ - if (ExecutionEnvironment.canUseDOM && typeof requestAnimationFrame !== 'function') { - warning(false, 'React depends on requestAnimationFrame. Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills'); - } -} + var step = newChildren.next(); + for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) { + if (oldFiber.index > newIdx) { + nextOldFiber = oldFiber; + oldFiber = null; + } else { + nextOldFiber = oldFiber.sibling; + } + var newFiber = updateSlot(returnFiber, oldFiber, step.value, expirationTime); + if (newFiber === null) { + // TODO: This breaks on empty slots like null children. That's + // unfortunate because it triggers the slow path all the time. We need + // a better way to communicate whether this was a miss or null, + // boolean, undefined, etc. + if (!oldFiber) { + oldFiber = nextOldFiber; + } + break; + } + if (shouldTrackSideEffects) { + if (oldFiber && newFiber.alternate === null) { + // We matched the slot, but we didn't reuse the existing fiber, so we + // need to delete the existing child. + deleteChild(returnFiber, oldFiber); + } + } + lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + // TODO: Move out of the loop. This only happens for the first run. + resultingFirstChild = newFiber; + } else { + // TODO: Defer siblings if we're not at the right index for this slot. + // I.e. if we had null values before, then we want to defer this + // for each null value. However, we also don't want to call updateSlot + // with the previous one. + previousNewFiber.sibling = newFiber; + } + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } -var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function'; + if (step.done) { + // We've reached the end of the new children. We can delete the rest. + deleteRemainingChildren(returnFiber, oldFiber); + return resultingFirstChild; + } -var now = void 0; -if (hasNativePerformanceNow) { - now = function () { - return performance.now(); - }; -} else { - now = function () { - return Date.now(); - }; -} + if (oldFiber === null) { + // If we don't have any more existing children we can choose a fast path + // since the rest will all be insertions. + for (; !step.done; newIdx++, step = newChildren.next()) { + var _newFiber3 = createChild(returnFiber, step.value, expirationTime); + if (_newFiber3 === null) { + continue; + } + lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + // TODO: Move out of the loop. This only happens for the first run. + resultingFirstChild = _newFiber3; + } else { + previousNewFiber.sibling = _newFiber3; + } + previousNewFiber = _newFiber3; + } + return resultingFirstChild; + } -// TODO: There's no way to cancel, because Fiber doesn't atm. -var rIC = void 0; -var cIC = void 0; + // Add all children to a key map for quick lookups. + var existingChildren = mapRemainingChildren(returnFiber, oldFiber); -if (!ExecutionEnvironment.canUseDOM) { - rIC = function (frameCallback) { - return setTimeout(function () { - frameCallback({ - timeRemaining: function () { - return Infinity; - }, + // Keep scanning and use the map to restore deleted items as moves. + for (; !step.done; newIdx++, step = newChildren.next()) { + var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, expirationTime); + if (_newFiber4 !== null) { + if (shouldTrackSideEffects) { + if (_newFiber4.alternate !== null) { + // The new fiber is a work in progress, but if there exists a + // current, that means that we reused the fiber. We need to delete + // it from the child list so that we don't add it to the deletion + // list. + existingChildren['delete'](_newFiber4.key === null ? newIdx : _newFiber4.key); + } + } + lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx); + if (previousNewFiber === null) { + resultingFirstChild = _newFiber4; + } else { + previousNewFiber.sibling = _newFiber4; + } + previousNewFiber = _newFiber4; + } + } - didTimeout: false + if (shouldTrackSideEffects) { + // Any existing children that weren't consumed above were deleted. We need + // to add them to the deletion list. + existingChildren.forEach(function (child) { + return deleteChild(returnFiber, child); }); - }); - }; - cIC = function (timeoutID) { - clearTimeout(timeoutID); - }; -} else if (alwaysUseRequestIdleCallbackPolyfill || typeof requestIdleCallback !== 'function' || typeof cancelIdleCallback !== 'function') { - // Polyfill requestIdleCallback and cancelIdleCallback - - var scheduledRICCallback = null; - var isIdleScheduled = false; - var timeoutTime = -1; - - var isAnimationFrameScheduled = false; - - var frameDeadline = 0; - // We start out assuming that we run at 30fps but then the heuristic tracking - // will adjust this value to a faster fps if we get more frequent animation - // frames. - var previousFrameTime = 33; - var activeFrameTime = 33; + } - var frameDeadlineObject = void 0; - if (hasNativePerformanceNow) { - frameDeadlineObject = { - didTimeout: false, - timeRemaining: function () { - // We assume that if we have a performance timer that the rAF callback - // gets a performance timer value. Not sure if this is always true. - var remaining = frameDeadline - performance.now(); - return remaining > 0 ? remaining : 0; - } - }; - } else { - frameDeadlineObject = { - didTimeout: false, - timeRemaining: function () { - // Fallback to Date.now() - var remaining = frameDeadline - Date.now(); - return remaining > 0 ? remaining : 0; - } - }; + return resultingFirstChild; } - // We use the postMessage trick to defer idle work until after the repaint. - var messageKey = '__reactIdleCallback$' + Math.random().toString(36).slice(2); - var idleTick = function (event) { - if (event.source !== window || event.data !== messageKey) { - return; + function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, expirationTime) { + // There's no need to check for keys on text nodes since we don't have a + // way to define them. + if (currentFirstChild !== null && currentFirstChild.tag === HostText) { + // We already have an existing node so let's just update it and delete + // the rest. + deleteRemainingChildren(returnFiber, currentFirstChild.sibling); + var existing = useFiber(currentFirstChild, textContent, expirationTime); + existing['return'] = returnFiber; + return existing; } + // The existing first child is not a text node so we need to create one + // and delete the existing ones. + deleteRemainingChildren(returnFiber, currentFirstChild); + var created = createFiberFromText(textContent, returnFiber.mode, expirationTime); + created['return'] = returnFiber; + return created; + } - isIdleScheduled = false; - - var currentTime = now(); - if (frameDeadline - currentTime <= 0) { - // There's no time left in this idle period. Check if the callback has - // a timeout and whether it's been exceeded. - if (timeoutTime !== -1 && timeoutTime <= currentTime) { - // Exceeded the timeout. Invoke the callback even though there's no - // time left. - frameDeadlineObject.didTimeout = true; - } else { - // No timeout. - if (!isAnimationFrameScheduled) { - // Schedule another animation callback so we retry later. - isAnimationFrameScheduled = true; - requestAnimationFrame(animationTick); + function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) { + var key = element.key; + var child = currentFirstChild; + while (child !== null) { + // TODO: If key === null and child.key === null, then this only applies to + // the first item in the list. + if (child.key === key) { + if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.type === element.type) { + deleteRemainingChildren(returnFiber, child.sibling); + var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime); + existing.ref = coerceRef(returnFiber, child, element); + existing['return'] = returnFiber; + { + existing._debugSource = element._source; + existing._debugOwner = element._owner; + } + return existing; + } else { + deleteRemainingChildren(returnFiber, child); + break; } - // Exit without invoking the callback. - return; + } else { + deleteChild(returnFiber, child); } - } else { - // There's still time left in this idle period. - frameDeadlineObject.didTimeout = false; + child = child.sibling; } - timeoutTime = -1; - var callback = scheduledRICCallback; - scheduledRICCallback = null; - if (callback !== null) { - callback(frameDeadlineObject); + if (element.type === REACT_FRAGMENT_TYPE) { + var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key); + created['return'] = returnFiber; + return created; + } else { + var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime); + _created4.ref = coerceRef(returnFiber, currentFirstChild, element); + _created4['return'] = returnFiber; + return _created4; } - }; - // Assumes that we have addEventListener in this environment. Might need - // something better for old IE. - window.addEventListener('message', idleTick, false); + } - var animationTick = function (rafTime) { - isAnimationFrameScheduled = false; - var nextFrameTime = rafTime - frameDeadline + activeFrameTime; - if (nextFrameTime < activeFrameTime && previousFrameTime < activeFrameTime) { - if (nextFrameTime < 8) { - // Defensive coding. We don't support higher frame rates than 120hz. - // If we get lower than that, it is probably a bug. - nextFrameTime = 8; + function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) { + var key = portal.key; + var child = currentFirstChild; + while (child !== null) { + // TODO: If key === null and child.key === null, then this only applies to + // the first item in the list. + if (child.key === key) { + if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) { + deleteRemainingChildren(returnFiber, child.sibling); + var existing = useFiber(child, portal.children || [], expirationTime); + existing['return'] = returnFiber; + return existing; + } else { + deleteRemainingChildren(returnFiber, child); + break; + } + } else { + deleteChild(returnFiber, child); } - // If one frame goes long, then the next one can be short to catch up. - // If two frames are short in a row, then that's an indication that we - // actually have a higher frame rate than what we're currently optimizing. - // We adjust our heuristic dynamically accordingly. For example, if we're - // running on 120hz display or 90hz VR display. - // Take the max of the two in case one of them was an anomaly due to - // missed frame deadlines. - activeFrameTime = nextFrameTime < previousFrameTime ? previousFrameTime : nextFrameTime; - } else { - previousFrameTime = nextFrameTime; - } - frameDeadline = rafTime + activeFrameTime; - if (!isIdleScheduled) { - isIdleScheduled = true; - window.postMessage(messageKey, '*'); + child = child.sibling; } - }; - rIC = function (callback, options) { - // This assumes that we only schedule one callback at a time because that's - // how Fiber uses it. - scheduledRICCallback = callback; - if (options != null && typeof options.timeout === 'number') { - timeoutTime = now() + options.timeout; - } - if (!isAnimationFrameScheduled) { - // If rAF didn't already schedule one, we need to schedule a frame. - // TODO: If this rAF doesn't materialize because the browser throttles, we - // might want to still have setTimeout trigger rIC as a backup to ensure - // that we keep performing work. - isAnimationFrameScheduled = true; - requestAnimationFrame(animationTick); - } - return 0; - }; + var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime); + created['return'] = returnFiber; + return created; + } - cIC = function () { - scheduledRICCallback = null; - isIdleScheduled = false; - timeoutTime = -1; - }; -} else { - rIC = window.requestIdleCallback; - cIC = window.cancelIdleCallback; -} + // This API will tag the children with the side-effect of the reconciliation + // itself. They will be added to the side-effect list as we pass through the + // children and the parent. + function reconcileChildFibers(returnFiber, currentFirstChild, newChild, expirationTime) { + // This function is not recursive. + // If the top level item is an array, we treat it as a set of children, + // not as a fragment. Nested arrays on the other hand will be treated as + // fragment nodes. Recursion happens at the normal flow. -var didWarnSelectedSetOnOption = false; + // Handle top level unkeyed fragments as if they were arrays. + // This leads to an ambiguity between <>{[...]} and <>.... + // We treat the ambiguous cases above the same. + if (typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null) { + newChild = newChild.props.children; + } -function flattenChildren(children) { - var content = ''; + // Handle object types + var isObject = typeof newChild === 'object' && newChild !== null; - // Flatten children and warn if they aren't strings or numbers; - // invalid types are ignored. - // We can silently skip them because invalid DOM nesting warning - // catches these cases in Fiber. - React.Children.forEach(children, function (child) { - if (child == null) { - return; + if (isObject) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, expirationTime)); + case REACT_PORTAL_TYPE: + return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, expirationTime)); + } } - if (typeof child === 'string' || typeof child === 'number') { - content += child; + + if (typeof newChild === 'string' || typeof newChild === 'number') { + return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime)); } - }); - return content; -} + if (isArray$1(newChild)) { + return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime); + } -/** - * Implements an